
{"param1":"select * from (select * from (SELECT td.`name` feeTypeCdName,pfc.fee_name feeName,oo.`name` payObjName, pfd.`detail_id` detailId,pfd.`cycles`,
 pfd.`receivable_amount` receivableAmount,pfd.`received_amount` receivedAmount,uu.`name` userName,pf.fee_id feeId,DATE_FORMAT(pfd.create_time,'%Y-%m-%d %H:%i:%s') createTime,td2.`name` primeRate  
FROM pay_fee pf,pay_fee_detail pfd,t_dict td,s_store ss,pay_fee_config pfc,t_dict td2,
  c_business cb,c_orders co,u_user uu,
  building_owner oo,building_owner_room_rel borr
WHERE pf.`fee_id` = pfd.`fee_id`
AND pf.`status_cd` = '0'
and pf.payer_obj_type = '3333'
and pf.config_id = pfc.config_id
and pfc.status_cd = '0'
AND pfc.`fee_type_cd` = td.`status_cd`
AND td.`table_name` = 'pay_fee_config'
AND td.`table_columns` = 'fee_type_cd'
AND pfd.`prime_rate` = td2.`status_cd`
AND td2.`table_name` = 'pay_fee_detail'
AND td2.`table_columns` = 'prime_rate'
AND pfd.`status_cd` = '0'
AND pfd.`b_id` = cb.`b_id`
AND cb.`o_id` = co.`o_id`
AND co.`user_id` = uu.`user_id`
AND pf.`income_obj_id` = ss.`store_id`
AND ss.`status_cd` = '0'
AND oo.`owner_id` = borr.`owner_id`
and oo.owner_type_cd = '1001'
AND oo.`status_cd` = '0'
AND borr.`room_id` = pf.`payer_obj_id`
AND borr.`status_cd` = '0'
<if test=\"storeId !=null and storeId !=''\">
and ss.`store_id` = #storeId#
</if>
<if test=\"startTime!=null \">
AND pfd.`create_time` &gt;= #startTime#
</if>
<if test=\"endTime !=null \">
AND pfd.`create_time` &lt;= #endTime#
</if>
<if test=\"communityId !=null and communityId != '' \">
AND pfd.`community_id` = #communityId#
</if>
<if test=\"configId !=null and configId !=''\">
AND pf.config_id = #configId#
</if>
<if test=\"primeRate!=null and primeRate!=''\">
AND pfd.prime_rate= #primeRate#
</if>) tc
union
select * from (
SELECT td.`name` feeTypeCdName,pfc.fee_name feeName,oo.`name` payObjName, pfd.`detail_id` detailId,pfd.`cycles`,
 pfd.`receivable_amount` receivableAmount,pfd.`received_amount` receivedAmount,uu.`name` userName,pf.fee_id feeId,DATE_FORMAT(pfd.create_time,'%Y-%m-%d %H:%i:%s') createTime,td2.`name` primeRate 
 FROM pay_fee pf,pay_fee_detail pfd,t_dict td,s_store ss,pay_fee_config pfc,t_dict td2,
  c_business cb,c_orders co,u_user uu,
  building_owner oo,owner_car oc
WHERE pf.`fee_id` = pfd.`fee_id`
AND pf.`status_cd` = '0'
and pf.payer_obj_type = '6666'
and pf.config_id = pfc.config_id
and pfc.status_cd = '0'
AND pfc.`fee_type_cd` = td.`status_cd`
AND td.`table_name` = 'pay_fee_config'
AND td.`table_columns` = 'fee_type_cd'
AND pfd.`prime_rate` = td2.`status_cd`
AND td2.`table_name` = 'pay_fee_detail'
AND td2.`table_columns` = 'prime_rate'
AND pfd.`status_cd` = '0'
AND pfd.`b_id` = cb.`b_id`
AND cb.`o_id` = co.`o_id`
AND co.`user_id` = uu.`user_id`
AND pf.`income_obj_id` = ss.`store_id`
AND ss.`status_cd` = '0'
AND oo.`owner_id` = oc.`owner_id`
and oo.owner_type_cd = '1001'
AND oo.`status_cd` = '0'
AND oc.car_id = pf.`payer_obj_id`
AND oc.`status_cd` = '0'
<if test=\"storeId !=null and storeId !=''\">
and ss.`store_id` = #storeId#
</if>
<if test=\"startTime!=null \">
AND pfd.`create_time` &gt;= #startTime#
</if>
<if test=\"endTime !=null \">
AND pfd.`create_time` &lt;= #endTime#
</if>
<if test=\"communityId !=null and communityId !='' \">
AND pfd.`community_id` = #communityId#
</if>
<if test=\"configId !=null and configId !=''\">
AND pf.`config_id` = #configId#
</if>
<if test=\"primeRate!=null and primeRate!=''\">
AND pfd.`prime_rate` = #primeRate#
</if>) rc)s 
order by createTime desc 
limit #page#,#row#",
"param2":"select sum(total) total from 
((SELECT count(1) total
 FROM pay_fee pf,pay_fee_detail pfd,t_dict td,s_store ss,pay_fee_config pfc,
  c_business cb,c_orders co,u_user uu,
  building_owner oo,building_owner_room_rel borr
WHERE pf.`fee_id` = pfd.`fee_id`
AND pf.`status_cd` = '0'
and pf.payer_obj_type = '3333'
and pf.config_id = pfc.config_id
and pfc.status_cd = '0'
AND pfc.`fee_type_cd` = td.`status_cd`
AND td.`table_name` = 'pay_fee_config'
AND td.`table_columns` = 'fee_type_cd'
AND pfd.`status_cd` = '0'
AND pfd.`b_id` = cb.`b_id`
AND cb.`o_id` = co.`o_id`
AND co.`user_id` = uu.`user_id`
AND pf.`income_obj_id` = ss.`store_id`
AND ss.`status_cd` = '0'
AND oo.`owner_id` = borr.`owner_id`
and oo.owner_type_cd = '1001'
AND oo.`status_cd` = '0'
AND borr.`room_id` = pf.`payer_obj_id`
AND borr.`status_cd` = '0'
<if test=\"storeId !=null and storeId !=''\">
and ss.`store_id` = #storeId#
</if>
<if test=\"startTime!=null \">
AND pfd.`create_time` &gt;= #startTime#
</if>
<if test=\"endTime !=null \">
AND pfd.`create_time` &lt;= #endTime#
</if>
<if test=\"communityId !=null and communityId != '' \">
AND pfd.`community_id` = #communityId#
</if>
<if test=\"primeRate!=null and primeRate!= '' \">
AND pfd.`prime_rate` = #primeRate#
</if>
<if test=\"configId !=null and configId !=''\">
AND pf.config_id = #configId#
</if>
)
union
(SELECT count(1) total
  FROM pay_fee pf,pay_fee_detail pfd,t_dict td,s_store ss,pay_fee_config pfc,
  c_business cb,c_orders co,u_user uu,
  building_owner oo,owner_car oc
WHERE pf.`fee_id` = pfd.`fee_id`
AND pf.`status_cd` = '0'
and pf.payer_obj_type = '6666'
and pf.config_id = pfc.config_id
and pfc.status_cd = '0'
AND pfc.`fee_type_cd` = td.`status_cd`
AND td.`table_name` = 'pay_fee_config'
AND td.`table_columns` = 'fee_type_cd'
AND pfd.`status_cd` = '0'
AND pfd.`b_id` = cb.`b_id`
AND cb.`o_id` = co.`o_id`
AND co.`user_id` = uu.`user_id`
AND pf.`income_obj_id` = ss.`store_id`
AND ss.`status_cd` = '0'
AND oo.`owner_id` = oc.`owner_id`
and oo.owner_type_cd = '1001'
AND oo.`status_cd` = '0'
AND oc.car_id = pf.`payer_obj_id`
AND oc.`status_cd` = '0'
<if test=\"storeId !=null and storeId !=''\">
and ss.`store_id` = #storeId#
</if>
<if test=\"startTime!=null \">
AND pfd.`create_time` &gt;= #startTime#
</if>
<if test=\"endTime !=null \">
AND pfd.`create_time` &lt;= #endTime#
</if>
<if test=\"communityId !=null and communityId !='' \">
AND pfd.`community_id` = #communityId#
</if>
<if test=\"primeRate!=null and primeRate!=''\">
AND pfd.`prime_rate` = #primeRate#
</if>
<if test=\"configId !=null and configId !=''\">
AND pf.`config_id` = #configId#
</if>
)) as t",
"param3":"select SUM(allReceivableAmount) allReceivableAmount,SUM(allReceivedAmount) allReceivedAmount from
((SELECT
SUM(pfd.`receivable_amount`) allReceivableAmount,SUM(pfd.`received_amount`) allReceivedAmount
FROM pay_fee pf,pay_fee_detail pfd,t_dict td,s_store ss,pay_fee_config pfc,t_dict td2,
  c_business cb,c_orders co,u_user uu,
  building_owner oo,building_owner_room_rel borr
WHERE pf.`fee_id` = pfd.`fee_id`
AND pf.`status_cd` = '0'
and pf.payer_obj_type = '3333'
and pf.config_id = pfc.config_id
and pfc.status_cd = '0'
AND pfc.`fee_type_cd` = td.`status_cd`
AND td.`table_name` = 'pay_fee_config'
AND td.`table_columns` = 'fee_type_cd'
AND pfd.`prime_rate` = td2.`status_cd`
AND td2.`table_name` = 'pay_fee_detail'
AND td2.`table_columns` = 'prime_rate'
AND pfd.`status_cd` = '0'
AND pfd.`b_id` = cb.`b_id`
AND cb.`o_id` = co.`o_id`
AND co.`user_id` = uu.`user_id`
AND pf.`income_obj_id` = ss.`store_id`
AND ss.`status_cd` = '0'
AND oo.`owner_id` = borr.`owner_id`
and oo.owner_type_cd = '1001'
AND oo.`status_cd` = '0'
AND borr.`room_id` = pf.`payer_obj_id`
AND borr.`status_cd` = '0' 
<if test=\"storeId !=null and storeId !=''\">
and ss.`store_id` = #storeId#
</if>
<if test=\"startTime!=null \">
AND pfd.`create_time` &gt;= #startTime#
</if>
<if test=\"endTime !=null \">
AND pfd.`create_time` &lt;= #endTime#
</if>
<if test=\"communityId !=null and communityId != '' \">
AND pfd.`community_id` = #communityId#
</if>
<if test=\"configId !=null and configId !=''\">
AND pf.config_id = #configId#
</if>
<if test=\"primeRate!=null and primeRate!=''\">
AND pfd.prime_rate= #primeRate#
</if>)
union
(SELECT 
SUM(pfd.`receivable_amount`) allReceivableAmount,SUM(pfd.`received_amount`) allReceivedAmount
FROM pay_fee pf,pay_fee_detail pfd,t_dict td,s_store ss,pay_fee_config pfc,t_dict td2,
  c_business cb,c_orders co,u_user uu,
  building_owner oo,owner_car oc
WHERE pf.`fee_id` = pfd.`fee_id`
AND pf.`status_cd` = '0'
and pf.payer_obj_type = '6666'
and pf.config_id = pfc.config_id
and pfc.status_cd = '0'
AND pfc.`fee_type_cd` = td.`status_cd`
AND td.`table_name` = 'pay_fee_config'
AND td.`table_columns` = 'fee_type_cd'
AND pfd.`prime_rate` = td2.`status_cd`
AND td2.`table_name` = 'pay_fee_detail'
AND td2.`table_columns` = 'prime_rate'
AND pfd.`status_cd` = '0'
AND pfd.`b_id` = cb.`b_id`
AND cb.`o_id` = co.`o_id`
AND co.`user_id` = uu.`user_id`
AND pf.`income_obj_id` = ss.`store_id`
AND ss.`status_cd` = '0'
AND oo.`owner_id` = oc.`owner_id`
and oo.owner_type_cd = '1001'
AND oo.`status_cd` = '0'
AND oc.car_id = pf.`payer_obj_id`
AND oc.`status_cd` = '0'
<if test=\"storeId !=null and storeId !=''\">
and ss.`store_id` = #storeId#
</if>
<if test=\"startTime!=null \">
AND pfd.`create_time` &gt;= #startTime#
</if>
<if test=\"endTime !=null \">
AND pfd.`create_time` &lt;= #endTime#
</if>
<if test=\"communityId !=null and communityId !='' \">
AND pfd.`community_id` = #communityId#
</if>
<if test=\"configId !=null and configId !=''\">
AND pf.`config_id` = #configId#
</if>
<if test=\"primeRate!=null and primeRate!=''\">
AND pfd.`prime_rate` = #primeRate#
</if>)) rt"
}