25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

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