@@ -43,7 +43,7 @@
<result column="business_type" property="businessType"/>
<result column="receive_period" property="receivePeriod"/>
<result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/>
<result column="file_names" jdbcType="VARCHAR" property="fileNames"/>
<result column="file_names" jdbcType="VARCHAR" property="fileNames"/>
<result column="price_unit" property="priceUnit"/>
<result column="rent_price" property="rentPrice"/>
<result column="subject_name" property="subjectName"/>
@@ -68,28 +68,28 @@
<result column="subject_name" property="subjectName"/>
<result column="rent_start_type" property="rentStartType"/>
<result column="rent_input_way" property="rentInputWay"/>
<result column="adjust_ratio_way" property="adjustRatioWay"/>
<result column="operation_type" property="operationType"/>
<result column="late_pay_ratio" property="latePayRatio"/>
<result column="late_pay_day" property="latePayDay"/>
<result column="bus_discount_ratio" property="busDiscountRatio"/>
<result column="bus_discount_time" property="busDiscountTime"/>
</resultMap>
<sql id="allColumns">
`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`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`,
`start_date`,`end_date`,
`apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`,
`business_type`,`rent_info`, `file_names`,price_unit,rent_price,`subject_name`,rent_start_type,
`rent_input_way`,`adjust_ratio_way`,`operation_type`,late_pay_ratio,late_pay_day,bus_discount_ratio
`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`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`,
`start_date`,`end_date`,
`apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`,
`business_type`,`rent_info`, `file_names`,price_unit,rent_price,`subject_name`,rent_start_type,
`rent_input_way`,`adjust_ratio_way`,`operation_type`,late_pay_ratio,late_pay_day,bus_discount_ratio,bus_discount_time
</sql>
<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id ">and `id` = #{id}</if>
@@ -123,7 +123,7 @@
<if test=" null != endDate ">and `end_date` = #{endDate}</if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != operationType ">and `operation_type` = #{operationType}</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -132,14 +132,14 @@
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>
<select id="findList" parameterType="com.iformall.domain.po.WxRentContract" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_rent_contract
<include refid="dynamicWhereConditions"/>
</select>
<select id="queryRentContractData" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract">
select rc.id,rc.merchant_name merchantName,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.`status`,
rc.price,rc.contract_number contractNumber,s.shop_number shopNumber,f.floor_name floorName,b.building_name buildingName,
@@ -148,7 +148,7 @@
bankName,rc.rent_shop_type rentShopType,rc.fix_start_date fixStartDate,rc.fix_end_date fixEndDate
,rc.business_type businessType,rc.adjust_period adjustPeriod,rc.rent_info rentInfo, rc.file_names
fileNames,rc.price_unit,rc.subject_name subjectName,rc.`rent_input_way` rentInputWay,rc.`adjust_ratio_way`
adjustRatioWay,rc.bus_discount_ratio
adjustRatioWay,rc.bus_discount_ratio,rc.bus_discount_time
from wx_rent_contract rc
left join wx_shop s on rc.shop_id=s.id
left join wx_mall_floor f on s.floor=f.id
@@ -176,42 +176,42 @@
<if test=" null == sortColumns"> order by rc.createtime desc,rc.id desc </if>
</select>
<select id="queryRentContractWaitSignStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status=#{status}
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractEndSoonStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status=4
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractPaidStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status in (2,3,4)
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="queryRentContractEndStatus" resultType="int" parameterType="com.iformall.domain.po.WxRentContract">
select count(id) from wx_rent_contract where tenant_id=#{tenantId} and status!=0 and status!=1 and status!=6 and
status!=7
and rental_end_date <now()
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<update id="updateRentContractEndSoonStatus" parameterType="com.iformall.domain.po.WxRentContract">
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()) <= 30 and rental_end_date > now()
</update>
<update id="updateRentContractPaidStatus" parameterType="com.iformall.domain.po.WxRentContract">
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 <= now() and rental_end_date >= now()
</update>
<update id="updateRentContractEndStatus" parameterType="com.iformall.domain.po.WxRentContract">
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 <now()
</update>
<update id="updateRentWaitSignStatus" parameterType="com.iformall.domain.po.WxRentContract">
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
</update>
@@ -233,9 +233,9 @@
select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(2,3,4)
)s) and status in(0,1) and status!=7 and tenant_id=#{tenantId} and rent_shop_type=2
</update>
<select id="getRentContractList" parameterType="com.iformall.domain.po.WxRentContract"
resultType="com.iformall.domain.po.WxRentContract">
resultType="com.iformall.domain.po.WxRentContract">
select s.shop_id,s.shop_number,s.building_name building, s.floor_name floor,s.build_area,rc.* from (
select s.id shop_id,ms.merchant_id,s.shop_number,b.building_name,f.floor_name,s.build_area
from wx_shop s
@@ -247,13 +247,13 @@
where rc.tenant_id=#{tenantId}
order by rc.id desc
</select>
<select id="updateStatusForUnsign" parameterType="com.iformall.domain.po.WxRentContract">
update wx_rent_contract set status=1 where tenant_id=#{tenantId} and status=2 and merchant_id is null
</select>
<select id="getRentInvalidList" parameterType="com.iformall.domain.po.WxRentContract"
resultType="com.iformall.domain.po.WxRentContract">
resultType="com.iformall.domain.po.WxRentContract">
select id from wx_rent_contract where shop_id in (
select s.shop_id from (SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(2,3,4)
)s) and status in(0,1) and status!=7 and tenant_id=#{tenantId} and apply_status=1
@@ -263,28 +263,28 @@
select count(*) from wx_rent_contract r,wx_bill_rent b
where b.rent_contract_id = r.id and b.status = 1 and r.id = #{id}
</select>
<select id="getMerchants" parameterType="com.iformall.domain.po.WxRentContract"
resultType="com.iformall.domain.po.WxRentContract">
resultType="com.iformall.domain.po.WxRentContract">
select * from wx_rent_contract where status in(2,3,4)
and merchant_id not in(select merchant_id from wx_property_contract where status in(2,3,4))
<if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if>
</select>
<select id="selectRentContractCountByShopId" parameterType="com.iformall.domain.po.WxRentContract" resultType="int">
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)
<if test="id!=null">
and id!=#{id}
</if>
</select>
<select id="selectRentContractByShopId" parameterType="com.iformall.domain.po.WxRentContract"
resultType="com.iformall.domain.po.WxRentContract">
resultType="com.iformall.domain.po.WxRentContract">
select * from wx_rent_contract where tenant_id=#{tenantId} and
json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"')) and rent_shop_type =1
<if test=" null != status ">and status=#{status} and status!=7</if>
</select>
<update id="updateInvalidContract" parameterType="com.iformall.domain.po.WxRentContract">
update wx_rent_contract set status=#{status} where tenant_id=#{tenantId} and id in(select r.id from (
select id from wx_rent_contract where json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"'))
@@ -297,9 +297,9 @@
where status in(2,3,4)
and merchant_id = #{merchantId}
</select>
<select id="hasContractNumber" parameterType="com.iformall.domain.po.WxRentContract"
resultType="int">
resultType="int">
select count(*) from (
select * from wx_rent_contract where tenant_id=#{tenantId}
and contract_number=#{contractNumber}
@@ -320,7 +320,7 @@
select s.type from wx_rent_contract r left join wx_shop s on(s.id = r.`shop_id`)
where r.id = #{id}
</select>
<resultMap id="contractMap" type="com.iformall.domain.vo.WxRentPropertyContractVo">
<id column="id" property="id"/>
<result column="contract_number" property="contractNumber"/>
@@ -340,9 +340,9 @@
<result column="property_status" property="propertyStatus"/>
<result column="rent_price_unit" property="rentPriceUnit"/>
<result column="property_price_unit" property="propertyPriceUnit"/>
</resultMap>
<select id="listContractVo" parameterType="com.iformall.domain.vo.WxRentPropertyContractVo" resultMap="contractMap">
select rc.id,rc.merchant_name,rc.rental_start_date,rc.rental_end_date,rc.`status`,
rc.price as rent_price,rc.contract_number,s.shop_number,rc.type,rc.apply_status,
@@ -361,7 +361,7 @@
</if>
<if test=" null != shopNumber and shopNumber!='' and null != rentShopType and rentShopType==2">
and s.`shop_number` like concat('%',#{shopNumber},'%')
</if>
<if test=" null != status ">and rc.`status` = #{status}</if>
<if test=" null != type ">and rc.`type` = #{type}</if>
@@ -375,7 +375,8 @@
<select id="getByBill" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap">
select * from wx_rent_contract where id in(
select rent_contract_id from wx_bill_rent id = #{id}
select rent_contract_id from wx_bill_rent id = #{id}
)
</select>
</mapper>