From f14c50cb0036d3ddd655ce4e34732ba396a836c4 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 30 五月 2023 12:42:03 +0800
Subject: [PATCH] optimize 统计

---
 java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml |  150 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 149 insertions(+), 1 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml
index 10b29bf..33804a5 100755
--- a/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml
@@ -60,7 +60,7 @@
         where t.status_cd = '0'
         and t.community_id = #{communityId}
         and bu.unit_id = #{unitId}
-        order by t.room_num
+        order by CONVERT(t.layer,SIGNED),CONVERT(t.room_num,SIGNED) asc
     </select>
 
     <select id="queryCarStructures" parameterType="Map" resultType="Map">
@@ -96,6 +96,12 @@
         <if test="state !=null and state != ''">
             and t.state= #{state}
         </if>
+        <if test="leaseTypes !=null ">
+            and t.lease_type in
+            <foreach collection="leaseTypes" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
@@ -115,6 +121,12 @@
         where t.status_cd = '0'
         <if test="state !=null and state != ''">
             and t.state= #{state}
+        </if>
+        <if test="leaseTypes !=null ">
+            and t.lease_type in
+            <foreach collection="leaseTypes" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
         </if>
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -179,8 +191,144 @@
 
     </select>
 
+    <!-- 鏌ヨ鏃犳晥璐圭敤 add by wuxw 2018-07-03 -->
+    <select id="queryInvalidFeeMonthStatistics" parameterType="Map" resultType="Map">
+        select t.fee_id feeId from pay_fee t
+        inner join pay_fee_config pfc on t.config_id = pfc.config_id
+        inner join report_fee_year_collection rfyc on t.fee_id = rfyc.fee_id and rfyc.status_cd = '0'
+        where (t.status_cd = '1' or pfc.status_cd = '1')
+        and t.community_id= #{communityId}
+    </select>
+
+    <!--娓呯悊鎶ヨ〃 鏃犳晥鏁版嵁-->
+    <update id="deleteInvalidFee" parameterType="Map">
+        delete from report_fee_year_collection where fee_id  in
+        <foreach collection="feeIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        and community_id = #{communityId}
+    </update>
 
 
 
+    <!-- 鏌ヨ鏃犳晥璐圭敤 add by wuxw 2018-07-03 -->
+    <select id="queryRoomsTree" parameterType="Map" resultType="Map">
+        SELECT t.room_id,t.room_id roomId,t.layer,t.room_num,
+        t.room_num roomNum,t.unit_id,u.`unit_num` unitNum,
+        u.unit_id unitId,f.floor_id floorId,f.floor_num floorNum,t.`community_id` communityId,bo.owner_id ownerId ,bo.`name` ownerName ,bo.link link
+        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 building_owner_room_rel borr on t.room_id =  borr.room_id and borr.status_cd = '0'
+        left join building_owner bo on borr.owner_id =  bo.member_id and bo.status_cd = '0'
+        WHERE 1 =1
+        and t.status_cd = '0'
+        and u.unit_id = #{unitId}
+        and t.community_id= #{communityId}
+        order by CONVERT(t.layer,SIGNED),CONVERT(t.room_num,SIGNED)
+    </select>
+
+    <select id="queryHisOwnerCarCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from business_owner_car t
+        left join c_business cb on t.b_id = cb.b_id
+        left join c_orders co on cb.o_id = co.o_id
+        left join u_user uu on co.user_id = uu.user_id
+        left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
+        left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
+        left join t_dict t3 on t.lease_type = t3.status_cd and t3.table_name = 'owner_car' and t3.table_columns = 'lease_type'
+        left join t_dict t4 on t.car_type_cd=t4.status_cd and t4.table_name='owner_car' and t4.table_columns = 'car_type_cd'
+        left join building_owner bo on t.owner_id = bo.member_id and bo.status_cd = '0'
+        where 1=1
+        and t.car_num = #{carNum}
+        and t.community_id= #{communityId}
+    </select>
+
+    <select id="queryHisOwnerCars" parameterType="Map" resultType="Map">
+        select t.car_color carColor,t.car_brand carBrand,t.car_type carType,t1.name
+        carTypeName,
+        t.car_num carNum,t.ps_id psId,t.remark,
+        t.owner_id ownerId,t.b_id bId,t.user_id userId,t.car_id carId ,t.create_time
+        createTime,t.community_id communityId,t2.name stateName,
+        t.start_time startTime,t.end_time endTime,t.state,
+        t.car_type_cd carTypeCd,t.member_id memberId,t.lease_type leaseType,
+        t3.name leaseTypeName,t4.name carTypeCdName,t.operate,uu.`name` userName,bo.`name` ownerName,bo.link
+        from business_owner_car t
+        left join c_business cb on t.b_id = cb.b_id
+        left join c_orders co on cb.o_id = co.o_id
+        left join u_user uu on co.user_id = uu.user_id
+        left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
+        left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
+        left join t_dict t3 on t.lease_type = t3.status_cd and t3.table_name = 'owner_car' and t3.table_columns = 'lease_type'
+        left join t_dict t4 on t.car_type_cd=t4.status_cd and t4.table_name='owner_car' and t4.table_columns = 'car_type_cd'
+        left join building_owner bo on t.owner_id = bo.member_id and bo.status_cd = '0'
+        where 1=1
+        and t.car_num = #{carNum}
+        and t.community_id= #{communityId}
+        order by t.create_time desc,t.operate
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
+    <select id="queryHisOwnerCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from business_building_owner t
+        left join c_business cb on t.b_id = cb.b_id
+        left join c_orders co on cb.o_id = co.o_id
+        left join u_user uu on co.user_id = uu.user_id
+        where 1=1
+        and t.member_id = #{memberId}
+        and t.community_id = #{communityId}
+    </select>
+
+    <select id="queryHisOwners" parameterType="Map" resultType="Map">
+        select t.operate,t.sex,t.name,t.link,t.remark,t.owner_id ownerId,t.b_id bId,
+        t.age,t.member_id memberId,
+        t.owner_type_cd ownerTypeCd,t.community_id communityId,t.owner_flag ownerFlag,
+        t.id_card idCard,t.state,t.address,t.create_time createTime,uu.`name` userName,t.operate
+        from business_building_owner t
+        left join c_business cb on t.b_id = cb.b_id
+        left join c_orders co on cb.o_id = co.o_id
+        left join u_user uu on co.user_id = uu.user_id
+        where 1=1
+        and t.member_id = #{memberId}
+        and t.community_id = #{communityId}
+        order by t.create_time desc,t.operate
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
+    <select id="queryHisFeeCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from business_pay_fee t
+        left join  pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
+        left join c_business cb on t.b_id = cb.b_id
+        left join c_orders co on cb.o_id = co.o_id
+        left join u_user uu on co.user_id = uu.user_id
+        where 1=1
+        and t.fee_id = #{feeId}
+        and t.community_id = #{communityId}
+    </select>
+
+    <select id="queryHisFees" parameterType="Map" resultType="Map">
+        select t.operate,t.start_time startTime,t.end_time endTime,t.create_time createTime,pfc.fee_name feeName,
+        t.amount,
+        uu.`name` userName
+        from business_pay_fee t
+        left join  pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
+        left join c_business cb on t.b_id = cb.b_id
+        left join c_orders co on cb.o_id = co.o_id
+        left join u_user uu on co.user_id = uu.user_id
+        where 1=1
+        and t.fee_id = #{feeId}
+        and t.community_id = #{communityId}
+        order by t.create_time desc,t.operate
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
 
 </mapper>

--
Gitblit v1.8.0