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

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