25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

142 satır
9.1 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.iformall.mapper.WxBillAllMapper">
  4. <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap">
  5. select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay,
  6. bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,bill.expired_day expiredDay,bill.status,
  7. bill.tenant_id tenantId,m.name merchantName,s.shop_number shopNumber,bill.starttime,bill.endtime,bill.name from (
  8. select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_rent
  9. union
  10. select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_rent_deposit
  11. union
  12. select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_property
  13. union
  14. select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_property_deposit
  15. union
  16. select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type, '' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_daily where type=1
  17. union
  18. select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_daily where type=2
  19. union
  20. select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_other
  21. ) bill
  22. left join wx_merchant m on bill.merchant_id=m.id
  23. left join wx_shop s on bill.shop_id=s.id
  24. where date_format(bill.receive_date,'%Y-%m')=#{month}
  25. <if test=" null != tenantId ">
  26. and bill.tenant_id=#{tenantId}
  27. </if>
  28. <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
  29. <if test=" null != billTypeValue ">and bill.bill_type_value = #{billTypeValue}</if>
  30. <if test=" null != status ">and bill.`status` = #{status}</if>
  31. order by bill.id,bill.merchant_id
  32. </select>
  33. <select id="queryOweInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap">
  34. select count(bill.id) owncount,IFNULL(sum(bill.owe),0) owe from (
  35. select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent
  36. union
  37. select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent_deposit
  38. union
  39. select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property
  40. union
  41. select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property_deposit
  42. union
  43. select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type, '' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=1
  44. union
  45. select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=2
  46. union
  47. select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_other
  48. ) bill
  49. where date_format(bill.receive_date,'%Y-%m')=#{month} and bill.tenant_id=#{tenantId}
  50. and bill.status=#{status}
  51. </select>
  52. <select id="queryPaidInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap">
  53. select count(bill.id) paycount,IFNULL(sum(bill.pay),0) pay from (
  54. select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent
  55. union
  56. select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent_deposit
  57. union
  58. select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property
  59. union
  60. select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_property_deposit
  61. union
  62. select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type, '' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=1
  63. union
  64. select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=2
  65. union
  66. select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_other
  67. ) bill
  68. where date_format(bill.receive_date,'%Y-%m')=#{month} and bill.tenant_id=#{tenantId}
  69. and bill.status=#{status}
  70. </select>
  71. <select id="listData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll">
  72. select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay,
  73. bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,bill.expired_day expiredDay,bill.status,
  74. bill.tenant_id tenantId,m.name merchantName,s.shop_number shopNumber,bill.starttime,bill.endtime,bill.name,pb.pay_bill_status payBillStatus,
  75. pb.pay_time_end tradeTime,pb.transaction_id transactionId,pb.pay_amount payAmount from (
  76. select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime from wx_bill_rent
  77. union
  78. select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime from wx_bill_rent_deposit
  79. union
  80. select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime from wx_bill_property
  81. union
  82. select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime from wx_bill_property_deposit
  83. union
  84. select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type, '' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_daily where type=1
  85. union
  86. select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_daily where type=2
  87. union
  88. select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime from wx_bill_other
  89. ) bill
  90. left join wx_merchant m on bill.merchant_id=m.id
  91. left join wx_shop s on bill.shop_id=s.id
  92. left join wx_pay_bill pb on bill.id=pb.bill_id
  93. where 1=1
  94. <if test=" null != id ">
  95. and bill.id=#{id}
  96. </if>
  97. <if test=" null != tenantId ">
  98. and bill.tenant_id=#{tenantId}
  99. </if>
  100. <if test=" null != merchantId ">
  101. and bill.merchant_id=#{merchantId}
  102. </if>
  103. <if test=" null != statusList ">
  104. and bill.`status` in
  105. <foreach collection="statusList" index="index" item="status" open="(" separator="," close=")">
  106. #{status}
  107. </foreach>
  108. </if>
  109. <if test=" null != typeList ">
  110. and bill.`bill_type_value` in
  111. <foreach collection="typeList" index="index" item="type" open="(" separator="," close=")">
  112. #{type}
  113. </foreach>
  114. </if>
  115. <if test="null!=starttime and null!=endtime">
  116. and DATE_FORMAT(bill.receive_date,'%Y-%m') between #{starttime} and #{endtime}
  117. </if>
  118. <if test=" null != status ">
  119. and bill.status=#{status}
  120. </if>
  121. <if test=" null != billTypeValue ">
  122. and bill.bill_type_value=#{billTypeValue}
  123. </if>
  124. order by bill.merchant_id,bill.status,bill.receive_date desc
  125. </select>
  126. </mapper>