Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

141 Zeilen
8.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.WxRentContractMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRentContract">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
  7. <result column="price" jdbcType="INTEGER" property="price"/>
  8. <result column="rental_start_date" jdbcType="TIMESTAMP" property="rentalStartDate"/>
  9. <result column="rental_end_date" jdbcType="TIMESTAMP" property="rentalEndDate"/>
  10. <result column="sign_date" jdbcType="TIMESTAMP" property="signDate"/>
  11. <result column="receive_period" jdbcType="INTEGER" property="receivePeriod"/>
  12. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  13. <result column="filepath" jdbcType="VARCHAR" property="filepath"/>
  14. <result column="status" jdbcType="INTEGER" property="status"/>
  15. <result column="contract_number" jdbcType="VARCHAR" property="contractNumber"/>
  16. <result column="deposit" jdbcType="VARCHAR" property="deposit"/>
  17. <result column="pay_date" jdbcType="INTEGER" property="payDate"/>
  18. <result column="is_del" jdbcType="INTEGER" property="isDel"/>
  19. <result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
  20. <result column="brand" jdbcType="VARCHAR" property="brand"/>
  21. <result column="business_id" jdbcType="BIGINT" property="businessId"/>
  22. <result column="shop_type" jdbcType="INTEGER" property="shopType"/>
  23. <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
  24. <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/>
  25. <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
  26. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  27. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  28. <result column="pay_account" jdbcType="VARCHAR" property="payAccount"/>
  29. <result column="filename" jdbcType="VARCHAR" property="filename"/>
  30. <result column="lease" jdbcType="INTEGER" property="lease"/>
  31. </resultMap>
  32. <sql id="allColumns">
  33. `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime`,`link_person`,`link_phone`,`pay_account`,`filename`,`lease`
  34. </sql>
  35. <sql id="dynamicWhereConditions">
  36. where 1 = 1
  37. <if test=" null != id ">and `id` = #{id}</if>
  38. <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if>
  39. <if test=" null != price ">and `price` = #{price}</if>
  40. <if test=" null != rentalStartDate ">and `rental_start_date` = #{rentalStartDate}</if>
  41. <if test=" null != rentalEndDate ">and `rental_end_date` = #{rentalEndDate}</if>
  42. <if test=" null != signDate ">and `sign_date` = #{signDate}</if>
  43. <if test=" null != receivePeriod ">and `receive_period` = #{receivePeriod}</if>
  44. <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if>
  45. <if test=" null != filepath ">and `filepath` = #{filepath}</if>
  46. <if test=" null != status ">and `status` = #{status}</if>
  47. <if test=" null != contractNumber ">and `contract_number` = #{contractNumber}</if>
  48. <if test=" null != deposit ">and `deposit` = #{deposit}</if>
  49. <if test=" null != payDate ">and `pay_date` = #{payDate}</if>
  50. <if test=" null != isDel ">and `is_del` = #{isDel}</if>
  51. <if test=" null != merchantName ">and `merchant_name` = #{merchantName}</if>
  52. <if test=" null != brand ">and `brand` = #{brand}</if>
  53. <if test=" null != businessId ">and `business_id` = #{businessId}</if>
  54. <if test=" null != shopType ">and `shop_type` = #{shopType}</if>
  55. <if test=" null != shopId ">and `shop_id` = #{shopId}</if>
  56. <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if>
  57. <if test=" null != createtime ">and `createtime` = #{createtime}</if>
  58. <if test=" null != linkPerson ">and `link_person` = #{linkPerson}</if>
  59. <if test=" null != linkPhone ">and `link_phone` = #{linkPhone}</if>
  60. <if test=" null != payAccount ">and `pay_account` = #{payAccount}</if>
  61. <if test=" null != filename ">and `filename` = #{filename}</if>
  62. <if test=" null != lease ">and `lease` = #{lease}</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.WxRentContract" resultMap="BaseResultMap">
  72. select
  73. <include refid="allColumns"/>
  74. from wx_rent_contract
  75. <include refid="dynamicWhereConditions"/>
  76. </select>
  77. <select id="queryRentContractData" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract">
  78. select rc.id,rc.merchant_name merchantName,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.`status`,
  79. rc.price,rc.contract_number contractNumber,s.shop_number shopNumber,f.floor_name floorName,b.building_name buildingName,
  80. rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate
  81. from wx_rent_contract rc
  82. left join wx_shop s on rc.shop_id=s.id
  83. left join wx_mall_floor f on s.floor=f.id
  84. left join wx_mall_building b on s.building=b.id
  85. <where>
  86. rc.tenant_id=#{tenantId}
  87. <if test=" null != merchantName and merchantName!=''">and rc.`merchant_name` like concat('%',#{merchantName},'%')</if>
  88. <if test=" null != shopNumber and shopNumber!=''">and s.`shop_number` like concat('%',#{shopNumber},'%')</if>
  89. <if test=" null != status ">and rc.`status` = #{status}</if>
  90. </where>
  91. order by rc.id desc
  92. </select>
  93. <select id="queryRentContractWaitSignStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
  94. select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status=#{status}
  95. </select>
  96. <select id="queryRentContractEndSoonStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
  97. select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and DATEDIFF(rental_end_date,now()) &lt;= 30
  98. </select>
  99. <select id="queryRentContractPaidStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
  100. select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_start_date &lt;= now() and rental_end_date >= now()
  101. </select>
  102. <select id="queryRentContractEndStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
  103. select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_end_date &lt;now()
  104. </select>
  105. <update id="updateRentContractEndSoonStatus" parameterType="com.iformall.domain.po.WxRentContract">
  106. update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and DATEDIFF(rental_end_date,now()) &lt;= 30
  107. </update>
  108. <update id="updateRentContractPaidStatus" parameterType="com.iformall.domain.po.WxRentContract">
  109. update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_start_date &lt;= now() and rental_end_date >= now()
  110. </update>
  111. <update id="updateRentContractEndStatus" parameterType="com.iformall.domain.po.WxRentContract">
  112. update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=1 and status!=6 and status!=7 and rental_end_date &lt;now()
  113. </update>
  114. <update id="updateRentWaitSignStatus" parameterType="com.iformall.domain.po.WxRentContract">
  115. update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=7 and merchant_id is null
  116. </update>
  117. <update id="updateRentInvalidStatus" parameterType="com.iformall.domain.po.WxRentContract">
  118. update wx_rent_contract set status=#{status} where shop_id in (
  119. select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and merchant_id is not null and status!=6
  120. )s) and merchant_id is null and tenant_id=#{tenantId}
  121. </update>
  122. </mapper>