Parcourir la source

mapper底层的时间筛选统一处理

yq il y a 3 ans
Parent
commit
084ba66624

+ 3 - 5
mhfire-mapping/src/main/resources/mapper/mysql/AlFsdDisagreeMapper.xml

@@ -5,11 +5,9 @@
     <select id="selectCount" resultType="java.lang.Integer">
         select count(1) from `xzxk-bhgz`
         <where>
-            <if test="startTime != null">
-                and `检查日期` >= #{startTime}
-            </if>
-            <if test="endTime != null">
-                and `检查日期` &lt;= #{endTime}
+            <if test="startTime != null and endTime != null">
+                and  `检查日期` between STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
+                and STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
             </if>
         </where>
     </select>

+ 3 - 5
mhfire-mapping/src/main/resources/mapper/mysql/AlFsdSeqMapper.xml

@@ -5,11 +5,9 @@
     <select id="selectCount" resultType="java.lang.Integer">
         select count(1) from `xzxk-ajhgz`
         <where>
-            <if test="startTime != null">
-                and `创建时间` >= #{startTime}
-            </if>
-            <if test="endTime != null">
-                and `创建时间` &lt;= #{endTime}
+            <if test="startTime != null and endTime != null">
+                and  `创建时间` between STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
+                and STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
             </if>
         </where>
     </select>

+ 3 - 5
mhfire-mapping/src/main/resources/mapper/mysql/AlFsdVoucherMapper.xml

@@ -5,11 +5,9 @@
     <select id="selectCount" resultType="java.lang.Integer">
         select count(1) from `xzxk-aqjcpz`
         <where>
-            <if test="startTime != null">
-                and `创建时间` >= #{startTime}
-            </if>
-            <if test="endTime != null">
-                and `创建时间` &lt;= #{endTime}
+            <if test="startTime != null and endTime != null">
+                and  `创建时间` between STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
+                and STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
             </if>
         </where>
     </select>

+ 3 - 5
mhfire-mapping/src/main/resources/mapper/mysql/BsSupervisionAll.xml

@@ -12,11 +12,9 @@
             <if test="typeTwoLetter != null and typeTwoLetter != ''">
                 and `项目分类型二` = #{typeTwoLetter}
             </if>
-            <if test="startTime != null">
-                and `项目创建日期` >= #{startTime}
-            </if>
-            <if test="endTime != null">
-                and `项目创建日期` &lt;= #{endTime}
+            <if test="startTime != null and endTime != null">
+                and  `项目创建日期` between STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
+                and STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
             </if>
             <if test="unitId != null and unitId != ''">
                 and `项目单位ID` = #{unitId}

+ 3 - 5
mhfire-mapping/src/main/resources/mapper/mysql/FireStatisticsMapper.xml

@@ -78,11 +78,9 @@
         select sum(`死亡人数`) as deathPerson,avg(`过火面积`) as fireArea
         from `hzdc-hztjb`
         <where>
-            <if test="startTime != null">
-                and `起火时间_日期型` >= #{startTime}
-            </if>
-            <if test="endTime != null">
-                and `起火时间_日期型` &lt;= #{endTime}
+            <if test="startTime != null and endTime != null">
+                and  `起火时间_日期型` between STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
+                and STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
             </if>
             <if test="region != null and region != ''">
                 and `行政区域` = #{region}

+ 3 - 5
mhfire-mapping/src/main/resources/mapper/mysql/FireWaterMapper.xml

@@ -29,11 +29,9 @@
             <if test="getWaterType !=null and getWaterType != ''">
                 and `取水形式` = #{getWaterType}
             </if>
-            <if test="startTime !=null">
-                and `BDP_AUDIT` >= #{startTime}
-            </if>
-            <if test="endTime !=null">
-                and `BDP_AUDIT` &lt;= #{endTime}
+            <if test="startTime != null and endTime != null">
+                and  `BDP_AUDIT` between STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
+                and STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
             </if>
             <if test="waterFlag !=null and waterFlag != ''">
                 and `可用状态` = #{waterFlag}

+ 3 - 5
mhfire-mapping/src/main/resources/mapper/mysql/ReportComplaintMapper.xml

@@ -7,11 +7,9 @@
         select count(1)
         from `jdjc-hzyhtsjbxx`
         <where>
-            <if test="startTime != null">
-                and `举报时间` >= #{startTime}
-            </if>
-            <if test="endTime !=null">
-                and `举报时间` &lt;= #{endTime}
+            <if test="startTime != null and endTime != null">
+                and  `举报时间` between STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
+                and STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
             </if>
             <if test="type !=null and type != ''">
                 and `火患场所名称` = #{type}

+ 3 - 5
mhfire-mapping/src/main/resources/mapper/mysql/SiAeAllMapper.xml

@@ -13,11 +13,9 @@
         COALESCE(sum(`发临时查封决定书(份)`),0) as `临时查封(份)`
         FROM `jdjc-xzzftj-all`
         <where>
-            <if test="startTime !=null">
-                and `ChgTime` >= #{startTime}
-            </if>
-            <if test="endTime !=null">
-                and `ChgTime`  &lt;= #{endTime}
+            <if test="startTime != null and endTime != null">
+                and  `ChgTime` between STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
+                and STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
             </if>
         </where>
     </select>

+ 3 - 5
mhfire-mapping/src/main/resources/mapper/mysql/UnitBeOnDutyMapper.xml

@@ -5,11 +5,9 @@
     <select id="list" resultType="java.util.Map">
         select * from `jbzb-zbb`
         <where>
-            <if test="startTime != null">
-                and `值班日期` >= #{startTime}
-            </if>
-            <if test="endTime !=null">
-                and `值班日期` &lt;= #{endTime}
+            <if test="startTime != null and endTime != null">
+                and  `值班日期` between STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
+                and STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
             </if>
         </where>
     </select>