Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

461 righe
22 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.WxPropertyContractMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxPropertyContract">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
  7. <result column="decimal_size" jdbcType="INTEGER" property="decimalSize"/>
  8. <result column="price" jdbcType="VARCHAR" property="price"/>
  9. <result column="rental_start_date" jdbcType="TIMESTAMP" property="rentalStartDate"/>
  10. <result column="rental_end_date" jdbcType="TIMESTAMP" property="rentalEndDate"/>
  11. <result column="sign_date" jdbcType="TIMESTAMP" property="signDate"/>
  12. <result column="receive_period" jdbcType="INTEGER" property="receivePeriod"/>
  13. <result column="receive_period_unit" jdbcType="INTEGER" property="receivePeriodUnit"/>
  14. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  15. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  16. <result column="filepath" jdbcType="VARCHAR" property="filepath"/>
  17. <result column="status" jdbcType="INTEGER" property="status"/>
  18. <result column="contract_number" jdbcType="VARCHAR" property="contractNumber"/>
  19. <result column="deposit" jdbcType="VARCHAR" property="deposit"/>
  20. <result column="pay_date" jdbcType="INTEGER" property="payDate"/>
  21. <result column="is_del" jdbcType="INTEGER" property="isDel"/>
  22. <result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
  23. <result column="brand" jdbcType="VARCHAR" property="brand"/>
  24. <result column="business_id" jdbcType="INTEGER" property="businessId"/>
  25. <result column="shop_type" jdbcType="INTEGER" property="shopType"/>
  26. <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/>
  27. <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
  28. <result column="rent_area" jdbcType="VARCHAR" property="rentArea"/>
  29. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  30. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  31. <result column="pay_account" jdbcType="VARCHAR" property="payAccount"/>
  32. <result column="filename" jdbcType="VARCHAR" property="filename"/>
  33. <result column="lease" jdbcType="INTEGER" property="lease"/>
  34. <result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/>
  35. <result column="start_date" jdbcType="TIMESTAMP" property="startDate"/>
  36. <result column="end_date" jdbcType="TIMESTAMP" property="endDate"/>
  37. <result column="apply_status" property="applyStatus"/>
  38. <result column="adjust_period" jdbcType="INTEGER" property="adjustPeriod"/>
  39. <result column="business_type" property="businessType"/>
  40. <result column="adjust_ratio" property="adjustRatio"/>
  41. <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/>
  42. <result column="file_names" jdbcType="VARCHAR" property="fileNames"/>
  43. <result column="price_unit" property="priceUnit"/>
  44. <result column="rent_price" property="rentPrice"/>
  45. <result column="subject_name" property="subjectName"/>
  46. <result column="rent_start_type" property="rentStartType"/>
  47. <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
  48. <result column="fixed_price" jdbcType="INTEGER" property="fixedPrice"/>
  49. <result column="create_by" jdbcType="BIGINT" property="createBy"/>
  50. <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
  51. <result column="operation_type" property="operationType"/>
  52. <result column="late_pay_ratio" property="latePayRatio"/>
  53. <result column="late_pay_day" property="latePayDay"/>
  54. <result column="end_contract_time" jdbcType="TIMESTAMP" property="endContractTime"/>
  55. <result column="out_date_notify_days" jdbcType="INTEGER" property="outDateNotifyDays"/>
  56. <result column="out_date_notify_phone" jdbcType="VARCHAR" property="outDateNotifyPhone"/>
  57. <result column="create_type" jdbcType="INTEGER" property="createType"/>
  58. <result column="shop_ids" jdbcType="VARCHAR" property="shopIds"/>
  59. <result column="shop_numbers" jdbcType="VARCHAR" property="shopNumbers"/>
  60. <result column="price_detail" jdbcType="VARCHAR" property="priceDetail"/>
  61. <result column="fees_standards_info" jdbcType="VARCHAR" property="feesStandardsInfo"/>
  62. <result column="day_price_calcute" jdbcType="INTEGER" property="dayPriceCalcute"/>
  63. <result column="month_average_days" jdbcType="INTEGER" property="monthAverageDays"/>
  64. </resultMap>
  65. <sql id="allColumns">
  66. `id`,`merchant_id`,`decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`create_type`,`shop_ids`,`shop_numbers`,
  67. `sign_date`,`receive_period`,`tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`,`price_detail`,
  68. `deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`,`receive_period_unit`,`create_by`,`update_by`,
  69. `shop_type`,`updatetime`,`createtime`,`rent_area`,`rent_shop_type`,`fees_standards_info`,
  70. `link_person`,`link_phone`,`pay_account`,`filename`,`lease`,`rent_contract_id`,`day_price_calcute`,`month_average_days`,
  71. `start_date`,`end_date`,`apply_status`,`adjust_period`,`business_type`,adjust_ratio,`rent_info`,fixed_price,
  72. `file_names`,price_unit,rent_price,subject_name,rent_start_type,`operation_type`,late_pay_ratio,late_pay_day,end_contract_time,out_date_notify_days,out_date_notify_phone
  73. </sql>
  74. <sql id="dynamicWhereConditions">
  75. where 1 = 1
  76. <if test=" null != id ">and `id` = #{id}</if>
  77. <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if>
  78. <if test=" null != price ">and `price` = #{price}</if>
  79. <if test=" null != rentalStartDate ">and `rental_start_date` = #{rentalStartDate}</if>
  80. <if test=" null != rentalEndDate ">and `rental_end_date` = #{rentalEndDate}</if>
  81. <if test=" null != outDateNofity ">and out_date_notify_phone is not null and out_date_notify_phone != '' and and out_date_notify_days is not null and out_date_notify_days &gt; 0 </if>
  82. <if test=" null != signDate ">and `sign_date` = #{signDate}</if>
  83. <if test=" null != receivePeriod ">and `receive_period` = #{receivePeriod}</if>
  84. <if test=" null != receivePeriodUnit ">and `receive_period_unit` = #{receivePeriodUnit}</if>
  85. <if test=" null != tenantId and '' != tenantId">
  86. and `tenant_id` = #{tenantId}
  87. </if>
  88. <if test=" null != parentTenantId and '' != parentTenantId">
  89. and `parent_tenant_id` = #{parentTenantId}
  90. </if>
  91. <if test=" null != filepath ">and `filepath` = #{filepath}</if>
  92. <if test=" null != status ">and `status` = #{status}</if>
  93. <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if>
  94. <if test=" null != contractNumber and '' != contractNumber">and `contract_number` = #{contractNumber}</if>
  95. <if test=" null != deposit ">and `deposit` = #{deposit}</if>
  96. <if test=" null != payDate ">and `pay_date` = #{payDate}</if>
  97. <if test=" null != isDel ">and `is_del` = #{isDel}</if>
  98. <if test=" null != merchantName and '' != merchantName ">and `merchant_name` like concat('%', #{merchantName},'%') </if>
  99. <if test=" null != brand ">and `brand` = #{brand}</if>
  100. <if test=" null != businessId ">and `business_id` = #{businessId}</if>
  101. <if test=" null != shopType ">and `shop_type` = #{shopType}</if>
  102. <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if>
  103. <if test=" null != createtime ">and `createtime` = #{createtime}</if>
  104. <if test=" null != rentArea ">and `rent_area` = #{rentArea}</if>
  105. <if test=" null != linkPerson ">and `link_person` = #{linkPerson}</if>
  106. <if test=" null != linkPhone ">and `link_phone` = #{linkPhone}</if>
  107. <if test=" null != payAccount ">and `pay_account` = #{payAccount}</if>
  108. <if test=" null != filename ">and `filename` = #{filename}</if>
  109. <if test=" null != lease ">and `lease` = #{lease}</if>
  110. <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if>
  111. <if test=" null != startDate ">and `start_date` = #{startDate}</if>
  112. <if test=" null != endDate ">and `end_date` = #{endDate}</if>
  113. <if test=" null != rentShopType">and `rent_shop_type` = #{rentShopType}</if>
  114. <if test=" null != operationType ">and `operation_type` = #{operationType}</if>
  115. <if test=" null != createType ">and `create_type` = #{createType}</if>
  116. <if test=" null != dayPriceCalcute ">and `day_price_calcute` = #{dayPriceCalcute}</if>
  117. <if test=" null != monthAverageDays ">and `month_average_days` = #{monthAverageDays}</if>
  118. <if test=" null != businessForRule and '' != businessForRule ">
  119. and business_id in (${businessForRule})
  120. </if>
  121. <if test=" null != merchantIds ">
  122. and merchant_id in
  123. <foreach collection="merchantIds" index="index" item="mItem" open="(" separator="," close=")">
  124. #{mItem}
  125. </foreach>
  126. </if>
  127. <if test=" null != shopIdsQuery ">
  128. and
  129. <foreach collection="shopIdsQuery" index="index" item="shopidItem" open="(" separator="or" close=")">
  130. shop_ids like concat('%,', #{shopidItem},',%')
  131. </foreach>
  132. </if>
  133. <if test=" null != ids ">
  134. and id in
  135. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  136. #{idItem}
  137. </foreach>
  138. </if>
  139. <if test=" null != statuss ">
  140. and status in
  141. <foreach collection="statuss" index="index" item="statusItem" open="(" separator="," close=")">
  142. #{statusItem}
  143. </foreach>
  144. </if>
  145. <if test=" null != sortColumns">order by ${sortColumns}</if>
  146. </sql>
  147. <select id="findList" parameterType="com.iformall.domain.po.WxPropertyContract" resultMap="BaseResultMap">
  148. select
  149. <include refid="allColumns"/>
  150. from wx_property_contract
  151. <include refid="dynamicWhereConditions"/>
  152. </select>
  153. <!-- <select id="queryPropertyContractData" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract">
  154. select rc.id,rc.merchant_name merchantName,rc.rental_start_date rentalStartDate,rc.rental_end_date
  155. rentalEndDate,rc.`status`,rc.price,rc.contract_number contractNumber,s.shop_number shopNumber,
  156. f.floor_name floorName,b.building_name buildingName,receive_period receivePeriod,
  157. rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,
  158. start_date startDate,end_date endDate,rc.rent_contract_id rentContractId,br.`name` brandName,
  159. s.addr,rc.apply_status applyStatus,rc.adjust_period adjustPeriod,rc.business_type businessType,
  160. rc.adjust_ratio adjustRatio,rc.rent_info rentInfo, rc.file_names fileNames,rc.price_unit,rc.subject_name
  161. subjectName
  162. from wx_property_contract rc
  163. left join wx_shop s on rc.shop_id=s.id
  164. left join wx_mall_floor f on s.floor=f.id
  165. left join wx_mall_building b on s.building=b.id
  166. left join wx_brand br on rc.brand=br.id
  167. <where>
  168. <if test=" null != tenantId and '' != tenantId">
  169. and rc.`tenant_id` = #{tenantId}
  170. </if>
  171. <if test=" null != parentTenantId and '' != parentTenantId">
  172. and rc.`parent_tenant_id` = #{parentTenantId}
  173. </if>
  174. <if test=" null != merchantName and merchantName!=''">and rc.`merchant_name` like
  175. concat('%',#{merchantName},'%')
  176. </if>
  177. <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==1">
  178. and json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%')
  179. </if>
  180. <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==2">
  181. and s.`shop_number` like concat('%',#{shopNumber},'%')
  182. </if>
  183. <if test=" null != status ">and rc.`status` = #{status}</if>
  184. <if test=" null != rentContractId">and rc.`rent_contract_id` = #{rentContractId}</if>
  185. <if test=" null != id">and rc.`id` = #{id}</if>
  186. <if test=" null != rentShopType">and rc.`rent_shop_type` = #{rentShopType}</if>
  187. <if test=" null != applyStatus ">and rc.`apply_status` = #{applyStatus}</if>
  188. <if test=" null != building and ''!= building">and b.id = #{building}</if>
  189. <if test=" null != floor and ''!= floor">and f.id = #{floor}</if>
  190. <if test=" null != operationType ">and `operation_type` = #{operationType}</if>
  191. <if test=" null != businessForRule and '' != businessForRule ">
  192. and rc.business_id in (${businessForRule})
  193. </if>
  194. <if test="null != rentShopType and 1 == rentShopType and null != floorForRule and '' != floorForRule ">
  195. and rc.`id` in
  196. <foreach collection="tempShop" index="idx" separator=" union all " open="(" close=")">
  197. select id from wx_property_contract where 1=1
  198. <if test=" null != tenantId and '' != tenantId">
  199. and `tenant_id` = #{tenantId}
  200. </if>
  201. <if test=" null != parentTenantId and '' != parentTenantId">
  202. and `parent_tenant_id` = #{parentTenantId}
  203. </if>
  204. and json_unquote(json_extract(json_extract(rent_info,'$[*].shopId'),concat('$[',#{idx},']'))) in(select
  205. id from wx_shop where 1=1
  206. <if test=" null != tenantId and '' != tenantId">
  207. and `tenant_id` = #{tenantId}
  208. </if>
  209. <if test=" null != parentTenantId and '' != parentTenantId">
  210. and `parent_tenant_id` = #{parentTenantId}
  211. </if>
  212. and floor in (${floorForRule}))
  213. </foreach>
  214. </if>
  215. <if test="null != rentShopType and 2 == rentShopType and null != floorForRule and '' != floorForRule ">
  216. and rc.shop_id in (select id from wx_shop where 1=1
  217. <if test=" null != tenantId and '' != tenantId">
  218. and `tenant_id` = #{tenantId}
  219. </if>
  220. <if test=" null != parentTenantId and '' != parentTenantId">
  221. and `parent_tenant_id` = #{parentTenantId}
  222. </if>
  223. and floor in (${floorForRule}))
  224. </if>
  225. </where>
  226. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  227. <if test=" null == sortColumns">order by rc.createtime desc,rc.id desc</if>
  228. </select> -->
  229. <select id="queryRentContractWaitSignStatus" resultType="int"
  230. parameterType="com.iformall.domain.po.WxPropertyContract">
  231. select count(id) from wx_property_contract where status=#{status}
  232. <if test=" null != tenantId and '' != tenantId">
  233. and `tenant_id` = #{tenantId}
  234. </if>
  235. <if test=" null != parentTenantId and '' != parentTenantId">
  236. and `parent_tenant_id` = #{parentTenantId}
  237. </if>
  238. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  239. </select>
  240. <select id="queryRentContractEndSoonStatus" resultType="int"
  241. parameterType="com.iformall.domain.po.WxPropertyContract">
  242. select count(id) from wx_property_contract where status=4
  243. <if test=" null != tenantId and '' != tenantId">
  244. and `tenant_id` = #{tenantId}
  245. </if>
  246. <if test=" null != parentTenantId and '' != parentTenantId">
  247. and `parent_tenant_id` = #{parentTenantId}
  248. </if>
  249. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  250. </select>
  251. <select id="queryRentContractPaidStatus" resultType="int" parameterType="com.iformall.domain.po.WxPropertyContract">
  252. select count(id) from wx_property_contract where status in (2,3,4)
  253. <if test=" null != tenantId and '' != tenantId">
  254. and `tenant_id` = #{tenantId}
  255. </if>
  256. <if test=" null != parentTenantId and '' != parentTenantId">
  257. and `parent_tenant_id` = #{parentTenantId}
  258. </if>
  259. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  260. </select>
  261. <select id="queryRentContractEndStatus" resultType="int" parameterType="com.iformall.domain.po.WxPropertyContract">
  262. select count(id) from wx_property_contract where status!=1 and status!=6 and status!=7 and rental_end_date &lt;now()
  263. <if test=" null != tenantId and '' != tenantId">
  264. and `tenant_id` = #{tenantId}
  265. </if>
  266. <if test=" null != parentTenantId and '' != parentTenantId">
  267. and `parent_tenant_id` = #{parentTenantId}
  268. </if>
  269. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  270. </select>
  271. <update id="updateRentContractEndSoonStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
  272. update wx_property_contract set status=#{status} where status!=1 and status!=5 and status!=6 and status!=7
  273. <if test=" null != tenantId and '' != tenantId">
  274. and `tenant_id` = #{tenantId}
  275. </if>
  276. <if test=" null != parentTenantId and '' != parentTenantId">
  277. and `parent_tenant_id` = #{parentTenantId}
  278. </if>
  279. and DATEDIFF(rental_end_date,now()) &lt;= 30 and rental_end_date > now()
  280. </update>
  281. <update id="updateRentContractPaidStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
  282. update wx_property_contract set status=#{status} where status!=1 and status!=5 and status!=6 and status!=7
  283. <if test=" null != tenantId and '' != tenantId">
  284. and `tenant_id` = #{tenantId}
  285. </if>
  286. <if test=" null != parentTenantId and '' != parentTenantId">
  287. and `parent_tenant_id` = #{parentTenantId}
  288. </if>
  289. and rental_start_date &lt;= now() and rental_end_date >= now()
  290. </update>
  291. <update id="updateRentContractEndStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
  292. update wx_property_contract set status=#{status} where status!=1 and status!=5 and status!=6 and status!=7
  293. <if test=" null != tenantId and '' != tenantId">
  294. and `tenant_id` = #{tenantId}
  295. </if>
  296. <if test=" null != parentTenantId and '' != parentTenantId">
  297. and `parent_tenant_id` = #{parentTenantId}
  298. </if>
  299. and rental_end_date &lt;now()
  300. </update>
  301. <update id="updateRentWaitSignStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
  302. update wx_property_contract set status=#{status} where status!=7
  303. <if test=" null != tenantId and '' != tenantId">
  304. and `tenant_id` = #{tenantId}
  305. </if>
  306. <if test=" null != parentTenantId and '' != parentTenantId">
  307. and `parent_tenant_id` = #{parentTenantId}
  308. </if>
  309. and merchant_id is null
  310. </update>
  311. <!-- <update id="updateRentInvalidStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
  312. update wx_property_contract set status=#{status} where shop_id in (
  313. select s.shop_id from (SELECT shop_id FROM wx_property_contract WHERE merchant_id is not null and status!=6
  314. <if test=" null != tenantId and '' != tenantId">
  315. and `tenant_id` = #{tenantId}
  316. </if>
  317. <if test=" null != parentTenantId and '' != parentTenantId">
  318. and `parent_tenant_id` = #{parentTenantId}
  319. </if>
  320. )s) and merchant_id is null
  321. <if test=" null != tenantId and '' != tenantId">
  322. and `tenant_id` = #{tenantId}
  323. </if>
  324. <if test=" null != parentTenantId and '' != parentTenantId">
  325. and `parent_tenant_id` = #{parentTenantId}
  326. </if>
  327. </update> -->
  328. <!-- <select id="getRentContractListByShop" parameterType="hashmap" resultType="com.iformall.domain.po.WxRentContract">
  329. select rc.* from wx_rent_contract rc
  330. where rc.status not in(0,1,5,6,7,8)
  331. <if test=" null != tenantId and '' != tenantId">
  332. and rc.`tenant_id` = #{tenantId}
  333. </if>
  334. <if test=" null != parentTenantId and '' != parentTenantId">
  335. and rc.`parent_tenant_id` = #{parentTenantId}
  336. </if>
  337. and rc.id not in (select pc.rent_contract_id from (
  338. select rent_contract_id from wx_property_contract where status not in(5,6,7)
  339. <if test=" null != tenantId and '' != tenantId">
  340. and `tenant_id` = #{tenantId}
  341. </if>
  342. <if test=" null != parentTenantId and '' != parentTenantId">
  343. and `parent_tenant_id` = #{parentTenantId}
  344. </if>
  345. ) pc)
  346. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  347. </select> -->
  348. <!-- <select id="getRentContractListByPoint" parameterType="hashmap" resultType="com.iformall.domain.po.WxRentContract">
  349. select rc.*,s.shop_number from wx_rent_contract rc
  350. inner join wx_shop s on rc.shop_id=s.id
  351. where rc.status not in(0,1,5,6,7,8)
  352. <if test=" null != tenantId and '' != tenantId">
  353. and rc.`tenant_id` = #{tenantId}
  354. </if>
  355. <if test=" null != parentTenantId and '' != parentTenantId">
  356. and rc.`parent_tenant_id` = #{parentTenantId}
  357. </if>
  358. and rc.id not in (select pc.rent_contract_id from (
  359. select rent_contract_id from wx_property_contract where status not in(5,6,7)
  360. <if test=" null != tenantId and '' != tenantId">
  361. and `tenant_id` = #{tenantId}
  362. </if>
  363. <if test=" null != parentTenantId and '' != parentTenantId">
  364. and `parent_tenant_id` = #{parentTenantId}
  365. </if>
  366. ) pc)
  367. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  368. </select> -->
  369. <update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
  370. update wx_property_contract set apply_status=#{applyStatus}
  371. <if test=" null != businessType ">,business_type=#{businessType}</if>
  372. <if test=" null != status ">,status=#{status}</if>
  373. where id=#{id}
  374. </update>
  375. <update id="updateApplyStatusByRentContractId" parameterType="com.iformall.domain.po.WxPropertyContract">
  376. update wx_property_contract set apply_status=#{applyStatus}
  377. <if test=" null != businessType ">,business_type=#{businessType}</if>
  378. <if test=" null != status ">,status=#{status}</if>
  379. where rent_contract_id=#{rentContractId} and id = #{id}
  380. </update>
  381. <update id="updateStatus" parameterType="com.iformall.domain.po.WxPropertyContract">
  382. update wx_property_contract set status=#{status}
  383. <if test=" null != endContractTime ">
  384. ,end_contract_time = #{endContractTime}
  385. </if>
  386. where id=#{id}
  387. </update>
  388. <update id="updateStatusByRentContractId" parameterType="com.iformall.domain.po.WxPropertyContract">
  389. update wx_property_contract set status=#{status} where rent_contract_id=#{rentContractId}
  390. </update>
  391. <select id="queryOweCount" parameterType="com.iformall.domain.po.WxPropertyContract" resultType="Long">
  392. select count(1) from wx_property_contract r,wx_bill_property b
  393. where b.property_contract_id = r.id and b.status = 1
  394. <if test=" null != id ">and r.id = #{id}</if>
  395. <if test=" null != rentContractId ">and r.rent_contract_id = #{rentContractId}</if>
  396. </select>
  397. <select id="findOneByRentId" parameterType="com.iformall.domain.po.WxRentContract" resultType="com.iformall.domain.po.WxPropertyContract">
  398. select * from wx_property_contract where rent_contract_id =#{id} order by createtime desc limit 1
  399. </select>
  400. <select id="getByBill" parameterType="com.iformall.domain.po.WxAllBill" resultMap="BaseResultMap">
  401. select * from wx_property_contract where id in(
  402. select property_contract_id from wx_all_bill id = #{id}
  403. )
  404. </select>
  405. <update id="endContract" parameterType="com.iformall.domain.po.WxPropertyContract">
  406. update wx_property_contract set status=#{status},updatetime = #{updatetime},update_by = #{updateBy} where rent_contract_id =#{rentContractId}
  407. <if test=" null != statuss ">
  408. and status in
  409. <foreach collection="statuss" index="index" item="statusItem" open="(" separator="," close=")">
  410. #{statusItem}
  411. </foreach>
  412. </if>
  413. </update>
  414. <update id = "setEndContractTime" parameterType="com.iformall.domain.po.WxPropertyContract">
  415. update wx_property_contract set end_contract_time = #{endContractTime} where id = #{id}
  416. </update>
  417. <select id = "findToEndContractList" parameterType="com.iformall.domain.po.WxPropertyContract" resultMap="BaseResultMap">
  418. select
  419. <include refid="allColumns"/>
  420. from wx_property_contract
  421. where `tenant_id` = #{tenantId} and status = 3 and end_contract_time &lt;= now();
  422. </select>
  423. </mapper>