From 781c2e20a4bb844dae3f4eafbf5f0e494b942ea8 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 25 五月 2023 18:07:08 +0800
Subject: [PATCH] optimize

---
 java110-db/src/main/resources/mapper/community/MaintainanceItemV1ServiceDaoImplMapper.xml |  162 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 85 insertions(+), 77 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/community/MaintainanceItemV1ServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/community/MaintainanceItemV1ServiceDaoImplMapper.xml
index e1bb002..e96062a 100644
--- a/java110-db/src/main/resources/mapper/community/MaintainanceItemV1ServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/community/MaintainanceItemV1ServiceDaoImplMapper.xml
@@ -5,102 +5,110 @@
 <mapper namespace="maintainanceItemV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 淇濆瓨淇濆吇妫�鏌ラ」淇℃伅 add by wuxw 2018-07-03 -->
     <insert id="saveMaintainanceItemInfo" parameterType="Map">
         insert into maintainance_item(
-item_id,title_type,item_title,community_id,seq
-) values (
-#{itemId},#{titleType},#{itemTitle},#{communityId},#{seq}
-)
+        item_id,title_type,item_title,community_id,seq
+        ) values (
+        #{itemId},#{titleType},#{itemTitle},#{communityId},#{seq}
+        )
     </insert>
-
 
 
     <!-- 鏌ヨ淇濆吇妫�鏌ラ」淇℃伅 add by wuxw 2018-07-03 -->
     <select id="getMaintainanceItemInfo" parameterType="Map" resultType="Map">
-        select  t.item_id,t.item_id itemId,t.title_type,t.title_type titleType,t.item_title,t.item_title itemTitle,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,t.seq 
-from maintainance_item t 
-where 1 =1 
-<if test="itemId !=null and itemId != ''">
-   and t.item_id= #{itemId}
-</if> 
-<if test="titleType !=null and titleType != ''">
-   and t.title_type= #{titleType}
-</if> 
-<if test="itemTitle !=null and itemTitle != ''">
-   and t.item_title= #{itemTitle}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="seq !=null and seq != ''">
-   and t.seq= #{seq}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.item_id,t.item_id itemId,t.title_type,t.title_type titleType,t.item_title,t.item_title
+        itemTitle,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,t.seq,t.create_time createTime
+        from maintainance_item t
+        <if test="standardId !=null and standardId != ''">
+            left join maintainance_standard_item msi on t.item_id = msi.item_id and msi.status_cd = '0'
+        </if>
+        where 1 =1
+        <if test="standardId !=null and standardId != ''">
+            and msi.standard_id = #{standardId}
+        </if>
+        <if test="itemId !=null and itemId != ''">
+            and t.item_id= #{itemId}
+        </if>
+        <if test="titleType !=null and titleType != ''">
+            and t.title_type= #{titleType}
+        </if>
+        <if test="itemTitle !=null and itemTitle != ''">
+            and t.item_title= #{itemTitle}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="seq !=null and seq != ''">
+            and t.seq= #{seq}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 淇敼淇濆吇妫�鏌ラ」淇℃伅 add by wuxw 2018-07-03 -->
     <update id="updateMaintainanceItemInfo" parameterType="Map">
-        update  maintainance_item t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="titleType !=null and titleType != ''">
-, t.title_type= #{titleType}
-</if> 
-<if test="itemTitle !=null and itemTitle != ''">
-, t.item_title= #{itemTitle}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
-<if test="seq !=null and seq != ''">
-, t.seq= #{seq}
-</if> 
- where 1=1 <if test="itemId !=null and itemId != ''">
-and t.item_id= #{itemId}
-</if> 
+        update maintainance_item t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="titleType !=null and titleType != ''">
+            , t.title_type= #{titleType}
+        </if>
+        <if test="itemTitle !=null and itemTitle != ''">
+            , t.item_title= #{itemTitle}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        <if test="seq !=null and seq != ''">
+            , t.seq= #{seq}
+        </if>
+        where 1=1
+        <if test="itemId !=null and itemId != ''">
+            and t.item_id= #{itemId}
+        </if>
 
     </update>
 
     <!-- 鏌ヨ淇濆吇妫�鏌ラ」鏁伴噺 add by wuxw 2018-07-03 -->
-     <select id="queryMaintainanceItemsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from maintainance_item t 
-where 1 =1 
-<if test="itemId !=null and itemId != ''">
-   and t.item_id= #{itemId}
-</if> 
-<if test="titleType !=null and titleType != ''">
-   and t.title_type= #{titleType}
-</if> 
-<if test="itemTitle !=null and itemTitle != ''">
-   and t.item_title= #{itemTitle}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="seq !=null and seq != ''">
-   and t.seq= #{seq}
-</if> 
+    <select id="queryMaintainanceItemsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from maintainance_item t
+        <if test="standardId !=null and standardId != ''">
+            left join maintainance_standard_item msi on t.item_id = msi.item_id and msi.status_cd = '0'
+        </if>
+        where 1 =1
+        <if test="standardId !=null and standardId != ''">
+            and msi.standard_id = #{standardId}
+        </if>
+        <if test="itemId !=null and itemId != ''">
+            and t.item_id= #{itemId}
+        </if>
+        <if test="titleType !=null and titleType != ''">
+            and t.title_type= #{titleType}
+        </if>
+        <if test="itemTitle !=null and itemTitle != ''">
+            and t.item_title= #{itemTitle}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="seq !=null and seq != ''">
+            and t.seq= #{seq}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

--
Gitblit v1.8.0