|
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.iformall.mapper.WxBillPropertyMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillProperty">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
- <result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/>
- <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/>
- <result column="pay" jdbcType="VARCHAR" property="pay"/>
- <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/>
- <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/>
- <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
- <result column="create_by" jdbcType="BIGINT" property="createBy"/>
- <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/>
- <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
- <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/>
- <result column="expired_day" jdbcType="INTEGER" property="expiredDay"/>
- <result column="status" jdbcType="INTEGER" property="status"/>
- <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/>
- <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/>
- <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/>
- <result column="is_del" jdbcType="INTEGER" property="isDel"/>
- <result column="need_pay" jdbcType="VARCHAR" property="needPay"/>
- <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
- <result column="user_id" jdbcType="BIGINT" property="userId"/>
- <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
- <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/>
- <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
- <result column="revenue" jdbcType="BIGINT" property="revenue"/>
- <result column="late_pay_ratio" jdbcType="INTEGER" property="latePayRatio"/>
- <result column="late_pay_time" jdbcType="TIMESTAMP" property="latePayTime"/>
- <result column="late_pay_price" jdbcType="VARCHAR" property="latePayPrice"/>
- <result column="period" jdbcType="INTEGER" property="period"/>
- <result column="is_preview" property="isPreview"/>
- <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/>
- <result column="pay_way" jdbcType="BIGINT" property="payWay"/>
- <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/>
- <result column="comments" jdbcType="VARCHAR" property="comments"/>
- <result column="parent_bill_id" jdbcType="BIGINT" property="parentBillId"/>
- <result column="starttime" property="starttime"/>
- <result column="endtime" property="endtime"/>
- <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/>
- <result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/>
- <result column="merchant_name" property="merchantName"/>
- <result column="deposit" property="deposit"/>
- <result column="deposit_status" property="depositStatus"/>
- <result column="all_period" property="allPeriod"/>
-
- <result column="late_pay_day" property="latePayDay"/>
- <result column="late_pay_ratio" property="latePayRatio"/>
- <result column="freeze" property="freeze"/>
- <result column="service_charge_pay" property="serviceChargePay"/>
- <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/>
- <result column="set_off" jdbcType="VARCHAR" property="setOff"/>
- <result column="advance_id" jdbcType="BIGINT" property="advanceId"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,
- `createtime`,`expired_day`,`tenant_id`,`status`,`is_del`,`need_pay`,`last_owe_call_time`,`last_owe_call_user`,
- `merchant_id`,`user_id`,`shop_id`,`updatetime`,`rent_shop_type`,`apply_status`,`apply_pay_img`,`apply_update_time`,
- `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`,`create_by`,`create_by_name`,`update_by`,`update_by_name`,
- `pay_way`,`late_pay_status`,`comments`,starttime,endtime,freeze,service_charge_pay,`parent_bill_id`,`energy_fees_id`,`set_off`,`advance_id`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1=1
- <if test=" null != id ">and `id` = #{id}</if>
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != propertyContractId ">and `property_contract_id` = #{propertyContractId}</if>
- <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if>
- <if test=" null != advanceId ">and `advance_id` = #{advanceId}</if>
- <if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if>
- <if test=" null != pay ">and `pay` = #{pay}</if>
- <if test=" null != receiveDate ">and `receive_date` = #{receiveDate}</if>
- <if test=" null != payDate ">and `pay_date` = #{payDate}</if>
- <if test=" null != createtime ">and `createtime` = #{createtime}</if>
- <if test=" null != expiredDay ">and `expired_day` = #{expiredDay}</if>
- <if test=" null != status ">and `status` = #{status}</if>
- <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if>
- <if test=" null != isDel ">and `is_del` = #{isDel}</if>
- <if test=" null != needPay ">and `need_pay` = #{needPay}</if>
- <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if>
- <if test=" null != userId ">and `user_id` = #{userId}</if>
- <if test=" null != shopId ">and `shop_id` = #{shopId}</if>
- <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if>
- <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
- <if test=" null != isPreview ">and is_preview = #{isPreview}</if>
- <if test=" null != payWay ">and `pay_way` = #{payWay}</if>
- <if test=" null != latePayStatus ">and `late_pay_status` = #{latePayStatus}</if>
- <if test=" null != parentBillId ">and `parent_bill_id` = #{parentBillId}</if>
- <if test=" 1 == hasParentBillId ">and `parent_bill_id` is not null</if>
- <if test=" 0 == hasParentBillId ">and `parent_bill_id` is null</if>
- <if test=" 1 == hasFeesStardarsId ">and `energy_fees_id` is not null</if>
- <if test=" 0 == hasFeesStardarsId ">and `energy_fees_id` is null</if>
-
- <if test=" 1 == notifyed ">and (`last_owe_call_time` is not null and `receive_pay` - `pay` - `set_off` > 0 and status not in (3,6,7) )</if>
- <if test=" null != propertyContractIds ">
- and property_contract_id in
- <foreach collection="propertyContractIds" index="index" item="pidItem" open="(" separator="," close=")">
- #{pidItem}
- </foreach>
- </if>
-
- <if test=" null != merchantIds ">
- and merchant_id in
- <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")">
- #{midItem}
- </foreach>
- </if>
-
- <if test=" null != statusList ">
- and status in
- <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")">
- #{stItem}
- </foreach>
- </if>
-
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_bill_property
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_bill_property
- where id = #{id} and tenant_id = #{tenantId}
- </select>
-
- <sql id="queryBillPropertyListConditions">
- <where>
- br.is_preview = 0
- <if test=" null != id ">and br.`id` = #{id}</if>
- <if test=" null != tenantId and '' != tenantId"> and br.`tenant_id` = #{tenantId}</if>
- <if test=" null != parentTenantId and '' != parentTenantId">and br.`parent_tenant_id` = #{parentTenantId}</if>
- <if test=" null != freeze ">and br.`freeze` = #{freeze}</if>
- <if test=" null != id ">and br.`id` = #{id}</if>
- <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if>
- <if test=" null != energyFeesId ">and br.`energy_fees_id` = #{energyFeesId}</if>
- <if test=" null != advanceId ">and br.`advance_id` = #{advanceId}</if>
- <if test=" null != status ">and br.`status` = #{status}</if>
- <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if>
- <if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
- <if test=" null != starttime">and br.`starttime` <= #{starttime}</if>
- <if test=" null != endtime">and br.`endtime` >= #{endtime}</if>
- <if test=" null != month and '' != month">
- and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month}
- </if>
- <if test=" null == nearBillLastTime and null != oweBillLastTime">
- and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - br.`set_off` > 0 and br.status not in (3,6,7))
- </if>
- <if test=" null != nearBillLastTime and null != oweBillLastTime">
- and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.`receive_pay` - br.`pay` - br.`set_off` > 0 and br.status not in (3,6,7))
- </if>
- <if test=" null != needPayStartDay">
- and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - br.`set_off` > 0 and br.status not in (3,6,7))
- </if>
- <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
- <if test=" null != propertyContractId ">and br.`property_contract_id` = #{propertyContractId}</if>
- <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if>
- <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if>
- <if test=" null != parentBillId ">and br.`parent_bill_id` = #{parentBillId}</if>
- <if test=" 1 == hasParentBillId ">and br.`parent_bill_id` is not null</if>
- <if test=" 0 == hasParentBillId ">and br.`parent_bill_id` is null</if>
- <if test=" 1 == hasFeesStardarsId ">and br.`energy_fees_id` is not null</if>
- <if test=" 0 == hasFeesStardarsId ">and br.`energy_fees_id` is null</if>
-
- <if test=" 1 == notifyed ">and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` - br.`set_off` > 0 and br.status not in (3,6,7) )</if>
- <if test=" null != propertyContractIds ">
- and br.property_contract_id in
- <foreach collection="propertyContractIds" index="index" item="pidItem" open="(" separator="," close=")">
- #{pidItem}
- </foreach>
- </if>
-
- <if test=" null != merchantIds ">
- and br.merchant_id in
- <foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")">
- #{midItem}
- </foreach>
- </if>
-
- <if test=" null != statusList ">
- and br.status in
- <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")">
- #{stItem}
- </foreach>
- </if>
- </where>
- </sql>
-
- <select id="queryBillPropertyList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap">
- select br.`id`,br.`tenant_id`,br.`parent_tenant_id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,
- br.`status`,br.`need_pay`,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`period`,br.`last_owe_call_time`,br.`last_owe_call_user`,
- br.`revenue`,br.`late_pay_time`,br.`property_contract_id`,br.late_pay_price,br.`shop_info`,br.pay_way,br.late_pay_status,br.`energy_fees_id`,
- br.`comments`,br.starttime,br.endtime,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.freeze,br.service_charge_pay,
- br.`late_pay_ratio`,br.`parent_bill_id`,br.`create_by`,br.`create_by_name`,br.`update_by`,br.`update_by_name`,br.`set_off`,br.`advance_id`
- from wx_bill_property br
- <include refid="queryBillPropertyListConditions"/>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </select>
-
- <select id="queryPropertyContractIdList" parameterType="com.iformall.domain.po.WxBillProperty" resultType="Long">
- select distinct br.property_contract_id
- from wx_bill_property br
- <include refid="queryBillPropertyListConditions"/>
- </select>
-
- <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum">
- <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/>
- <result column="paid" jdbcType="VARCHAR" property="paid" />
- <result column="min_date" jdbcType="TIMESTAMP" property="minDate" />
- <result column="max_date" jdbcType="TIMESTAMP" property="maxDate" />
- <result column="service_pay" jdbcType="VARCHAR" property="servicePay"/>
- <result column="late_pay" jdbcType="VARCHAR" property="latePay"/>
- <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/>
- </resultMap>
- <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="SumBaseResultMap">
- select
- sum(CAST(br.receive_pay AS DECIMAL(20,2))) receive_pay ,
- sum(CAST(br.pay AS DECIMAL(20,2))) paid,
- min(starttime) min_date,
- max(endtime) max_date,
- sum(CAST(br.service_charge_pay AS DECIMAL(20,2))) service_pay ,
- sum(CAST(br.late_pay_price AS DECIMAL(20,2))) late_pay,
- '0' return_pay
- from wx_bill_property br
- <include refid="queryBillPropertyListConditions"/>
- </select>
-
- <select id="getMerchantIdList" parameterType="com.iformall.domain.po.WxBillProperty" resultType="Long">
- select distinct merchant_id from wx_bill_property br
- <include refid="queryBillPropertyListConditions"/>
- </select>
-
- <resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify">
- <result column="total_count" jdbcType="INTEGER" property="totalCount"/>
- <result column="total_money" jdbcType="VARCHAR" property="totalMoney" />
- <result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/>
- </resultMap>
- <select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="HotNotifyBaseResultMap">
- select count(1) total_count , sum(CAST(br.`receive_pay` AS DECIMAL(20,2)) - CAST(br.`pay` AS DECIMAL(20,2)) - CAST(IFNULL(br.`set_off`,"0") AS DECIMAL(20,2))) total_money,MIN(br.starttime) min_begin_time from wx_bill_property br
- <include refid="queryBillPropertyListConditions"/>
- </select>
-
- <resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify">
- <result column="bill_type" jdbcType="INTEGER" property="billType"/>
- <result column="bill_type_name" jdbcType="VARCHAR" property="billTypeName" />
- <result column="bill_id" jdbcType="BIGINT" property="billId" />
- <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/>
- <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/>
- <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/>
- <result column="pay" jdbcType="VARCHAR" property="pay"/>
- <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
- </resultMap>
- <select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="NotifyResultMap">
- select #{billType} bill_type,#{billTypeName} bill_type_name,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.merchant_id from wx_bill_property br
- <include refid="queryBillPropertyListConditions"/>
- </select>
-
- <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap">
- select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property
- where is_preview = 0 and status!=6
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and receive_date between #{startdate} and #{enddate}
- group by tenant_id, parent_tenant_id
- </select>
-
-
- <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap">
- select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property
- where receive_date between #{startdate} and #{enddate}
- and is_preview = 0 and status!=6
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- </select>
-
-
- <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap">
- select IFNULL(sum(receive_pay - pay),0) owe,tenant_id from wx_bill_property
- where status = 1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and receive_date between #{startdate} and #{enddate}
- and is_preview = 0
- </select>
-
- <update id="updateNotPaidStatus" parameterType="hashmap">
- update wx_bill_property b set b.status=#{notPaid},b.expired_day=
- DATEDIFF(now(), b.receive_date)
- where b.status!=#{paid} and b.status!=6
- and DATEDIFF(now(), b.receive_date) >0
- <if test=" null != tenantId and '' != tenantId">
- and b.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and b.`parent_tenant_id` = #{parentTenantId}
- </if>
- </update>
-
- <update id="updateWaitPayStatus" parameterType="hashmap">
- update wx_bill_property set status=#{waitPay} where id in(
- select a.id from (
- select br.id,rc.receive_period,br.property_contract_id,br.receive_date
- from wx_bill_property br
- left join wx_property_contract rc on br.property_contract_id=rc.id
- where 1=1
- <if test=" null != tenantId and '' != tenantId">
- and br.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and br.`parent_tenant_id` = #{parentTenantId}
- </if>
- and br.status!=#{paid} and br.status != 6 and now() < br.receive_date
- and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a)
- </update>
-
-
- <update id="updateInvalidStatus" parameterType="com.iformall.domain.po.WxBillProperty">
- update wx_bill_property set status = 6 where property_contract_id = #{propertyContractId}
- and status in(4,2)
- </update>
-
- <update id="updateInvalidStatusByRent" parameterType="com.iformall.domain.po.WxRentContract">
- update wx_bill_property set status = 6 where property_contract_id in
- (select id from wx_property_contract where rent_contract_id = #{id})
- and status != 3
- </update>
-
- <delete id="deleteBillByContract" parameterType="com.iformall.domain.po.WxPropertyContract">
- delete from wx_bill_property where property_contract_id = #{id}
- </delete>
-
- <delete id="deletePreviewBill" parameterType="com.iformall.domain.po.WxBillProperty">
- delete from wx_bill_property where property_contract_id = #{propertyContractId}
- <if test=" null != isPreview "> and is_preview = #{isPreview}</if>
- </delete>
-
- <update id="updateForReceivePay" parameterType="com.iformall.domain.po.WxBillProperty">
- update wx_bill_property set updatetime = now()
- <if test=" null != receivePay ">,receive_pay = #{receivePay}</if>
- <if test=" null != comments ">,comments = #{comments}</if>
- <if test=" null != receiveDate ">,receive_date = #{receiveDate}</if>
- <if test="0 == receivePay or 0l == receivePay">,status = 3,pay_date=now()</if>
- where id = #{id}
- </update>
-
- <update id="updatePreviewStatus" parameterType="com.iformall.domain.po.WxBillProperty">
- update wx_bill_property set is_preview = #{isPreview},merchant_id = #{merchantId},need_pay = receive_pay
- where property_contract_id = #{propertyContractId}
- </update>
-
-
- <select id="oweBillCount" parameterType="java.lang.Long" resultType="java.lang.Long">
- select count(br.id) from wx_bill_property br,wx_property_contract c
- where c.id = br.property_contract_id and br.status = 1 and c.id = #{contractId}
- </select>
-
- <insert id="insertBills" parameterType="hashmap">
- INSERT INTO wx_bill_property (id,property_contract_id, receive_pay, pay, receive_date, pay_date, createtime,
- expired_day,create_by,create_by_name,update_by,update_by_name,
- tenant_id, parent_tenant_id, status, is_del, need_pay, merchant_id, user_id, shop_id, updatetime, starttime,
- endtime,
- rent_shop_type, revenue, late_pay_ratio, late_pay_time, late_pay_price, period, is_preview, shop_info,
- pay_way, late_pay_status, comments,service_charge_pay,parent_bill_id,energy_fees_id,advance_id)
- VALUES
- <foreach collection="list" item="item" index="index" separator=",">
- (
- #{item.id},#{item.propertyContractId},#{item.receivePay},#{item.pay},#{item.receiveDate},#{item.payDate},#{item.createtime},
- #{item.expiredDay},#{item.createBy},#{item.createByName},#{item.updateBy},#{item.updateByName},
- #{item.tenantId},#{item.parentTenantId},#{item.status},#{item.isDel},#{item.needPay},#{item.merchantId},
- #{item.userId},#{item.shopId},#{item.updatetime},#{item.starttime},#{item.endtime},#{item.rentShopType},#{item.revenue},
- #{item.latePayRatio},#{item.latePayTime},#{item.latePayPrice},#{item.period},#{item.isPreview},#{item.shopInfo},
- #{item.payWay},#{item.latePayStatus},#{item.comments},#{item.serviceChargePay},#{item.parentBillId},#{item.energyFeesId},#{item.advanceId}
- )
- </foreach>
- </insert>
-
- <update id="updateBills" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update wx_bill_property
- <set>
- <if test=" null != item.receivePay ">updatetime = now(),receive_pay = #{item.receivePay},</if>
- <if test=" null != item.comments ">comments = #{item.comments},</if>
- <if test=" null != item.receiveDate ">receive_date = #{item.receiveDate},</if>
- <if test="0 == item.receivePay or 0l == item.receivePay">status = 3,pay_date=now()</if>
- </set>
- where id = #{item.id}
- </foreach>
- </update>
-
- <select id="selectBillOne" parameterType="com.iformall.domain.po.WxBillProperty"
- resultType="com.iformall.domain.po.WxBillProperty">
- select * from wx_bill_property where merchant_id=#{merchantId}
- AND rent_shop_type = #{rentShopType} AND is_preview = #{isPreview}
- AND date_format(starttime,'%Y-%m-%d 00:00:00.0') = #{starttime} AND date_format(endtime,'%Y-%m-%d 00:00:00.0') = #{endtime}
- </select>
-
- <delete id = "deleteById" parameterType="HashMap">
- delete from wx_bill_property where id = #{id} and tenant_id = #{tenantId}
- </delete>
-
- <!--
- <update id="insertBillAction">
- insert into wx_bill_action(id,user_name,`action`,bill_id,details,tenant_id,parent_tenant_id)
- select
- (select unix_timestamp(now()) + CEILING(RAND()*90000+10000) + CEILING(RAND()*90000+10000) + CEILING(RAND()*90000+10000)) id
- ,'系统端' user_name,7 `action`,b.id bill_id,
- CONCAT('系统计入',
- if(b.late_pay_price is null,
- round(
- c.late_pay_ratio * DATEDIFF(now(), date_add(b.receive_date,interval(c.late_pay_day) day)) /10000
- ,2)
- ,
- round(
- (c.late_pay_ratio) /10000
- ,2)
- )
- ,'元') details,b.tenant_id,b.parent_tenant_id
- from wx_bill_property b left join wx_property_contract c on(b.`property_contract_id`=c.id)
- where c.late_pay_ratio >0
- and DATEDIFF(now(), date_add(b.receive_date,interval(c.late_pay_day) day)) >0
- and b.status!=3 and b.status!=6
- </update>
-
- <update id="autoAddLatePayPrice">
- update wx_bill_property b set b.late_pay_price =
- if(b.late_pay_price is null,
- round(
- (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`)
- * DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day)) /100
- ,2)
- ,
- b.late_pay_price +
- round(
- (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) /100
- ,2)
- )
- where b.status!=3 and b.status!=6
- and (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) > 0
- and DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day)) >0;
- </update>
-
- <update id="updateServiceCharge" parameterType="com.iformall.domain.po.WxPayAccountBill">
- update wx_bill_property
- set service_charge_pay=round(receive_pay*#{serviceChargeRate}/10000)
- where service_charge_pay=0 and status in(1,2,4)
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- </update>
- -->
- <!-- <update id="updateOwe">
- update wx_bill_property
- set owe = receive_pay + service_charge_pay + ifnull(late_pay_price,0) - pay
- where status in (1,2,4)
- </update> -->
-
- </mapper>
|