Commit 4b61eb59 authored by 季圣华's avatar 季圣华
Browse files

增加商品条码功能

parent 301d053b
package com.jsh.erp.service.MaterialExtend;
import com.jsh.erp.service.ICommonQuery;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "material_extend")
@MaterialExtendResource
public class MaterialExtendComponent implements ICommonQuery {
@Resource
private MaterialExtendService materialExtendService;
@Override
public Object selectOne(Long id) throws Exception {
return materialExtendService.getMaterialExtend(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getMaterialList(map);
}
private List<?> getMaterialList(Map<String, String> map) throws Exception{
return null;
}
@Override
public Long counts(Map<String, String> map)throws Exception {
return 0L;
}
@Override
public int insert(String beanJson, HttpServletRequest request) throws Exception{
return materialExtendService.insertMaterialExtend(beanJson, request);
}
@Override
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return materialExtendService.updateMaterialExtend(beanJson, id, request);
}
@Override
public int delete(Long id, HttpServletRequest request)throws Exception {
return materialExtendService.deleteMaterialExtend(id, request);
}
@Override
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return materialExtendService.batchDeleteMaterialExtendByIds(ids, request);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return materialExtendService.checkIsExist(id, name);
}
}
package com.jsh.erp.service.MaterialExtend;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
@ResourceInfo(value = "materialExtend", type = 1574012422)
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MaterialExtendResource {
}
package com.jsh.erp.service.MaterialExtend;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.MaterialExtend;
import com.jsh.erp.datasource.entities.MaterialExtendExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.MaterialExtendMapper;
import com.jsh.erp.datasource.mappers.MaterialExtendMapperEx;
import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class MaterialExtendService {
private Logger logger = LoggerFactory.getLogger(MaterialExtendService.class);
@Resource
private MaterialExtendMapper materialExtendMapper;
@Resource
private MaterialExtendMapperEx materialExtendMapperEx;
@Resource
private LogService logService;
@Resource
private UserService userService;
public MaterialExtend getMaterialExtend(long id)throws Exception {
MaterialExtend result=null;
try{
result=materialExtendMapper.selectByPrimaryKey(id);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public List<MaterialExtendVo4List> getDetailList(Long materialId) {
List<MaterialExtendVo4List> list=null;
try{
list = materialExtendMapperEx.getDetailList(materialId);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<MaterialExtend> getListByMIds(List<Long> idList) {
List<MaterialExtend> meList = null;
try{
Long [] idArray= StringUtil.listToLongArray(idList);
if(idArray!=null && idArray.length>0) {
meList = materialExtendMapperEx.getListByMId(idArray);
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return meList;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String saveDetials(String inserted, String deleted, String updated,Long materialId) throws Exception {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
logService.insertLog("商品价格扩展",
BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
//转为json
JSONArray insertedJson = JSONArray.parseArray(inserted);
JSONArray deletedJson = JSONArray.parseArray(deleted);
JSONArray updatedJson = JSONArray.parseArray(updated);
if (null != insertedJson) {
for (int i = 0; i < insertedJson.size(); i++) {
MaterialExtend materialExtend = new MaterialExtend();
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
materialExtend.setMaterialId(materialId);
if (StringUtils.isNotEmpty(tempInsertedJson.getString("BarCode"))) {
materialExtend.setBarCode(tempInsertedJson.getString("BarCode"));
}
if (StringUtils.isNotEmpty(tempInsertedJson.getString("CommodityUnit"))) {
materialExtend.setCommodityUnit(tempInsertedJson.getString("CommodityUnit"));
}
if (StringUtils.isNotEmpty(tempInsertedJson.getString("PurchaseDecimal"))) {
materialExtend.setPurchaseDecimal(tempInsertedJson.getBigDecimal("PurchaseDecimal"));
}
if (StringUtils.isNotEmpty(tempInsertedJson.getString("CommodityDecimal"))) {
materialExtend.setCommodityDecimal(tempInsertedJson.getBigDecimal("CommodityDecimal"));
}
if (StringUtils.isNotEmpty(tempInsertedJson.getString("WholesaleDecimal"))) {
materialExtend.setWholesaleDecimal(tempInsertedJson.getBigDecimal("WholesaleDecimal"));
}
if (StringUtils.isNotEmpty(tempInsertedJson.getString("LowDecimal"))) {
materialExtend.setLowDecimal(tempInsertedJson.getBigDecimal("LowDecimal"));
}
this.insertMaterialExtend(materialExtend);
}
}
if (null != deletedJson) {
StringBuffer bf=new StringBuffer();
for (int i = 0; i < deletedJson.size(); i++) {
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
bf.append(tempDeletedJson.getLong("Id"));
if(i<(deletedJson.size()-1)){
bf.append(",");
}
}
this.batchDeleteMaterialExtendByIds(bf.toString(), request);
}
if (null != updatedJson) {
for (int i = 0; i < updatedJson.size(); i++) {
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
MaterialExtend materialExtend = new MaterialExtend();
materialExtend.setId(tempUpdatedJson.getLong("Id"));
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("BarCode"))) {
materialExtend.setBarCode(tempUpdatedJson.getString("BarCode"));
}
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("CommodityUnit"))) {
materialExtend.setCommodityUnit(tempUpdatedJson.getString("CommodityUnit"));
}
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("PurchaseDecimal"))) {
materialExtend.setPurchaseDecimal(tempUpdatedJson.getBigDecimal("PurchaseDecimal"));
}
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("CommodityDecimal"))) {
materialExtend.setCommodityDecimal(tempUpdatedJson.getBigDecimal("CommodityDecimal"));
}
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("WholesaleDecimal"))) {
materialExtend.setWholesaleDecimal(tempUpdatedJson.getBigDecimal("WholesaleDecimal"));
}
if (StringUtils.isNotEmpty(tempUpdatedJson.getString("LowDecimal"))) {
materialExtend.setLowDecimal(tempUpdatedJson.getBigDecimal("LowDecimal"));
}
this.updateMaterialExtend(materialExtend, request);
}
}
return null;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertMaterialExtend(MaterialExtend materialExtend)throws Exception {
User user = userService.getCurrentUser();
materialExtend.setDeleteFlag(BusinessConstants.DELETE_FLAG_EXISTS);
materialExtend.setCreateTime(new Date());
materialExtend.setUpdateTime(new Date().getTime());
materialExtend.setCreateSerial(user.getLoginame());
materialExtend.setUpdateSerial(user.getLoginame());
int result =0;
try{
result= materialExtendMapper.insertSelective(materialExtend);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateMaterialExtend(MaterialExtend MaterialExtend, HttpServletRequest request) throws Exception{
User user = userService.getCurrentUser();
MaterialExtend.setUpdateTime(new Date().getTime());
MaterialExtend.setUpdateSerial(user.getLoginame());
int res =0;
try{
res= materialExtendMapper.updateByPrimaryKeySelective(MaterialExtend);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return res;
}
public int checkIsExist(Long id, String MaterialExtendName)throws Exception {
MaterialExtendExample example = new MaterialExtendExample();
MaterialExtendExample.Criteria criteria = example.createCriteria();
criteria.andBarCodeEqualTo(MaterialExtendName);
if (id > 0) {
criteria.andIdNotEqualTo(id);
}
List<MaterialExtend> list =null;
try{
list= materialExtendMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteMaterialExtend(Long id, HttpServletRequest request)throws Exception {
int result =0;
MaterialExtend materialExtend = new MaterialExtend();
materialExtend.setId(id);
materialExtend.setDeleteFlag(BusinessConstants.DELETE_FLAG_DELETED);
Object userInfo = request.getSession().getAttribute("user");
User user = (User)userInfo;
materialExtend.setUpdateTime(new Date().getTime());
materialExtend.setUpdateSerial(user.getLoginame());
try{
result= materialExtendMapper.updateByPrimaryKeySelective(materialExtend);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialExtendByIds(String ids, HttpServletRequest request) throws Exception{
logService.insertLog("商品价格扩展",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
String [] idArray=ids.split(",");
int result = 0;
try{
result = materialExtendMapperEx.batchDeleteMaterialExtendByIds(idArray);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
public int insertMaterialExtend(String beanJson, HttpServletRequest request) throws Exception{
MaterialExtend materialExtend = JSONObject.parseObject(beanJson, MaterialExtend.class);
int result=0;
try{
result = materialExtendMapper.insertSelective(materialExtend);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
public int updateMaterialExtend(String beanJson, Long id, HttpServletRequest request)throws Exception {
MaterialExtend materialExtend = JSONObject.parseObject(beanJson, MaterialExtend.class);
int result=0;
try{
result = materialExtendMapper.insertSelective(materialExtend);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
public List<MaterialExtend> getMaterialExtendByTenantAndTime(Long tenantId, Long lastTime, Long syncNum)throws Exception {
List<MaterialExtend> list=new ArrayList<MaterialExtend>();
try{
//先获取最大的时间戳,再查两个时间戳之间的数据,这样同步能够防止丢失数据(应为时间戳有重复)
Long maxTime = materialExtendMapperEx.getMaxTimeByTenantAndTime(tenantId, lastTime, syncNum);
if(tenantId!=null && lastTime!=null && maxTime!=null) {
MaterialExtendExample example = new MaterialExtendExample();
example.createCriteria().andTenantIdEqualTo(tenantId)
.andUpdateTimeGreaterThan(lastTime)
.andUpdateTimeLessThanOrEqualTo(maxTime);
list=materialExtendMapper.selectByExample(example);
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
/**
* 根据条码更新零售价
* @param retailPrice
* @param barCode
*/
public int updateRetailPriceByCode(BigDecimal retailPrice,String barCode) {
int result=0;
try{
MaterialExtend materialExtend = new MaterialExtend();
materialExtend.setCommodityDecimal(retailPrice);
MaterialExtendExample example = new MaterialExtendExample();
example.createCriteria().andBarCodeEqualTo(barCode);
result = materialExtendMapper.updateByExampleSelective(materialExtend, example);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
/**
* 根据条码更新进价
* @param purchasePrice
* @param barCode
*/
public int updatePurchasePriceByCode(BigDecimal purchasePrice,String barCode) {
int result=0;
try{
MaterialExtend materialExtend = new MaterialExtend();
materialExtend.setPurchaseDecimal(purchasePrice);
MaterialExtendExample example = new MaterialExtendExample();
example.createCriteria().andBarCodeEqualTo(barCode);
result = materialExtendMapper.updateByExampleSelective(materialExtend, example);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
/**
* 根据条码更新进价
* @param barCode
* @param barCode
*/
public MaterialExtend getMaterialExtendByBarCode(String barCode) {
MaterialExtend me = new MaterialExtend();
try{
MaterialExtendExample example = new MaterialExtendExample();
example.createCriteria().andBarCodeEqualTo(barCode);
List<MaterialExtend> list = materialExtendMapper.selectByExample(example);
if(list!=null && list.size()>0) {
me = list.get(0);
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return me;
}
}
...@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.vo.DepotItemStockWarningCount; ...@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
import com.jsh.erp.datasource.vo.DepotItemVo4Stock; import com.jsh.erp.datasource.vo.DepotItemVo4Stock;
import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException; import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.MaterialExtend.MaterialExtendService;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.material.MaterialService; import com.jsh.erp.service.material.MaterialService;
import com.jsh.erp.service.serialNumber.SerialNumberService; import com.jsh.erp.service.serialNumber.SerialNumberService;
...@@ -49,6 +50,8 @@ public class DepotItemService { ...@@ -49,6 +50,8 @@ public class DepotItemService {
@Resource @Resource
private MaterialService materialService; private MaterialService materialService;
@Resource @Resource
private MaterialExtendService materialExtendService;
@Resource
SerialNumberMapperEx serialNumberMapperEx; SerialNumberMapperEx serialNumberMapperEx;
@Resource @Resource
private DepotHeadMapper depotHeadMapper; private DepotHeadMapper depotHeadMapper;
...@@ -349,20 +352,18 @@ public class DepotItemService { ...@@ -349,20 +352,18 @@ public class DepotItemService {
DepotItem depotItem = new DepotItem(); DepotItem depotItem = new DepotItem();
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i)); JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
depotItem.setHeaderid(headerId); depotItem.setHeaderid(headerId);
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId")); Long materialExtendId = tempInsertedJson.getLong("MaterialExtendId");
Long materialId = materialExtendService.getMaterialExtend(materialExtendId).getMaterialId();
depotItem.setMaterialid(materialId);
depotItem.setMaterialExtendId(tempInsertedJson.getLong("MaterialExtendId"));
depotItem.setMunit(tempInsertedJson.getString("Unit")); depotItem.setMunit(tempInsertedJson.getString("Unit"));
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) { if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber")); depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
try { try {
String Unit = tempInsertedJson.get("Unit").toString(); String Unit = tempInsertedJson.get("Unit").toString();
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber"); BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
/***
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
* */
//以下进行单位换算 //以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称 String unitName = materialService.findUnitName(materialId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) { if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("(")); String unitList = unitName.substring(0, unitName.indexOf("("));
String ratioList = unitName.substring(unitName.indexOf("(")); String ratioList = unitName.substring(unitName.indexOf("("));
...@@ -484,7 +485,13 @@ public class DepotItemService { ...@@ -484,7 +485,13 @@ public class DepotItemService {
this.updateDepotItemWithObj(depotItem); this.updateDepotItemWithObj(depotItem);
} }
depotItem.setId(tempUpdatedJson.getLong("Id")); depotItem.setId(tempUpdatedJson.getLong("Id"));
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId")); Long materialId = null;
if (StringUtil.isExist(tempUpdatedJson.get("MaterialExtendId"))) {
Long materialExtendId = tempUpdatedJson.getLong("MaterialExtendId");
materialId = materialExtendService.getMaterialExtend(materialExtendId).getMaterialId();
depotItem.setMaterialid(materialId);
depotItem.setMaterialExtendId(tempUpdatedJson.getLong("MaterialExtendId"));
}
depotItem.setMunit(tempUpdatedJson.getString("Unit")); depotItem.setMunit(tempUpdatedJson.getString("Unit"));
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) { if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber")); depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
...@@ -493,8 +500,7 @@ public class DepotItemService { ...@@ -493,8 +500,7 @@ public class DepotItemService {
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber"); BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString()); Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
//以下进行单位换算 //以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称 String unitName = materialService.findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) { if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("(")); String unitList = unitName.substring(0, unitName.indexOf("("));
String ratioList = unitName.substring(unitName.indexOf("(")); String ratioList = unitName.substring(unitName.indexOf("("));
......
...@@ -33,21 +33,22 @@ public class MaterialComponent implements ICommonQuery { ...@@ -33,21 +33,22 @@ public class MaterialComponent implements ICommonQuery {
private List<?> getMaterialList(Map<String, String> map) throws Exception{ private List<?> getMaterialList(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH); String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name"); String name = StringUtil.getInfo(search, "name");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model"); String model = StringUtil.getInfo(search, "model");
String categoryIds = StringUtil.getInfo(search, "categoryIds"); String categoryIds = StringUtil.getInfo(search, "categoryIds");
String mpList = StringUtil.getInfo(search, "mpList"); String mpList = StringUtil.getInfo(search, "mpList");
String order = QueryUtils.order(map); return materialService.select(name, standard, model,categoryIds,mpList, QueryUtils.offset(map), QueryUtils.rows(map));
return materialService.select(name, model,categoryIds,mpList, QueryUtils.offset(map), QueryUtils.rows(map));
} }
@Override @Override
public Long counts(Map<String, String> map)throws Exception { public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH); String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name"); String name = StringUtil.getInfo(search, "name");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model"); String model = StringUtil.getInfo(search, "model");
String categoryIds = StringUtil.getInfo(search, "categoryIds"); String categoryIds = StringUtil.getInfo(search, "categoryIds");
String mpList = StringUtil.getInfo(search, "mpList"); String mpList = StringUtil.getInfo(search, "mpList");
return materialService.countMaterial(name, model,categoryIds,mpList); return materialService.countMaterial(name, standard, model,categoryIds,mpList);
} }
@Override @Override
......
...@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.mappers.MaterialMapperEx; ...@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.mappers.MaterialMapperEx;
import com.jsh.erp.datasource.mappers.MaterialStockMapper; import com.jsh.erp.datasource.mappers.MaterialStockMapper;
import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException; import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.MaterialExtend.MaterialExtendService;
import com.jsh.erp.service.depot.DepotService; import com.jsh.erp.service.depot.DepotService;
import com.jsh.erp.service.depotItem.DepotItemService; import com.jsh.erp.service.depotItem.DepotItemService;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
...@@ -59,6 +60,8 @@ public class MaterialService { ...@@ -59,6 +60,8 @@ public class MaterialService {
private MaterialStockMapper materialStockMapper; private MaterialStockMapper materialStockMapper;
@Resource @Resource
private DepotService depotService; private DepotService depotService;
@Resource
private MaterialExtendService materialExtendService;
public Material getMaterial(long id)throws Exception { public Material getMaterial(long id)throws Exception {
Material result=null; Material result=null;
...@@ -82,27 +85,26 @@ public class MaterialService { ...@@ -82,27 +85,26 @@ public class MaterialService {
return list; return list;
} }
public List<MaterialVo4Unit> select(String name, String model, String categoryIds,String mpList, int offset, int rows) public List<MaterialVo4Unit> select(String name, String standard, String model, String categoryIds,String mpList, int offset, int rows)
throws Exception{ throws Exception{
String[] mpArr = mpList.split(","); String[] mpArr = mpList.split(",");
List<MaterialVo4Unit> resList = new ArrayList<MaterialVo4Unit>(); List<MaterialVo4Unit> resList = new ArrayList<MaterialVo4Unit>();
List<MaterialVo4Unit> list =null; List<MaterialVo4Unit> list =null;
try{ try{
list= materialMapperEx.selectByConditionMaterial(name, model,categoryIds,mpList, offset, rows); list= materialMapperEx.selectByConditionMaterial(name, standard, model, categoryIds, mpList, offset, rows);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
if (null != list) { if (null != list) {
List<Long> idList = new ArrayList<Long>();
for (MaterialVo4Unit m : list) {
idList.add(m.getId());
}
List<MaterialExtend> meList = materialExtendService.getListByMIds(idList);
for (MaterialVo4Unit m : list) { for (MaterialVo4Unit m : list) {
//扩展信息 //扩展信息
String materialOther = ""; String materialOther = "";
for (int i = 0; i < mpArr.length; i++) { for (int i = 0; i < mpArr.length; i++) {
if (mpArr[i].equals("颜色")) {
materialOther = materialOther + ((m.getColor() == null || m.getColor().equals("")) ? "" : "(" + m.getColor() + ")");
}
if (mpArr[i].equals("规格")) {
materialOther = materialOther + ((m.getStandard() == null || m.getStandard().equals("")) ? "" : "(" + m.getStandard() + ")");
}
if (mpArr[i].equals("制造商")) { if (mpArr[i].equals("制造商")) {
materialOther = materialOther + ((m.getMfrs() == null || m.getMfrs().equals("")) ? "" : "(" + m.getMfrs() + ")"); materialOther = materialOther + ((m.getMfrs() == null || m.getMfrs().equals("")) ? "" : "(" + m.getMfrs() + ")");
} }
...@@ -119,16 +121,24 @@ public class MaterialService { ...@@ -119,16 +121,24 @@ public class MaterialService {
m.setMaterialOther(materialOther); m.setMaterialOther(materialOther);
Long tenantId = m.getTenantId(); Long tenantId = m.getTenantId();
m.setStock(depotItemService.getStockByParam(null,m.getId(),null,null,tenantId)); m.setStock(depotItemService.getStockByParam(null,m.getId(),null,null,tenantId));
for(MaterialExtend me:meList) {
if(me.getMaterialId().longValue() == m.getId().longValue()) {
m.setPurchaseDecimal(me.getPurchaseDecimal()); //采购价
m.setCommodityDecimal(me.getCommodityDecimal()); //零售价
m.setWholesaleDecimal(me.getWholesaleDecimal()); //销售价
m.setLowDecimal(me.getLowDecimal()); //最低售价
}
}
resList.add(m); resList.add(m);
} }
} }
return resList; return resList;
} }
public Long countMaterial(String name, String model, String categoryIds,String mpList)throws Exception { public Long countMaterial(String name, String standard, String model, String categoryIds,String mpList)throws Exception {
Long result =null; Long result =null;
try{ try{
result= materialMapperEx.countsByMaterial(name, model,categoryIds,mpList); result= materialMapperEx.countsByMaterial(name, standard, model, categoryIds, mpList);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
...@@ -137,13 +147,18 @@ public class MaterialService { ...@@ -137,13 +147,18 @@ public class MaterialService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertMaterial(String beanJson, HttpServletRequest request)throws Exception { public int insertMaterial(String beanJson, HttpServletRequest request)throws Exception {
Material material = JSONObject.parseObject(beanJson, Material.class); Material m = JSONObject.parseObject(beanJson, Material.class);
material.setEnabled(true); m.setEnabled(true);
int result =0;
try{ try{
result= materialMapper.insertSelective(material); Long mId = null;
materialMapper.insertSelective(m);
List<Material> materials = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),
m.getStandard(), m.getMfrs(),m.getUnit(),m.getUnitid());
if(materials!=null && materials.size()>0) {
mId = materials.get(0).getId();
}
JSONObject mObj = JSON.parseObject(beanJson); JSONObject mObj = JSON.parseObject(beanJson);
Long mId = material.getId(); materialExtendService.saveDetials(mObj.getString("inserted"), mObj.getString("deleted"), mObj.getString("updated"), mId);
if(mObj.get("stock")!=null) { if(mObj.get("stock")!=null) {
String stockStr = mObj.getString("stock"); String stockStr = mObj.getString("stock");
JSONArray stockArr = JSONArray.parseArray(stockStr); JSONArray stockArr = JSONArray.parseArray(stockStr);
...@@ -159,19 +174,19 @@ public class MaterialService { ...@@ -159,19 +174,19 @@ public class MaterialService {
} }
} }
logService.insertLog("商品", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); logService.insertLog("商品", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
return 1;
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
return 0;
} }
return result;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateMaterial(String beanJson, Long id, HttpServletRequest request) throws Exception{ public int updateMaterial(String beanJson, Long id, HttpServletRequest request) throws Exception{
Material material = JSONObject.parseObject(beanJson, Material.class); Material material = JSONObject.parseObject(beanJson, Material.class);
material.setId(id); material.setId(id);
int res =0;
try{ try{
res= materialMapper.updateByPrimaryKeySelective(material); materialMapper.updateByPrimaryKeySelective(material);
Long unitId = material.getUnitid(); Long unitId = material.getUnitid();
if(unitId != null) { if(unitId != null) {
materialMapperEx.updatePriceNullByPrimaryKey(id); //将价格置空 materialMapperEx.updatePriceNullByPrimaryKey(id); //将价格置空
...@@ -179,6 +194,7 @@ public class MaterialService { ...@@ -179,6 +194,7 @@ public class MaterialService {
materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空 materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空
} }
JSONObject mObj = JSON.parseObject(beanJson); JSONObject mObj = JSON.parseObject(beanJson);
materialExtendService.saveDetials(mObj.getString("inserted"),mObj.getString("deleted"),mObj.getString("updated"),id);
if(mObj.get("stock")!=null) { if(mObj.get("stock")!=null) {
String stockStr = mObj.getString("stock"); String stockStr = mObj.getString("stock");
JSONArray stockArr = JSONArray.parseArray(stockStr); JSONArray stockArr = JSONArray.parseArray(stockStr);
...@@ -199,11 +215,11 @@ public class MaterialService { ...@@ -199,11 +215,11 @@ public class MaterialService {
} }
logService.insertLog("商品", logService.insertLog("商品",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
return 1;
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
return 0;
} }
return res;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
...@@ -310,6 +326,16 @@ public class MaterialService { ...@@ -310,6 +326,16 @@ public class MaterialService {
return list; return list;
} }
public List<MaterialVo4Unit> findByIdWithBarCode(Long meId)throws Exception{
List<MaterialVo4Unit> list =null;
try{
list= materialMapperEx.findByIdWithBarCode(meId);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<MaterialVo4Unit> findBySelect()throws Exception{ public List<MaterialVo4Unit> findBySelect()throws Exception{
List<MaterialVo4Unit> list =null; List<MaterialVo4Unit> list =null;
try{ try{
...@@ -333,6 +359,29 @@ public class MaterialService { ...@@ -333,6 +359,29 @@ public class MaterialService {
return list; return list;
} }
public List<MaterialVo4Unit> findBySelectWithBarCode(String q,Integer offset, Integer rows)throws Exception{
List<MaterialVo4Unit> list =null;
try{
list= materialMapperEx.findBySelectWithBarCode(q, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public int findBySelectWithBarCodeCount(String q)throws Exception{
int result=0;
try{
result = materialMapperEx.findBySelectWithBarCodeCount(q);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
public List<MaterialVo4Unit> findByAll(String name, String model, String categoryIds)throws Exception { public List<MaterialVo4Unit> findByAll(String name, String model, String categoryIds)throws Exception {
List<MaterialVo4Unit> resList = new ArrayList<MaterialVo4Unit>(); List<MaterialVo4Unit> resList = new ArrayList<MaterialVo4Unit>();
List<MaterialVo4Unit> list =null; List<MaterialVo4Unit> list =null;
...@@ -442,8 +491,12 @@ public class MaterialService { ...@@ -442,8 +491,12 @@ public class MaterialService {
List<Material> materials = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),m.getStandard(), List<Material> materials = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),m.getStandard(),
m.getMfrs(),m.getUnit(),m.getUnitid()); m.getMfrs(),m.getUnit(),m.getUnitid());
if(materials.size()<=0) { if(materials.size()<=0) {
materialMapperEx.insertSelectiveEx(m); materialMapper.insertSelective(m);
mId = m.getId(); List<Material> newList = getMaterialListByParam(m.getName(),m.getModel(),m.getColor(),m.getStandard(),
m.getMfrs(),m.getUnit(),m.getUnitid());
if(newList!=null && newList.size()>0) {
mId = newList.get(0).getId();
}
} else { } else {
mId = materials.get(0).getId(); mId = materials.get(0).getId();
String materialJson = JSON.toJSONString(m); String materialJson = JSON.toJSONString(m);
...@@ -658,4 +711,19 @@ public class MaterialService { ...@@ -658,4 +711,19 @@ public class MaterialService {
} }
return stock; return stock;
} }
public List<MaterialVo4Unit> getMaterialByMeId(long meId) {
List<MaterialVo4Unit> result = new ArrayList<MaterialVo4Unit>();
try{
result= materialMapperEx.getMaterialByMeId(meId);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public String getMaxBarCode() {
String maxBarCodeOld = materialMapperEx.getMaxBarCode();
return Long.parseLong(maxBarCodeOld)+"";
}
} }
...@@ -148,6 +148,13 @@ public class StringUtil { ...@@ -148,6 +148,13 @@ public class StringUtil {
return new String[0]; return new String[0];
} }
public static Long[] listToLongArray(List<Long> list) {
if (list != null && !list.isEmpty()) {
return list.toArray(new Long[list.size()]);
}
return new Long[0];
}
public static List<String> stringToListArray(String[] strings) { public static List<String> stringToListArray(String[] strings) {
if (strings != null && strings.length > 0) { if (strings != null && strings.length > 0) {
return Arrays.asList(strings); return Arrays.asList(strings);
...@@ -223,6 +230,19 @@ public class StringUtil { ...@@ -223,6 +230,19 @@ public class StringUtil {
return value; return value;
} }
public static boolean isExist(Object value) {
if(value!=null) {
String str = value.toString();
if("".equals(str.trim())) {
return false;
} else {
return true;
}
} else {
return false;
}
}
public static void main(String[] args) { public static void main(String[] args) {
int i = 10/3; int i = 10/3;
System.out.println(i); System.out.println(i);
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jsh.erp.datasource.mappers.DepotItemMapper"> <mapper namespace="com.jsh.erp.datasource.mappers.DepotItemMapper">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.DepotItem"> <resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.DepotItem">
<!-- <id column="Id" jdbcType="BIGINT" property="id" />
WARNING - @mbggenerated <result column="HeaderId" jdbcType="BIGINT" property="headerid" />
This element is automatically generated by MyBatis Generator, do not modify. <result column="MaterialId" jdbcType="BIGINT" property="materialid" />
--> <result column="material_extend_id" jdbcType="BIGINT" property="materialExtendId" />
<id column="Id" jdbcType="BIGINT" property="id" /> <result column="MUnit" jdbcType="VARCHAR" property="munit" />
<result column="HeaderId" jdbcType="BIGINT" property="headerid" /> <result column="OperNumber" jdbcType="DECIMAL" property="opernumber" />
<result column="MaterialId" jdbcType="BIGINT" property="materialid" /> <result column="BasicNumber" jdbcType="DECIMAL" property="basicnumber" />
<result column="MUnit" jdbcType="VARCHAR" property="munit" /> <result column="UnitPrice" jdbcType="DECIMAL" property="unitprice" />
<result column="OperNumber" jdbcType="DECIMAL" property="opernumber" /> <result column="TaxUnitPrice" jdbcType="DECIMAL" property="taxunitprice" />
<result column="BasicNumber" jdbcType="DECIMAL" property="basicnumber" /> <result column="AllPrice" jdbcType="DECIMAL" property="allprice" />
<result column="UnitPrice" jdbcType="DECIMAL" property="unitprice" /> <result column="Remark" jdbcType="VARCHAR" property="remark" />
<result column="TaxUnitPrice" jdbcType="DECIMAL" property="taxunitprice" /> <result column="Img" jdbcType="VARCHAR" property="img" />
<result column="AllPrice" jdbcType="DECIMAL" property="allprice" /> <result column="Incidentals" jdbcType="DECIMAL" property="incidentals" />
<result column="Remark" jdbcType="VARCHAR" property="remark" /> <result column="DepotId" jdbcType="BIGINT" property="depotid" />
<result column="Img" jdbcType="VARCHAR" property="img" /> <result column="AnotherDepotId" jdbcType="BIGINT" property="anotherdepotid" />
<result column="Incidentals" jdbcType="DECIMAL" property="incidentals" /> <result column="TaxRate" jdbcType="DECIMAL" property="taxrate" />
<result column="DepotId" jdbcType="BIGINT" property="depotid" /> <result column="TaxMoney" jdbcType="DECIMAL" property="taxmoney" />
<result column="AnotherDepotId" jdbcType="BIGINT" property="anotherdepotid" /> <result column="TaxLastMoney" jdbcType="DECIMAL" property="taxlastmoney" />
<result column="TaxRate" jdbcType="DECIMAL" property="taxrate" /> <result column="OtherField1" jdbcType="VARCHAR" property="otherfield1" />
<result column="TaxMoney" jdbcType="DECIMAL" property="taxmoney" /> <result column="OtherField2" jdbcType="VARCHAR" property="otherfield2" />
<result column="TaxLastMoney" jdbcType="DECIMAL" property="taxlastmoney" /> <result column="OtherField3" jdbcType="VARCHAR" property="otherfield3" />
<result column="OtherField1" jdbcType="VARCHAR" property="otherfield1" /> <result column="OtherField4" jdbcType="VARCHAR" property="otherfield4" />
<result column="OtherField2" jdbcType="VARCHAR" property="otherfield2" /> <result column="OtherField5" jdbcType="VARCHAR" property="otherfield5" />
<result column="OtherField3" jdbcType="VARCHAR" property="otherfield3" /> <result column="MType" jdbcType="VARCHAR" property="mtype" />
<result column="OtherField4" jdbcType="VARCHAR" property="otherfield4" /> <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="OtherField5" jdbcType="VARCHAR" property="otherfield5" /> <result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
<result column="MType" jdbcType="VARCHAR" property="mtype" /> </resultMap>
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" /> <sql id="Example_Where_Clause">
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" /> <where>
</resultMap> <foreach collection="oredCriteria" item="criteria" separator="or">
<sql id="Example_Where_Clause"> <if test="criteria.valid">
<!-- <trim prefix="(" prefixOverrides="and" suffix=")">
WARNING - @mbggenerated <foreach collection="criteria.criteria" item="criterion">
This element is automatically generated by MyBatis Generator, do not modify. <choose>
--> <when test="criterion.noValue">
<where> and ${criterion.condition}
<foreach collection="oredCriteria" item="criteria" separator="or"> </when>
<if test="criteria.valid"> <when test="criterion.singleValue">
<trim prefix="(" prefixOverrides="and" suffix=")"> and ${criterion.condition} #{criterion.value}
<foreach collection="criteria.criteria" item="criterion"> </when>
<choose> <when test="criterion.betweenValue">
<when test="criterion.noValue"> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
and ${criterion.condition} </when>
</when> <when test="criterion.listValue">
<when test="criterion.singleValue"> and ${criterion.condition}
and ${criterion.condition} #{criterion.value} <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
</when> #{listItem}
<when test="criterion.betweenValue"> </foreach>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when>
</when> </choose>
<when test="criterion.listValue"> </foreach>
and ${criterion.condition} </trim>
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> </if>
#{listItem} </foreach>
</foreach> </where>
</when> </sql>
</choose> <sql id="Update_By_Example_Where_Clause">
</foreach> <where>
</trim> <foreach collection="example.oredCriteria" item="criteria" separator="or">
</if> <if test="criteria.valid">
</foreach> <trim prefix="(" prefixOverrides="and" suffix=")">
</where> <foreach collection="criteria.criteria" item="criterion">
</sql> <choose>
<sql id="Update_By_Example_Where_Clause"> <when test="criterion.noValue">
<!-- and ${criterion.condition}
WARNING - @mbggenerated </when>
This element is automatically generated by MyBatis Generator, do not modify. <when test="criterion.singleValue">
--> and ${criterion.condition} #{criterion.value}
<where> </when>
<foreach collection="example.oredCriteria" item="criteria" separator="or"> <when test="criterion.betweenValue">
<if test="criteria.valid"> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
<trim prefix="(" prefixOverrides="and" suffix=")"> </when>
<foreach collection="criteria.criteria" item="criterion"> <when test="criterion.listValue">
<choose> and ${criterion.condition}
<when test="criterion.noValue"> <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
and ${criterion.condition} #{listItem}
</when> </foreach>
<when test="criterion.singleValue"> </when>
and ${criterion.condition} #{criterion.value} </choose>
</when> </foreach>
<when test="criterion.betweenValue"> </trim>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </if>
</when> </foreach>
<when test="criterion.listValue"> </where>
and ${criterion.condition} </sql>
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <sql id="Base_Column_List">
#{listItem} Id, HeaderId, MaterialId, material_extend_id, MUnit, OperNumber, BasicNumber, UnitPrice,
</foreach> TaxUnitPrice, AllPrice, Remark, Img, Incidentals, DepotId, AnotherDepotId, TaxRate,
</when> TaxMoney, TaxLastMoney, OtherField1, OtherField2, OtherField3, OtherField4, OtherField5,
</choose> MType, tenant_id, delete_Flag
</foreach> </sql>
</trim> <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="BaseResultMap">
</if> select
</foreach> <if test="distinct">
</where> distinct
</sql> </if>
<sql id="Base_Column_List"> <include refid="Base_Column_List" />
<!-- from jsh_depotitem
WARNING - @mbggenerated <if test="_parameter != null">
This element is automatically generated by MyBatis Generator, do not modify. <include refid="Example_Where_Clause" />
--> </if>
Id, HeaderId, MaterialId, MUnit, OperNumber, BasicNumber, UnitPrice, TaxUnitPrice, <if test="orderByClause != null">
AllPrice, Remark, Img, Incidentals, DepotId, AnotherDepotId, TaxRate, TaxMoney, TaxLastMoney, order by ${orderByClause}
OtherField1, OtherField2, OtherField3, OtherField4, OtherField5, MType, tenant_id, </if>
delete_Flag </select>
</sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="BaseResultMap"> select
<!-- <include refid="Base_Column_List" />
WARNING - @mbggenerated from jsh_depotitem
This element is automatically generated by MyBatis Generator, do not modify. where Id = #{id,jdbcType=BIGINT}
--> </select>
select <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<if test="distinct"> delete from jsh_depotitem
distinct where Id = #{id,jdbcType=BIGINT}
</if> </delete>
<include refid="Base_Column_List" /> <delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample">
from jsh_depotitem delete from jsh_depotitem
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
<if test="orderByClause != null"> </delete>
order by ${orderByClause} <insert id="insert" parameterType="com.jsh.erp.datasource.entities.DepotItem">
</if> insert into jsh_depotitem (Id, HeaderId, MaterialId,
</select> material_extend_id, MUnit, OperNumber,
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> BasicNumber, UnitPrice, TaxUnitPrice,
<!-- AllPrice, Remark, Img,
WARNING - @mbggenerated Incidentals, DepotId, AnotherDepotId,
This element is automatically generated by MyBatis Generator, do not modify. TaxRate, TaxMoney, TaxLastMoney,
--> OtherField1, OtherField2, OtherField3,
select OtherField4, OtherField5, MType,
<include refid="Base_Column_List" /> tenant_id, delete_Flag)
from jsh_depotitem values (#{id,jdbcType=BIGINT}, #{headerid,jdbcType=BIGINT}, #{materialid,jdbcType=BIGINT},
where Id = #{id,jdbcType=BIGINT} #{materialExtendId,jdbcType=BIGINT}, #{munit,jdbcType=VARCHAR}, #{opernumber,jdbcType=DECIMAL},
</select> #{basicnumber,jdbcType=DECIMAL}, #{unitprice,jdbcType=DECIMAL}, #{taxunitprice,jdbcType=DECIMAL},
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> #{allprice,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR}, #{img,jdbcType=VARCHAR},
<!-- #{incidentals,jdbcType=DECIMAL}, #{depotid,jdbcType=BIGINT}, #{anotherdepotid,jdbcType=BIGINT},
WARNING - @mbggenerated #{taxrate,jdbcType=DECIMAL}, #{taxmoney,jdbcType=DECIMAL}, #{taxlastmoney,jdbcType=DECIMAL},
This element is automatically generated by MyBatis Generator, do not modify. #{otherfield1,jdbcType=VARCHAR}, #{otherfield2,jdbcType=VARCHAR}, #{otherfield3,jdbcType=VARCHAR},
--> #{otherfield4,jdbcType=VARCHAR}, #{otherfield5,jdbcType=VARCHAR}, #{mtype,jdbcType=VARCHAR},
delete from jsh_depotitem #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
where Id = #{id,jdbcType=BIGINT} </insert>
</delete> <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotItem">
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample"> insert into jsh_depotitem
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">
WARNING - @mbggenerated <if test="id != null">
This element is automatically generated by MyBatis Generator, do not modify. Id,
--> </if>
delete from jsh_depotitem <if test="headerid != null">
<if test="_parameter != null"> HeaderId,
<include refid="Example_Where_Clause" /> </if>
</if> <if test="materialid != null">
</delete> MaterialId,
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.DepotItem"> </if>
<!-- <if test="materialExtendId != null">
WARNING - @mbggenerated material_extend_id,
This element is automatically generated by MyBatis Generator, do not modify. </if>
--> <if test="munit != null">
insert into jsh_depotitem (Id, HeaderId, MaterialId, MUnit,
MUnit, OperNumber, BasicNumber, </if>
UnitPrice, TaxUnitPrice, AllPrice, <if test="opernumber != null">
Remark, Img, Incidentals, OperNumber,
DepotId, AnotherDepotId, TaxRate, </if>
TaxMoney, TaxLastMoney, OtherField1, <if test="basicnumber != null">
OtherField2, OtherField3, OtherField4, BasicNumber,
OtherField5, MType, tenant_id, </if>
delete_Flag) <if test="unitprice != null">
values (#{id,jdbcType=BIGINT}, #{headerid,jdbcType=BIGINT}, #{materialid,jdbcType=BIGINT}, UnitPrice,
#{munit,jdbcType=VARCHAR}, #{opernumber,jdbcType=DECIMAL}, #{basicnumber,jdbcType=DECIMAL}, </if>
#{unitprice,jdbcType=DECIMAL}, #{taxunitprice,jdbcType=DECIMAL}, #{allprice,jdbcType=DECIMAL}, <if test="taxunitprice != null">
#{remark,jdbcType=VARCHAR}, #{img,jdbcType=VARCHAR}, #{incidentals,jdbcType=DECIMAL}, TaxUnitPrice,
#{depotid,jdbcType=BIGINT}, #{anotherdepotid,jdbcType=BIGINT}, #{taxrate,jdbcType=DECIMAL}, </if>
#{taxmoney,jdbcType=DECIMAL}, #{taxlastmoney,jdbcType=DECIMAL}, #{otherfield1,jdbcType=VARCHAR}, <if test="allprice != null">
#{otherfield2,jdbcType=VARCHAR}, #{otherfield3,jdbcType=VARCHAR}, #{otherfield4,jdbcType=VARCHAR}, AllPrice,
#{otherfield5,jdbcType=VARCHAR}, #{mtype,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, </if>
#{deleteFlag,jdbcType=VARCHAR}) <if test="remark != null">
</insert> Remark,
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotItem"> </if>
<!-- <if test="img != null">
WARNING - @mbggenerated Img,
This element is automatically generated by MyBatis Generator, do not modify. </if>
--> <if test="incidentals != null">
insert into jsh_depotitem Incidentals,
<trim prefix="(" suffix=")" suffixOverrides=","> </if>
<if test="id != null"> <if test="depotid != null">
Id, DepotId,
</if> </if>
<if test="headerid != null"> <if test="anotherdepotid != null">
HeaderId, AnotherDepotId,
</if> </if>
<if test="materialid != null"> <if test="taxrate != null">
MaterialId, TaxRate,
</if> </if>
<if test="munit != null"> <if test="taxmoney != null">
MUnit, TaxMoney,
</if> </if>
<if test="opernumber != null"> <if test="taxlastmoney != null">
OperNumber, TaxLastMoney,
</if> </if>
<if test="basicnumber != null"> <if test="otherfield1 != null">
BasicNumber, OtherField1,
</if> </if>
<if test="unitprice != null"> <if test="otherfield2 != null">
UnitPrice, OtherField2,
</if> </if>
<if test="taxunitprice != null"> <if test="otherfield3 != null">
TaxUnitPrice, OtherField3,
</if> </if>
<if test="allprice != null"> <if test="otherfield4 != null">
AllPrice, OtherField4,
</if> </if>
<if test="remark != null"> <if test="otherfield5 != null">
Remark, OtherField5,
</if> </if>
<if test="img != null"> <if test="mtype != null">
Img, MType,
</if> </if>
<if test="incidentals != null"> <if test="tenantId != null">
Incidentals, tenant_id,
</if> </if>
<if test="depotid != null"> <if test="deleteFlag != null">
DepotId, delete_Flag,
</if> </if>
<if test="anotherdepotid != null"> </trim>
AnotherDepotId, <trim prefix="values (" suffix=")" suffixOverrides=",">
</if> <if test="id != null">
<if test="taxrate != null"> #{id,jdbcType=BIGINT},
TaxRate, </if>
</if> <if test="headerid != null">
<if test="taxmoney != null"> #{headerid,jdbcType=BIGINT},
TaxMoney, </if>
</if> <if test="materialid != null">
<if test="taxlastmoney != null"> #{materialid,jdbcType=BIGINT},
TaxLastMoney, </if>
</if> <if test="materialExtendId != null">
<if test="otherfield1 != null"> #{materialExtendId,jdbcType=BIGINT},
OtherField1, </if>
</if> <if test="munit != null">
<if test="otherfield2 != null"> #{munit,jdbcType=VARCHAR},
OtherField2, </if>
</if> <if test="opernumber != null">
<if test="otherfield3 != null"> #{opernumber,jdbcType=DECIMAL},
OtherField3, </if>
</if> <if test="basicnumber != null">
<if test="otherfield4 != null"> #{basicnumber,jdbcType=DECIMAL},
OtherField4, </if>
</if> <if test="unitprice != null">
<if test="otherfield5 != null"> #{unitprice,jdbcType=DECIMAL},
OtherField5, </if>
</if> <if test="taxunitprice != null">
<if test="mtype != null"> #{taxunitprice,jdbcType=DECIMAL},
MType, </if>
</if> <if test="allprice != null">
<if test="tenantId != null"> #{allprice,jdbcType=DECIMAL},
tenant_id, </if>
</if> <if test="remark != null">
<if test="deleteFlag != null"> #{remark,jdbcType=VARCHAR},
delete_Flag, </if>
</if> <if test="img != null">
</trim> #{img,jdbcType=VARCHAR},
<trim prefix="values (" suffix=")" suffixOverrides=","> </if>
<if test="id != null"> <if test="incidentals != null">
#{id,jdbcType=BIGINT}, #{incidentals,jdbcType=DECIMAL},
</if> </if>
<if test="headerid != null"> <if test="depotid != null">
#{headerid,jdbcType=BIGINT}, #{depotid,jdbcType=BIGINT},
</if> </if>
<if test="materialid != null"> <if test="anotherdepotid != null">
#{materialid,jdbcType=BIGINT}, #{anotherdepotid,jdbcType=BIGINT},
</if> </if>
<if test="munit != null"> <if test="taxrate != null">
#{munit,jdbcType=VARCHAR}, #{taxrate,jdbcType=DECIMAL},
</if> </if>
<if test="opernumber != null"> <if test="taxmoney != null">
#{opernumber,jdbcType=DECIMAL}, #{taxmoney,jdbcType=DECIMAL},
</if> </if>
<if test="basicnumber != null"> <if test="taxlastmoney != null">
#{basicnumber,jdbcType=DECIMAL}, #{taxlastmoney,jdbcType=DECIMAL},
</if> </if>
<if test="unitprice != null"> <if test="otherfield1 != null">
#{unitprice,jdbcType=DECIMAL}, #{otherfield1,jdbcType=VARCHAR},
</if> </if>
<if test="taxunitprice != null"> <if test="otherfield2 != null">
#{taxunitprice,jdbcType=DECIMAL}, #{otherfield2,jdbcType=VARCHAR},
</if> </if>
<if test="allprice != null"> <if test="otherfield3 != null">
#{allprice,jdbcType=DECIMAL}, #{otherfield3,jdbcType=VARCHAR},
</if> </if>
<if test="remark != null"> <if test="otherfield4 != null">
#{remark,jdbcType=VARCHAR}, #{otherfield4,jdbcType=VARCHAR},
</if> </if>
<if test="img != null"> <if test="otherfield5 != null">
#{img,jdbcType=VARCHAR}, #{otherfield5,jdbcType=VARCHAR},
</if> </if>
<if test="incidentals != null"> <if test="mtype != null">
#{incidentals,jdbcType=DECIMAL}, #{mtype,jdbcType=VARCHAR},
</if> </if>
<if test="depotid != null"> <if test="tenantId != null">
#{depotid,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT},
</if> </if>
<if test="anotherdepotid != null"> <if test="deleteFlag != null">
#{anotherdepotid,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR},
</if> </if>
<if test="taxrate != null"> </trim>
#{taxrate,jdbcType=DECIMAL}, </insert>
</if> <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultType="java.lang.Long">
<if test="taxmoney != null"> select count(*) from jsh_depotitem
#{taxmoney,jdbcType=DECIMAL}, <if test="_parameter != null">
</if> <include refid="Example_Where_Clause" />
<if test="taxlastmoney != null"> </if>
#{taxlastmoney,jdbcType=DECIMAL}, </select>
</if> <update id="updateByExampleSelective" parameterType="map">
<if test="otherfield1 != null"> update jsh_depotitem
#{otherfield1,jdbcType=VARCHAR}, <set>
</if> <if test="record.id != null">
<if test="otherfield2 != null"> Id = #{record.id,jdbcType=BIGINT},
#{otherfield2,jdbcType=VARCHAR}, </if>
</if> <if test="record.headerid != null">
<if test="otherfield3 != null"> HeaderId = #{record.headerid,jdbcType=BIGINT},
#{otherfield3,jdbcType=VARCHAR}, </if>
</if> <if test="record.materialid != null">
<if test="otherfield4 != null"> MaterialId = #{record.materialid,jdbcType=BIGINT},
#{otherfield4,jdbcType=VARCHAR}, </if>
</if> <if test="record.materialExtendId != null">
<if test="otherfield5 != null"> material_extend_id = #{record.materialExtendId,jdbcType=BIGINT},
#{otherfield5,jdbcType=VARCHAR}, </if>
</if> <if test="record.munit != null">
<if test="mtype != null"> MUnit = #{record.munit,jdbcType=VARCHAR},
#{mtype,jdbcType=VARCHAR}, </if>
</if> <if test="record.opernumber != null">
<if test="tenantId != null"> OperNumber = #{record.opernumber,jdbcType=DECIMAL},
#{tenantId,jdbcType=BIGINT}, </if>
</if> <if test="record.basicnumber != null">
<if test="deleteFlag != null"> BasicNumber = #{record.basicnumber,jdbcType=DECIMAL},
#{deleteFlag,jdbcType=VARCHAR}, </if>
</if> <if test="record.unitprice != null">
</trim> UnitPrice = #{record.unitprice,jdbcType=DECIMAL},
</insert> </if>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultType="java.lang.Integer"> <if test="record.taxunitprice != null">
<!-- TaxUnitPrice = #{record.taxunitprice,jdbcType=DECIMAL},
WARNING - @mbggenerated </if>
This element is automatically generated by MyBatis Generator, do not modify. <if test="record.allprice != null">
--> AllPrice = #{record.allprice,jdbcType=DECIMAL},
select count(*) from jsh_depotitem </if>
<if test="_parameter != null"> <if test="record.remark != null">
<include refid="Example_Where_Clause" /> Remark = #{record.remark,jdbcType=VARCHAR},
</if> </if>
</select> <if test="record.img != null">
<update id="updateByExampleSelective" parameterType="map"> Img = #{record.img,jdbcType=VARCHAR},
<!-- </if>
WARNING - @mbggenerated <if test="record.incidentals != null">
This element is automatically generated by MyBatis Generator, do not modify. Incidentals = #{record.incidentals,jdbcType=DECIMAL},
--> </if>
update jsh_depotitem <if test="record.depotid != null">
<set> DepotId = #{record.depotid,jdbcType=BIGINT},
<if test="record.id != null"> </if>
Id = #{record.id,jdbcType=BIGINT}, <if test="record.anotherdepotid != null">
</if> AnotherDepotId = #{record.anotherdepotid,jdbcType=BIGINT},
<if test="record.headerid != null"> </if>
HeaderId = #{record.headerid,jdbcType=BIGINT}, <if test="record.taxrate != null">
</if> TaxRate = #{record.taxrate,jdbcType=DECIMAL},
<if test="record.materialid != null"> </if>
MaterialId = #{record.materialid,jdbcType=BIGINT}, <if test="record.taxmoney != null">
</if> TaxMoney = #{record.taxmoney,jdbcType=DECIMAL},
<if test="record.munit != null"> </if>
MUnit = #{record.munit,jdbcType=VARCHAR}, <if test="record.taxlastmoney != null">
</if> TaxLastMoney = #{record.taxlastmoney,jdbcType=DECIMAL},
<if test="record.opernumber != null"> </if>
OperNumber = #{record.opernumber,jdbcType=DECIMAL}, <if test="record.otherfield1 != null">
</if> OtherField1 = #{record.otherfield1,jdbcType=VARCHAR},
<if test="record.basicnumber != null"> </if>
BasicNumber = #{record.basicnumber,jdbcType=DECIMAL}, <if test="record.otherfield2 != null">
</if> OtherField2 = #{record.otherfield2,jdbcType=VARCHAR},
<if test="record.unitprice != null"> </if>
UnitPrice = #{record.unitprice,jdbcType=DECIMAL}, <if test="record.otherfield3 != null">
</if> OtherField3 = #{record.otherfield3,jdbcType=VARCHAR},
<if test="record.taxunitprice != null"> </if>
TaxUnitPrice = #{record.taxunitprice,jdbcType=DECIMAL}, <if test="record.otherfield4 != null">
</if> OtherField4 = #{record.otherfield4,jdbcType=VARCHAR},
<if test="record.allprice != null"> </if>
AllPrice = #{record.allprice,jdbcType=DECIMAL}, <if test="record.otherfield5 != null">
</if> OtherField5 = #{record.otherfield5,jdbcType=VARCHAR},
<if test="record.remark != null"> </if>
Remark = #{record.remark,jdbcType=VARCHAR}, <if test="record.mtype != null">
</if> MType = #{record.mtype,jdbcType=VARCHAR},
<if test="record.img != null"> </if>
Img = #{record.img,jdbcType=VARCHAR}, <if test="record.tenantId != null">
</if> tenant_id = #{record.tenantId,jdbcType=BIGINT},
<if test="record.incidentals != null"> </if>
Incidentals = #{record.incidentals,jdbcType=DECIMAL}, <if test="record.deleteFlag != null">
</if> delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
<if test="record.depotid != null"> </if>
DepotId = #{record.depotid,jdbcType=BIGINT}, </set>
</if> <if test="_parameter != null">
<if test="record.anotherdepotid != null"> <include refid="Update_By_Example_Where_Clause" />
AnotherDepotId = #{record.anotherdepotid,jdbcType=BIGINT}, </if>
</if> </update>
<if test="record.taxrate != null"> <update id="updateByExample" parameterType="map">
TaxRate = #{record.taxrate,jdbcType=DECIMAL}, update jsh_depotitem
</if> set Id = #{record.id,jdbcType=BIGINT},
<if test="record.taxmoney != null"> HeaderId = #{record.headerid,jdbcType=BIGINT},
TaxMoney = #{record.taxmoney,jdbcType=DECIMAL}, MaterialId = #{record.materialid,jdbcType=BIGINT},
</if> material_extend_id = #{record.materialExtendId,jdbcType=BIGINT},
<if test="record.taxlastmoney != null"> MUnit = #{record.munit,jdbcType=VARCHAR},
TaxLastMoney = #{record.taxlastmoney,jdbcType=DECIMAL}, OperNumber = #{record.opernumber,jdbcType=DECIMAL},
</if> BasicNumber = #{record.basicnumber,jdbcType=DECIMAL},
<if test="record.otherfield1 != null"> UnitPrice = #{record.unitprice,jdbcType=DECIMAL},
OtherField1 = #{record.otherfield1,jdbcType=VARCHAR}, TaxUnitPrice = #{record.taxunitprice,jdbcType=DECIMAL},
</if> AllPrice = #{record.allprice,jdbcType=DECIMAL},
<if test="record.otherfield2 != null"> Remark = #{record.remark,jdbcType=VARCHAR},
OtherField2 = #{record.otherfield2,jdbcType=VARCHAR}, Img = #{record.img,jdbcType=VARCHAR},
</if> Incidentals = #{record.incidentals,jdbcType=DECIMAL},
<if test="record.otherfield3 != null"> DepotId = #{record.depotid,jdbcType=BIGINT},
OtherField3 = #{record.otherfield3,jdbcType=VARCHAR}, AnotherDepotId = #{record.anotherdepotid,jdbcType=BIGINT},
</if> TaxRate = #{record.taxrate,jdbcType=DECIMAL},
<if test="record.otherfield4 != null"> TaxMoney = #{record.taxmoney,jdbcType=DECIMAL},
OtherField4 = #{record.otherfield4,jdbcType=VARCHAR}, TaxLastMoney = #{record.taxlastmoney,jdbcType=DECIMAL},
</if> OtherField1 = #{record.otherfield1,jdbcType=VARCHAR},
<if test="record.otherfield5 != null"> OtherField2 = #{record.otherfield2,jdbcType=VARCHAR},
OtherField5 = #{record.otherfield5,jdbcType=VARCHAR}, OtherField3 = #{record.otherfield3,jdbcType=VARCHAR},
</if> OtherField4 = #{record.otherfield4,jdbcType=VARCHAR},
<if test="record.mtype != null"> OtherField5 = #{record.otherfield5,jdbcType=VARCHAR},
MType = #{record.mtype,jdbcType=VARCHAR}, MType = #{record.mtype,jdbcType=VARCHAR},
</if> tenant_id = #{record.tenantId,jdbcType=BIGINT},
<if test="record.tenantId != null"> delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
tenant_id = #{record.tenantId,jdbcType=BIGINT}, <if test="_parameter != null">
</if> <include refid="Update_By_Example_Where_Clause" />
<if test="record.deleteFlag != null"> </if>
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}, </update>
</if> <update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.DepotItem">
</set> update jsh_depotitem
<if test="_parameter != null"> <set>
<include refid="Update_By_Example_Where_Clause" /> <if test="headerid != null">
</if> HeaderId = #{headerid,jdbcType=BIGINT},
</update> </if>
<update id="updateByExample" parameterType="map"> <if test="materialid != null">
<!-- MaterialId = #{materialid,jdbcType=BIGINT},
WARNING - @mbggenerated </if>
This element is automatically generated by MyBatis Generator, do not modify. <if test="materialExtendId != null">
--> material_extend_id = #{materialExtendId,jdbcType=BIGINT},
update jsh_depotitem </if>
set Id = #{record.id,jdbcType=BIGINT}, <if test="munit != null">
HeaderId = #{record.headerid,jdbcType=BIGINT}, MUnit = #{munit,jdbcType=VARCHAR},
MaterialId = #{record.materialid,jdbcType=BIGINT}, </if>
MUnit = #{record.munit,jdbcType=VARCHAR}, <if test="opernumber != null">
OperNumber = #{record.opernumber,jdbcType=DECIMAL}, OperNumber = #{opernumber,jdbcType=DECIMAL},
BasicNumber = #{record.basicnumber,jdbcType=DECIMAL}, </if>
UnitPrice = #{record.unitprice,jdbcType=DECIMAL}, <if test="basicnumber != null">
TaxUnitPrice = #{record.taxunitprice,jdbcType=DECIMAL}, BasicNumber = #{basicnumber,jdbcType=DECIMAL},
AllPrice = #{record.allprice,jdbcType=DECIMAL}, </if>
Remark = #{record.remark,jdbcType=VARCHAR}, <if test="unitprice != null">
Img = #{record.img,jdbcType=VARCHAR}, UnitPrice = #{unitprice,jdbcType=DECIMAL},
Incidentals = #{record.incidentals,jdbcType=DECIMAL}, </if>
DepotId = #{record.depotid,jdbcType=BIGINT}, <if test="taxunitprice != null">
AnotherDepotId = #{record.anotherdepotid,jdbcType=BIGINT}, TaxUnitPrice = #{taxunitprice,jdbcType=DECIMAL},
TaxRate = #{record.taxrate,jdbcType=DECIMAL}, </if>
TaxMoney = #{record.taxmoney,jdbcType=DECIMAL}, <if test="allprice != null">
TaxLastMoney = #{record.taxlastmoney,jdbcType=DECIMAL}, AllPrice = #{allprice,jdbcType=DECIMAL},
OtherField1 = #{record.otherfield1,jdbcType=VARCHAR}, </if>
OtherField2 = #{record.otherfield2,jdbcType=VARCHAR}, <if test="remark != null">
OtherField3 = #{record.otherfield3,jdbcType=VARCHAR}, Remark = #{remark,jdbcType=VARCHAR},
OtherField4 = #{record.otherfield4,jdbcType=VARCHAR}, </if>
OtherField5 = #{record.otherfield5,jdbcType=VARCHAR}, <if test="img != null">
MType = #{record.mtype,jdbcType=VARCHAR}, Img = #{img,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT}, </if>
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR} <if test="incidentals != null">
<if test="_parameter != null"> Incidentals = #{incidentals,jdbcType=DECIMAL},
<include refid="Update_By_Example_Where_Clause" /> </if>
</if> <if test="depotid != null">
</update> DepotId = #{depotid,jdbcType=BIGINT},
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.DepotItem"> </if>
<!-- <if test="anotherdepotid != null">
WARNING - @mbggenerated AnotherDepotId = #{anotherdepotid,jdbcType=BIGINT},
This element is automatically generated by MyBatis Generator, do not modify. </if>
--> <if test="taxrate != null">
update jsh_depotitem TaxRate = #{taxrate,jdbcType=DECIMAL},
<set> </if>
<if test="headerid != null"> <if test="taxmoney != null">
HeaderId = #{headerid,jdbcType=BIGINT}, TaxMoney = #{taxmoney,jdbcType=DECIMAL},
</if> </if>
<if test="materialid != null"> <if test="taxlastmoney != null">
MaterialId = #{materialid,jdbcType=BIGINT}, TaxLastMoney = #{taxlastmoney,jdbcType=DECIMAL},
</if> </if>
<if test="munit != null"> <if test="otherfield1 != null">
MUnit = #{munit,jdbcType=VARCHAR}, OtherField1 = #{otherfield1,jdbcType=VARCHAR},
</if> </if>
<if test="opernumber != null"> <if test="otherfield2 != null">
OperNumber = #{opernumber,jdbcType=DECIMAL}, OtherField2 = #{otherfield2,jdbcType=VARCHAR},
</if> </if>
<if test="basicnumber != null"> <if test="otherfield3 != null">
BasicNumber = #{basicnumber,jdbcType=DECIMAL}, OtherField3 = #{otherfield3,jdbcType=VARCHAR},
</if> </if>
<if test="unitprice != null"> <if test="otherfield4 != null">
UnitPrice = #{unitprice,jdbcType=DECIMAL}, OtherField4 = #{otherfield4,jdbcType=VARCHAR},
</if> </if>
<if test="taxunitprice != null"> <if test="otherfield5 != null">
TaxUnitPrice = #{taxunitprice,jdbcType=DECIMAL}, OtherField5 = #{otherfield5,jdbcType=VARCHAR},
</if> </if>
<if test="allprice != null"> <if test="mtype != null">
AllPrice = #{allprice,jdbcType=DECIMAL}, MType = #{mtype,jdbcType=VARCHAR},
</if> </if>
<if test="remark != null"> <if test="tenantId != null">
Remark = #{remark,jdbcType=VARCHAR}, tenant_id = #{tenantId,jdbcType=BIGINT},
</if> </if>
<if test="img != null"> <if test="deleteFlag != null">
Img = #{img,jdbcType=VARCHAR}, delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if> </if>
<if test="incidentals != null"> </set>
Incidentals = #{incidentals,jdbcType=DECIMAL}, where Id = #{id,jdbcType=BIGINT}
</if> </update>
<if test="depotid != null"> <update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.DepotItem">
DepotId = #{depotid,jdbcType=BIGINT}, update jsh_depotitem
</if> set HeaderId = #{headerid,jdbcType=BIGINT},
<if test="anotherdepotid != null"> MaterialId = #{materialid,jdbcType=BIGINT},
AnotherDepotId = #{anotherdepotid,jdbcType=BIGINT}, material_extend_id = #{materialExtendId,jdbcType=BIGINT},
</if> MUnit = #{munit,jdbcType=VARCHAR},
<if test="taxrate != null"> OperNumber = #{opernumber,jdbcType=DECIMAL},
TaxRate = #{taxrate,jdbcType=DECIMAL}, BasicNumber = #{basicnumber,jdbcType=DECIMAL},
</if> UnitPrice = #{unitprice,jdbcType=DECIMAL},
<if test="taxmoney != null"> TaxUnitPrice = #{taxunitprice,jdbcType=DECIMAL},
TaxMoney = #{taxmoney,jdbcType=DECIMAL}, AllPrice = #{allprice,jdbcType=DECIMAL},
</if> Remark = #{remark,jdbcType=VARCHAR},
<if test="taxlastmoney != null"> Img = #{img,jdbcType=VARCHAR},
TaxLastMoney = #{taxlastmoney,jdbcType=DECIMAL}, Incidentals = #{incidentals,jdbcType=DECIMAL},
</if> DepotId = #{depotid,jdbcType=BIGINT},
<if test="otherfield1 != null"> AnotherDepotId = #{anotherdepotid,jdbcType=BIGINT},
OtherField1 = #{otherfield1,jdbcType=VARCHAR}, TaxRate = #{taxrate,jdbcType=DECIMAL},
</if> TaxMoney = #{taxmoney,jdbcType=DECIMAL},
<if test="otherfield2 != null"> TaxLastMoney = #{taxlastmoney,jdbcType=DECIMAL},
OtherField2 = #{otherfield2,jdbcType=VARCHAR}, OtherField1 = #{otherfield1,jdbcType=VARCHAR},
</if> OtherField2 = #{otherfield2,jdbcType=VARCHAR},
<if test="otherfield3 != null"> OtherField3 = #{otherfield3,jdbcType=VARCHAR},
OtherField3 = #{otherfield3,jdbcType=VARCHAR}, OtherField4 = #{otherfield4,jdbcType=VARCHAR},
</if> OtherField5 = #{otherfield5,jdbcType=VARCHAR},
<if test="otherfield4 != null"> MType = #{mtype,jdbcType=VARCHAR},
OtherField4 = #{otherfield4,jdbcType=VARCHAR}, tenant_id = #{tenantId,jdbcType=BIGINT},
</if> delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
<if test="otherfield5 != null"> where Id = #{id,jdbcType=BIGINT}
OtherField5 = #{otherfield5,jdbcType=VARCHAR}, </update>
</if>
<if test="mtype != null">
MType = #{mtype,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.DepotItem">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_depotitem
set HeaderId = #{headerid,jdbcType=BIGINT},
MaterialId = #{materialid,jdbcType=BIGINT},
MUnit = #{munit,jdbcType=VARCHAR},
OperNumber = #{opernumber,jdbcType=DECIMAL},
BasicNumber = #{basicnumber,jdbcType=DECIMAL},
UnitPrice = #{unitprice,jdbcType=DECIMAL},
TaxUnitPrice = #{taxunitprice,jdbcType=DECIMAL},
AllPrice = #{allprice,jdbcType=DECIMAL},
Remark = #{remark,jdbcType=VARCHAR},
Img = #{img,jdbcType=VARCHAR},
Incidentals = #{incidentals,jdbcType=DECIMAL},
DepotId = #{depotid,jdbcType=BIGINT},
AnotherDepotId = #{anotherdepotid,jdbcType=BIGINT},
TaxRate = #{taxrate,jdbcType=DECIMAL},
TaxMoney = #{taxmoney,jdbcType=DECIMAL},
TaxLastMoney = #{taxlastmoney,jdbcType=DECIMAL},
OtherField1 = #{otherfield1,jdbcType=VARCHAR},
OtherField2 = #{otherfield2,jdbcType=VARCHAR},
OtherField3 = #{otherfield3,jdbcType=VARCHAR},
OtherField4 = #{otherfield4,jdbcType=VARCHAR},
OtherField5 = #{otherfield5,jdbcType=VARCHAR},
MType = #{mtype,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
where Id = #{id,jdbcType=BIGINT}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<result column="AnotherDepotName" jdbcType="VARCHAR" property="AnotherDepotName" /> <result column="AnotherDepotName" jdbcType="VARCHAR" property="AnotherDepotName" />
<result column="UnitId" jdbcType="BIGINT" property="UnitId" /> <result column="UnitId" jdbcType="BIGINT" property="UnitId" />
<result column="UName" jdbcType="VARCHAR" property="UName" /> <result column="UName" jdbcType="VARCHAR" property="UName" />
<result column="barCode" jdbcType="VARCHAR" property="barCode" />
</resultMap> </resultMap>
<resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultByMaterial" type="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx"> <resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultByMaterial" type="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
...@@ -134,9 +135,10 @@ ...@@ -134,9 +135,10 @@
<select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap"> <select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
select di.*,m.Name MName,m.Model MModel,m.Unit MaterialUnit,m.Color MColor,m.Standard MStandard,m.Mfrs MMfrs, select di.*,m.Name MName,m.Model MModel,m.Unit MaterialUnit,m.Color MColor,m.Standard MStandard,m.Mfrs MMfrs,
m.OtherField1 MOtherField1,m.OtherField2 MOtherField2,m.OtherField3 MOtherField3, m.OtherField1 MOtherField1,m.OtherField2 MOtherField2,m.OtherField3 MOtherField3,
dp1.name DepotName,dp2.name AnotherDepotName, u.id UnitId, u.UName dp1.name DepotName,dp2.name AnotherDepotName, u.id UnitId, u.UName, me.bar_code barCode
from jsh_depotitem di from jsh_depotitem di
left join jsh_material m on di.MaterialId=m.id and ifnull(m.delete_Flag,'0') !='1' left join jsh_material m on di.MaterialId=m.id and ifnull(m.delete_Flag,'0') !='1'
left join jsh_material_extend me on me.id=di.material_extend_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1' left join jsh_unit u on m.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1'
left join jsh_depot dp1 on di.DepotId=dp1.id and ifnull(dp1.delete_Flag,'0') !='1' left join jsh_depot dp1 on di.DepotId=dp1.id and ifnull(dp1.delete_Flag,'0') !='1'
left join jsh_depot dp2 on di.AnotherDepotId=dp2.id and ifnull(dp2.delete_Flag,'0') !='1' left join jsh_depot dp2 on di.AnotherDepotId=dp2.id and ifnull(dp2.delete_Flag,'0') !='1'
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jsh.erp.datasource.mappers.MaterialExtendMapper">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.MaterialExtend">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="material_id" jdbcType="BIGINT" property="materialId" />
<result column="bar_code" jdbcType="VARCHAR" property="barCode" />
<result column="commodity_unit" jdbcType="VARCHAR" property="commodityUnit" />
<result column="purchase_decimal" jdbcType="DECIMAL" property="purchaseDecimal" />
<result column="commodity_decimal" jdbcType="DECIMAL" property="commodityDecimal" />
<result column="wholesale_decimal" jdbcType="DECIMAL" property="wholesaleDecimal" />
<result column="low_decimal" jdbcType="DECIMAL" property="lowDecimal" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_serial" jdbcType="VARCHAR" property="createSerial" />
<result column="update_serial" jdbcType="VARCHAR" property="updateSerial" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, material_id, bar_code, commodity_unit, purchase_decimal, commodity_decimal, wholesale_decimal,
low_decimal, create_time, create_serial, update_serial, update_time, tenant_id, delete_Flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from jsh_material_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from jsh_material_extend
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from jsh_material_extend
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample">
delete from jsh_material_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
insert into jsh_material_extend (id, material_id, bar_code,
commodity_unit, purchase_decimal, commodity_decimal,
wholesale_decimal, low_decimal, create_time,
create_serial, update_serial, update_time,
tenant_id, delete_Flag)
values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{barCode,jdbcType=VARCHAR},
#{commodityUnit,jdbcType=VARCHAR}, #{purchaseDecimal,jdbcType=DECIMAL}, #{commodityDecimal,jdbcType=DECIMAL},
#{wholesaleDecimal,jdbcType=DECIMAL}, #{lowDecimal,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP},
#{createSerial,jdbcType=VARCHAR}, #{updateSerial,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
insert into jsh_material_extend
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="materialId != null">
material_id,
</if>
<if test="barCode != null">
bar_code,
</if>
<if test="commodityUnit != null">
commodity_unit,
</if>
<if test="purchaseDecimal != null">
purchase_decimal,
</if>
<if test="commodityDecimal != null">
commodity_decimal,
</if>
<if test="wholesaleDecimal != null">
wholesale_decimal,
</if>
<if test="lowDecimal != null">
low_decimal,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createSerial != null">
create_serial,
</if>
<if test="updateSerial != null">
update_serial,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="tenantId != null">
tenant_id,
</if>
<if test="deleteFlag != null">
delete_Flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="materialId != null">
#{materialId,jdbcType=BIGINT},
</if>
<if test="barCode != null">
#{barCode,jdbcType=VARCHAR},
</if>
<if test="commodityUnit != null">
#{commodityUnit,jdbcType=VARCHAR},
</if>
<if test="purchaseDecimal != null">
#{purchaseDecimal,jdbcType=DECIMAL},
</if>
<if test="commodityDecimal != null">
#{commodityDecimal,jdbcType=DECIMAL},
</if>
<if test="wholesaleDecimal != null">
#{wholesaleDecimal,jdbcType=DECIMAL},
</if>
<if test="lowDecimal != null">
#{lowDecimal,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createSerial != null">
#{createSerial,jdbcType=VARCHAR},
</if>
<if test="updateSerial != null">
#{updateSerial,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample" resultType="java.lang.Long">
select count(*) from jsh_material_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update jsh_material_extend
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.materialId != null">
material_id = #{record.materialId,jdbcType=BIGINT},
</if>
<if test="record.barCode != null">
bar_code = #{record.barCode,jdbcType=VARCHAR},
</if>
<if test="record.commodityUnit != null">
commodity_unit = #{record.commodityUnit,jdbcType=VARCHAR},
</if>
<if test="record.purchaseDecimal != null">
purchase_decimal = #{record.purchaseDecimal,jdbcType=DECIMAL},
</if>
<if test="record.commodityDecimal != null">
commodity_decimal = #{record.commodityDecimal,jdbcType=DECIMAL},
</if>
<if test="record.wholesaleDecimal != null">
wholesale_decimal = #{record.wholesaleDecimal,jdbcType=DECIMAL},
</if>
<if test="record.lowDecimal != null">
low_decimal = #{record.lowDecimal,jdbcType=DECIMAL},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.createSerial != null">
create_serial = #{record.createSerial,jdbcType=VARCHAR},
</if>
<if test="record.updateSerial != null">
update_serial = #{record.updateSerial,jdbcType=VARCHAR},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
<if test="record.deleteFlag != null">
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update jsh_material_extend
set id = #{record.id,jdbcType=BIGINT},
material_id = #{record.materialId,jdbcType=BIGINT},
bar_code = #{record.barCode,jdbcType=VARCHAR},
commodity_unit = #{record.commodityUnit,jdbcType=VARCHAR},
purchase_decimal = #{record.purchaseDecimal,jdbcType=DECIMAL},
commodity_decimal = #{record.commodityDecimal,jdbcType=DECIMAL},
wholesale_decimal = #{record.wholesaleDecimal,jdbcType=DECIMAL},
low_decimal = #{record.lowDecimal,jdbcType=DECIMAL},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
create_serial = #{record.createSerial,jdbcType=VARCHAR},
update_serial = #{record.updateSerial,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=BIGINT},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
update jsh_material_extend
<set>
<if test="materialId != null">
material_id = #{materialId,jdbcType=BIGINT},
</if>
<if test="barCode != null">
bar_code = #{barCode,jdbcType=VARCHAR},
</if>
<if test="commodityUnit != null">
commodity_unit = #{commodityUnit,jdbcType=VARCHAR},
</if>
<if test="purchaseDecimal != null">
purchase_decimal = #{purchaseDecimal,jdbcType=DECIMAL},
</if>
<if test="commodityDecimal != null">
commodity_decimal = #{commodityDecimal,jdbcType=DECIMAL},
</if>
<if test="wholesaleDecimal != null">
wholesale_decimal = #{wholesaleDecimal,jdbcType=DECIMAL},
</if>
<if test="lowDecimal != null">
low_decimal = #{lowDecimal,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createSerial != null">
create_serial = #{createSerial,jdbcType=VARCHAR},
</if>
<if test="updateSerial != null">
update_serial = #{updateSerial,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
update jsh_material_extend
set material_id = #{materialId,jdbcType=BIGINT},
bar_code = #{barCode,jdbcType=VARCHAR},
commodity_unit = #{commodityUnit,jdbcType=VARCHAR},
purchase_decimal = #{purchaseDecimal,jdbcType=DECIMAL},
commodity_decimal = #{commodityDecimal,jdbcType=DECIMAL},
wholesale_decimal = #{wholesaleDecimal,jdbcType=DECIMAL},
low_decimal = #{lowDecimal,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_serial = #{createSerial,jdbcType=VARCHAR},
update_serial = #{updateSerial,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=BIGINT},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.jsh.erp.datasource.mappers.MaterialExtendMapperEx" >
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialExtendMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.vo.MaterialExtendVo4List">
</resultMap>
<select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample" resultMap="ResultMapList">
select DISTINCT d.Id,d.bar_code,d.commodity_unit,d.commodity_decimal,d.purchase_decimal,d.wholesale_decimal,d.low_decimal
from jsh_material_extend d
where d.material_id = '${materialId}'
and ifnull(d.delete_Flag,'0') !='1'
order by d.id asc
</select>
<select id="getMaxTimeByTenantAndTime" resultType="java.lang.Long">
select max(update_time) from
(
select update_time from jsh_material_extend
where 1=1
<if test="lastTime != null">
and update_time > ${lastTime}
</if>
order by update_time asc
<if test="syncNum != null">
limit 0,#{syncNum}
</if>
) time_list
</select>
<select id="getListByMId" resultType="com.jsh.erp.datasource.entities.MaterialExtend">
select
<include refid="com.jsh.erp.datasource.mappers.MaterialExtendMapper.Base_Column_List" />
from jsh_material_extend
where 1=1
and material_id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
group by material_id
</select>
<update id="batchDeleteMaterialExtendByIds">
update jsh_material_extend
set delete_Flag='1'
where 1=1
and ifnull(delete_Flag,'0') !='1'
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.entities.MaterialVo4Unit"> <resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
<result column="unitName" jdbcType="VARCHAR" property="unitName" /> <result column="unitName" jdbcType="VARCHAR" property="unitName" />
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" /> <result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
<result column="m_bar_code" jdbcType="VARCHAR" property="mBarCode" />
</resultMap> </resultMap>
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit"> <resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
...@@ -19,6 +20,9 @@ ...@@ -19,6 +20,9 @@
<if test="name != null"> <if test="name != null">
and m.name like '%${name}%' and m.name like '%${name}%'
</if> </if>
<if test="standard != null">
and m.Standard like '%${standard}%'
</if>
<if test="model != null"> <if test="model != null">
and m.model like '%${model}%' and m.model like '%${model}%'
</if> </if>
...@@ -42,6 +46,9 @@ ...@@ -42,6 +46,9 @@
<if test="name != null"> <if test="name != null">
and m.name like '%${name}%' and m.name like '%${name}%'
</if> </if>
<if test="standard != null">
and m.Standard like '%${standard}%'
</if>
<if test="model != null"> <if test="model != null">
and m.model like '%${model}%' and m.model like '%${model}%'
</if> </if>
...@@ -65,6 +72,14 @@ ...@@ -65,6 +72,14 @@
and ifnull(m.delete_Flag,'0') !='1' and ifnull(m.delete_Flag,'0') !='1'
</select> </select>
<select id="findByIdWithBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
select m.*,u.UName,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_decimal from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
where me.id = ${meId}
and ifnull(m.delete_Flag,'0') !='1'
</select>
<select id="findBySelect" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap"> <select id="findBySelect" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
select m.*,u.UName from jsh_material m select m.*,u.UName from jsh_material m
left join jsh_unit u on m.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1' left join jsh_unit u on m.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
...@@ -73,6 +88,32 @@ ...@@ -73,6 +88,32 @@
ORDER BY Id desc ORDER BY Id desc
</select> </select>
<select id="findBySelectWithBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
select m.*,u.UName,me.bar_code m_bar_code,me.id meId,me.commodity_unit from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
where m.enabled=1 and me.id is not null
<if test="q != null">
and (m.name like '%${q}%' or me.bar_code like '%${q}%')
</if>
and ifnull(m.delete_Flag,'0') !='1'
ORDER BY Id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="findBySelectWithBarCodeCount" resultType="java.lang.Integer">
select count(1) from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
where m.enabled=1 and me.id is not null
<if test="q != null">
and (m.name like '%${q}%' or me.bar_code like '%${q}%')
</if>
and ifnull(m.delete_Flag,'0') !='1'
</select>
<update id="updatePriceNullByPrimaryKey" parameterType="java.lang.Long"> <update id="updatePriceNullByPrimaryKey" parameterType="java.lang.Long">
update jsh_material update jsh_material
set set
...@@ -174,168 +215,21 @@ ...@@ -174,168 +215,21 @@
and ifnull(delete_Flag,'0') !='1' and ifnull(delete_Flag,'0') !='1'
</select> </select>
<insert id="insertSelectiveEx" parameterType="com.jsh.erp.datasource.entities.Material" <select id="getMaxBarCode" resultType="java.lang.String">
useGeneratedKeys="true" keyProperty="id" keyColumn="id"> select max(CAST(l.bar_code AS SIGNED)) bar_code from jsh_material_extend l
insert into jsh_material </select>
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <select id="getMaterialByMeId" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
Id, select m.*,me.bar_code m_bar_code,u.uname unitName, mc.name categoryName, org.org_abr
</if> FROM jsh_material m
<if test="categoryid != null"> left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
CategoryId, left JOIN jsh_unit u on m.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1'
</if> left JOIN jsh_materialcategory mc on m.CategoryId = mc.id and ifnull(mc.status,'0') !='2'
<if test="name != null"> left join jsh_organization org on m.orga_id = org.id
Name, where 1=1
</if> <if test="meId != null">
<if test="mfrs != null"> and me.id = ${meId}
Mfrs, </if>
</if> and ifnull(m.delete_Flag,'0') !='1'
<if test="packing != null"> </select>
Packing,
</if>
<if test="safetystock != null">
SafetyStock,
</if>
<if test="model != null">
Model,
</if>
<if test="standard != null">
Standard,
</if>
<if test="color != null">
Color,
</if>
<if test="unit != null">
Unit,
</if>
<if test="remark != null">
Remark,
</if>
<if test="retailprice != null">
RetailPrice,
</if>
<if test="lowprice != null">
LowPrice,
</if>
<if test="presetpriceone != null">
PresetPriceOne,
</if>
<if test="presetpricetwo != null">
PresetPriceTwo,
</if>
<if test="unitid != null">
UnitId,
</if>
<if test="firstoutunit != null">
FirstOutUnit,
</if>
<if test="firstinunit != null">
FirstInUnit,
</if>
<if test="pricestrategy != null">
PriceStrategy,
</if>
<if test="enabled != null">
Enabled,
</if>
<if test="otherfield1 != null">
OtherField1,
</if>
<if test="otherfield2 != null">
OtherField2,
</if>
<if test="otherfield3 != null">
OtherField3,
</if>
<if test="enableserialnumber != null">
enableSerialNumber,
</if>
<if test="tenantId != null">
tenant_id,
</if>
<if test="deleteFlag != null">
delete_Flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="categoryid != null">
#{categoryid,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="mfrs != null">
#{mfrs,jdbcType=VARCHAR},
</if>
<if test="packing != null">
#{packing,jdbcType=DECIMAL},
</if>
<if test="safetystock != null">
#{safetystock,jdbcType=DECIMAL},
</if>
<if test="model != null">
#{model,jdbcType=VARCHAR},
</if>
<if test="standard != null">
#{standard,jdbcType=VARCHAR},
</if>
<if test="color != null">
#{color,jdbcType=VARCHAR},
</if>
<if test="unit != null">
#{unit,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="retailprice != null">
#{retailprice,jdbcType=DECIMAL},
</if>
<if test="lowprice != null">
#{lowprice,jdbcType=DECIMAL},
</if>
<if test="presetpriceone != null">
#{presetpriceone,jdbcType=DECIMAL},
</if>
<if test="presetpricetwo != null">
#{presetpricetwo,jdbcType=DECIMAL},
</if>
<if test="unitid != null">
#{unitid,jdbcType=BIGINT},
</if>
<if test="firstoutunit != null">
#{firstoutunit,jdbcType=VARCHAR},
</if>
<if test="firstinunit != null">
#{firstinunit,jdbcType=VARCHAR},
</if>
<if test="pricestrategy != null">
#{pricestrategy,jdbcType=VARCHAR},
</if>
<if test="enabled != null">
#{enabled,jdbcType=BIT},
</if>
<if test="otherfield1 != null">
#{otherfield1,jdbcType=VARCHAR},
</if>
<if test="otherfield2 != null">
#{otherfield2,jdbcType=VARCHAR},
</if>
<if test="otherfield3 != null">
#{otherfield3,jdbcType=VARCHAR},
</if>
<if test="enableserialnumber != null">
#{enableserialnumber,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
<table tableName="jsh_inoutitem" domainObjectName="InOutItem"></table> <table tableName="jsh_inoutitem" domainObjectName="InOutItem"></table>
<table tableName="jsh_log" domainObjectName="Log"></table> <table tableName="jsh_log" domainObjectName="Log"></table>
<table tableName="jsh_material" domainObjectName="Material"></table> <table tableName="jsh_material" domainObjectName="Material"></table>
<table tableName="jsh_material_extend" domainObjectName="MaterialExtend"></table>
<table tableName="jsh_material_stock" domainObjectName="MaterialStock"></table> <table tableName="jsh_material_stock" domainObjectName="MaterialStock"></table>
<table tableName="jsh_materialcategory" domainObjectName="MaterialCategory"></table> <table tableName="jsh_materialcategory" domainObjectName="MaterialCategory"></table>
<table tableName="jsh_materialproperty" domainObjectName="MaterialProperty"></table> <table tableName="jsh_materialproperty" domainObjectName="MaterialProperty"></table>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment