java110 2 anos atrás
pai
commit
2e930963ed

+ 27 - 28
java110-db/src/main/resources/mapper/fee/FeeServiceDaoImplMapper.xml

@@ -282,35 +282,31 @@
     <!-- 查询费用数量 add by wuxw 2018-07-03 -->
     <select id="queryFeesCount" parameterType="Map" resultType="Map">
         select count(1) count
-        from pay_fee t,pay_fee_config pfc,t_dict td1,t_dict td2,t_dict td3,t_dict td4
+        from pay_fee t
+        INNER join pay_fee_config pfc on t.config_id = pfc.config_id and
+        pfc.status_cd = '0'
+        left join t_dict td1 on pfc.fee_type_cd = td1.status_cd and td1.table_name = 'pay_fee_config' and
+        td1.table_columns = 'fee_type_cd'
+        left join t_dict td2 on t.state = td2.status_cd and td2.table_name = 'pay_fee' and td2.table_columns = 'state'
+        left join t_dict td3 on pfc.fee_flag = td3.status_cd and td3.table_name = 'pay_fee' and td3.table_columns =
+        'fee_flag'
+        left join t_dict td4 on pfc.bill_type = td4.status_cd and td4.table_name = 'pay_fee_config' and
+        td4.table_columns = 'bill_type'
+        LEFT JOIN pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002' and pfa.status_cd = '0'
+        LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390010' and pfa1.status_cd = '0'
+        LEFT JOIN pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.spec_cd = '390008' and pfa2.status_cd = '0'
+        left join import_fee_detail ifd on t.fee_id = ifd.fee_id and ifd.status_cd = '0' and t.fee_flag = '2006012'
+        LEFT JOIN meter_water mw on t.fee_id = mw.fee_id and mw.status_cd = '0' and mw.community_id = t.community_id
         <if test="ownerId != null and ownerId != ''">
-            ,pay_fee_attrs pfao
+            LEFT JOIN pay_fee_attrs pfao on t.fee_id = pfao.fee_id and pfao.spec_cd = '390007' and pfao.status_cd = '0'
         </if>
         where 1 =1
-        and t.fee_type_cd = pfc.fee_type_cd
-        and t.config_id = pfc.config_id
-        and pfc.status_cd = '0'
-        and pfc.fee_type_cd = td1.status_cd
-        and td1.table_name = 'pay_fee_config'
-        and td1.table_columns = 'fee_type_cd'
-        and t.state = td2.status_cd
-        and td2.table_name = 'pay_fee'
-        and td2.table_columns = 'state'
-        and t.fee_flag = td3.status_cd
-        and td3.table_name = 'pay_fee'
-        and td3.table_columns = 'fee_flag'
-        and pfc.bill_type = td4.status_cd
-        and td4.table_name = 'pay_fee_config'
-        and td4.table_columns = 'bill_type'
-        <if test="ownerId != null and ownerId != ''">
-            and t.fee_id = pfao.fee_id
-            and pfao.spec_cd = '390007'
-            and pfao.status_cd = '0'
-            and pfao.value= #{ownerId}
-        </if>
         <if test="amount !=null and amount != ''">
             and t.amount= #{amount}
         </if>
+        <if test="ownerId !=null and ownerId != ''">
+            and pfao.value= #{ownerId}
+        </if>
         <if test="incomeObjId !=null and incomeObjId != ''">
             and t.income_obj_id= #{incomeObjId}
         </if>
@@ -323,7 +319,7 @@
                 #{item}
             </foreach>
         </if>
-        <if test="startTime !=null">
+        <if test="startTime !=null ">
             and t.start_time= #{startTime}
         </if>
         <if test="statusCd !=null and statusCd != ''">
@@ -335,12 +331,12 @@
         <if test="arrearsEndTime != null">
             and t.end_time &lt; #{arrearsEndTime}
         </if>
-        <if test="noArrearsEndTime != null">
-            and t.end_time &gt; #{noArrearsEndTime}
+        <if test="nowDate != null">
+            and t.end_time &gt; #{nowDate}
         </if>
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
-            and pfc.community_id= #{communityId}
+            and pfc.community_id in (#{communityId},'9999')
         </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
@@ -351,7 +347,7 @@
         <if test="payerObjId !=null and payerObjId != ''">
             and t.payer_obj_id= #{payerObjId}
         </if>
-        <if test="payerObjIds != null ">
+        <if test="payerObjIds != null and payerObjIds.length > 0">
             and t.payer_obj_id in
             <foreach collection="payerObjIds" item="item" open="(" close=")" separator=",">
                 #{item}
@@ -369,6 +365,9 @@
         <if test="payerObjType !=null and payerObjType != ''">
             and t.payer_obj_type = #{payerObjType}
         </if>
+        <if test="deductFrom !=null and deductFrom != ''">
+            and pfc.deduct_from = #{deductFrom}
+        </if>
 
     </select>