后台服务
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.

WxBillPropertyDepositMapper.xml 8.3 KiB

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