完善商品查询参数,增加助记码等查询条件
This commit is contained in:
@@ -211,8 +211,12 @@ public class MaterialController {
|
|||||||
@ApiOperation(value = "查找商品信息")
|
@ApiOperation(value = "查找商品信息")
|
||||||
public JSONObject findBySelect(@RequestParam(value = "categoryId", required = false) Long categoryId,
|
public JSONObject findBySelect(@RequestParam(value = "categoryId", required = false) Long categoryId,
|
||||||
@RequestParam(value = "q", required = false) String q,
|
@RequestParam(value = "q", required = false) String q,
|
||||||
|
@RequestParam(value = "standardOrModel", required = false) String standardOrModel,
|
||||||
@RequestParam(value = "mpList", required = false) String mpList,
|
@RequestParam(value = "mpList", required = false) String mpList,
|
||||||
@RequestParam(value = "depotId", required = false) Long depotId,
|
@RequestParam(value = "depotId", required = false) Long depotId,
|
||||||
|
@RequestParam(value = "color", required = false) String color,
|
||||||
|
@RequestParam(value = "brand", required = false) String brand,
|
||||||
|
@RequestParam(value = "mfrs", required = false) String mfrs,
|
||||||
@RequestParam(value = "enableSerialNumber", required = false) String enableSerialNumber,
|
@RequestParam(value = "enableSerialNumber", required = false) String enableSerialNumber,
|
||||||
@RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
|
@RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
|
||||||
@RequestParam("page") Integer currentPage,
|
@RequestParam("page") Integer currentPage,
|
||||||
@@ -224,10 +228,10 @@ public class MaterialController {
|
|||||||
if(StringUtil.isNotEmpty(mpList)){
|
if(StringUtil.isNotEmpty(mpList)){
|
||||||
mpArr= mpList.split(",");
|
mpArr= mpList.split(",");
|
||||||
}
|
}
|
||||||
List<MaterialVo4Unit> dataList = materialService.findBySelectWithBarCode(categoryId, q, enableSerialNumber,
|
List<MaterialVo4Unit> dataList = materialService.findBySelectWithBarCode(categoryId, q, standardOrModel,
|
||||||
enableBatchNumber, (currentPage-1)*pageSize, pageSize);
|
color, brand, mfrs, enableSerialNumber, enableBatchNumber, (currentPage-1)*pageSize, pageSize);
|
||||||
int total = materialService.findBySelectWithBarCodeCount(categoryId, q, enableSerialNumber,
|
int total = materialService.findBySelectWithBarCodeCount(categoryId, q, standardOrModel,
|
||||||
enableBatchNumber);
|
color, brand, mfrs, enableSerialNumber, enableBatchNumber);
|
||||||
object.put("total", total);
|
object.put("total", total);
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
@@ -258,10 +262,13 @@ public class MaterialController {
|
|||||||
}
|
}
|
||||||
item.put("mBarCode", material.getmBarCode());
|
item.put("mBarCode", material.getmBarCode());
|
||||||
item.put("name", material.getName());
|
item.put("name", material.getName());
|
||||||
|
item.put("mnemonic", material.getMnemonic());
|
||||||
item.put("categoryName", material.getCategoryName());
|
item.put("categoryName", material.getCategoryName());
|
||||||
item.put("standard", material.getStandard());
|
item.put("standard", material.getStandard());
|
||||||
item.put("model", material.getModel());
|
item.put("model", material.getModel());
|
||||||
item.put("color", material.getColor());
|
item.put("color", material.getColor());
|
||||||
|
item.put("brand", material.getBrand());
|
||||||
|
item.put("mfrs", material.getMfrs());
|
||||||
item.put("unit", material.getCommodityUnit() + ratioStr);
|
item.put("unit", material.getCommodityUnit() + ratioStr);
|
||||||
item.put("sku", material.getSku());
|
item.put("sku", material.getSku());
|
||||||
item.put("enableSerialNumber", material.getEnableSerialNumber());
|
item.put("enableSerialNumber", material.getEnableSerialNumber());
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ public interface MaterialMapperEx {
|
|||||||
|
|
||||||
List<MaterialVo4Unit> findBySelectWithBarCode(@Param("idList") List<Long> idList,
|
List<MaterialVo4Unit> findBySelectWithBarCode(@Param("idList") List<Long> idList,
|
||||||
@Param("q") String q,
|
@Param("q") String q,
|
||||||
|
@Param("standardOrModel") String standardOrModel,
|
||||||
|
@Param("color") String color,
|
||||||
|
@Param("brand") String brand,
|
||||||
|
@Param("mfrs") String mfrs,
|
||||||
@Param("enableSerialNumber") String enableSerialNumber,
|
@Param("enableSerialNumber") String enableSerialNumber,
|
||||||
@Param("enableBatchNumber") String enableBatchNumber,
|
@Param("enableBatchNumber") String enableBatchNumber,
|
||||||
@Param("offset") Integer offset,
|
@Param("offset") Integer offset,
|
||||||
@@ -74,6 +78,10 @@ public interface MaterialMapperEx {
|
|||||||
|
|
||||||
int findBySelectWithBarCodeCount(@Param("idList") List<Long> idList,
|
int findBySelectWithBarCodeCount(@Param("idList") List<Long> idList,
|
||||||
@Param("q") String q,
|
@Param("q") String q,
|
||||||
|
@Param("standardOrModel") String standardOrModel,
|
||||||
|
@Param("color") String color,
|
||||||
|
@Param("brand") String brand,
|
||||||
|
@Param("mfrs") String mfrs,
|
||||||
@Param("enableSerialNumber") String enableSerialNumber,
|
@Param("enableSerialNumber") String enableSerialNumber,
|
||||||
@Param("enableBatchNumber") String enableBatchNumber);
|
@Param("enableBatchNumber") String enableBatchNumber);
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ public class MaterialVoSearch {
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
private String mnemonic;
|
||||||
|
|
||||||
private String standard;
|
private String standard;
|
||||||
|
|
||||||
private String model;
|
private String model;
|
||||||
@@ -30,6 +32,14 @@ public class MaterialVoSearch {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMnemonic() {
|
||||||
|
return mnemonic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMnemonic(String mnemonic) {
|
||||||
|
this.mnemonic = mnemonic;
|
||||||
|
}
|
||||||
|
|
||||||
public String getStandard() {
|
public String getStandard() {
|
||||||
return standard;
|
return standard;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -409,6 +409,9 @@ public class MaterialService {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(item.getBarCode());
|
sb.append(item.getBarCode());
|
||||||
sb.append("_").append(item.getName());
|
sb.append("_").append(item.getName());
|
||||||
|
if(StringUtil.isNotEmpty(item.getMnemonic())) {
|
||||||
|
sb.append("(").append(item.getMnemonic()).append(")");
|
||||||
|
}
|
||||||
if(StringUtil.isNotEmpty(item.getStandard())) {
|
if(StringUtil.isNotEmpty(item.getStandard())) {
|
||||||
sb.append("(").append(item.getStandard()).append(")");
|
sb.append("(").append(item.getStandard()).append(")");
|
||||||
}
|
}
|
||||||
@@ -428,8 +431,9 @@ public class MaterialService {
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MaterialVo4Unit> findBySelectWithBarCode(Long categoryId, String q, String enableSerialNumber,
|
public List<MaterialVo4Unit> findBySelectWithBarCode(Long categoryId, String q, String standardOrModel, String color,
|
||||||
String enableBatchNumber, Integer offset, Integer rows)throws Exception{
|
String brand, String mfrs, String enableSerialNumber, String enableBatchNumber,
|
||||||
|
Integer offset, Integer rows) throws Exception{
|
||||||
List<MaterialVo4Unit> list =null;
|
List<MaterialVo4Unit> list =null;
|
||||||
try{
|
try{
|
||||||
List<Long> idList = new ArrayList<>();
|
List<Long> idList = new ArrayList<>();
|
||||||
@@ -441,15 +445,16 @@ public class MaterialService {
|
|||||||
q = q.replace("'", "");
|
q = q.replace("'", "");
|
||||||
q = q.trim();
|
q = q.trim();
|
||||||
}
|
}
|
||||||
list= materialMapperEx.findBySelectWithBarCode(idList, q, enableSerialNumber, enableBatchNumber, offset, rows);
|
list= materialMapperEx.findBySelectWithBarCode(idList, q, standardOrModel, color, brand, mfrs,
|
||||||
|
enableSerialNumber, enableBatchNumber, offset, rows);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int findBySelectWithBarCodeCount(Long categoryId, String q, String enableSerialNumber,
|
public int findBySelectWithBarCodeCount(Long categoryId, String q, String standardOrModel, String color,
|
||||||
String enableBatchNumber)throws Exception{
|
String brand, String mfrs, String enableSerialNumber, String enableBatchNumber) throws Exception{
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
List<Long> idList = new ArrayList<>();
|
List<Long> idList = new ArrayList<>();
|
||||||
@@ -460,7 +465,8 @@ public class MaterialService {
|
|||||||
if(StringUtil.isNotEmpty(q)) {
|
if(StringUtil.isNotEmpty(q)) {
|
||||||
q = q.replace("'", "");
|
q = q.replace("'", "");
|
||||||
}
|
}
|
||||||
result = materialMapperEx.findBySelectWithBarCodeCount(idList, q, enableSerialNumber, enableBatchNumber);
|
result = materialMapperEx.findBySelectWithBarCodeCount(idList, q, standardOrModel, color, brand, mfrs,
|
||||||
|
enableSerialNumber, enableBatchNumber);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
|||||||
@@ -357,13 +357,13 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getMaterialByParam" resultType="com.jsh.erp.datasource.vo.MaterialVoSearch">
|
<select id="getMaterialByParam" resultType="com.jsh.erp.datasource.vo.MaterialVoSearch">
|
||||||
select me.bar_code, m.name, m.standard, m.model, m.color, me.commodity_unit unit
|
select me.bar_code, m.name, m.mnemonic, m.standard, m.model, m.color, me.commodity_unit unit
|
||||||
from jsh_material m
|
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_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
||||||
where m.enabled=1 and me.id is not null
|
where m.enabled=1 and me.id is not null
|
||||||
<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})
|
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey})
|
||||||
</if>
|
</if>
|
||||||
and ifnull(m.delete_flag,'0') !='1'
|
and ifnull(m.delete_flag,'0') !='1'
|
||||||
order by m.id desc, me.default_flag desc, me.id asc
|
order by m.id desc, me.default_flag desc, me.id asc
|
||||||
@@ -378,7 +378,23 @@
|
|||||||
where m.enabled=1 and me.id is not null
|
where m.enabled=1 and me.id is not null
|
||||||
<if test="q != null and q !=''">
|
<if test="q != null and q !=''">
|
||||||
<bind name="bindKey" value="'%'+q+'%'"/>
|
<bind name="bindKey" value="'%'+q+'%'"/>
|
||||||
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey} or m.color like #{bindKey})
|
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey})
|
||||||
|
</if>
|
||||||
|
<if test="standardOrModel != null and standardOrModel !=''">
|
||||||
|
<bind name="bindStandardOrModel" value="'%'+standardOrModel+'%'"/>
|
||||||
|
and (m.standard like #{bindStandardOrModel} or m.model like #{bindStandardOrModel})
|
||||||
|
</if>
|
||||||
|
<if test="color != null and color !=''">
|
||||||
|
<bind name="bindColor" value="'%'+color+'%'"/>
|
||||||
|
and m.color like #{bindColor}
|
||||||
|
</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>
|
||||||
<if test="idList.size()>0">
|
<if test="idList.size()>0">
|
||||||
and m.category_id in
|
and m.category_id in
|
||||||
@@ -404,9 +420,25 @@
|
|||||||
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
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.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
|
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
|
||||||
where m.enabled=1 and me.id is not null
|
where m.enabled=1 and me.id is not null
|
||||||
<if test="q != null">
|
<if test="q != null and q !=''">
|
||||||
<bind name="bindKey" value="'%'+q+'%'"/>
|
<bind name="bindKey" value="'%'+q+'%'"/>
|
||||||
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
|
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey})
|
||||||
|
</if>
|
||||||
|
<if test="standardOrModel != null and standardOrModel !=''">
|
||||||
|
<bind name="bindStandardOrModel" value="'%'+standardOrModel+'%'"/>
|
||||||
|
and (m.standard like #{bindStandardOrModel} or m.model like #{bindStandardOrModel})
|
||||||
|
</if>
|
||||||
|
<if test="color != null and color !=''">
|
||||||
|
<bind name="bindColor" value="'%'+color+'%'"/>
|
||||||
|
and m.color like #{bindColor}
|
||||||
|
</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>
|
||||||
<if test="idList.size()>0">
|
<if test="idList.size()>0">
|
||||||
and m.category_id in
|
and m.category_id in
|
||||||
|
|||||||
Reference in New Issue
Block a user