liyg 2 年之前
父节点
当前提交
cd70785577

+ 1 - 3
src/main/java/com/steerinfo/dil/controller/BmsshipContractPriceController.java

@@ -103,15 +103,13 @@ public class BmsshipContractPriceController extends BaseRESTfulController {
                                      String con,
                                      String startTime,
                                      String endTime) {
-        DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
         if (mapValue == null) {
             mapValue = new HashMap<>();
         }
-
+        DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
         if (con != null && con.length() != 0) {
             mapValue.put("con","%" + con + "%");
         }
-
         PageHelper.startPage(pageNum, pageSize);
         //初始化过滤
         List<Map<String, Object>> columnList = bmsshipContractPriceService.bmsshipContractPriceList(mapValue);

+ 51 - 8
src/main/resources/com/steerinfo/dil/mapper/BmsshipContractPriceMapper.xml

@@ -442,6 +442,14 @@
   </delete>
   <!-- 友情提示!!!-->
   <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+  <sql id="orderBy">
+    <if test="orderField != null and orderField != ''">
+      order by "${orderField}"
+      <if test="orderType != null and orderType != ''">
+        ${orderType}
+      </if>
+    </if>
+  </sql>
 
   <select id="contractNoCompare" resultType="java.math.BigDecimal" parameterType="java.lang.String">
     select BCP.RESULT_ID "resultId"
@@ -451,6 +459,7 @@
 
   <!-- 展示船运合同管理列表-->
   <select id="bmsshipContractPriceList" resultType="java.util.Map" parameterType="java.util.Map">
+    select * from (
     select
     BCP.RESULT_ID "resultId",
     BCP.CONTRACT_NO "contractNo",
@@ -464,21 +473,55 @@
     on BCP.PORT_ID=RP.PORT_ID
     where  BCP.DELETED=0
     <if test="con!=null">
-      AND instr(BCP.CONTRACT_NO,#{con}) > 0
+      AND BCP.CONTRACT_NO like #{con}
     </if>
     <if test="startDate != null">
       and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;=   BCP.END_TIME
       and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= BCP.END_TIME
     </if>
+    )
+    <where>
+      <if test="contractNo != null">
+        and
+        <foreach collection="contractNo" item="item" open="(" separator="or" close=")">
+          "contractNo" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="startTime != null">
+        and
+        <foreach collection="startTime" item="item" open="(" separator="or" close=")">
+          "startTime" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="endTime != null">
+        and
+        <foreach collection="endTime" item="item" open="(" separator="or" close=")">
+          "endTime" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="unitPrice != null">
+        and
+        <foreach collection="unitPrice" item="item" open="(" separator="or" close=")">
+          "unitPrice" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="portName != null">
+        and
+        <foreach collection="portName" item="item" open="(" separator="or" close=")">
+          "portName" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
   </select>
   <select id="selectBmsshipPriceList" resultType="java.util.Map" parameterType="java.math.BigDecimal">
-    select  BCP.CONTRACT_NO "contractNo",
-            BCP.START_TIME "startTime",
-            BCP.END_TIME "endTime",
-            BCP.UNIT_PRICE "unitPrice",
-            BCP.RESULT_ID "resultId",
-            BCP.PORT_ID "portID"
+select BCP.CONTRACT_NO "contractNo",
+    BCP.START_TIME "startTime",
+    BCP.END_TIME "endTime",
+    BCP.UNIT_PRICE "unitPrice",
+    BCP.RESULT_ID "resultId",
+    BCP.PORT_ID "portID"
     from BMSSHIP_CONTRACT_PRICE BCP
-    WHERE  BCP.RESULT_ID =#{resultId}
+    WHERE BCP.RESULT_ID =#{resultId}
   </select>
 </mapper>