You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

94 regels
4.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.WxBillSettleBillMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillSettleBill">
  5. <id column="id" property="id"/>
  6. <result column="tenant_id" property="tenantId"/>
  7. <result column="settle_id" property="settleId"/>
  8. <result column="type" property="type"/>
  9. <result column="bill_id" property="billId"/>
  10. <result column="bill_type" property="billType"/>
  11. <result column="createtime" property="createtime"/>
  12. <result column="updatetime" property="updatetime"/>
  13. <result column="billName" property="billName"/>
  14. <result column="receivePay" property="receivePay"/>
  15. </resultMap>
  16. <sql id="allColumns">
  17. `id`,`tenant_id`,`settle_id`,`type`,`bill_id`,`bill_type`
  18. ,`createtime`,`updatetime`
  19. </sql>
  20. <sql id="dynamicWhereConditions">
  21. where 1=1
  22. <if test=" null != id ">and `id` = #{id}</if>
  23. <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if>
  24. <if test=" null != ids ">
  25. and id in
  26. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  27. #{idItem}
  28. </foreach>
  29. </if>
  30. <if test=" null != sortColumns">order by ${sortColumns}</if>
  31. </sql>
  32. <select id="findList" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap">
  33. select
  34. <include refid="allColumns"/>
  35. from wx_bill_settle_bill
  36. <include refid="dynamicWhereConditions"/>
  37. </select>
  38. <select id="findBySettleId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap">
  39. select bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.receive_pay,0) receivePay from wx_bill_settle_bill bl left join
  40. (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金'
  41. bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent where is_preview = 0
  42. union all
  43. select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金'
  44. bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from
  45. wx_bill_rent_deposit
  46. union all
  47. select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费'
  48. bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from
  49. wx_bill_property where is_preview = 0
  50. union all
  51. select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金'
  52. bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from
  53. wx_bill_property_deposit
  54. union all
  55. select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as
  56. need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
  57. type=1
  58. union all
  59. select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as
  60. need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
  61. type=2
  62. union all
  63. select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费' bill_type,0 as
  64. need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
  65. type=3
  66. union all
  67. select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他费用' bill_type,0 as
  68. need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other
  69. union all
  70. select id,merchant_id,shop_id,tenant_id,8 bill_type_value,'其他押金' bill_type,0 as
  71. need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit
  72. ) bill
  73. on(bl.bill_id = bill.id)
  74. where 1=1
  75. <if test=" null != tenantId ">and bl.`tenant_id` = #{tenantId}</if>
  76. <if test=" null != settleId ">and bl.`settle_id` = #{settleId}</if>
  77. <if test=" null != type ">and bl.`type` = #{type}</if>
  78. </select>
  79. <update id="delBySettleId" parameterType="com.iformall.domain.po.WxBillSettle">
  80. delete from wx_bill_settle_bill where settle_id = #{id}
  81. </update>
  82. </mapper>