优化商品导出excel的功能

This commit is contained in:
神话
2022-05-03 16:30:41 +08:00
parent ccec596c93
commit 15743a2952
4 changed files with 44 additions and 7 deletions

View File

@@ -308,6 +308,12 @@ public class MaterialController {
@RequestParam("name") String name, @RequestParam("name") String name,
@RequestParam("standard") String standard, @RequestParam("standard") String standard,
@RequestParam("model") String model, @RequestParam("model") String model,
@RequestParam("color") String color,
@RequestParam("weight") String weight,
@RequestParam("expiryNum") String expiryNum,
@RequestParam("enableSerialNumber") String enableSerialNumber,
@RequestParam("enableBatchNumber") String enableBatchNumber,
@RequestParam("remark") String remark,
@RequestParam("mpList") String mpList, @RequestParam("mpList") String mpList,
HttpServletRequest request, HttpServletResponse response) { HttpServletRequest request, HttpServletResponse response) {
try { try {
@@ -316,7 +322,9 @@ public class MaterialController {
mpArr= mpList.split(","); mpArr= mpList.split(",");
} }
List<MaterialVo4Unit> dataList = materialService.findByAll(StringUtil.toNull(barCode), StringUtil.toNull(name), List<MaterialVo4Unit> dataList = materialService.findByAll(StringUtil.toNull(barCode), StringUtil.toNull(name),
StringUtil.toNull(standard), StringUtil.toNull(model), StringUtil.toNull(categoryId)); StringUtil.toNull(standard), StringUtil.toNull(model), StringUtil.toNull(color), StringUtil.toNull(weight),
StringUtil.toNull(expiryNum), StringUtil.toNull(enableSerialNumber), StringUtil.toNull(enableBatchNumber),
StringUtil.toNull(remark), StringUtil.toNull(categoryId));
String[] names = {"条码", "名称", "规格", "型号", "颜色", "类别", "扩展信息", "单位", "基础重量", "保质期", "采购价", "销售价", "零售价", "最低售价", "备注", "状态", "序列号", "批号"}; String[] names = {"条码", "名称", "规格", "型号", "颜色", "类别", "扩展信息", "单位", "基础重量", "保质期", "采购价", "销售价", "零售价", "最低售价", "备注", "状态", "序列号", "批号"};
String title = "商品信息"; String title = "商品信息";
List<String[]> objects = new ArrayList<>(); List<String[]> objects = new ArrayList<>();

View File

@@ -67,6 +67,12 @@ public interface MaterialMapperEx {
@Param("name") String name, @Param("name") String name,
@Param("standard") String standard, @Param("standard") String standard,
@Param("model") String model, @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("idList") List<Long> idList);
/** /**
* 通过商品名称查询商品信息 * 通过商品名称查询商品信息

View File

@@ -432,7 +432,9 @@ public class MaterialService {
return result; return result;
} }
public List<MaterialVo4Unit> findByAll(String barCode, String name, String standard, String model, String categoryId)throws Exception { public List<MaterialVo4Unit> findByAll(String barCode, String name, String standard, String model, String color,
String weight, String expiryNum, String enableSerialNumber, String enableBatchNumber,
String remark, String categoryId)throws Exception {
List<MaterialVo4Unit> resList = new ArrayList<>(); List<MaterialVo4Unit> resList = new ArrayList<>();
List<MaterialVo4Unit> list =null; List<MaterialVo4Unit> list =null;
try{ try{
@@ -440,7 +442,8 @@ public class MaterialService {
if(StringUtil.isNotEmpty(categoryId)){ if(StringUtil.isNotEmpty(categoryId)){
idList = getListByParentId(Long.parseLong(categoryId)); idList = getListByParentId(Long.parseLong(categoryId));
} }
list= materialMapperEx.findByAll(barCode, name, standard, model, idList); list= materialMapperEx.findByAll(barCode, name, standard, model, color, weight, expiryNum,
enableSerialNumber, enableBatchNumber, remark, idList);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }

View File

@@ -216,22 +216,42 @@
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1' left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1 where 1=1
and me.default_flag=1 and me.default_flag=1
<if test="barCode != null"> <if test="barCode != null and barCode !=''">
<bind name="bindBarCode" value="'%'+barCode+'%'"/> <bind name="bindBarCode" value="'%'+barCode+'%'"/>
and me.bar_code like #{bindBarCode} and me.bar_code like #{bindBarCode}
</if> </if>
<if test="name != null"> <if test="name != null and name !=''">
<bind name="bindName" value="'%'+name+'%'"/> <bind name="bindName" value="'%'+name+'%'"/>
and m.name like #{bindName} and m.name like #{bindName}
</if> </if>
<if test="standard != null"> <if test="standard != null and standard !=''">
<bind name="bindStandard" value="'%'+standard+'%'"/> <bind name="bindStandard" value="'%'+standard+'%'"/>
and m.standard like #{bindStandard} and m.standard like #{bindStandard}
</if> </if>
<if test="model != null"> <if test="model != null and model !=''">
<bind name="bindModel" value="'%'+standard+'%'"/> <bind name="bindModel" value="'%'+standard+'%'"/>
and m.model like #{bindModel} and m.model like #{bindModel}
</if> </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"> <if test="idList.size()>0">
and m.category_id in and m.category_id in
<foreach collection="idList" item="item" index="index" separator="," open="(" close=")"> <foreach collection="idList" item="item" index="index" separator="," open="(" close=")">