Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

575 wiersze
32 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="shop_type_sub" jdbcType="VARCHAR" property="shopTypeSub"/>
  8. <result column="lease_purpose" jdbcType="VARCHAR" property="leasePurpose"/>
  9. <result column="contractual_rules" jdbcType="VARCHAR" property="contractualRules"/>
  10. <result column="delivery_date" jdbcType="TIMESTAMP" property="deliveryDate"/>
  11. <result column="delivery_grace_period" jdbcType="INTEGER" property="deliveryGracePeriod"/>
  12. <result column="opening_date" jdbcType="TIMESTAMP" property="openingDate"/>
  13. <result column="business_hours" jdbcType="VARCHAR" property="businessHours"/>
  14. <result column="scope_metre" jdbcType="INTEGER" property="scopeMetre"/>
  15. <result column="decimal_size" jdbcType="INTEGER" property="decimalSize"/>
  16. <result column="price" jdbcType="VARCHAR" property="price"/>
  17. <result column="rental_start_date" jdbcType="TIMESTAMP" property="rentalStartDate"/>
  18. <result column="rental_end_date" jdbcType="TIMESTAMP" property="rentalEndDate"/>
  19. <result column="sign_date" jdbcType="TIMESTAMP" property="signDate"/>
  20. <result column="receive_period" jdbcType="INTEGER" property="receivePeriod"/>
  21. <result column="receive_period_unit" jdbcType="INTEGER" property="receivePeriodUnit"/>
  22. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  23. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  24. <result column="filepath" jdbcType="VARCHAR" property="filepath"/>
  25. <result column="status" jdbcType="INTEGER" property="status"/>
  26. <result column="contract_number" jdbcType="VARCHAR" property="contractNumber"/>
  27. <result column="create_by" jdbcType="BIGINT" property="createBy"/>
  28. <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
  29. <result column="first_party_bank_info" jdbcType="VARCHAR" property="firstPartyBankInfo"/>
  30. <result column="second_party_bank_info" jdbcType="VARCHAR" property="secondPartyBankInfo"/>
  31. <result column="second_party_tax_info" jdbcType="VARCHAR" property="secondPartyTaxInfo"/>
  32. <result column="property_name" jdbcType="VARCHAR" property="propertyName"/>
  33. <result column="property_fee" jdbcType="VARCHAR" property="propertyFee"/>
  34. <result column="fee_cycle" jdbcType="INTEGER" property="feeCycle"/>
  35. <result column="water_fee" jdbcType="VARCHAR" property="waterFee"/>
  36. <result column="electricity_fees" jdbcType="VARCHAR" property="electricityFees"/>
  37. <result column="deposit" jdbcType="VARCHAR" property="deposit"/>
  38. <!--<result column="deposit_info" jdbcType="VARCHAR" property="depositInfo"/>-->
  39. <result column="cashtype_content_lsit" jdbcType="VARCHAR" property="cashtypeContentLsit"/>
  40. <result column="cashtype_lsit" jdbcType="VARCHAR" property="cashtypeLsit"/>
  41. <result column="pay_date" jdbcType="INTEGER" property="payDate"/>
  42. <result column="is_del" jdbcType="INTEGER" property="isDel"/>
  43. <result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
  44. <result column="brand" jdbcType="VARCHAR" property="brand"/>
  45. <result column="business_id" jdbcType="INTEGER" property="businessId"/>
  46. <result column="shop_type" jdbcType="INTEGER" property="shopType"/>
  47. <result column="shop_type_str" jdbcType="VARCHAR" property="shopTypeStr"/>
  48. <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/>
  49. <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
  50. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  51. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  52. <result column="pay_account" jdbcType="VARCHAR" property="payAccount"/>
  53. <result column="link_address" jdbcType="VARCHAR" property="linkAddress"/>
  54. <result column="filename" jdbcType="VARCHAR" property="filename"/>
  55. <result column="lease" jdbcType="INTEGER" property="lease"/>
  56. <result column="type" jdbcType="INTEGER" property="type"/>
  57. <result column="revenue" jdbcType="VARCHAR" property="revenue"/>
  58. <result column="revenue_ratio" jdbcType="INTEGER" property="revenueRatio"/>
  59. <result column="revenue_ratio_way" jdbcType="INTEGER" property="revenueRatioWay"/>
  60. <result column="revenue_ratio_set" jdbcType="VARCHAR" property="revenueRatioSet"/>
  61. <result column="adjust_ratio" jdbcType="VARCHAR" property="adjustRatio"/>
  62. <result column="adjust_period" jdbcType="INTEGER" property="adjustPeriod"/>
  63. <result column="pay_ratio" jdbcType="INTEGER" property="payRatio"/>
  64. <result column="start_date" jdbcType="TIMESTAMP" property="startDate"/>
  65. <result column="end_date" jdbcType="TIMESTAMP" property="endDate"/>
  66. <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/>
  67. <result column="bank_name" jdbcType="VARCHAR" property="bankName"/>
  68. <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
  69. <result column="fix_start_date" property="fixStartDate"/>
  70. <result column="fix_end_date" property="fixEndDate"/>
  71. <result column="business_type" property="businessType"/>
  72. <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/>
  73. <result column="file_names" jdbcType="VARCHAR" property="fileNames"/>
  74. <result column="price_unit" property="priceUnit"/>
  75. <result column="rent_price" property="rentPrice"/>
  76. <result column="other_rent_price_info" jdbcType="VARCHAR" property="otherRentPriceInfo"/>
  77. <result column="subject_name" property="subjectName"/>
  78. <result column="rent_start_type" property="rentStartType"/>
  79. <result column="type" jdbcType="INTEGER" property="type"/>
  80. <result column="revenue" jdbcType="INTEGER" property="revenue"/>
  81. <result column="adjust_ratio" jdbcType="VARCHAR" property="adjustRatio"/>
  82. <result column="adjust_period" jdbcType="INTEGER" property="adjustPeriod"/>
  83. <result column="pay_ratio" jdbcType="INTEGER" property="payRatio"/>
  84. <result column="start_date" jdbcType="TIMESTAMP" property="startDate"/>
  85. <result column="end_date" jdbcType="TIMESTAMP" property="endDate"/>
  86. <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/>
  87. <result column="bank_name" jdbcType="VARCHAR" property="bankName"/>
  88. <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
  89. <result column="fix_start_date" property="fixStartDate"/>
  90. <result column="fix_end_date" property="fixEndDate"/>
  91. <result column="business_type" property="businessType"/>
  92. <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/>
  93. <result column="file_names" jdbcType="VARCHAR" property="fileNames"/>
  94. <result column="subject_name" property="subjectName"/>
  95. <result column="rent_start_type" property="rentStartType"/>
  96. <result column="shop_name" property="shopName"/>
  97. <result column="from_id" property="fromId"/>
  98. <result column="rent_input_way" property="rentInputWay"/>
  99. <result column="adjust_ratio_way" property="adjustRatioWay"/>
  100. <result column="operation_type" property="operationType"/>
  101. <result column="late_pay_ratio" property="latePayRatio"/>
  102. <result column="late_pay_day" property="latePayDay"/>
  103. <result column="end_contract_time" jdbcType="TIMESTAMP" property="endContractTime"/>
  104. <result column="bussiness_management_fee" jdbcType="VARCHAR" property="bussinessManagementFee"/>
  105. <result column="bussiness_management_fee_ratio_way" jdbcType="INTEGER" property="bussinessManagementFeeRatioWay"/>
  106. <result column="bussiness_management_fee_ratio" jdbcType="VARCHAR" property="bussinessManagementFeeRatio"/>
  107. <result column="operating_management_fee" jdbcType="VARCHAR" property="operatingManagementFee"/>
  108. <result column="operating_management_fee_ratio_way" jdbcType="INTEGER" property="operatingManagementFeeRatioWay"/>
  109. <result column="operating_management_fee_ratio" jdbcType="VARCHAR" property="operatingManagementFeeRatio"/>
  110. <result column="out_date_notify_days" jdbcType="INTEGER" property="outDateNotifyDays"/>
  111. <result column="out_date_notify_phone" jdbcType="VARCHAR" property="outDateNotifyPhone"/>
  112. <result column="design_file" jdbcType="VARCHAR" property="designFile"/>
  113. <result column="price_detail" jdbcType="VARCHAR" property="priceDetail"/>
  114. <result column="day_price_calcute" jdbcType="INTEGER" property="dayPriceCalcute"/>
  115. <result column="month_average_days" jdbcType="INTEGER" property="monthAverageDays"/>
  116. <result column="revenue_fixed_rent_price" jdbcType="INTEGER" property="revenueFixedRentPrice"/>
  117. <result column="revenue_rent_price" jdbcType="VARCHAR" property="revenueRentPrice"/>
  118. <result column="revenue_jumps_remark" jdbcType="VARCHAR" property="revenueJumpsRemark"/>
  119. <result column="free_period_remark" jdbcType="VARCHAR" property="freePeriodRemark"/>
  120. <result column="first_bill_date_start" jdbcType="TIMESTAMP" property="firstBillDateStart"/>
  121. <result column="first_bill_date_end" jdbcType="TIMESTAMP" property="firstBillDateEnd"/>
  122. </resultMap>
  123. <sql id="allColumns">
  124. `id`,`merchant_id`,
  125. `shop_type_sub`,`lease_purpose`,`contractual_rules`,`delivery_date`,`delivery_grace_period`,`opening_date`,`business_hours`,`scope_metre`,
  126. `decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`receive_period_unit`,
  127. `tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`,`price_detail`,`create_by`,`update_by`,
  128. `first_party_bank_info`,`second_party_bank_info`,`second_party_tax_info`,`day_price_calcute`,`first_bill_date_start`,`first_bill_date_end`,
  129. `property_name`,`property_fee`,`fee_cycle`,`water_fee`,`electricity_fees`,`month_average_days`,`free_period_remark`,
  130. `deposit`,cashtype_content_lsit,cashtype_lsit,`pay_date`,`is_del`,`merchant_name`,`revenue_jumps_remark`,
  131. `brand`,`business_id`,`shop_type`,`shop_type_str`,`updatetime`,`createtime`,`link_person`,`link_phone`,`link_address`,
  132. `pay_account`,`filename`,`lease`,`type`,`revenue`,`revenue_ratio`,`revenue_ratio_way`,`revenue_ratio_set`,`adjust_ratio`,`adjust_period`,`pay_ratio`,
  133. `start_date`,`end_date`,`shop_name`,`from_id`,`end_contract_time`,`revenue_fixed_rent_price`,`revenue_rent_price`,
  134. `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`,
  135. `business_type`,`rent_info`, `file_names`,price_unit,rent_price,other_rent_price_info,`subject_name`,rent_start_type,
  136. `rent_input_way`,`adjust_ratio_way`,`operation_type`,late_pay_ratio,late_pay_day,
  137. bussiness_management_fee,bussiness_management_fee_ratio_way,bussiness_management_fee_ratio,
  138. operating_management_fee,operating_management_fee_ratio_way,operating_management_fee_ratio,out_date_notify_days,out_date_notify_phone,design_file
  139. </sql>
  140. <sql id="dynamicWhereConditions">
  141. where 1 = 1
  142. <if test=" null != id ">and `id` = #{id}</if>
  143. <if test=" null != fromId ">and `from_id` = #{fromId}</if>
  144. <if test=" null != merchantId and '' != merchantId">and `merchant_id` = #{merchantId}</if>
  145. <if test=" null != price and '' != price">and `price` = #{price}</if>
  146. <if test=" null != rentalStartDate and '' != rentalStartDate">and `rental_start_date` = #{rentalStartDate}</if>
  147. <if test=" null != rentalEndDate and '' != rentalEndDate">and `rental_end_date` = #{rentalEndDate}</if>
  148. <if test=" null != outDateNofity ">and out_date_notify_phone is not null and out_date_notify_phone != '' and out_date_notify_days is not null and out_date_notify_days &gt; 0 </if>
  149. <if test=" null != signDate and '' != signDate">and `sign_date` = #{signDate}</if>
  150. <if test=" null != receivePeriod and '' != receivePeriod">and `receive_period` = #{receivePeriod}</if>
  151. <if test=" null != receivePeriodUnit and '' != receivePeriodUnit">and `receive_period_unit` = #{receivePeriodUnit}</if>
  152. <if test=" null != tenantId and '' != tenantId">
  153. and `tenant_id` = #{tenantId}
  154. </if>
  155. <if test=" null != parentTenantId and '' != parentTenantId">
  156. and `parent_tenant_id` = #{parentTenantId}
  157. </if>
  158. <if test=" null != filepath and '' != filepath">and `filepath` = #{filepath}</if>
  159. <if test=" null != status and '' != status">and `status` = #{status}</if>
  160. <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if>
  161. <if test=" null != contractNumber and '' != contractNumber">and `contract_number` = #{contractNumber}</if>
  162. <if test=" null != deposit and '' != deposit">and `deposit` = #{deposit}</if>
  163. <if test=" null != payDate and '' != payDate">and `pay_date` = #{payDate}</if>
  164. <if test=" null != isDel and '' != isDel">and `is_del` = #{isDel}</if>
  165. <if test=" null != merchantName and '' != merchantName">and `merchant_name` like concat('%', #{merchantName},'%') </if>
  166. <if test=" null != brand and '' != brand">and `brand` = #{brand}</if>
  167. <if test=" null != businessId and '' != businessId">and `business_id` = #{businessId}</if>
  168. <if test=" null != shopType and '' != shopType">and `shop_type` = #{shopType}</if>
  169. <if test=" null != updatetime and '' != updatetime">and `updatetime` = #{updatetime}</if>
  170. <if test=" null != createtime and '' != createtime">and `createtime` = #{createtime}</if>
  171. <if test=" null != linkPerson and '' != linkPerson">and `link_person` = #{linkPerson}</if>
  172. <if test=" null != linkPhone and '' != linkPhone">and `link_phone` = #{linkPhone}</if>
  173. <if test=" null != payAccount and '' != payAccount">and `pay_account` = #{payAccount}</if>
  174. <if test=" null != filename and '' != filename">and `filename` = #{filename}</if>
  175. <if test=" null != lease and '' != lease">and `lease` = #{lease}</if>
  176. <if test=" null != type and '' != type">and `type` = #{type}</if>
  177. <if test=" null != startDate and '' != startDate">and `start_date` = #{startDate}</if>
  178. <if test=" null != endDate and '' != endDate">and `end_date` = #{endDate}</if>
  179. <if test=" null != rentShopType and '' != rentShopType">and `rent_shop_type` = #{rentShopType}</if>
  180. <if test=" null != operationType and '' != operationType">and `operation_type` = #{operationType}</if>
  181. <if test=" null != queryShopId and '' != queryShopId">and json_contains(json_extract(rent_info,'$[*].id'),concat('"',#{queryShopId},'"'))</if>
  182. <if test=" null != dayPriceCalcute ">and `day_price_calcute` = #{dayPriceCalcute}</if>
  183. <if test=" null != monthAverageDays ">and `month_average_days` = #{monthAverageDays}</if>
  184. <if test=" null != revenueFixedRentPrice ">and `revenue_fixed_rent_price` = #{revenueFixedRentPrice}</if>
  185. <if test=" null != shopNumber and shopNumber!=''">
  186. and shop_name like concat('%',#{shopNumber},'%')
  187. </if>
  188. <if test=" null != businessForRule and '' != businessForRule ">
  189. and business_id in (${businessForRule})
  190. </if>
  191. <if test=" null != merchantIds ">
  192. and merchant_id in
  193. <foreach collection="merchantIds" index="index" item="mItem" open="(" separator="," close=")">
  194. #{mItem}
  195. </foreach>
  196. </if>
  197. <if test=" null != statuss ">
  198. and status in
  199. <foreach collection="statuss" index="index" item="statusItem" open="(" separator="," close=")">
  200. #{statusItem}
  201. </foreach>
  202. </if>
  203. <if test=" null != typeList ">
  204. and type in
  205. <foreach collection="typeList" index="index" item="typeItem" open="(" separator="," close=")">
  206. #{typeItem}
  207. </foreach>
  208. </if>
  209. <if test=" null != ids ">
  210. and id in
  211. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  212. #{idItem}
  213. </foreach>
  214. </if>
  215. <if test=" null != sortColumns">order by ${sortColumns}</if>
  216. </sql>
  217. <select id="findList" parameterType="com.iformall.domain.po.WxRentContract" resultMap="BaseResultMap">
  218. select
  219. <include refid="allColumns"/>
  220. from wx_rent_contract
  221. <include refid="dynamicWhereConditions"/>
  222. </select>
  223. <select id="findCount" parameterType="com.iformall.domain.po.WxRentContract" resultType="java.lang.Long">
  224. select count(id)
  225. from wx_rent_contract
  226. where status=#{status}
  227. <if test=" null != tenantId and '' != tenantId">
  228. and `tenant_id` = #{tenantId}
  229. </if>
  230. <if test=" null != parentTenantId and '' != parentTenantId">
  231. and `parent_tenant_id` = #{parentTenantId}
  232. </if>
  233. <if test=" null != rentShopType ">
  234. and rent_shop_type = #{rentShopType}
  235. </if>
  236. </select>
  237. <update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxRentContract">
  238. update wx_rent_contract
  239. set apply_status=#{applyStatus}
  240. <if test=" null != businessType ">,business_type=#{businessType}</if>
  241. <if test=" null != status ">,status=#{status}</if>
  242. where id=#{id}
  243. </update>
  244. <update id="updateStatus" parameterType="com.iformall.domain.po.WxRentContract">
  245. update wx_rent_contract set status=#{status} where id=#{id}
  246. </update>
  247. <select id="updateStatusForUnsign" parameterType="com.iformall.domain.po.WxRentContract">
  248. update wx_rent_contract set status=1 where status=2 and merchant_id is null
  249. <if test=" null != tenantId and '' != tenantId">
  250. and `tenant_id` = #{tenantId}
  251. </if>
  252. <if test=" null != parentTenantId and '' != parentTenantId">
  253. and `parent_tenant_id` = #{parentTenantId}
  254. </if>
  255. </select>
  256. <select id="queryOweCount" parameterType="com.iformall.domain.po.WxRentContract" resultType="Long">
  257. select count(1) from wx_rent_contract r,wx_all_bill b
  258. where b.rent_contract_id = r.id and b.status = 1 and r.id = #{id}
  259. </select>
  260. <select id="getMerchants" parameterType="com.iformall.domain.po.WxRentContract"
  261. resultType="com.iformall.domain.po.WxRentContract">
  262. select <include refid="allColumns"/> from wx_rent_contract where status in(2,3,4)
  263. and merchant_id not in(select merchant_id from wx_property_contract where status in(2,3,4))
  264. <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
  265. </select>
  266. <select id="selectRentContractCountByShopId" parameterType="java.util.Map" resultType="int">
  267. select count(1) from wx_rent_contract where 1=1
  268. <if test=" null != tenantId and '' != tenantId">
  269. and `tenant_id` = #{tenantId}
  270. </if>
  271. <if test=" null != parentTenantId and '' != parentTenantId">
  272. and `parent_tenant_id` = #{parentTenantId}
  273. </if>
  274. and json_contains(json_extract(rent_info,'$[*].id'),concat('"',#{shopId},'"')) and status in (2,3,4)
  275. <if test="id!=null">
  276. and id!=#{id}
  277. </if>
  278. </select>
  279. <select id="selectRentContractByShopId" parameterType="com.iformall.domain.po.WxRentContract"
  280. resultType="com.iformall.domain.po.WxRentContract">
  281. select <include refid="allColumns"/> from wx_rent_contract
  282. where 1=1
  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 json_contains(json_extract(rent_info,'$[*].id'),concat('"',${shopId},'"')) and rent_shop_type =1
  290. <if test=" null != status ">and status=#{status} and status!=7</if>
  291. </select>
  292. <select id="selectRentContractByMerchantId" parameterType="com.iformall.domain.po.WxRentContract"
  293. resultType="com.iformall.domain.po.WxRentContract">
  294. select <include refid="allColumns"/> from wx_rent_contract
  295. where status in(2,3,4)
  296. and merchant_id = #{merchantId}
  297. </select>
  298. <select id="hasContractNumber" parameterType="com.iformall.domain.po.WxRentContract"
  299. resultType="int">
  300. select count(1) from (
  301. select * from wx_rent_contract where contract_number=#{contractNumber}
  302. and status not in(5,6,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. union
  310. select * from wx_rent_contract where contract_number=#{contractNumber}
  311. and apply_status in(1,2)
  312. <if test=" null != tenantId and '' != tenantId">
  313. and `tenant_id` = #{tenantId}
  314. </if>
  315. <if test=" null != parentTenantId and '' != parentTenantId">
  316. and `parent_tenant_id` = #{parentTenantId}
  317. </if>
  318. ) r
  319. <where>
  320. <if test="id!=null and id!=''">
  321. r.id!=#{id}
  322. </if>
  323. </where>
  324. </select>
  325. <resultMap id="contractMap" type="com.iformall.domain.vo.WxRentPropertyContractVo">
  326. <id column="id" property="id"/>
  327. <result column="tenant_id" property="tenantId"/>
  328. <result column="parent_tenant_id" property="parentTenantId"/>
  329. <result column="rent_id" property="rentId"/>
  330. <result column="property_id" property="propertyId"/>
  331. <result column="shop_name" property="shopName"/>
  332. <result column="merchant_name" property="merchantName"/>
  333. <result column="rent_info" property="rentInfo"/>
  334. <result column="rental_start_date" property="rentalStartDate"/>
  335. <result column="rental_end_date" property="rentalEndDate"/>
  336. <result column="rent_price" property="rentPrice"/>
  337. <result column="price_detail" property="priceDetail"/>
  338. <result column="property_price" property="propertyPrice"/>
  339. <result column="type" property="type"/>
  340. <result column="status" property="status"/>
  341. <result column="apply_status" property="applyStatus"/>
  342. <result column="operation_type" property="operationType"/>
  343. <result column="rent_shop_type" property="rentShopType"/>
  344. <result column="merchant_id" property="merchantId"/>
  345. <result column="property_status" property="propertyStatus"/>
  346. <result column="rent_price_unit" property="rentPriceUnit"/>
  347. <result column="property_price_unit" property="propertyPriceUnit"/>
  348. <result column="day_price_calcute" property="dayPriceCalcute"/>
  349. <result column="month_average_days" property="monthAverageDays"/>
  350. <result column="revenue_fixed_rent_price" jdbcType="INTEGER" property="revenueFixedRentPrice"/>
  351. <result column="revenue_rent_price" jdbcType="VARCHAR" property="revenueRentPrice"/>
  352. <result column="revenue_jumps_remark" jdbcType="VARCHAR" property="revenueJumpsRemark"/>
  353. <result column="free_period_remark" jdbcType="VARCHAR" property="freePeriodRemark"/>
  354. <result column="first_bill_date_start" jdbcType="TIMESTAMP" property="firstBillDateStart"/>
  355. <result column="first_bill_date_end" jdbcType="TIMESTAMP" property="firstBillDateEnd"/>
  356. </resultMap>
  357. <select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap">
  358. select rc.id,rc.tenant_id,rc.parent_tenant_id,rc.id as rent_id, pc.id as property_id, rc.merchant_name,rc.rental_start_date,rc.rental_end_date,rc.`status`,
  359. rc.price as rent_price,rc.contract_number,rc.shop_name,rc.type,rc.apply_status,rc.price_detail,rc.revenue_fixed_rent_price,rc.revenue_rent_price,
  360. rc.rent_shop_type,rc.rent_info,pc.price as property_price,rc.merchant_id,pc.`status` as property_status,
  361. rc.price_unit as rent_price_unit,pc.price_unit as property_price_unit,rc.day_price_calcute,rc.free_period_remark,
  362. rc.business_type businessType,rc.month_average_days,rc.revenue_jumps_remark,rc.first_bill_date_start,rc.first_bill_date_end
  363. from wx_rent_contract rc left join wx_property_contract pc on rc.id=pc.rent_contract_id
  364. <where>
  365. <if test=" null != tenantId and '' != tenantId">
  366. and rc.`tenant_id` = #{tenantId}
  367. </if>
  368. <if test=" null != parentTenantId and '' != parentTenantId">
  369. and rc.`parent_tenant_id` = #{parentTenantId}
  370. </if>
  371. <if test=" null != contractNumber and '' != contractNumber">
  372. and rc.`contract_number` = #{contractNumber}
  373. </if>
  374. <if test=" null != rentId and '' != rentId">
  375. and rc.`id` = #{rentId}
  376. </if>
  377. <if test=" null != propertyId and '' != propertyId">
  378. and pc.`id` = #{propertyId}
  379. </if>
  380. <if test=" null != merchantName and merchantName!=''">and rc.`merchant_name` like
  381. concat('%',#{merchantName},'%')
  382. </if>
  383. <if test=" null != shopNumber and shopNumber!=''">
  384. and (json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%') or rc.shop_name like concat('%',#{shopNumber},'%') )
  385. </if>
  386. <!-- <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==1">
  387. and json_extract(rc.rent_info,'$[*].shopNumber') like concat('%',#{shopNumber},'%')
  388. </if>
  389. <if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==2">
  390. and s.`shop_number` like concat('%',#{shopNumber},'%')
  391. </if> -->
  392. <if test=" null != status ">and rc.`status` = #{status}</if>
  393. <if test=" null != type ">and rc.`type` = #{type}</if>
  394. <if test=" null != rentShopType ">
  395. and rc.`rent_shop_type` = #{rentShopType}
  396. </if>
  397. <if test=" null != applyStatus ">and rc.`apply_status` = #{applyStatus}</if>
  398. <if test=" null != operationType ">and rc.`operation_type` = #{operationType}</if>
  399. <if test=" null != dayPriceCalcute ">and rc.`day_price_calcute` = #{dayPriceCalcute}</if>
  400. <if test=" null != monthAverageDays ">and rc.`month_average_days` = #{monthAverageDays}</if>
  401. <if test=" null != businessForRule and '' != businessForRule ">
  402. and rc.business_id in (${businessForRule})
  403. </if>
  404. <if test=" null != merchantIds ">
  405. and rc.merchant_id in
  406. <foreach collection="merchantIds" index="index" item="mItem" open="(" separator="," close=")">
  407. #{mItem}
  408. </foreach>
  409. </if>
  410. </where>
  411. <if test=" null != sortColumns">order by ${sortColumns}</if>
  412. <if test=" null == sortColumns">order by rc.createtime desc,rc.id desc</if>
  413. </select>
  414. <select id="getByBill" parameterType="com.iformall.domain.po.WxAllBill" resultMap="BaseResultMap">
  415. select <include refid="allColumns"/> from wx_rent_contract
  416. where id in(
  417. select rent_contract_id from wx_all_bill id = #{id}
  418. )
  419. </select>
  420. <select id="getShopCountMax" resultType="int">
  421. select max(json_length(rent_info)) from wx_rent_contract
  422. </select>
  423. <select id="queryContractByBus" resultType="hashmap" parameterType="com.iformall.domain.po.WxBusiness">
  424. select 1 type,c.`rental_start_date`,c.`rental_end_date`,c.id id from wx_merchant m left join wx_rent_contract c on(m.id = c.merchant_id)
  425. where m.business_id = #{id} and c.price is not null and c.`rental_start_date` is not null and c.`rental_end_date` is not null
  426. union all
  427. select 2 type,c.`rental_start_date`,c.`rental_end_date`,c.id id from wx_merchant m left join wx_property_contract c on(m.id = c.merchant_id)
  428. where m.business_id = #{id} and c.price is not null and c.`rental_start_date` is not null and c.`rental_end_date` is not null
  429. </select>
  430. <select id="getCanApplyCount" resultType="Integer" parameterType="Long">
  431. select count(1) from wx_rent_contract where id != #{id} and (status=1 or (status=10 and apply_status=3) )
  432. </select>
  433. <select id="getMerchantIdsByStatuss" resultType="Long" parameterType="com.iformall.domain.po.WxRentContract">
  434. select distinct merchant_id from wx_rent_contract where `tenant_id` = #{tenantId} and merchant_id is not null
  435. <if test=" null != parentTenantId and '' != parentTenantId">
  436. and `parent_tenant_id` = #{parentTenantId}
  437. </if>
  438. and status in
  439. <foreach collection="statuss" index="index" item="statusItem" open="(" separator="," close=")">
  440. #{statusItem}
  441. </foreach>
  442. </select>
  443. <select id="findRentByShop" parameterType="Long" resultType="hashmap">
  444. select
  445. rc.`id`,rc.`merchant_id`,
  446. rc.`shop_type_sub`,rc.`lease_purpose`,rc.`contractual_rules`,rc.`delivery_date`,rc.`delivery_grace_period`,rc.`opening_date`,rc.`business_hours`,rc.`scope_metre`,
  447. rc.`price`,rc.rent_area,rc.`rental_start_date`,rc.`rental_end_date`,rc.`sign_date`,rc.`receive_period`, rc.`receive_period_unit`,
  448. rc.`tenant_id`,rc.`parent_tenant_id`,rc.`filepath`,rc.`status`,rc.`contract_number`,rc.`price_detail`,rc.`create_by`,rc.`update_by`,
  449. rc.`first_party_bank_info`,rc.`second_party_bank_info`,rc.`second_party_tax_info`,rc.`free_period_remark`,
  450. rc.`property_name`,rc.`property_fee`,rc.`fee_cycle`,rc.`water_fee`,rc.`electricity_fees`,
  451. rc.`deposit`,rc.cashtype_content_lsit,rc.cashtype_lsit,rc.`pay_date`,rc.`is_del`,rc.`merchant_name`,
  452. rc.`brand`,rc.`business_id`,rc.`shop_type`,rc.`shop_type_str`,rc.`updatetime`,rc.`createtime`,rc.`link_person`,rc.`link_phone`,rc.`link_address`,
  453. rc.`pay_account`,rc.`filename`,rc.`lease`,rc.`type`,rc.`revenue`,rc.`revenue_ratio`,rc.`revenue_ratio_way`,rc.`revenue_ratio_set`,rc.`adjust_ratio`,rc.`adjust_period`,rc.`pay_ratio`,
  454. rc.`start_date`,rc.`end_date`,rc.`shop_name`,rc.`from_id`,`rc.end_contract_time`,rc.`revenue_jumps_remark`,
  455. rc.`apply_status`,rc.`bank_name`,rc.`rent_shop_type`,rc.`fix_start_date`,rc.`fix_end_date`,
  456. rc.`business_type`,rc.`rent_info`, rc.`file_names`,rc.price_unit,rent_price,rc.other_rent_price_info,rc.`subject_name`,rc.rent_start_type,
  457. rc.`rent_input_way`,rc.`adjust_ratio_way`,rc.`operation_type`,rc.late_pay_ratio,rc.late_pay_day,
  458. rc.bussiness_management_fee,rc.bussiness_management_fee_ratio_way,rc.bussiness_management_fee_ratio,
  459. rc.operating_management_fee,rc.operating_management_fee_ratio_way,rc.operating_management_fee_ratio,rc.out_date_notify_days,rc.out_date_notify_phone
  460. from wx_shop s
  461. left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  462. left join wx_merchant m on ms.merchant_id=m.id
  463. left join wx_rent_contract rc on rc.merchant_id = m.id and rc.is_del=0
  464. where s.`id` = #{shopId}
  465. and rc.`status` in (2,3)
  466. and rc.`rental_start_date` &lt;= now() and rc.rental_end_date >= now()
  467. order by rc.`updatetime` desc;
  468. </select>
  469. <select id="currentValidByMerchantId" parameterType="com.iformall.domain.po.WxRentContract" resultType="hashmap">
  470. select
  471. rc.`id`,rc.`merchant_id`,
  472. rc.`shop_type_sub`,rc.`lease_purpose`,rc.`contractual_rules`,rc.`delivery_date`,rc.`delivery_grace_period`,rc.`opening_date`,rc.`business_hours`,rc.`scope_metre`,
  473. rc.`price`,rc.rent_area,rc.`rental_start_date`,rc.`rental_end_date`,rc.`sign_date`,rc.`receive_period`, rc.`receive_period_unit`,
  474. rc.`tenant_id`,rc.`parent_tenant_id`,rc.`filepath`,rc.`status`,rc.`contract_number`,rc.`price_detail`,rc.`create_by`,rc.`update_by`,
  475. rc.`first_party_bank_info`,rc.`second_party_bank_info`,rc.`second_party_tax_info`,rc.`revenue_jumps_remark`,
  476. rc.`property_name`,rc.`property_fee`,rc.`fee_cycle`,rc.`water_fee`,rc.`electricity_fees`,rc.`free_period_remark`,
  477. rc.`deposit`,rc.cashtype_content_lsit,rc.cashtype_lsit,rc.`pay_date`,rc.`is_del`,rc.`merchant_name`,
  478. rc.`brand`,rc.`business_id`,rc.`shop_type`,rc.`shop_type_str`,rc.`updatetime`,rc.`createtime`,rc.`link_person`,rc.`link_phone`,rc.`link_address`,
  479. rc.`pay_account`,rc.`filename`,rc.`lease`,rc.`type`,rc.`revenue`,rc.`revenue_ratio`,rc.`revenue_ratio_way`,rc.`revenue_ratio_set`,rc.`adjust_ratio`,rc.`adjust_period`,rc.`pay_ratio`,
  480. rc.`start_date`,rc.`end_date`,rc.`shop_name`,rc.`from_id`,rc.`end_contract_time`,
  481. rc.`apply_status`,rc.`bank_name`,rc.`rent_shop_type`,rc.`fix_start_date`,rc.`fix_end_date`,
  482. rc.`business_type`,rc.`rent_info`, rc.`file_names`,rc.price_unit,rent_price,rc.other_rent_price_info,rc.`subject_name`,rc.rent_start_type,
  483. rc.`rent_input_way`,rc.`adjust_ratio_way`,rc.`operation_type`,rc.late_pay_ratio,rc.late_pay_day,
  484. rc.bussiness_management_fee,rc.bussiness_management_fee_ratio_way,rc.bussiness_management_fee_ratio,
  485. rc.operating_management_fee,rc.operating_management_fee_ratio_way,rc.operating_management_fee_ratio,rc.out_date_notify_days,rc.out_date_notify_phone
  486. from wx_rent_contract rc
  487. where rc.is_del = 0
  488. <if test=" null != tenantId and '' != tenantId">
  489. and rc.`tenant_id` = #{tenantId}
  490. </if>
  491. <if test=" null != parentTenantId and '' != parentTenantId">
  492. and rc.`parent_tenant_id` = #{parentTenantId}
  493. </if>
  494. and rc.`merchant_id` = #{merchantId}
  495. <if test=" null != shopNumber and shopNumber!=''">
  496. and rc.shop_name like concat('%',#{shopNumber},'%')
  497. </if>
  498. and rc.`rental_start_date` &lt;= now() and rc.rental_end_date >= now()
  499. <if test=" null != statuss ">
  500. and rc.`status` in
  501. <foreach collection="statuss" index="index" item="statusItem" open="(" separator="," close=")">
  502. #{statusItem}
  503. </foreach>
  504. </if>
  505. </select>
  506. <select id="getUsedRentShopIds" parameterType="com.iformall.domain.po.WxRentContract" resultType="Long">
  507. SELECT distinct shop_id FROM wx_rent_contract WHERE status in(1,2,3,4,8)
  508. and rent_shop_type=2
  509. <if test=" null != tenantId and '' != tenantId">
  510. and `tenant_id` = #{tenantId}
  511. </if>
  512. <if test=" null != parentTenantId and '' != parentTenantId">
  513. and `parent_tenant_id` = #{parentTenantId}
  514. </if>
  515. </select>
  516. <update id = "setEndContractTime" parameterType="com.iformall.domain.po.WxRentContract" >
  517. update wx_rent_contract set end_contract_time = #{endContractTime} where id = #{id}
  518. </update>
  519. <select id = "findToEndContractList" parameterType="com.iformall.domain.po.WxRentContract" resultMap="BaseResultMap">
  520. select
  521. <include refid="allColumns"/>
  522. from wx_rent_contract
  523. where `tenant_id` = #{tenantId} and status = 3 and end_contract_time &lt;= now();
  524. </select>
  525. </mapper>