Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 

157 řádky
7.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.WxBillPropertyDepositMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillPropertyDeposit">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/>
  9. <result column="receive_pay" jdbcType="BIGINT" property="receivePay"/>
  10. <result column="pay" jdbcType="BIGINT" property="pay"/>
  11. <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" />
  12. <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" />
  13. <result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
  14. <result column="expired_day" jdbcType="INTEGER" property="expiredDay" />
  15. <result column="owe" jdbcType="BIGINT" property="owe"/>
  16. <result column="status" jdbcType="INTEGER" property="status" />
  17. <result column="is_del" jdbcType="INTEGER" property="isDel" />
  18. <result column="need_pay" jdbcType="INTEGER" property="needPay" />
  19. <result column="merchant_id" jdbcType="INTEGER" property="merchantId" />
  20. <result column="user_id" jdbcType="INTEGER" property="userId" />
  21. <result column="shop_id" jdbcType="INTEGER" property="shopId" />
  22. <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
  23. <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
  24. <result column="return_price" jdbcType="BIGINT" property="returnPrice"/>
  25. <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/>
  26. <result column="pay_way" jdbcType="INTEGER" property="payWay"/>
  27. <result column="freeze" property="freeze"/>
  28. <result column="service_charge_pay" property="serviceChargePay"/>
  29. <result column="merchant_name" property="merchantName"/>
  30. <result column="shop_number" property="shopNumber"/>
  31. </resultMap>
  32. <sql id="allColumns">
  33. `id`,`tenant_id`,`parent_tenant_id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,
  34. `pay_date`,`createtime`,`expired_day`,`owe`,`status`,`is_del`,`need_pay`,
  35. `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`return_price`,`shop_info`,`pay_way`,freeze,service_charge_pay
  36. </sql>
  37. <sql id="dynamicWhereConditions">
  38. where 1 = 1
  39. <if test=" null != id "> and `id` = #{id} </if>
  40. <if test=" null != tenantId and '' != tenantId">
  41. and `tenant_id` = #{tenantId}
  42. </if>
  43. <if test=" null != parentTenantId and '' != parentTenantId">
  44. and `parent_tenant_id` = #{parentTenantId}
  45. </if>
  46. <if test=" null != propertyContractId "> and `property_contract_id` = #{propertyContractId} </if>
  47. <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if>
  48. <if test=" null != pay "> and `pay` = #{pay} </if>
  49. <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if>
  50. <if test=" null != payDate "> and `pay_date` = #{payDate} </if>
  51. <if test=" null != createtime "> and `createtime` = #{createtime} </if>
  52. <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if>
  53. <if test=" null != owe "> and `owe` = #{owe} </if>
  54. <if test=" null != status "> and `status` = #{status} </if>
  55. <if test=" null != isDel "> and `is_del` = #{isDel} </if>
  56. <if test=" null != needPay "> and `need_pay` = #{needPay} </if>
  57. <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if>
  58. <if test=" null != userId "> and `user_id` = #{userId} </if>
  59. <if test=" null != shopId "> and `shop_id` = #{shopId} </if>
  60. <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if>
  61. <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
  62. <if test=" null != payWay ">and `pay_way` = #{payWay}</if>
  63. <if test=" null != ids ">
  64. and id in
  65. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  66. #{idItem}
  67. </foreach>
  68. </if>
  69. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  70. </sql>
  71. <select id="findList" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" resultMap="BaseResultMap">
  72. select <include refid="allColumns" /> from wx_bill_property_deposit
  73. <include refid="dynamicWhereConditions" />
  74. </select>
  75. <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxBillPropertyDeposit"
  76. resultMap="BaseResultMap">
  77. select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,
  78. br.`pay_date`,br.`createtime`,br.`expired_day`,br.`owe`,br.`status`,
  79. br.`need_pay`,m.`name` merchant_name,s.shop_number,br.`updatetime`,
  80. br.`merchant_id`,br.`rent_shop_type`,br.`return_price`,br.`shop_info`,br.pay_way,
  81. br.freeze,br.service_charge_pay
  82. from wx_bill_property_deposit br left join wx_merchant m on br.merchant_id=m.id
  83. left join wx_shop s on br.shop_id=s.id
  84. <where>
  85. <if test=" null != id ">and br.`id` = #{id}</if>
  86. <if test=" null != tenantId and '' != tenantId">
  87. and br.`tenant_id` = #{tenantId}
  88. </if>
  89. <if test=" null != parentTenantId and '' != parentTenantId">
  90. and br.`parent_tenant_id` = #{parentTenantId}
  91. </if>
  92. <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if>
  93. <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
  94. <if test=" null != status ">and br.`status` = #{status}</if>
  95. <if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
  96. <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
  97. <if test=" null != propertyContractId ">and br.`property_contract_id` = #{propertyContractId}</if>
  98. <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if>
  99. </where>
  100. order by id desc
  101. </select>
  102. <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap">
  103. select IFNULL((sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property_deposit
  104. where date_format(receive_date,'%Y-%m')=#{receiveDate}
  105. <if test=" null != tenantId and '' != tenantId">
  106. and `tenant_id` = #{tenantId}
  107. </if>
  108. <if test=" null != parentTenantId and '' != parentTenantId">
  109. and `parent_tenant_id` = #{parentTenantId}
  110. </if>
  111. group by tenant_id
  112. </select>
  113. <update id="updateNotPaidStatus" parameterType="hashmap">
  114. update wx_bill_property_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date)
  115. where status!=#{paid}
  116. <if test=" null != tenantId and '' != tenantId">
  117. and `tenant_id` = #{tenantId}
  118. </if>
  119. <if test=" null != parentTenantId and '' != parentTenantId">
  120. and `parent_tenant_id` = #{parentTenantId}
  121. </if>
  122. and status!=5 and DATEDIFF(now(),receive_date)>0
  123. </update>
  124. <update id="updateWaitPayStatus" parameterType="hashmap">
  125. update wx_bill_property_deposit set status=#{waitPay} where id in(
  126. select a.id from (select br.id,rc.receive_period,br.property_contract_id,br.receive_date from wx_bill_property_deposit br
  127. left join wx_property_contract rc on br.property_contract_id=rc.id
  128. where br.status!=#{paid}
  129. <if test=" null != tenantId and '' != tenantId">
  130. and br.`tenant_id` = #{tenantId}
  131. </if>
  132. <if test=" null != parentTenantId and '' != parentTenantId">
  133. and br.`parent_tenant_id` = #{parentTenantId}
  134. </if>
  135. and br.status!=5 and now() &lt; br.receive_date
  136. and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a)
  137. </update>
  138. <select id="queryOweCount" parameterType="com.iformall.domain.po.WxPropertyContract" resultType="Long">
  139. select count(*) from wx_property_contract r,wx_bill_property_deposit b
  140. where b.property_contract_id = r.id and b.status = 1
  141. <if test=" null != id ">and r.id = #{id}</if>
  142. <if test=" null != rentContractId ">and r.rent_contract_id = #{rentContractId}</if>
  143. </select>
  144. </mapper>