From ba5210dc8c6c537cacc59c18d58baa9744cd2b9d Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 10 五月 2022 11:14:39 +0800
Subject: [PATCH] 优化报修单推送bug

---
 java110-db/src/main/resources/mapper/community/UnitServiceDaoImplMapper.xml |   79 +++++++++++++++++++++++++++------------
 1 files changed, 55 insertions(+), 24 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/community/UnitServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/community/UnitServiceDaoImplMapper.xml
old mode 100644
new mode 100755
index ab8324f..c34fcb1
--- a/java110-db/src/main/resources/mapper/community/UnitServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/community/UnitServiceDaoImplMapper.xml
@@ -7,9 +7,9 @@
     <!-- 淇濆瓨灏忓尯鍗曞厓淇℃伅 add by wuxw 2018-07-03 -->
     <insert id="saveBusinessUnitInfo" parameterType="Map">
         insert into business_building_unit(
-        floor_id,operate,layer_count,unit_id,unit_num,lift,remark,b_id,user_id
+        floor_id,operate,layer_count,unit_id,unit_num,lift,remark,b_id,user_id,unit_area
         ) values (
-        #{floorId},#{operate},#{layerCount},#{unitId},#{unitNum},#{lift},#{remark},#{bId},#{userId}
+        #{floorId},#{operate},#{layerCount},#{unitId},#{unitNum},#{lift},#{remark},#{bId},#{userId},#{unitArea}
         )
     </insert>
 
@@ -17,7 +17,8 @@
     <!-- 鏌ヨ灏忓尯鍗曞厓淇℃伅锛圔usiness锛� add by wuxw 2018-07-03 -->
     <select id="getBusinessUnitInfo" parameterType="Map" resultType="Map">
         select t.floor_id,t.floor_id floorId,t.operate,t.layer_count,t.layer_count layerCount,t.unit_id,t.unit_id
-        unitId,t.unit_num,t.unit_num unitNum,t.lift,t.remark,t.b_id,t.b_id bId,t.user_id,t.user_id userId
+        unitId,t.unit_num,t.unit_num unitNum,t.lift,t.remark,t.b_id,t.b_id bId,t.user_id,t.user_id userId,
+        t.unit_area,t.unit_area unitArea
         from business_building_unit t
         where 1 =1
         <if test="floorId !=null and floorId != ''">
@@ -47,6 +48,7 @@
         <if test="userId !=null and userId != ''">
             and t.user_id= #{userId}
         </if>
+        order by unitNum asc
 
     </select>
 
@@ -54,8 +56,9 @@
     <!-- 淇濆瓨灏忓尯鍗曞厓淇℃伅鑷� instance琛ㄤ腑 add by wuxw 2018-07-03 -->
     <insert id="saveUnitInfoInstance" parameterType="Map">
         insert into building_unit(
-        floor_id,layer_count,unit_id,unit_num,lift,status_cd,remark,b_id,user_id
-        ) select t.floor_id,t.layer_count,t.unit_id,t.unit_num,t.lift,'0',t.remark,t.b_id,t.user_id from
+        floor_id,layer_count,unit_id,unit_num,lift,status_cd,remark,b_id,user_id,unit_area
+        ) select t.floor_id,t.layer_count,t.unit_id,t.unit_num,t.lift,'0',t.remark,t.b_id,t.user_id,t.unit_area
+        from
         business_building_unit t where 1=1
         <if test="floorId !=null and floorId != ''">
             and t.floor_id= #{floorId}
@@ -90,17 +93,12 @@
     <select id="getUnitInfo" parameterType="Map" resultType="Map">
         select t.floor_id,t.floor_id floorId,t.layer_count,t.layer_count layerCount,t.unit_id,t.unit_id
         unitId,t.unit_num,t.unit_num unitNum,t.lift,t.status_cd,t.status_cd statusCd,t.remark,t.b_id,t.b_id
-        bId,t.user_id,t.user_id userId
+        bId,t.user_id,t.user_id userId,t.unit_area,t.unit_area unitArea,ff.floor_num floorNum
         from building_unit t
-        <if test="communityId!=null and communityId != ''">
-            ,f_floor ff ,s_community_member cm
-        </if>
+        left join f_floor ff on t.`floor_id` = ff.`floor_id` and ff.status_cd = '0'
         where 1 =1
         <if test="communityId!=null and communityId != ''">
-            and bu.`floor_id` = ff.`floor_id`
-            AND ff.`floor_id` = cm.`member_id`
-            AND cm.`member_type_cd` = '390001200004'
-            and cm.community_id = #{communityId}
+            AND ff.community_id = #{communityId}
         </if>
         <if test="floorId !=null and floorId != ''">
             and t.floor_id= #{floorId}
@@ -129,10 +127,11 @@
         <if test="userId !=null and userId != ''">
             and t.user_id= #{userId}
         </if>
+        order by unitNum asc
        <!-- <if test="page != -1 and page != null ">
             limit #{page}, #{row}
-        </if>-->
-            limit 10;
+        </if>limit 10;-->
+
     </select>
 
 
@@ -156,6 +155,9 @@
         </if>
         <if test="remark !=null and remark != ''">
             , t.remark= #{remark}
+        </if>
+        <if test="unitArea !=null and unitArea != ''">
+            , t.unit_area= #{unitArea}
         </if>
         <if test="userId !=null and userId != ''">
             , t.user_id= #{userId}
@@ -209,16 +211,11 @@
     <select id="queryUnitsByCommunityId" parameterType="Map" resultType="Map">
         select t.floor_id,t.floor_id floorId,t.layer_count,t.layer_count layerCount,t.unit_id,t.unit_id
         unitId,t.unit_num,t.unit_num unitNum,t.lift,t.status_cd,t.status_cd statusCd,t.remark,t.b_id,t.b_id
-        bId,t.user_id,t.user_id userId
-        from building_unit t,s_community sc,s_community_member scm,f_floor f
+        bId,t.user_id,t.user_id userId,t.unit_area,t.unit_area unitArea
+        from building_unit t,f_floor f
         where 1 =1
         and t.floor_id = f.floor_id
-        and f.floor_id = scm.member_id
-        and scm.community_id = sc.community_id
-        and scm.member_type_cd = '390001200004'
-        and sc.community_id = #{communityId}
-        and sc.status_cd = '0'
-        and scm.status_cd = '0'
+        and f.community_id = #{communityId}
         and f.status_cd = '0'
         <if test="floorId !=null and floorId != ''">
             and t.floor_id= #{floorId}
@@ -229,7 +226,7 @@
         <if test="unitId !=null and unitId != ''">
             and t.unit_id= #{unitId}
         </if>
-        <if test="unitNum !=null and unitNum != ''">
+        <if test="unitNum !=null and unitNum != '' or unitNum == 0">
             and t.unit_num= #{unitNum}
         </if>
         <if test="lift !=null and lift != ''">
@@ -250,6 +247,40 @@
         <if test="page != -1 and page != null">
             limit #{page}, #{row}
         </if>
+        order by unitNum asc
+    </select>
+
+    <select id="getFloorAndUnitInfo" parameterType="Map" resultType="Map">
+        SELECT
+          bu.`unit_id` unitId,
+          bu.`unit_num` unitNum,
+          f.`floor_id` floorId,
+          f.`floor_num` floorNum
+        FROM
+          f_floor f,
+          building_unit bu
+        WHERE f.`floor_id` = bu.`floor_id`
+          AND f.`status_cd` = '0'
+          AND bu.`status_cd` = '0'
+          <if test="floorId != null and floorId !=''">
+              and bu.floor_id = #{floorId}
+          </if>
+        <if test="floorNum != null and floorNum !=''">
+            and f.floor_num = #{floorNum}
+        </if>
+        <if test="unitId != null and unitId !=''">
+            and bu.unit_id = #{unitId}
+        </if>
+        <if test="unitIds != null">
+            and bu.unit_id in
+            <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="unitNum != null and unitNum !=''">
+            and bu.unit_num = #{unitNum}
+        </if>
+
     </select>
 
 </mapper>

--
Gitblit v1.8.0