From df774e4fd262b0a39e52152f166ccddb2aa9f90e Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期日, 11 十月 2020 23:44:43 +0800
Subject: [PATCH] 优化代码
---
java110-db/src/main/resources/mapper/community/RoomServiceDaoImplMapper.xml | 45 ++++++++++++++++++++++++---------------------
1 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/community/RoomServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/community/RoomServiceDaoImplMapper.xml
index b0c7e62..baacdc9 100644
--- a/java110-db/src/main/resources/mapper/community/RoomServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/community/RoomServiceDaoImplMapper.xml
@@ -192,7 +192,7 @@
<if test="newBId != null and newBId != ''">
,t.b_id = #{newBId}
</if>
- <if test="feeCoefficient !=null and feeCoefficient != ''">
+ <if test="feeCoefficient !=null">
, t.fee_coefficient= #{feeCoefficient}
</if>
<if test="section !=null and section != ''">
@@ -290,13 +290,11 @@
<!-- 鏌ヨ灏忓尯鎴垮眿鏁伴噺 add by wuxw 2018-07-03 -->
<select id="queryRoomsByCommunityIdCount" parameterType="Map" resultType="Map">
select count(1) count
- FROM building_room t,building_unit u,f_floor f
+ FROM building_room t
+ inner join building_unit u on t.`unit_id` = u.`unit_id` and u.`status_cd` = '0'
+ inner JOIN f_floor f on u.`floor_id` = f.`floor_id` AND f.`community_id` = t.`community_id` AND f.`status_cd` = '0'
+ left join t_dict td on t.state = td.status_cd and td.table_name = 'building_room' and td.table_columns = 'state'
WHERE 1 =1
- AND t.`unit_id` = u.`unit_id`
- AND u.`floor_id` = f.`floor_id`
- AND f.`community_id` = t.`community_id`
- AND u.`status_cd` = '0'
- AND f.`status_cd` = '0'
AND t.`community_id` = #{communityId}
<if test="floorId !=null and floorId != ''">
and f.`floor_id`= #{floorId}
@@ -314,9 +312,7 @@
<if test="remark !=null and remark != ''">
and t.remark= #{remark}
</if>
- <if test="userId !=null and userId != ''">
- and t.user_id= #{userId}
- </if>
+
<if test="roomId !=null and roomId != ''">
and t.room_id= #{roomId}
</if>
@@ -341,6 +337,12 @@
<if test="state !=null and state != ''">
and t.state= #{state}
</if>
+ <if test="states != null">
+ and t.state in
+ <foreach collection="states" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
</if>
@@ -349,7 +351,7 @@
and f.`floor_num`= #{floorNum}
</if>
<if test="unitNum !=null and unitNum != ''">
- and t.unit_num= #{unitNum}
+ and u.unit_num= #{unitNum}
</if>
@@ -611,14 +613,12 @@
SELECT t.fee_coefficient,t.fee_coefficient feeCoefficient,t.section,t.status_cd,t.status_cd statusCd,t.remark,t.user_id,
t.user_id userId,t.room_id,t.room_id roomId,t.layer,t.built_up_area,t.built_up_area builtUpArea,t.room_num,
t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment,t.state,u.`unit_num` unitNum,
- u.unit_id unitId,f.floor_id floorId,f.floor_num floorNum,f.floor_area floorArea,u.unit_area unitArea
- FROM building_room t,building_unit u,f_floor f
+ u.unit_id unitId,f.floor_id floorId,f.floor_num floorNum,f.floor_area floorArea,u.unit_area unitArea,td.name stateName
+ FROM building_room t
+ inner join building_unit u on t.`unit_id` = u.`unit_id` and u.`status_cd` = '0'
+ inner JOIN f_floor f on u.`floor_id` = f.`floor_id` AND f.`community_id` = t.`community_id` AND f.`status_cd` = '0'
+ left join t_dict td on t.state = td.status_cd and td.table_name = 'building_room' and td.table_columns = 'state'
WHERE 1 =1
- AND t.`unit_id` = u.`unit_id`
- AND u.`floor_id` = f.`floor_id`
- AND f.`community_id` = t.`community_id`
- AND u.`status_cd` = '0'
- AND f.`status_cd` = '0'
AND t.`community_id` = #{communityId}
<if test="floorId !=null and floorId != ''">
and f.`floor_id`= #{floorId}
@@ -637,9 +637,6 @@
</if>
<if test="remark !=null and remark != ''">
and t.remark= #{remark}
- </if>
- <if test="userId !=null and userId != ''">
- and t.user_id= #{userId}
</if>
<if test="roomId !=null and roomId != ''">
and t.room_id= #{roomId}
@@ -674,6 +671,12 @@
<if test="state !=null and state != ''">
and t.state= #{state}
</if>
+ <if test="states != null">
+ and t.state in
+ <foreach collection="states" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
</if>
--
Gitblit v1.8.0