给商品接口增加规格、型号、品牌、制造商参数

This commit is contained in:
jishenghua 2024-09-30 00:13:10 +08:00
parent 33dbe7c3b9
commit 0b6306e3a9
4 changed files with 63 additions and 15 deletions

View File

@ -19,7 +19,11 @@ public interface MaterialMapperEx {
List<MaterialVo4Unit> selectByConditionMaterial( List<MaterialVo4Unit> selectByConditionMaterial(
@Param("materialParam") String materialParam, @Param("materialParam") String materialParam,
@Param("standard") String standard,
@Param("model") String model,
@Param("color") String color, @Param("color") String color,
@Param("brand") String brand,
@Param("mfrs") String mfrs,
@Param("materialOther") String materialOther, @Param("materialOther") String materialOther,
@Param("weight") String weight, @Param("weight") String weight,
@Param("expiryNum") String expiryNum, @Param("expiryNum") String expiryNum,
@ -35,7 +39,11 @@ public interface MaterialMapperEx {
Long countsByMaterial( Long countsByMaterial(
@Param("materialParam") String materialParam, @Param("materialParam") String materialParam,
@Param("standard") String standard,
@Param("model") String model,
@Param("color") String color, @Param("color") String color,
@Param("brand") String brand,
@Param("mfrs") String mfrs,
@Param("materialOther") String materialOther, @Param("materialOther") String materialOther,
@Param("weight") String weight, @Param("weight") String weight,
@Param("expiryNum") String expiryNum, @Param("expiryNum") String expiryNum,

View File

@ -35,7 +35,11 @@ public class MaterialComponent implements ICommonQuery {
String search = map.get(Constants.SEARCH); String search = map.get(Constants.SEARCH);
String categoryId = StringUtil.getInfo(search, "categoryId"); String categoryId = StringUtil.getInfo(search, "categoryId");
String materialParam = StringUtil.getInfo(search, "materialParam"); String materialParam = StringUtil.getInfo(search, "materialParam");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model");
String color = StringUtil.getInfo(search, "color"); String color = StringUtil.getInfo(search, "color");
String brand = StringUtil.getInfo(search, "brand");
String mfrs = StringUtil.getInfo(search, "mfrs");
String materialOther = StringUtil.getInfo(search, "materialOther"); String materialOther = StringUtil.getInfo(search, "materialOther");
String weight = StringUtil.getInfo(search, "weight"); String weight = StringUtil.getInfo(search, "weight");
String expiryNum = StringUtil.getInfo(search, "expiryNum"); String expiryNum = StringUtil.getInfo(search, "expiryNum");
@ -45,7 +49,7 @@ public class MaterialComponent implements ICommonQuery {
String enabled = StringUtil.getInfo(search, "enabled"); String enabled = StringUtil.getInfo(search, "enabled");
String remark = StringUtil.getInfo(search, "remark"); String remark = StringUtil.getInfo(search, "remark");
String mpList = StringUtil.getInfo(search, "mpList"); String mpList = StringUtil.getInfo(search, "mpList");
return materialService.select(materialParam, color, materialOther, weight, expiryNum, return materialService.select(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList, QueryUtils.offset(map), QueryUtils.rows(map)); enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList, QueryUtils.offset(map), QueryUtils.rows(map));
} }
@ -54,7 +58,11 @@ public class MaterialComponent implements ICommonQuery {
String search = map.get(Constants.SEARCH); String search = map.get(Constants.SEARCH);
String categoryId = StringUtil.getInfo(search, "categoryId"); String categoryId = StringUtil.getInfo(search, "categoryId");
String materialParam = StringUtil.getInfo(search, "materialParam"); String materialParam = StringUtil.getInfo(search, "materialParam");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model");
String color = StringUtil.getInfo(search, "color"); String color = StringUtil.getInfo(search, "color");
String brand = StringUtil.getInfo(search, "brand");
String mfrs = StringUtil.getInfo(search, "mfrs");
String materialOther = StringUtil.getInfo(search, "materialOther"); String materialOther = StringUtil.getInfo(search, "materialOther");
String weight = StringUtil.getInfo(search, "weight"); String weight = StringUtil.getInfo(search, "weight");
String expiryNum = StringUtil.getInfo(search, "expiryNum"); String expiryNum = StringUtil.getInfo(search, "expiryNum");
@ -64,7 +72,7 @@ public class MaterialComponent implements ICommonQuery {
String enabled = StringUtil.getInfo(search, "enabled"); String enabled = StringUtil.getInfo(search, "enabled");
String remark = StringUtil.getInfo(search, "remark"); String remark = StringUtil.getInfo(search, "remark");
String mpList = StringUtil.getInfo(search, "mpList"); String mpList = StringUtil.getInfo(search, "mpList");
return materialService.countMaterial(materialParam, color, materialOther, weight, expiryNum, return materialService.countMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList); enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList);
} }

View File

@ -115,9 +115,10 @@ public class MaterialService {
return list; return list;
} }
public List<MaterialVo4Unit> select(String materialParam, String color, String materialOther, String weight, String expiryNum, public List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand, String mfrs,
String enableSerialNumber, String enableBatchNumber, String position, String enabled, String materialOther, String weight, String expiryNum, String enableSerialNumber,
String remark, String categoryId, String mpList, int offset, int rows) String enableBatchNumber, String position, String enabled, String remark, String categoryId,
String mpList, int offset, int rows)
throws Exception{ throws Exception{
String[] mpArr = new String[]{}; String[] mpArr = new String[]{};
if(StringUtil.isNotEmpty(mpList)){ if(StringUtil.isNotEmpty(mpList)){
@ -130,7 +131,7 @@ public class MaterialService {
if(StringUtil.isNotEmpty(categoryId)){ if(StringUtil.isNotEmpty(categoryId)){
idList = getListByParentId(Long.parseLong(categoryId)); idList = getListByParentId(Long.parseLong(categoryId));
} }
list= materialMapperEx.selectByConditionMaterial(materialParam, color, materialOther, weight, expiryNum, list= materialMapperEx.selectByConditionMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList, offset, rows); enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList, offset, rows);
if (null != list && list.size()>0) { if (null != list && list.size()>0) {
Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list); Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list);
@ -151,16 +152,17 @@ public class MaterialService {
return resList; return resList;
} }
public Long countMaterial(String materialParam, String color, String materialOther, String weight, String expiryNum, public Long countMaterial(String materialParam, String standard, String model, String color, String brand, String mfrs,
String enableSerialNumber, String enableBatchNumber, String position, String enabled, String materialOther, String weight, String expiryNum, String enableSerialNumber,
String remark, String categoryId,String mpList)throws Exception { String enableBatchNumber, String position, String enabled, String remark, String categoryId,
String mpList)throws Exception {
Long result =null; Long result =null;
try{ try{
List<Long> idList = new ArrayList<>(); List<Long> idList = new ArrayList<>();
if(StringUtil.isNotEmpty(categoryId)){ if(StringUtil.isNotEmpty(categoryId)){
idList = getListByParentId(Long.parseLong(categoryId)); idList = getListByParentId(Long.parseLong(categoryId));
} }
result= materialMapperEx.countsByMaterial(materialParam, color, materialOther, weight, expiryNum, result= materialMapperEx.countsByMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList); enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);

View File

@ -48,16 +48,31 @@
where 1=1 where 1=1
<if test="materialParam != null and materialParam !=''"> <if test="materialParam != null and materialParam !=''">
<bind name="bindKey" value="'%'+materialParam+'%'"/> <bind name="bindKey" value="'%'+materialParam+'%'"/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey} or m.mnemonic like #{bindKey}) and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey})
</if>
<if test="standard != null and standard !=''">
<bind name="bindStandard" value="'%'+standard+'%'"/>
and m.standard like #{bindStandard}
</if>
<if test="model != null and model !=''">
<bind name="bindModel" value="'%'+model+'%'"/>
and m.model like #{bindModel}
</if> </if>
<if test="color != null and color !=''"> <if test="color != null and color !=''">
<bind name="bindColor" value="'%'+color+'%'"/> <bind name="bindColor" value="'%'+color+'%'"/>
and m.color like #{bindColor} and m.color like #{bindColor}
</if> </if>
<if test="brand != null and brand !=''">
<bind name="bindBrand" value="'%'+brand+'%'"/>
and m.brand like #{bindBrand}
</if>
<if test="mfrs != null and mfrs !=''">
<bind name="bindMfrs" value="'%'+mfrs+'%'"/>
and m.mfrs like #{bindMfrs}
</if>
<if test="materialOther != null and materialOther !=''"> <if test="materialOther != null and materialOther !=''">
<bind name="bindOther" value="'%'+materialOther+'%'"/> <bind name="bindOther" value="'%'+materialOther+'%'"/>
and (m.mfrs like #{bindOther} or m.other_field1 like #{bindOther} and (m.other_field1 like #{bindOther} or m.other_field2 like #{bindOther} or m.other_field3 like #{bindOther})
or m.other_field2 like #{bindOther} or m.other_field3 like #{bindOther})
</if> </if>
<if test="weight != null and weight !=''"> <if test="weight != null and weight !=''">
and m.weight = #{weight} and m.weight = #{weight}
@ -109,14 +124,29 @@
<bind name="bindKey" value="'%'+materialParam+'%'"/> <bind name="bindKey" value="'%'+materialParam+'%'"/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey} or m.mnemonic like #{bindKey}) and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey} or m.mnemonic like #{bindKey})
</if> </if>
<if test="standard != null and standard !=''">
<bind name="bindStandard" value="'%'+standard+'%'"/>
and m.standard like #{bindStandard}
</if>
<if test="model != null and model !=''">
<bind name="bindModel" value="'%'+model+'%'"/>
and m.model like #{bindModel}
</if>
<if test="color != null and color !=''"> <if test="color != null and color !=''">
<bind name="bindColor" value="'%'+color+'%'"/> <bind name="bindColor" value="'%'+color+'%'"/>
and m.color like #{bindColor} and m.color like #{bindColor}
</if> </if>
<if test="brand != null and brand !=''">
<bind name="bindBrand" value="'%'+brand+'%'"/>
and m.brand like #{bindBrand}
</if>
<if test="mfrs != null and mfrs !=''">
<bind name="bindMfrs" value="'%'+mfrs+'%'"/>
and m.mfrs like #{bindMfrs}
</if>
<if test="materialOther != null and materialOther !=''"> <if test="materialOther != null and materialOther !=''">
<bind name="bindOther" value="'%'+materialOther+'%'"/> <bind name="bindOther" value="'%'+materialOther+'%'"/>
and (m.mfrs like #{bindOther} or m.other_field1 like #{bindOther} and (m.other_field1 like #{bindOther} or m.other_field2 like #{bindOther} or m.other_field3 like #{bindOther})
or m.other_field2 like #{bindOther} or m.other_field3 like #{bindOther})
</if> </if>
<if test="weight != null and weight !=''"> <if test="weight != null and weight !=''">
and m.weight = #{weight} and m.weight = #{weight}