Commit b8fb7c7a authored by 神话's avatar 神话
Browse files

给商品查询增加查询条件接口

parent dd2f7197
......@@ -23,6 +23,12 @@ public interface MaterialMapperEx {
@Param("name") String name,
@Param("standard") String standard,
@Param("model") String model,
@Param("color") String color,
@Param("weight") String weight,
@Param("expiryNum") String expiryNum,
@Param("enableSerialNumber") String enableSerialNumber,
@Param("enableBatchNumber") String enableBatchNumber,
@Param("remark") String remark,
@Param("idList") List<Long> idList,
@Param("mpList") String mpList,
@Param("offset") Integer offset,
......@@ -33,6 +39,12 @@ public interface MaterialMapperEx {
@Param("name") String name,
@Param("standard") String standard,
@Param("model") String model,
@Param("color") String color,
@Param("weight") String weight,
@Param("expiryNum") String expiryNum,
@Param("enableSerialNumber") String enableSerialNumber,
@Param("enableBatchNumber") String enableBatchNumber,
@Param("remark") String remark,
@Param("idList") List<Long> idList,
@Param("mpList") String mpList);
......
......@@ -38,8 +38,15 @@ public class MaterialComponent implements ICommonQuery {
String name = StringUtil.getInfo(search, "name");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model");
String color = StringUtil.getInfo(search, "color");
String weight = StringUtil.getInfo(search, "weight");
String expiryNum = StringUtil.getInfo(search, "expiryNum");
String enableSerialNumber = StringUtil.getInfo(search, "enableSerialNumber");
String enableBatchNumber = StringUtil.getInfo(search, "enableBatchNumber");
String remark = StringUtil.getInfo(search, "remark");
String mpList = StringUtil.getInfo(search, "mpList");
return materialService.select(barCode, name, standard, model,categoryId,mpList, QueryUtils.offset(map), QueryUtils.rows(map));
return materialService.select(barCode, name, standard, model, color, weight, expiryNum,
enableSerialNumber, enableBatchNumber, remark, categoryId, mpList, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
......@@ -50,8 +57,15 @@ public class MaterialComponent implements ICommonQuery {
String name = StringUtil.getInfo(search, "name");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model");
String color = StringUtil.getInfo(search, "color");
String weight = StringUtil.getInfo(search, "weight");
String expiryNum = StringUtil.getInfo(search, "expiryNum");
String enableSerialNumber = StringUtil.getInfo(search, "enableSerialNumber");
String enableBatchNumber = StringUtil.getInfo(search, "enableBatchNumber");
String remark = StringUtil.getInfo(search, "remark");
String mpList = StringUtil.getInfo(search, "mpList");
return materialService.countMaterial(barCode, name, standard, model,categoryId,mpList);
return materialService.countMaterial(barCode, name, standard, model, color, weight, expiryNum,
enableSerialNumber, enableBatchNumber, remark, categoryId, mpList);
}
@Override
......
......@@ -106,7 +106,9 @@ public class MaterialService {
return list;
}
public List<MaterialVo4Unit> select(String barCode, String name, String standard, String model, String categoryId,String mpList, int offset, int rows)
public List<MaterialVo4Unit> select(String barCode, String name, String standard, String model, String color,
String weight, String expiryNum, String enableSerialNumber, String enableBatchNumber,
String remark, String categoryId, String mpList, int offset, int rows)
throws Exception{
String[] mpArr = new String[]{};
if(StringUtil.isNotEmpty(mpList)){
......@@ -119,7 +121,8 @@ public class MaterialService {
if(StringUtil.isNotEmpty(categoryId)){
idList = getListByParentId(Long.parseLong(categoryId));
}
list= materialMapperEx.selectByConditionMaterial(barCode, name, standard, model, idList, mpList, offset, rows);
list= materialMapperEx.selectByConditionMaterial(barCode, name, standard, model, color, weight, expiryNum,
enableSerialNumber, enableBatchNumber, remark, idList, mpList, offset, rows);
if (null != list) {
for (MaterialVo4Unit m : list) {
//扩展信息
......@@ -149,14 +152,17 @@ public class MaterialService {
return resList;
}
public Long countMaterial(String barCode, String name, String standard, String model, String categoryId,String mpList)throws Exception {
public Long countMaterial(String barCode, String name, String standard, String model, String color,
String weight, String expiryNum, String enableSerialNumber, String enableBatchNumber,
String remark, String categoryId,String mpList)throws Exception {
Long result =null;
try{
List<Long> idList = new ArrayList<>();
if(StringUtil.isNotEmpty(categoryId)){
idList = getListByParentId(Long.parseLong(categoryId));
}
result= materialMapperEx.countsByMaterial(barCode, name, standard, model, idList, mpList);
result= materialMapperEx.countsByMaterial(barCode, name, standard, model, color, weight, expiryNum,
enableSerialNumber, enableBatchNumber, remark, idList, mpList);
}catch(Exception e){
JshException.readFail(logger, e);
}
......
......@@ -39,22 +39,42 @@
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
<if test="barCode != null">
<if test="barCode != null and barCode !=''">
<bind name="bindBarCode" value="'%'+barCode+'%'"/>
and me.bar_code like #{bindBarCode}
</if>
<if test="name != null">
<if test="name != null and name !=''">
<bind name="bindName" value="'%'+name+'%'"/>
and m.name like #{bindName}
</if>
<if test="standard != null">
<if test="standard != null and standard !=''">
<bind name="bindStandard" value="'%'+standard+'%'"/>
and m.standard like #{bindStandard}
</if>
<if test="model != null">
<if test="model != null and model !=''">
<bind name="bindModel" value="'%'+model+'%'"/>
and m.model like #{bindModel}
</if>
<if test="color != null and color !=''">
<bind name="bindColor" value="'%'+color+'%'"/>
and m.color like #{bindColor}
</if>
<if test="weight != null and weight !=''">
and m.weight = #{weight}
</if>
<if test="expiryNum != null and expiryNum !=''">
and m.expiry_num = #{expiryNum}
</if>
<if test="enableSerialNumber != null and enableSerialNumber !=''">
and m.enable_serial_number = #{enableSerialNumber}
</if>
<if test="enableBatchNumber != null and enableBatchNumber !=''">
and m.enable_batch_number = #{enableBatchNumber}
</if>
<if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/>
and m.remark like #{bindRemark}
</if>
<if test="idList.size()>0">
and m.category_id in
<foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
......@@ -77,22 +97,42 @@
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
WHERE 1=1
and me.default_flag=1
<if test="barCode != null">
<if test="barCode != null and barCode !=''">
<bind name="bindBarCode" value="'%'+barCode+'%'"/>
and me.bar_code like #{bindBarCode}
</if>
<if test="name != null">
<if test="name != null and name !=''">
<bind name="bindName" value="'%'+name+'%'"/>
and m.name like #{bindName}
</if>
<if test="standard != null">
<if test="standard != null and standard !=''">
<bind name="bindStandard" value="'%'+standard+'%'"/>
and m.standard like #{bindStandard}
</if>
<if test="model != null">
<if test="model != null and model !=''">
<bind name="bindModel" value="'%'+model+'%'"/>
and m.model like #{bindModel}
</if>
<if test="color != null and color !=''">
<bind name="bindColor" value="'%'+color+'%'"/>
and m.color like #{bindColor}
</if>
<if test="weight != null and weight !=''">
and m.weight = #{weight}
</if>
<if test="expiryNum != null and expiryNum !=''">
and m.expiry_num = #{expiryNum}
</if>
<if test="enableSerialNumber != null and enableSerialNumber !=''">
and m.enable_serial_number = #{enableSerialNumber}
</if>
<if test="enableBatchNumber != null and enableBatchNumber !=''">
and m.enable_batch_number = #{enableBatchNumber}
</if>
<if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/>
and m.remark like #{bindRemark}
</if>
<if test="idList.size()>0">
and m.category_id in
<foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
......
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