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.
 
 
 
 
 

421 lines
23 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="INTEGER" 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="INTEGER" 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. <result column="type" jdbcType="INTEGER" property="type"/>
  32. <result column="revenue" jdbcType="INTEGER" property="revenue"/>
  33. <result column="adjust_ratio" jdbcType="VARCHAR" property="adjustRatio"/>
  34. <result column="adjust_period" jdbcType="INTEGER" property="adjustPeriod"/>
  35. <result column="pay_ratio" jdbcType="INTEGER" property="payRatio"/>
  36. <result column="start_date" jdbcType="TIMESTAMP" property="startDate"/>
  37. <result column="end_date" jdbcType="TIMESTAMP" property="endDate"/>
  38. <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/>
  39. <result column="bank_name" jdbcType="VARCHAR" property="bankName"/>
  40. <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
  41. <result column="fix_start_date" property="fixStartDate"/>
  42. <result column="fix_end_date" property="fixEndDate"/>
  43. <result column="business_type" property="businessType"/>
  44. <result column="receive_period" property="receivePeriod"/>
  45. <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/>
  46. <result column="file_names" jdbcType="VARCHAR" property="fileNames"/>
  47. <result column="price_unit" property="priceUnit"/>
  48. <result column="rent_price" property="rentPrice"/>
  49. <result column="subject_name" property="subjectName"/>
  50. <result column="rent_start_type" property="rentStartType"/><result column="type" jdbcType="INTEGER" property="type"/>
  51. <result column="revenue" jdbcType="INTEGER" property="revenue"/>
  52. <result column="adjust_ratio" jdbcType="VARCHAR" property="adjustRatio"/>
  53. <result column="adjust_period" jdbcType="INTEGER" property="adjustPeriod"/>
  54. <result column="pay_ratio" jdbcType="INTEGER" property="payRatio"/>
  55. <result column="start_date" jdbcType="TIMESTAMP" property="startDate"/>
  56. <result column="end_date" jdbcType="TIMESTAMP" property="endDate"/>
  57. <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/>
  58. <result column="bank_name" jdbcType="VARCHAR" property="bankName"/>
  59. <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
  60. <result column="fix_start_date" property="fixStartDate"/>
  61. <result column="fix_end_date" property="fixEndDate"/>
  62. <result column="business_type" property="businessType"/>
  63. <result column="receive_period" property="receivePeriod"/>
  64. <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/>
  65. <result column="file_names" jdbcType="VARCHAR" property="fileNames"/>
  66. <result column="price_unit" property="priceUnit"/>
  67. <result column="rent_price" property="rentPrice"/>
  68. <result column="subject_name" property="subjectName"/>
  69. <result column="rent_start_type" property="rentStartType"/>
  70. <result column="rent_input_way" property="rentInputWay"/>
  71. <result column="adjust_ratio_way" property="adjustRatioWay"/>
  72. <result column="operation_type" property="operationType"/>
  73. <result column="late_pay_ratio" property="latePayRatio"/>
  74. <result column="late_pay_day" property="latePayDay"/>
  75. <result column="bus_discount_ratio" property="busDiscountRatio"/>
  76. <result column="bus_discount_time" property="busDiscountTime"/>
  77. </resultMap>
  78. <sql id="allColumns">
  79. `id`,`merchant_id`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,
  80. `tenant_id`,`filepath`,`status`,`contract_number`,`deposit`,`pay_date`,`is_del`,`merchant_name`,
  81. `brand`,`business_id`,`shop_type`,`shop_id`,`updatetime`,`createtime`,`link_person`,`link_phone`,
  82. `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`,
  83. `start_date`,`end_date`,
  84. `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`,
  85. `business_type`,`rent_info`, `file_names`,price_unit,rent_price,`subject_name`,rent_start_type,
  86. `rent_input_way`,`adjust_ratio_way`,`operation_type`,late_pay_ratio,late_pay_day,bus_discount_ratio,bus_discount_time
  87. </sql>
  88. <sql id="dynamicWhereConditions">
  89. where 1 = 1
  90. <if test=" null != id ">and `id` = #{id}</if>
  91. <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if>
  92. <if test=" null != price ">and `price` = #{price}</if>
  93. <if test=" null != rentalStartDate ">and `rental_start_date` = #{rentalStartDate}</if>
  94. <if test=" null != rentalEndDate ">and `rental_end_date` = #{rentalEndDate}</if>
  95. <if test=" null != signDate ">and `sign_date` = #{signDate}</if>
  96. <if test=" null != receivePeriod ">and `receive_period` = #{receivePeriod}</if>
  97. <if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if>
  98. <if test=" null != filepath ">and `filepath` = #{filepath}</if>
  99. <if test=" null != status ">and `status` = #{status}</if>
  100. <if test=" null != contractNumber ">and `contract_number` = #{contractNumber}</if>
  101. <if test=" null != deposit ">and `deposit` = #{deposit}</if>
  102. <if test=" null != payDate ">and `pay_date` = #{payDate}</if>
  103. <if test=" null != isDel ">and `is_del` = #{isDel}</if>
  104. <if test=" null != merchantName ">and `merchant_name` = #{merchantName}</if>
  105. <if test=" null != brand ">and `brand` = #{brand}</if>
  106. <if test=" null != businessId ">and `business_id` = #{businessId}</if>
  107. <if test=" null != shopType ">and `shop_type` = #{shopType}</if>
  108. <if test=" null != shopId ">and `shop_id` = #{shopId}</if>
  109. <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if>
  110. <if test=" null != createtime ">and `createtime` = #{createtime}</if>
  111. <if test=" null != linkPerson ">and `link_person` = #{linkPerson}</if>
  112. <if test=" null != linkPhone ">and `link_phone` = #{linkPhone}</if>
  113. <if test=" null != payAccount ">and `pay_account` = #{payAccount}</if>
  114. <if test=" null != filename ">and `filename` = #{filename}</if>
  115. <if test=" null != lease ">and `lease` = #{lease}</if>
  116. <if test=" null != type ">and `type` = #{type}</if>
  117. <if test=" null != startDate ">and `start_date` = #{startDate}</if>
  118. <if test=" null != endDate ">and `end_date` = #{endDate}</if>
  119. <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
  120. <if test=" null != operationType ">and `operation_type` = #{operationType}</if>
  121. <if test=" null != ids ">
  122. and id in
  123. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  124. #{idItem}
  125. </foreach>
  126. </if>
  127. <if test=" null != sortColumns">order by ${sortColumns}</if>
  128. </sql>
  129. <select id="findList" parameterType="com.iformall.domain.po.WxRentContract" resultMap="BaseResultMap">
  130. select
  131. <include refid="allColumns"/>
  132. from wx_rent_contract
  133. <include refid="dynamicWhereConditions"/>
  134. </select>
  135. <select id="queryRentContractData" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract">
  136. select rc.id,rc.merchant_name merchantName,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.`status`,
  137. rc.price,rc.contract_number contractNumber,s.shop_number shopNumber,f.floor_name floorName,b.building_name buildingName,
  138. rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type,
  139. rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name
  140. bankName,rc.rent_shop_type rentShopType,rc.fix_start_date fixStartDate,rc.fix_end_date fixEndDate
  141. ,rc.business_type businessType,rc.adjust_period adjustPeriod,rc.rent_info rentInfo, rc.file_names
  142. fileNames,rc.price_unit,rc.subject_name subjectName,rc.`rent_input_way` rentInputWay,rc.`adjust_ratio_way`
  143. adjustRatioWay,rc.bus_discount_ratio,rc.bus_discount_time
  144. from wx_rent_contract rc
  145. left join wx_shop s on rc.shop_id=s.id
  146. left join wx_mall_floor f on s.floor=f.id
  147. left join wx_mall_building b on s.building=b.id
  148. left join wx_brand br on rc.brand=br.id
  149. <where>
  150. rc.tenant_id=#{tenantId}
  151. <if test=" null != merchantName and merchantName!=''">and rc.`merchant_name` like concat('%',#{merchantName},'%')</if>
  152. <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==1">
  153. and json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%')
  154. </if>
  155. <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==2">
  156. and s.`shop_number` like concat('%',#{shopNumber},'%')
  157. </if>
  158. <if test=" null != status ">and rc.`status` = #{status}</if>
  159. <if test=" null != shopId">and rc.`shop_id` = #{shopId}</if>
  160. <if test=" null != type ">and rc.`type` = #{type}</if>
  161. <if test=" null != rentShopType ">and rc.`rent_shop_type` = #{rentShopType}</if>
  162. <if test=" null != applyStatus ">and rc.`apply_status` = #{applyStatus}</if>
  163. <if test=" null != building and ''!= building">and b.id = #{building}</if>
  164. <if test=" null != floor and ''!= floor">and f.id = #{floor}</if>
  165. <if test=" null != operationType ">and `operation_type` = #{operationType}</if>
  166. <if test=" null != businessForRule and '' != businessForRule ">
  167. and rc.business_id in (${businessForRule})
  168. </if>
  169. <if test="null != rentShopType and 1 == rentShopType and null != floorForRule and '' != floorForRule ">
  170. and rc.`id` in
  171. <foreach collection="tempShop" index="idx" separator=" union all " open="(" close=")">
  172. select id from wx_rent_contract where tenant_id=#{tenantId} and
  173. json_unquote(json_extract(json_extract(rent_info,'$[*].shopId'),concat('$[',#{idx},']'))) in(select
  174. id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule}))
  175. </foreach>
  176. </if>
  177. <if test="null != rentShopType and 2 == rentShopType and null != floorForRule and '' != floorForRule ">
  178. and rc.shop_id in (select id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule}))
  179. </if>
  180. </where>
  181. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  182. <if test=" null == sortColumns"> order by rc.createtime desc,rc.id desc </if>
  183. </select>
  184. <select id="queryRentContractWaitSignStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
  185. select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status=#{status}
  186. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  187. </select>
  188. <select id="queryRentContractEndSoonStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
  189. select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status=4
  190. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  191. </select>
  192. <select id="queryRentContractPaidStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
  193. select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status in (2,3,4)
  194. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  195. </select>
  196. <select id="queryRentContractEndStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
  197. select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=0 and status!=1 and status!=6 and
  198. status!=7
  199. and rental_end_date &lt;now()
  200. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  201. </select>
  202. <update id="updateRentContractEndSoonStatus" parameterType="com.iformall.domain.po.WxRentContract">
  203. update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=0 and status!=5 and status!=1 and status!=6 and status!=7 and DATEDIFF(rental_end_date,now()) &lt;= 30 and rental_end_date > now()
  204. </update>
  205. <update id="updateRentContractPaidStatus" parameterType="com.iformall.domain.po.WxRentContract">
  206. update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=0 and status!=1 and status!=5 and status!=6 and status!=7 and rental_start_date &lt;= now() and rental_end_date >= now()
  207. </update>
  208. <update id="updateRentContractEndStatus" parameterType="com.iformall.domain.po.WxRentContract">
  209. update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=0 and status!=1 and status!=5 and status!=6 and status!=7 and rental_end_date &lt;now()
  210. </update>
  211. <update id="updateRentWaitSignStatus" parameterType="com.iformall.domain.po.WxRentContract">
  212. update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and status!=0 and status!=5 and status!=6 and status!=7 and merchant_id is null
  213. </update>
  214. <update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxRentContract">
  215. update wx_rent_contract
  216. set apply_status=#{applyStatus}
  217. <if test=" null != businessType ">,business_type=#{businessType}</if>
  218. <if test=" null != status ">,status=#{status}</if>
  219. where id=#{id}
  220. </update>
  221. <update id="updateStatus" parameterType="com.iformall.domain.po.WxRentContract">
  222. update wx_rent_contract set status=#{status} where id=#{id}
  223. </update>
  224. <update id="updateRentInvalidStatus" parameterType="com.iformall.domain.po.WxRentContract">
  225. update wx_rent_contract set status=#{status} where shop_id in (
  226. select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(2,3,4)
  227. )s) and status in(0,1) and status!=7 and tenant_id=#{tenantId} and rent_shop_type=2
  228. </update>
  229. <select id="getRentContractList" parameterType="com.iformall.domain.po.WxRentContract"
  230. resultType="com.iformall.domain.po.WxRentContract">
  231. select s.shop_id,s.shop_number,s.building_name building, s.floor_name floor,s.build_area,rc.* from (
  232. select s.id shop_id,ms.merchant_id,s.shop_number,b.building_name,f.floor_name,s.build_area
  233. from wx_shop s
  234. left join wx_mall_building b on s.building=b.id
  235. left join wx_mall_floor f on s.floor=f.id
  236. left join wx_merchant_shop ms on s.id=ms.shop_id
  237. where ms.is_del=0) s
  238. inner join (select * from wx_rent_contract where status in(2,3,4)) rc on s.merchant_id=rc.merchant_id
  239. where rc.tenant_id=#{tenantId}
  240. order by rc.id desc
  241. </select>
  242. <select id="updateStatusForUnsign" parameterType="com.iformall.domain.po.WxRentContract">
  243. update wx_rent_contract set status=1 where tenant_id=#{tenantId} and status=2 and merchant_id is null
  244. </select>
  245. <select id="getRentInvalidList" parameterType="com.iformall.domain.po.WxRentContract"
  246. resultType="com.iformall.domain.po.WxRentContract">
  247. select id from wx_rent_contract where shop_id in (
  248. select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(2,3,4)
  249. )s) and status in(0,1) and status!=7 and tenant_id=#{tenantId} and apply_status=1
  250. </select>
  251. <select id="queryOweCount" parameterType="com.iformall.domain.po.WxRentContract" resultType="Long">
  252. select count(*) from wx_rent_contract r,wx_bill_rent b
  253. where b.rent_contract_id = r.id and b.status = 1 and r.id = #{id}
  254. </select>
  255. <select id="getMerchants" parameterType="com.iformall.domain.po.WxRentContract"
  256. resultType="com.iformall.domain.po.WxRentContract">
  257. select * from wx_rent_contract where status in(2,3,4)
  258. and merchant_id not in(select merchant_id from wx_property_contract where status in(2,3,4))
  259. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  260. </select>
  261. <select id="selectRentContractCountByShopId" parameterType="com.iformall.domain.po.WxRentContract" resultType="int">
  262. select count(*) from wx_rent_contract where tenant_id=#{tenantId} and json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"')) and status in (2,3,4)
  263. <if test="id!=null">
  264. and id!=#{id}
  265. </if>
  266. </select>
  267. <select id="selectRentContractByShopId" parameterType="com.iformall.domain.po.WxRentContract"
  268. resultType="com.iformall.domain.po.WxRentContract">
  269. select * from wx_rent_contract where tenant_id=#{tenantId} and
  270. json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"')) and rent_shop_type =1
  271. <if test=" null != status ">and status=#{status} and status!=7</if>
  272. </select>
  273. <update id="updateInvalidContract" parameterType="com.iformall.domain.po.WxRentContract">
  274. update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and id in(select r.id from (
  275. select id from wx_rent_contract where json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"'))
  276. and rent_shop_type=1 and status in(0,1) and status!=7)r)
  277. </update>
  278. <select id="selectRentContractByMerchantId" parameterType="com.iformall.domain.po.WxRentContract"
  279. resultType="com.iformall.domain.po.WxRentContract">
  280. select * from wx_rent_contract
  281. where status in(2,3,4)
  282. and merchant_id = #{merchantId}
  283. </select>
  284. <select id="hasContractNumber" parameterType="com.iformall.domain.po.WxRentContract"
  285. resultType="int">
  286. select count(*) from (
  287. select * from wx_rent_contract where tenant_id=#{tenantId}
  288. and contract_number=#{contractNumber}
  289. and status not in(5,6,7)
  290. union
  291. select * from wx_rent_contract where tenant_id=#{tenantId}
  292. and contract_number=#{contractNumber}
  293. and apply_status in(1,2)
  294. ) r
  295. <where>
  296. <if test="id!=null and id!=''">
  297. r.id!=#{id}
  298. </if>
  299. </where>
  300. </select>
  301. <select id="getShopType" parameterType="com.iformall.domain.po.WxRentContract" resultType="int">
  302. select s.type from wx_rent_contract r left join wx_shop s on(s.id = r.`shop_id`)
  303. where r.id = #{id}
  304. </select>
  305. <resultMap id="contractMap" type="com.iformall.domain.vo.WxRentPropertyContractVo">
  306. <id column="id" property="id"/>
  307. <result column="contract_number" property="contractNumber"/>
  308. <result column="shop_number" property="shopNumber"/>
  309. <result column="merchant_name" property="merchantName"/>
  310. <result column="rent_info" property="rentInfo"/>
  311. <result column="rental_start_date" property="rentalStartDate"/>
  312. <result column="rental_end_date" property="rentalEndDate"/>
  313. <result column="rent_price" property="rentPrice"/>
  314. <result column="property_price" property="propertyPrice"/>
  315. <result column="type" property="type"/>
  316. <result column="status" property="status"/>
  317. <result column="apply_status" property="applyStatus"/>
  318. <result column="operation_type" property="operationType"/>
  319. <result column="rent_shop_type" property="rentShopType"/>
  320. <result column="merchant_id" property="merchantId"/>
  321. <result column="property_status" property="propertyStatus"/>
  322. <result column="rent_price_unit" property="rentPriceUnit"/>
  323. <result column="property_price_unit" property="propertyPriceUnit"/>
  324. <result column="bus_discount_time" property="busDiscountTime"/>
  325. <result column="bus_discount_ratio" property="busDiscountRatio"/>
  326. </resultMap>
  327. <select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap">
  328. select rc.id,rc.merchant_name,rc.rental_start_date,rc.rental_end_date,rc.`status`,
  329. rc.price as rent_price,rc.contract_number,s.shop_number,rc.type,rc.apply_status,
  330. rc.rent_shop_type,rc.rent_info,pc.price as property_price,rc.merchant_id,pc.`status` as property_status,
  331. rc.price_unit as rent_price_unit,pc.price_unit as property_price_unit,
  332. rc.business_type businessType,rc.bus_discount_ratio,rc.bus_discount_time
  333. from wx_rent_contract rc left join wx_property_contract pc on rc.id=pc.rent_contract_id
  334. left join wx_shop s on rc.shop_id=s.id
  335. <where>
  336. rc.tenant_id=#{tenantId}
  337. <if test=" null != merchantName and merchantName!=''">and rc.`merchant_name` like
  338. concat('%',#{merchantName},'%')
  339. </if>
  340. <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==1">
  341. and json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%')
  342. </if>
  343. <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==2">
  344. and s.`shop_number` like concat('%',#{shopNumber},'%')
  345. </if>
  346. <if test=" null != status ">and rc.`status` = #{status}</if>
  347. <if test=" null != type ">and rc.`type` = #{type}</if>
  348. <if test=" null != rentShopType ">
  349. and rc.`rent_shop_type` = #{rentShopType}
  350. </if>
  351. <if test=" null != applyStatus ">and rc.`apply_status` = #{applyStatus}</if>
  352. <if test=" null != operationType ">and rc.`operation_type` = #{operationType}</if>
  353. <if test=" null != businessForRule and '' != businessForRule ">
  354. and rc.business_id in (${businessForRule})
  355. </if>
  356. <if test="null != rentShopType and 1 == rentShopType and null != floorForRule and '' != floorForRule ">
  357. and rc.`id` in
  358. <foreach collection="tempShop" index="idx" separator=" union all " open="(" close=")">
  359. select id from wx_rent_contract where tenant_id=#{tenantId} and
  360. json_unquote(json_extract(json_extract(rent_info,'$[*].shopId'),concat('$[',#{idx},']'))) in(select
  361. id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule}))
  362. </foreach>
  363. </if>
  364. <if test="null != rentShopType and 2 == rentShopType and null != floorForRule and '' != floorForRule ">
  365. and rc.shop_id in (select id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule}))
  366. </if>
  367. </where>
  368. <if test=" null != sortColumns">order by ${sortColumns}</if>
  369. <if test=" null == sortColumns">order by rc.createtime desc,rc.id desc</if>
  370. </select>
  371. <select id="getByBill" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap">
  372. select * from wx_rent_contract where id in(
  373. select rent_contract_id from wx_bill_rent id = #{id}
  374. )
  375. </select>
  376. <select id="getShopCountMax" resultType="int">
  377. select max(json_length(rent_info)) from wx_rent_contract
  378. </select>
  379. </mapper>