From 093b73aadb022895a02dbbcd64b87613e19b547b Mon Sep 17 00:00:00 2001
From: 1098226878@qq.com <1098226878@qq.com>
Date: 星期一, 10 一月 2022 18:05:21 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

---
 java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml |  384 ++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 268 insertions(+), 116 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
index 1e3b141..439c6fe 100755
--- a/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
@@ -8,10 +8,12 @@
     <insert id="saveReportFeeMonthStatisticsInfo" parameterType="Map">
         insert into report_fee_month_statistics(
         receivable_amount,statistics_id,update_time,remark,obj_name,received_amount,fee_year,fee_month,fee_id,config_id,
-        obj_id,fee_name,owe_amount,community_id,fee_create_time,obj_type,deadline_time,cur_max_time
+        obj_id,fee_name,owe_amount,community_id,fee_create_time,obj_type,deadline_time,cur_max_time,
+        his_owe_amount,cur_receivable_amount,cur_received_amount, his_owe_received_amount,pre_received_amount
         ) values (
         #{receivableAmount},#{statisticsId},#{updateTime},#{remark},#{objName},#{receivedAmount},#{feeYear},#{feeMonth},
-        #{feeId},#{configId},#{objId},#{feeName},#{oweAmount},#{communityId},#{feeCreateTime},#{objType},#{deadlineTime},#{curMaxTime}
+        #{feeId},#{configId},#{objId},#{feeName},#{oweAmount},#{communityId},#{feeCreateTime},#{objType},#{deadlineTime},#{curMaxTime},
+        #{hisOweAmount},#{curReceivableAmount},#{curReceivedAmount},#{hisOweReceivedAmount},#{preReceivedAmount}
         )
     </insert>
 
@@ -23,7 +25,10 @@
         feeYear,t.fee_month,t.fee_month feeMonth,t.fee_id,t.fee_id feeId,t.config_id,t.config_id
         configId,t.obj_id,t.obj_id objId,t.fee_name,t.fee_name feeName,t.owe_amount,t.owe_amount
         oweAmount,t.community_id,t.community_id communityId,t.fee_create_time,t.fee_create_time
-        feeCreateTime,t.obj_type,t.obj_type objType,t.cur_max_time curMaxTime
+        feeCreateTime,t.obj_type,t.obj_type objType,t.cur_max_time curMaxTime,
+        t.his_owe_amount hisOweAmount,t.cur_receivable_amount curReceivableAmount,t.cur_received_amount
+        curReceivedAmount,
+        t.his_owe_received_amount hisOweReceivedAmount,t.pre_received_amount preReceivedAmount
         from report_fee_month_statistics t
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
         where 1 =1
@@ -89,7 +94,9 @@
         update report_fee_month_statistics t set
         t.owe_amount= #{oweAmount}
         where 1=1
+        <if test="statisticsId !=null and statisticsId != ''">
             and t.statistics_id= #{statisticsId}
+        </if>
         <if test="curMaxTime !=null ">
             and t.cur_max_time &lt;= #{curMaxTime}
         </if>
@@ -143,12 +150,26 @@
         <if test="oweAmount !=null and oweAmount != ''">
             , t.owe_amount= #{oweAmount}
         </if>
-
         <if test="feeCreateTime !=null and feeCreateTime != ''">
             , t.fee_create_time= #{feeCreateTime}
         </if>
         <if test="objType !=null and objType != ''">
             , t.obj_type= #{objType}
+        </if>
+        <if test="hisOweAmount !=null and hisOweAmount != ''">
+            , t.his_owe_amount= #{hisOweAmount}
+        </if>
+        <if test="curReceivableAmount !=null and curReceivableAmount != ''">
+            , t.cur_receivable_amount= #{curReceivableAmount}
+        </if>
+        <if test="curReceivedAmount !=null and curReceivedAmount != ''">
+            , t.cur_received_amount= #{curReceivedAmount}
+        </if>
+        <if test="hisOweReceivedAmount !=null and hisOweReceivedAmount != ''">
+            , t.his_owe_received_amount= #{hisOweReceivedAmount}
+        </if>
+        <if test="preReceivedAmount !=null and preReceivedAmount != ''">
+            , t.pre_received_amount= #{preReceivedAmount}
         </if>
         where 1=1
         and t.statistics_id= #{statisticsId}
@@ -272,6 +293,13 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -281,10 +309,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         group by t.fee_year,t.fee_month
@@ -293,9 +321,15 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryReportFeeSummary" parameterType="Map" resultType="Map">
-        select t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime,SUM(t.receivable_amount)
-        receivableAmount,SUM(t.received_amount)
-        receivedAmount,SUM(t.owe_amount) oweAmount,max(t.update_time) updateTime
+        select t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime
+        <if test="configIds !=null">
+            ,t.config_id configId
+        </if>
+        ,SUM(t.his_owe_amount) hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
+        SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
+        hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
+        max(t.update_time) updateTime,sum(t.his_owe_amount+t.cur_receivable_amount)
+        receivableAmount,sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount
         from report_fee_month_statistics t
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
@@ -326,6 +360,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -335,13 +375,16 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         group by t.fee_year,t.fee_month
+        <if test="configIds !=null">
+            ,t.config_id
+        </if>
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -349,9 +392,9 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� 澶ц add by wuxw 2018-07-03 -->
     <select id="queryReportFeeSummaryMajor" parameterType="Map" resultType="Map">
-        select SUM(t.receivable_amount)
-        allReceivableAmount,SUM(t.received_amount)
-        allReceivedAmount,SUM(t.owe_amount) allOweAmount
+        select
+        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
+        sum(t.his_owe_received_amount) allHisOweReceivedAmount
         from report_fee_month_statistics t
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
@@ -382,6 +425,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -391,10 +440,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
     </select>
@@ -433,6 +482,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -442,10 +497,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
@@ -454,9 +509,16 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryReportFloorUnitFeeSummary" parameterType="Map" resultType="Map">
-        select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num floorNum, bu.unit_num unitNum,t.create_time
-        createTime,
-        SUM(t.receivable_amount) receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
+        select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num floorNum, bu.unit_num unitNum,max(t.update_time)
+        updateTime
+        <if test="configIds !=null">
+            ,t.config_id configId
+        </if>
+        ,SUM(t.his_owe_amount) hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
+        SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
+        hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
+        max(t.update_time) updateTime,sum(t.his_owe_amount+t.cur_receivable_amount) receivableAmount,
+        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount
         from report_fee_month_statistics t
         INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
         inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
@@ -488,6 +550,12 @@
         <if test="configId !=null and configId != ''">
             and t.config_id= #{configId}
         </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
@@ -497,13 +565,16 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
+        <if test="configIds !=null">
+            ,t.config_id
+        </if>
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -512,9 +583,8 @@
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryReportFloorUnitFeeSummaryMajor" parameterType="Map" resultType="Map">
         select
-        SUM(t.receivable_amount)
-        allReceivableAmount,SUM(t.received_amount)
-        allReceivedAmount,SUM(t.owe_amount) allOweAmount
+        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
+        sum(t.his_owe_received_amount) allHisOweReceivedAmount
         from report_fee_month_statistics t
         INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
         inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
@@ -554,20 +624,22 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
     </select>
 
+    <!--
+    and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+    -->
     <select id="queryFeeBreakdownCount" parameterType="Map" resultType="Map">
         select count(1) count
         from (
         select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,pfc.start_time feeCreateTime,t.create_time
-        createTime,SUM(t.receivable_amount)
-        receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
+        createTime
         from report_fee_month_statistics t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
@@ -576,7 +648,7 @@
         left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
         td.table_columns='fee_type_cd'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-        where t.status_cd = '0' and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+        where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
@@ -613,21 +685,31 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and pfc.start_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and pfc.start_time &lt;= #{endTime}
         </if>
+        <if test="yearMonth !=null and yearMonth != ''">
+            and concat(t.fee_year,t.fee_month) = #{yearMonth}
+        </if>
+
         group by t.config_id,t.fee_name,pfc.start_time
         ) t
     </select>
 
-    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03
+     and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+     -->
     <select id="queryFeeBreakdown" parameterType="Map" resultType="Map">
-        select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,pfc.start_time feeStartTime,pfc.end_time
-        feeEndTime,SUM(t.receivable_amount)
-        receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
+        select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,SUM(t.his_owe_amount)
+        hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
+        SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
+        hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
+        max(t.update_time) updateTime,sum(t.his_owe_amount+t.cur_receivable_amount) receivableAmount,
+        sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount,max(t.update_time)
+        updateTime
         from report_fee_month_statistics t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
@@ -636,7 +718,7 @@
         left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
         td.table_columns='fee_type_cd'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-        where t.status_cd = '0' and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+        where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
@@ -673,11 +755,14 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and pfc.start_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and pfc.start_time &lt;= #{endTime}
+        </if>
+        <if test="yearMonth !=null and yearMonth != ''">
+            and concat(t.fee_year,t.fee_month) = #{yearMonth}
         </if>
         group by t.config_id,t.fee_name,pfc.start_time
         order by t.create_time desc
@@ -685,11 +770,15 @@
             limit #{page}, #{row}
         </if>
     </select>
-    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0 -->
     <select id="queryFeeBreakdownMajor" parameterType="Map" resultType="Map">
-        select SUM(t.receivable_amount)
-        allReceivableAmount,SUM(t.received_amount)
-        allReceivedAmount,SUM(t.owe_amount) allOweAmount
+        select
+        SUM(t.his_owe_amount + t.cur_receivable_amount) allReceivableAmount,
+        SUM(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
+        if(SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount) &lt; 0,0,
+        SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount))
+        allOweAmount,
+        SUM(t.his_owe_received_amount) allHisOweReceivedAmount
         from report_fee_month_statistics t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
@@ -698,7 +787,7 @@
         left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
         td.table_columns='fee_type_cd'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
-        where t.status_cd = '0' and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
+        where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
@@ -735,11 +824,14 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and pfc.start_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and pfc.start_time &lt;= #{endTime}
+        </if>
+        <if test="yearMonth !=null and yearMonth != ''">
+            and concat(t.fee_year,t.fee_month) = #{yearMonth}
         </if>
         order by t.create_time desc
     </select>
@@ -788,10 +880,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,t.deadline_time
@@ -800,15 +892,17 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryFeeDetail" parameterType="Map" resultType="Map">
-        select t.obj_name objName,t.fee_name feeName,t.fee_create_time feeCreateTime,t.deadline_time
+        select t.obj_name objName,t.fee_name feeName,t.fee_create_time feeCreateTime,pfa.`value`
+        ownerName,br.built_up_area builtUpArea ,max(t.deadline_time)
         deadlineTime,t.create_time createTime,SUM(t.receivable_amount) receivableAmount,SUM(t.received_amount)
-        receivedAmount,SUM(t.owe_amount) oweAmount
+        receivedAmount,SUM(t.owe_amount) oweAmount,max(t.update_time) updateTime
         from report_fee_month_statistics t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        left join pay_fee_attrs pfa on pf.fee_id = pfa.fee_id and pfa.spec_cd = '390008' and pfa.status_cd ='0'
         where t.status_cd = '0' and t.receivable_amount >=0 and t.receivable_amount >= 0
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
@@ -843,13 +937,13 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
-        group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,t.deadline_time
+        group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,pfa.`value`,br.built_up_area
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -898,10 +992,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
     </select>
@@ -945,10 +1039,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         group by t.fee_name,t.payer_obj_id,t.payer_obj_name
@@ -959,13 +1053,15 @@
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryOweFeeDetail" parameterType="Map" resultType="Map">
         select t.payer_obj_name objName,t.fee_name feeName,pf.end_time feeCreateTime,t.update_time
-        updateTime,SUM(t.amount_owed) oweAmount,max(t.deadline_time) deadlineTime
+        updateTime,pfa.`value` ownerName,br.built_up_area builtUpArea ,SUM(t.amount_owed) oweAmount,max(t.deadline_time)
+        deadlineTime
         from report_owe_fee t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
         inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        left join pay_fee_attrs pfa on pf.fee_id = pfa.fee_id and pfa.spec_cd = '390008' and pfa.status_cd ='0'
         where 1=1
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
@@ -994,13 +1090,13 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
-        group by t.fee_name,t.payer_obj_id,t.payer_obj_name
+        group by t.fee_name,t.payer_obj_id,t.payer_obj_name,pfa.`value`,br.built_up_area
         HAVING oweAmount > 0
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
@@ -1043,10 +1139,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
     </select>
@@ -1064,11 +1160,8 @@
         left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
+        left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
         left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
         left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
         d.table_columns="prime_rate"
         left join t_dict d2 on pfc.fee_type_cd = d2.status_cd and d2.table_name = "pay_fee_config" and d2.table_columns
@@ -1118,10 +1211,10 @@
         <if test="feeTypeCd != null and feeTypeCd != ''">
             and pfc.fee_type_cd = #{feeTypeCd}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         ) t
@@ -1129,20 +1222,25 @@
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryPayFeeDetail" parameterType="Map" resultType="Map">
-        select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum,
+        select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,br.built_up_area
+        builtUpArea ,oc.car_num carNum,
         pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
         t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
         importFeeName,t.prime_rate,d.name primeRate,fdr.discount_small_type discountSmallType,fdr.rule_name
         ruleName,pfdd.discount_price discountPrice,co.contract_code contractCode,pfo.`value` ownerName,cb.o_id oId,
-        d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName,t.fee_id feeId,pft.`value` repairId
+        d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName,t.fee_id feeId,pft.`value` repairId,
+        t.detail_id,t.detail_id detailId,pf.payer_obj_id,pfb.value ownerId,concat(pa.num,'鍋滆溅鍦�',ps.num,'杞︿綅') psName
         from pay_fee_detail t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
         inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
+        left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
+        LEFT JOIN parking_space ps on oc.ps_id = ps.ps_id and ps.status_cd = '0'
+        left join parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
         left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
+        left join pay_fee_attrs pfb on t.fee_id = pfb.fee_id and pfb.spec_cd = '390007'
         left join pay_fee_attrs pfo on t.fee_id = pfo.fee_id and pfo.spec_cd = '390008'
         left join pay_fee_attrs pft on t.fee_id = pft.fee_id and pft.spec_cd = '390001'
         left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
@@ -1199,10 +1297,10 @@
         <if test="feeTypeCd != null and feeTypeCd != ''">
             and pfc.fee_type_cd = #{feeTypeCd}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         order by t.create_time desc
@@ -1258,10 +1356,10 @@
         <if test="primeRate != null and primeRate != ''">
             and t.prime_rate = #{primeRate}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
     </select>
@@ -1323,10 +1421,10 @@
         <if test="primeRate != null and primeRate != ''">
             and t.prime_rate = #{primeRate}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.create_time &lt;= #{endTime}
         </if>
         group by fdr.discount_small_type
@@ -1381,10 +1479,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.deadline_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.deadline_time &lt;= #{endTime}
         </if>
         ) t
@@ -1438,10 +1536,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime !=''">
             and t.deadline_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.deadline_time &lt;= #{endTime}
         </if>
         order by t.deadline_time
@@ -1467,10 +1565,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.end_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null and endTime != ''">
             and t.end_time &lt;= #{endTime}
         </if>
         ) t
@@ -1492,10 +1590,10 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null and startTime != ''">
             and t.end_time &gt;= #{startTime}
         </if>
-        <if test="endTime !=null">
+        <if test="endTime !=null  and endTime != ''">
             and t.end_time &lt;= #{endTime}
         </if>
         <if test="page != -1 and page != null ">
@@ -1758,6 +1856,7 @@
 
     <select id="queryRepairForStaff" parameterType="Map" resultType="Map">
         SELECT r.staff_id staffId,r.staff_name staffName,r.state FROM r_repair_user r
+        inner join u_user u on u.user_id = r.staff_id and u.status_cd = '0'
         WHERE r.state!='10005' AND r.state!='10009' AND r.state!='11000' AND
         r.state!='12000' AND r.state != '10007' AND r.status_cd = '0' AND
         r.repair_event != 'payUser' AND r.repair_event != 'startUser' AND r.staff_id != '-1'
@@ -1872,7 +1971,7 @@
         left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
         left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
         left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        left join owner_car oc on t.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
+        left join owner_car oc on t.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
         where 1 = 1
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
@@ -2104,7 +2203,8 @@
         from f_floor t
         left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
         left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and rfms.status_cd = '0'
+        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and
+        rfms.status_cd = '0'
         where t.status_cd = '0'
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -2121,7 +2221,8 @@
         from f_floor t
         left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
         left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-        inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and curT.status_cd = '0' and  curT.community_id = t.community_id
+        inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and
+        curT.status_cd = '0' and curT.community_id = t.community_id
         where t.status_cd = '0'
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -2149,7 +2250,8 @@
         from f_floor t
         left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
         left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and rfms.status_cd = '0'
+        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and
+        rfms.status_cd = '0'
         where t.status_cd = '0'
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -2166,7 +2268,8 @@
         from f_floor t
         left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
         left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-        inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and curT.status_cd = '0' and  curT.community_id = t.community_id
+        inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and
+        curT.status_cd = '0' and curT.community_id = t.community_id
         where t.status_cd = '0'
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -2195,19 +2298,20 @@
         select t.floor_num
         from f_floor t
         where 1=1
-            and t.community_id= #{communityId}
+        and t.community_id= #{communityId}
         GROUP BY t.floor_num
         ) tt
     </select>
 
     <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
     <select id="queryHuaningPayFee" parameterType="Map" resultType="Map">
-        select a.floorNum,f.receivableAmount,a.receivedAmount,b.receivedAmount1,c.receivedAmount2,d.receivedAmount3,e.receivedAmount4
+        select
+        a.floorNum,f.receivableAmount,a.receivedAmount,b.receivedAmount1,c.receivedAmount2,d.receivedAmount3,e.receivedAmount4
         from
         (select t.floor_num floorNum,sum(pfd.received_amount) receivedAmount
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
         where 1=1
@@ -2219,10 +2323,11 @@
         (select t.floor_num floorNum,sum(pfdm1.received_amount ) receivedAmount1
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm1 on  pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2232,10 +2337,11 @@
         (select t.floor_num floorNum,sum(pfdm2.received_amount ) receivedAmount2
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm2 on  pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month}
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2245,10 +2351,11 @@
         (select t.floor_num floorNum,sum(pfdm3.received_amount ) receivedAmount3
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm3 on  pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth}
+        LEFT JOIN pay_fee_detail_month pfdm3 on pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and
+        pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2258,10 +2365,11 @@
         (select t.floor_num floorNum,sum(pfdm4.received_amount ) receivedAmount4
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm4 on  pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and pfdm4.status_cd = '0' and pfdm4.detail_year &lt; #{year}
+        LEFT JOIN pay_fee_detail_month pfdm4 on pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and
+        pfdm4.status_cd = '0' and pfdm4.detail_year &lt; #{year}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2271,7 +2379,7 @@
         (select t.floor_num floorNum,SUM(rfms.receivable_amount) receivableAmount
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
         where t.community_id = #{communityId}
         and rfms.fee_year = #{year}
@@ -2297,7 +2405,7 @@
         (select t.floor_num floorNum,sum(pfd.received_amount) receivedAmount
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
         where 1=1
@@ -2309,10 +2417,11 @@
         (select t.floor_num floorNum,SUM(pfdm1.discount_amount) receivedAmount1
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm1 on  pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year =  #{year}  and pfdm1.detail_month &lt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2322,10 +2431,11 @@
         (select t.floor_num floorNum,SUM(pfdm2.received_amount) receivedAmount2
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm2 on  pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year =  #{year}  and pfdm2.detail_month &gt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month &gt; #{month}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2335,7 +2445,7 @@
         (select t.floor_num floorNum,SUM(rfms.owe_amount) receivableAmount
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
         where t.community_id= #{communityId}
         group by t.floor_num
@@ -2355,7 +2465,7 @@
         (select t.floor_num floorNum,sum(pfd.received_amount) receivedAmount
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
         where 1=1
@@ -2367,10 +2477,11 @@
         (select t.floor_num floorNum,SUM(pfdm1.discount_amount) receivedAmount1
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm1 on  pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year =  #{year}  and pfdm1.detail_month &lt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2380,10 +2491,11 @@
         (select t.floor_num floorNum,SUM(pfdm2.received_amount) receivedAmount2
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm2 on  pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year =  #{year}  and pfdm2.detail_month &gt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month &gt; #{month}
         where 1=1
         and t.status_cd = '0'
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
@@ -2393,7 +2505,7 @@
         (select t.floor_num floorNum,SUM(rfms.owe_amount) receivableAmount
         from f_floor t
         inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        inner JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
         where t.community_id= #{communityId}
         group by t.floor_num
@@ -2437,4 +2549,44 @@
             limit #{page}, #{row}
         </if>
     </select>
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
+    <select id="getReceivedAmountByMonth" parameterType="Map" resultType="Map">
+        select ifnull(sum(t.received_amount),0) total
+        from pay_fee_detail_month t
+        where
+        1=1
+        and t.create_time &gt; #{startTime}
+        and t.create_time &lt; #{endTime}
+        and t.fee_id = #{feeId}
+        <if test="flag == 1">
+            and concat(t.detail_year,t.detail_month) = #{yearMonth}
+        </if>
+        <if test="flag == 2">
+            and concat(t.detail_year,t.detail_month) &lt; #{yearMonth}
+        </if>
+        <if test="flag == 3">
+            and concat(t.detail_year,t.detail_month) &gt; #{yearMonth}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+    </select>
+
+    <!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
+    <select id="queryRoomAndParkingSpace" parameterType="Map" resultType="Map">
+        select
+        br.room_id roomId,br.room_num roomNum,bu.unit_num unitNum,f.floor_num floorNum,t.owner_id ownerId
+        from building_owner_room_rel t
+        left join building_room br on t.room_id = br.room_id and br.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        where t.status_cd = '0'
+        and t.owner_id in
+        <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
+
+
+
 </mapper>

--
Gitblit v1.8.0