Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

131 строка
8.8 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} and bill.tenant_id=#{tenantId}
  25. <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
  26. <if test=" null != billTypeValue ">and bill.bill_type_value = #{billTypeValue}</if>
  27. <if test=" null != status ">and bill.`status` = #{status}</if>
  28. order by bill.id,bill.merchant_id
  29. </select>
  30. <select id="queryOweInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap">
  31. select count(bill.id) owncount,IFNULL(sum(bill.owe),0) owe from (
  32. 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
  33. union
  34. 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
  35. union
  36. 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
  37. union
  38. 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
  39. union
  40. 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
  41. union
  42. 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
  43. union
  44. 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
  45. ) bill
  46. where date_format(bill.receive_date,'%Y-%m')=#{month} and bill.tenant_id=#{tenantId}
  47. and bill.status=#{status}
  48. </select>
  49. <select id="queryPaidInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap">
  50. select count(bill.id) paycount,IFNULL(sum(bill.pay),0) pay from (
  51. 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
  52. union
  53. 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
  54. union
  55. 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
  56. union
  57. 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
  58. union
  59. 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
  60. union
  61. 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
  62. union
  63. 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
  64. ) bill
  65. where date_format(bill.receive_date,'%Y-%m')=#{month} and bill.tenant_id=#{tenantId}
  66. and bill.status=#{status}
  67. </select>
  68. <select id="listData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll">
  69. select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay,
  70. bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,bill.expired_day expiredDay,bill.status,
  71. bill.tenant_id tenantId,m.name merchantName,s.shop_number shopNumber,bill.starttime,bill.endtime,bill.name from (
  72. 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
  73. union
  74. 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
  75. union
  76. 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
  77. union
  78. 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
  79. union
  80. 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
  81. union
  82. 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
  83. union
  84. 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
  85. ) bill
  86. left join wx_merchant m on bill.merchant_id=m.id
  87. left join wx_shop s on bill.shop_id=s.id
  88. where bill.tenant_id=#{tenantId}
  89. <if test=" null != merchantId ">
  90. and bill.merchant_id=#{merchantId}
  91. </if>
  92. <if test=" null != statusList ">
  93. and bill.`status` in
  94. <foreach collection="statusList" index="index" item="status" open="(" separator="," close=")">
  95. #{status}
  96. </foreach>
  97. </if>
  98. <if test=" null != typeList ">
  99. and bill.`bill_type_value` in
  100. <foreach collection="typeList" index="index" item="type" open="(" separator="," close=")">
  101. #{type}
  102. </foreach>
  103. </if>
  104. <if test="null!=starttime and null!=endtime">
  105. and DATE_FORMAT(bill.receive_date,'%Y-%m') between #{starttime} and #{endtime}
  106. </if>
  107. <if test=" null != status ">
  108. and bill.status=#{status}
  109. </if>
  110. <if test=" null != billTypeValue ">
  111. and bill.bill_type_value=#{billTypeValue}
  112. </if>
  113. order by bill.merchant_id,bill.receive_date
  114. </select>
  115. </mapper>