Explorar o código

修改查询接口方法处理

txf %!s(int64=3) %!d(string=hai) anos
pai
achega
11ddffaad6

+ 22 - 39
src/main/java/com/steerinfo/dil/controller/UniversalController.java

@@ -73,11 +73,10 @@ public class UniversalController extends BaseRESTfulController {
         if(index != null){
             mapValue.put("index","%" + index + "%");
         }
-        List<Map<String, Object>> list = universalMapper.querySupplierByLike(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.querySupplierByLike(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId,columnList);
         return success(data);
     }
 
@@ -99,11 +98,10 @@ public class UniversalController extends BaseRESTfulController {
         if(index != null){
             mapValue.put("index","%" + index + "%");
         }
-        List<Map<String, Object>> list = universalMapper.queryAllSupplierByLike(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.queryAllSupplierByLike(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList);
         return success(data);
     }
 
@@ -130,11 +128,10 @@ public class UniversalController extends BaseRESTfulController {
         if(index != null){
             mapValue.put("index","%" + index + "%");
         }
-        List<Map<String, Object>> list = universalMapper.getSupplierMesByMaterialId(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.getSupplierMesByMaterialId(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList);
         return success(data);
     }
 
@@ -172,11 +169,10 @@ public class UniversalController extends BaseRESTfulController {
           mapValue.put("carrierId",carrierId);
         }
         //不分页筛选数据
-        List<Map<String, Object>> allCapacity = universalMapper.getAllCapacityByCarrierLike(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> capacity = universalMapper.getAllCapacityByCarrierLike(mapValue);
-        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allCapacity,capacity);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, capacity);
         return success(pageList);
     }
 
@@ -202,11 +198,10 @@ public class UniversalController extends BaseRESTfulController {
             mapValue.put("orderId", orderId);
         }
         //不分页筛选数据
-        List<Map<String, Object>> allCapacity = universalMapper.getMaterialMesByOrderId(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> capacity = universalMapper.getMaterialMesByOrderId(mapValue);
-        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allCapacity,capacity);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, capacity);
         return success(pageList);
     }
 
@@ -240,7 +235,7 @@ public class UniversalController extends BaseRESTfulController {
             @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal")
     })
     @PostMapping("/queryAPOMaterialByLike")
-    public RESTfulResult queryMaterialByLike(@RequestBody(required = false) Map<String,Object> mapValue,
+    public RESTfulResult queryAPOMaterialByLike(@RequestBody(required = false) Map<String,Object> mapValue,
                                              Integer pageNum,
                                              Integer pageSize,
                                              Integer apiId,
@@ -249,14 +244,13 @@ public class UniversalController extends BaseRESTfulController {
         if(mapValue == null) {
             mapValue = new HashMap<>();
         }
-        if(index != null){
-            mapValue.put("index", "%" + index + "%");
+        if(index != null && !"".equals(index) &&!"null".equals(index)){
+            mapValue.put("index", index);
         }
-        List<Map<String, Object>> list = universalMapper.queryAPOMaterialByLike(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.queryAPOMaterialByLike(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList);
         return success(data);
     }
 
@@ -282,13 +276,12 @@ public class UniversalController extends BaseRESTfulController {
             mapValue.put("type", type);
         }
         if(index != null){
-            mapValue.put("index", "%" + index + "%");
+            mapValue.put("index", index);
         }
-        List<Map<String, Object>> list = universalMapper.getUnloadingMesByLike(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.getUnloadingMesByLike(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList);
         return success(data);
     }
 
@@ -303,23 +296,18 @@ public class UniversalController extends BaseRESTfulController {
                                              Integer pageNum,
                                              Integer pageSize,
                                              Integer apiId,
-                                             String index,
-                                             String startNum) {
+                                             String index) {
 
         if(mapValue == null) {
             mapValue = new HashMap<>();
         }
-        if(startNum != null){
-            mapValue.put("startNum", startNum + "%");
-        }
         if(index != null){
-            mapValue.put("index", "%" + index + "%");
+            mapValue.put("index", index);
         }
-        List<Map<String, Object>> list = universalMapper.queryMaterialByLike(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.queryMaterialByLike(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList);
         return success(data);
     }
 
@@ -340,13 +328,12 @@ public class UniversalController extends BaseRESTfulController {
             mapValue = new HashMap<>();
         }
         if(index != null){
-            mapValue.put("index", "%" + index + "%");
+            mapValue.put("index", index);
         }
-        List<Map<String, Object>> list = universalMapper.getBatchAndOrderMes(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.getBatchAndOrderMes(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList);
         return success(data);
     }
 
@@ -373,13 +360,12 @@ public class UniversalController extends BaseRESTfulController {
             mapValue = new HashMap<>();
         }
         if(index != null){
-            mapValue.put("index","%" + index + "%");
+            mapValue.put("index", index);
         }
-        List<Map<String, Object>> list = universalMapper.queryConsigneeByLike(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.queryConsigneeByLike(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList);
         return success(data);
     }
 
@@ -399,13 +385,12 @@ public class UniversalController extends BaseRESTfulController {
             mapValue = new HashMap<>();
         }
         if(index != null){
-            mapValue.put("index","%" + index + "%");
+            mapValue.put("index", index);
         }
-        List<Map<String, Object>> list = universalMapper.selectAllMaterialName(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.selectAllMaterialName(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList);
         return success(data);
     }
 
@@ -444,11 +429,10 @@ public class UniversalController extends BaseRESTfulController {
             mapValue = new HashMap<>();
         }
         mapValue.put("index",index);
-        List<Map<String, Object>> list = universalMapper.getCarrierListByLike(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.getCarrierListByLike(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList);
         return success(data);
     }
 
@@ -498,11 +482,10 @@ public class UniversalController extends BaseRESTfulController {
             mapValue = new HashMap<>();
         }
         mapValue.put("index",index);
-        List<Map<String, Object>> list = universalMapper.getConsigneeListByLike(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = universalMapper.getConsigneeListByLike(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, columnList);
         return success(data);
     }
 

+ 2 - 2
src/main/java/com/steerinfo/dil/util/ColumnDataUtil.java

@@ -25,11 +25,11 @@ public class ColumnDataUtil {
         return setString;
     }
 
-    public PageListAdd tableColumnData(Integer apiId, List<Map<String, Object>> list, List<Map<String,Object>> data) {
+    public PageListAdd tableColumnData(Integer apiId, List<Map<String,Object>> data) {
         List<Map<String, Object>> columnDataList = columnDataFeign.getColumnData(apiId);
         for (Map<String, Object> columnData : columnDataList) {
             //每个表头字段的过滤条件
-            columnData.put("filters", setListMap(list, columnData.get("prop").toString()));
+            columnData.put("filters", setListMap(data, columnData.get("prop").toString()));
         }
         PageListAdd pageList = new PageListAdd(data);
         pageList.setColumnData(columnDataList);

+ 27 - 33
src/main/resources/com/steerinfo/dil/mapper/UniversalMapper.xml

@@ -60,7 +60,7 @@
     <select id="queryAPOMaterialByLike" parameterType="java.util.Map" resultType="java.util.Map">
         SELECT *
         FROM (
-                SELECT DISTINCT RM.MATERIAL_ID "materialId",
+                SELECT RM.MATERIAL_ID "materialId",
                     RM.MATERIAL_NAME "materialName",
                     RM.MATERIAL_CODE "materialCode",
                     RM.MATERIAL_SPECIFICATION "materialSpecification",
@@ -72,13 +72,13 @@
                         ON RM.MATERIAL_ID = DB.MATERIAL_ID
                 <where>
                     <if test="index != null">
-                        RM.MATERIAL_NAME LIKE #{index}
+                        instr(RM.MATERIAL_NAME, #{index}) > 0
                     </if>
                 </where>
+                 group by RM.MATERIAL_ID,RM.MATERIAL_NAME,RM.MATERIAL_CODE,RM.MATERIAL_SPECIFICATION,RM.MATERIAL_MODEL
         )
         <where>
             <if test="materialName != null">
-
                 <foreach collection="materialName" item="item" open="(" separator="or" close=")">
                  "materialName" like '%${item}%'
                 </foreach>
@@ -103,9 +103,6 @@
             </if>
         </where>
         <include refid="orderBy"></include>
-        <if test="orderField == null  ">
-            order by "materialId" desc
-        </if>
     </select>
     <!--    模糊查询发货单位 -->
     <select id="querySupplierByLike" parameterType="java.util.Map" resultType="java.util.Map">
@@ -251,7 +248,7 @@
         from RMS_MATERIAL RM
         <where>
             <if test="index != null">
-                RM.MATERIAL_NAME like #{index}
+               instr(RM.MATERIAL_NAME, #{index}) > 0
             </if>
         </where>
         )
@@ -319,12 +316,12 @@
                      <if test="type != null">
                          RW.WAREHOUSE_TYPE_ID = #{type}
                      </if>
+                     <if test="index != null">
+                         instr(RW.WAREHOUSE_NAME, #{index}) > 0
+                     </if>
                  </where>
              )
         <where>
-            <if test="index != null">
-                "warehouseName" like #{index}
-            </if>
             <if test="warehouseName != null">
                 <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
                     "warehouseName" like '%${item}%'
@@ -348,20 +345,13 @@
         RM.MATERIAL_MODEL "materialModel"
         FROM RMS_MATERIAL RM
         <where>
-            <if test="startNum != null">
-                RM.MATERIAL_CODE LIKE #{startNum}
-            </if>
-            <if test="startNum == null">
-                RM.MATERIAL_CODE LIKE '010%' OR RM.MATERIAL_CODE LIKE '080%'
+            <if test="index != null">
+                instr(RM.MATERIAL_NAM, #{index}) > 0
             </if>
         </where>
         )
         <where>
-            <if test="index != null">
-                "materialName" LIKE #{index}
-            </if>
             <if test="materialName != null">
-                and
                 <foreach collection="materialName" item="item" open="(" separator="or" close=")">
                     "materialName" like '%${item}%'
                 </foreach>
@@ -407,7 +397,7 @@
                                     on RM.MATERIAL_ID = DB.MATERIAL_ID
                  <where>
                      <if test="index != null">
-                         "resultForeignShipName" like #{index}
+                         instr(DB.RESULT_FOREIGN_SHIP_NAME, #{index}) > 0
                      </if>
                  </where>
              )
@@ -503,7 +493,9 @@
     </select>
 
     <select id="queryConsigneeByLike" resultType="java.util.Map" parameterType="java.util.Map" >
-        SELECT * FROM (
+        SELECT
+               *
+        FROM (
         SELECT
         RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
         RCO.CONSIGNEE_CODE AS "consigneeCode",
@@ -511,21 +503,23 @@
         FROM RMS_CONSIGNEE RCO
         <where>
             <if test="index != null">
-                RCO.CONSIGNEE_COMPANY_NAME like #{index}
+                instr(RCO.CONSIGNEE_COMPANY_NAME, #{index}) > 0
             </if>
         </where>
         )
-        <if test="consigneeCompanyName != null">
-            <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
-                "consigneeCompanyName" like '%${item}%'
-            </foreach>
-        </if>
-        <if test="consigneeCode != null">
-            and
-            <foreach collection="consigneeCode" item="item" open="(" separator="or" close=")">
-                "consigneeCode" like '%${item}%'
-            </foreach>
-        </if>
+        <where>
+            <if test="consigneeCompanyName != null">
+                <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
+                    "consigneeCompanyName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="consigneeCode != null">
+                and
+                <foreach collection="consigneeCode" item="item" open="(" separator="or" close=")">
+                    "consigneeCode" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
     </select>
 
 <!--  通过订单ID查询订单下所有物资  -->