emis-service/emis-biz/src/main/resources/mapper/EmisSiteSettleRecordMapper.xml
2024-06-17 23:32:22 +08:00

388 lines
27 KiB
XML

<?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.xdadan.erp.emis.mapper.EmisSiteSettleRecordMapper">
<resultMap type="EmisSiteSettleRecord" id="EmisSiteSettleRecordResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="accCode" column="acc_code" />
<result property="billCode" column="bill_code" />
<result property="recPayType" column="rec_pay_type" />
<result property="settleType" column="settle_type" />
<result property="settleName" column="settle_name" />
<result property="preBalance" column="pre_balance" />
<result property="preConfirmBalance" column="pre_confirm_balance" />
<result property="curMoney" column="cur_money" />
<result property="curConfirmMoney" column="cur_confirm_money" />
<result property="backBalance" column="back_balance" />
<result property="backConfirmBalance" column="back_confirm_balance" />
<result property="currency" column="currency" />
<result property="changeType" column="change_type" />
<result property="changeDate" column="change_date" />
<result property="centerCode" column="center_code" />
<result property="centerManCode" column="center_man_code" />
<result property="centerManName" column="center_man_name" />
<result property="siteCode" column="site_code" />
<result property="siteManCode" column="site_man_code" />
<result property="siteManName" column="site_man_name" />
<result property="financeDate" column="finance_date" />
<result property="operataDate" column="operata_date" />
<result property="centerDate" column="center_date" />
<result property="blConfirm" column="bl_confirm" />
<result property="confirmSiteCode" column="confirm_site_code" />
<result property="confirmManCode" column="confirm_man_code" />
<result property="settleSiteCode" column="settle_site_code" />
<result property="settleManCode" column="settle_man_code" />
<result property="blCenter" column="bl_center" />
<result property="blSite" column="bl_site" />
<result property="siteDate" column="site_date" />
<result property="blChargeFee" column="bl_charge_fee" />
<result property="transferCode" column="transfer_code" />
<result property="settleEbrCode" column="settle_ebr_code" />
<result property="settleEbrDate" column="settle_ebr_date" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
<result property="dataFrom" column="data_from" />
<association property="siteName" column="site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
<association property="centerName" column="center_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
</resultMap>
<!-- <result property="centerName" column="center_name" />-->
<!-- <result property="siteName" column="site_name" />-->
<sql id="selectEmisSiteSettleRecordVo">
select id, acc_code, bill_code, rec_pay_type, settle_type, settle_name, pre_balance, pre_confirm_balance, cur_money, cur_confirm_money, back_balance, back_confirm_balance, currency, change_type, change_date, center_code, center_name, center_man_code, center_man_name, site_code, site_name, site_man_code, site_man_name, finance_date, operata_date, center_date, bl_confirm, confirm_site_code, confirm_man_code, settle_site_code, settle_man_code, bl_center, bl_site, site_date, bl_charge_fee, transfer_code, settle_ebr_code, settle_ebr_date, customer_code, customer_name, data_from, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_site_settle_record
</sql>
<select id="selectEmisSiteSettleRecordList" parameterType="EmisSiteSettleRecord" resultMap="EmisSiteSettleRecordResult">
<include refid="selectEmisSiteSettleRecordVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="accCode != null and accCode != ''"> and acc_code = #{accCode}</if>
<if test="billCode != null and billCode != ''"> and ( FIND_IN_SET(`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') ) </if>
<if test="recPayType != null and recPayType != ''"> and rec_pay_type = #{recPayType}</if>
<if test="settleType != null and settleType != ''"> and settle_type = #{settleType}</if>
<if test="settleName != null and settleName != ''"> and settle_name like concat('%', #{settleName}, '%')</if>
<if test="preBalance != null "> and pre_balance = #{preBalance}</if>
<if test="preConfirmBalance != null "> and pre_confirm_balance = #{preConfirmBalance}</if>
<if test="curMoney != null "> and cur_money = #{curMoney}</if>
<if test="curConfirmMoney != null "> and cur_confirm_money = #{curConfirmMoney}</if>
<if test="backBalance != null "> and back_balance = #{backBalance}</if>
<if test="backConfirmBalance != null "> and back_confirm_balance = #{backConfirmBalance}</if>
<if test="currency != null and currency != ''"> and currency = #{currency}</if>
<if test="changeType != null and changeType != ''"> and change_type = #{changeType}</if>
<if test="changeDate != null "> and change_date = #{changeDate}</if>
<if test="centerCode != null and centerCode != ''"> and center_code = #{centerCode}</if>
<if test="centerName != null and centerName != ''"> and center_name like concat('%', #{centerName}, '%')</if>
<if test="centerManCode != null and centerManCode != ''"> and center_man_code = #{centerManCode}</if>
<if test="centerManName != null and centerManName != ''"> and center_man_name like concat('%', #{centerManName}, '%')</if>
<if test="siteCode != null and siteCode != ''"> and site_code = #{siteCode}</if>
<if test="siteName != null and siteName != ''"> and site_name like concat('%', #{siteName}, '%')</if>
<if test="siteManCode != null and siteManCode != ''"> and site_man_code = #{siteManCode}</if>
<if test="siteManName != null and siteManName != ''"> and site_man_name like concat('%', #{siteManName}, '%')</if>
<if test="financeDate != null "> and finance_date = #{financeDate}</if>
<if test="operataDate != null "> and operata_date = #{operataDate}</if>
<if test="centerDate != null "> and center_date = #{centerDate}</if>
<if test="blConfirm != null and blConfirm != ''"> and bl_confirm = #{blConfirm}</if>
<if test="confirmSiteCode != null and confirmSiteCode != ''"> and confirm_site_code = #{confirmSiteCode}</if>
<if test="confirmManCode != null and confirmManCode != ''"> and confirm_man_code = #{confirmManCode}</if>
<if test="settleSiteCode != null and settleSiteCode != ''"> and settle_site_code = #{settleSiteCode}</if>
<if test="settleManCode != null and settleManCode != ''"> and settle_man_code = #{settleManCode}</if>
<if test="blCenter != null and blCenter != ''"> and bl_center = #{blCenter}</if>
<if test="blSite != null and blSite != ''"> and bl_site = #{blSite}</if>
<if test="siteDate != null "> and site_date = #{siteDate}</if>
<if test="blChargeFee != null and blChargeFee != ''"> and bl_charge_fee like concat('%', #{blChargeFee}, '%')</if>
<if test="transferCode != null and transferCode != ''"> and transfer_code = #{transferCode}</if>
<if test="settleEbrCode != null and settleEbrCode != ''"> and settle_ebr_code like concat('%', #{settleEbrCode}, '%')</if>
<if test="settleEbrDate != null "> and settle_ebr_date = #{settleEbrDate}</if>
<if test="customerCode != null and customerCode != ''"> and customer_code = #{customerCode}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="dataFrom != null and dataFrom != ''"> and data_from like concat('%', #{dataFrom}, '%')</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site = #{createSite}</if>
<if test="updateSite != null and updateSite != ''"> and update_site = #{updateSite}</if>
<if test="params.beginFinanceDate!= null and params.beginFinanceDate != ''">
and finance_date <![CDATA[ >= ]]> #{params.beginFinanceDate}
</if>
<if test="params.endFinanceDate != null and params.endFinanceDate != ''">
and finance_date <![CDATA[ <= ]]> #{params.endFinanceDate}
</if>
<if test="params.beginChangeDate!= null and params.beginChangeDate != ''">
and change_date <![CDATA[ >= ]]> #{params.beginChangeDate}
</if>
<if test="params.endChangeDate != null and params.endChangeDate != ''">
and change_date <![CDATA[ <= ]]> #{params.endChangeDate}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
)
</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisSiteSettleRecord" resultType="int">
select count(1) from emis_site_settle_record
where del_flag='0'
and id = #{id}
and acc_code = #{accCode}
and bill_code = #{billCode}
and rec_pay_type = #{recPayType}
and settle_type = #{settleType}
and settle_name = #{settleName}
and pre_balance = #{preBalance}
and pre_confirm_balance = #{preConfirmBalance}
and cur_money = #{curMoney}
and cur_confirm_money = #{curConfirmMoney}
and back_balance = #{backBalance}
and back_confirm_balance = #{backConfirmBalance}
and currency = #{currency}
and change_type = #{changeType}
and change_date = #{changeDate}
and center_code = #{centerCode}
and center_name = #{centerName}
and center_man_code = #{centerManCode}
and center_man_name = #{centerManName}
and site_code = #{siteCode}
and site_name = #{siteName}
and site_man_code = #{siteManCode}
and site_man_name = #{siteManName}
and finance_date = #{financeDate}
and operata_date = #{operataDate}
and center_date = #{centerDate}
and bl_confirm = #{blConfirm}
and confirm_site_code = #{confirmSiteCode}
and confirm_man_code = #{confirmManCode}
and settle_site_code = #{settleSiteCode}
and settle_man_code = #{settleManCode}
and bl_center = #{blCenter}
and bl_site = #{blSite}
and site_date = #{siteDate}
and bl_charge_fee = #{blChargeFee}
and transfer_code = #{transferCode}
and settle_ebr_code = #{settleEbrCode}
and settle_ebr_date = #{settleEbrDate}
and customer_code = #{customerCode}
and customer_name = #{customerName}
and data_from = #{dataFrom}
and remark = #{remark}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
<select id="selectEmisSiteSettleRecordById" parameterType="Long" resultMap="EmisSiteSettleRecordResult">
select id, acc_code, bill_code, rec_pay_type, settle_type, settle_name, pre_balance, pre_confirm_balance, cur_money, cur_confirm_money, back_balance, back_confirm_balance, currency, change_type, change_date, center_code, center_name, center_man_code, center_man_name, site_code, site_name, site_man_code, site_man_name, finance_date, operata_date, center_date, bl_confirm, confirm_site_code, confirm_man_code, settle_site_code, settle_man_code, bl_center, bl_site, site_date, bl_charge_fee, transfer_code, settle_ebr_code, settle_ebr_date, customer_code, customer_name, data_from, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_site_settle_record a
where a.id = #{id}
</select>
<insert id="insertEmisSiteSettleRecord" parameterType="EmisSiteSettleRecord" useGeneratedKeys="true" keyProperty="id">
insert into emis_site_settle_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="accCode != null and accCode != ''">acc_code,</if>
<if test="billCode != null and billCode != ''">bill_code,</if>
<if test="recPayType != null and recPayType != ''">rec_pay_type,</if>
<if test="settleType != null and settleType != ''">settle_type,</if>
<if test="settleName != null and settleName != ''">settle_name,</if>
<if test="preBalance != null">pre_balance,</if>
<if test="preConfirmBalance != null">pre_confirm_balance,</if>
<if test="curMoney != null">cur_money,</if>
<if test="curConfirmMoney != null">cur_confirm_money,</if>
<if test="backBalance != null">back_balance,</if>
<if test="backConfirmBalance != null">back_confirm_balance,</if>
<if test="currency != null and currency != ''">currency,</if>
<if test="changeType != null and changeType != ''">change_type,</if>
<if test="changeDate != null">change_date,</if>
<if test="centerCode != null and centerCode != ''">center_code,</if>
<if test="centerName != null and centerName != ''">center_name,</if>
<if test="centerManCode != null and centerManCode != ''">center_man_code,</if>
<if test="centerManName != null and centerManName != ''">center_man_name,</if>
<if test="siteCode != null and siteCode != ''">site_code,</if>
<if test="siteName != null and siteName != ''">site_name,</if>
<if test="siteManCode != null and siteManCode != ''">site_man_code,</if>
<if test="siteManName != null and siteManName != ''">site_man_name,</if>
<if test="financeDate != null">finance_date,</if>
<if test="operataDate != null">operata_date,</if>
<if test="centerDate != null">center_date,</if>
<if test="blConfirm != null and blConfirm != ''">bl_confirm,</if>
<if test="confirmSiteCode != null and confirmSiteCode != ''">confirm_site_code,</if>
<if test="confirmManCode != null and confirmManCode != ''">confirm_man_code,</if>
<if test="settleSiteCode != null and settleSiteCode != ''">settle_site_code,</if>
<if test="settleManCode != null and settleManCode != ''">settle_man_code,</if>
<if test="blCenter != null and blCenter != ''">bl_center,</if>
<if test="blSite != null and blSite != ''">bl_site,</if>
<if test="siteDate != null">site_date,</if>
<if test="blChargeFee != null and blChargeFee != ''">bl_charge_fee,</if>
<if test="transferCode != null and transferCode != ''">transfer_code,</if>
<if test="settleEbrCode != null and settleEbrCode != ''">settle_ebr_code,</if>
<if test="settleEbrDate != null">settle_ebr_date,</if>
<if test="customerCode != null and customerCode != ''">customer_code,</if>
<if test="customerName != null and customerName != ''">customer_name,</if>
<if test="dataFrom != null and dataFrom != ''">data_from,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="accCode != null and accCode != ''">#{accCode},</if>
<if test="billCode != null and billCode != ''">#{billCode},</if>
<if test="recPayType != null and recPayType != ''">#{recPayType},</if>
<if test="settleType != null and settleType != ''">#{settleType},</if>
<if test="settleName != null and settleName != ''">#{settleName},</if>
<if test="preBalance != null">#{preBalance},</if>
<if test="preConfirmBalance != null">#{preConfirmBalance},</if>
<if test="curMoney != null">#{curMoney},</if>
<if test="curConfirmMoney != null">#{curConfirmMoney},</if>
<if test="backBalance != null">#{backBalance},</if>
<if test="backConfirmBalance != null">#{backConfirmBalance},</if>
<if test="currency != null and currency != ''">#{currency},</if>
<if test="changeType != null and changeType != ''">#{changeType},</if>
<if test="changeDate != null">#{changeDate},</if>
<if test="centerCode != null and centerCode != ''">#{centerCode},</if>
<if test="centerName != null and centerName != ''">#{centerName},</if>
<if test="centerManCode != null and centerManCode != ''">#{centerManCode},</if>
<if test="centerManName != null and centerManName != ''">#{centerManName},</if>
<if test="siteCode != null and siteCode != ''">#{siteCode},</if>
<if test="siteName != null and siteName != ''">#{siteName},</if>
<if test="siteManCode != null and siteManCode != ''">#{siteManCode},</if>
<if test="siteManName != null and siteManName != ''">#{siteManName},</if>
<if test="financeDate != null">#{financeDate},</if>
<if test="operataDate != null">#{operataDate},</if>
<if test="centerDate != null">#{centerDate},</if>
<if test="blConfirm != null and blConfirm != ''">#{blConfirm},</if>
<if test="confirmSiteCode != null and confirmSiteCode != ''">#{confirmSiteCode},</if>
<if test="confirmManCode != null and confirmManCode != ''">#{confirmManCode},</if>
<if test="settleSiteCode != null and settleSiteCode != ''">#{settleSiteCode},</if>
<if test="settleManCode != null and settleManCode != ''">#{settleManCode},</if>
<if test="blCenter != null and blCenter != ''">#{blCenter},</if>
<if test="blSite != null and blSite != ''">#{blSite},</if>
<if test="siteDate != null">#{siteDate},</if>
<if test="blChargeFee != null and blChargeFee != ''">#{blChargeFee},</if>
<if test="transferCode != null and transferCode != ''">#{transferCode},</if>
<if test="settleEbrCode != null and settleEbrCode != ''">#{settleEbrCode},</if>
<if test="settleEbrDate != null">#{settleEbrDate},</if>
<if test="customerCode != null and customerCode != ''">#{customerCode},</if>
<if test="customerName != null and customerName != ''">#{customerName},</if>
<if test="dataFrom != null and dataFrom != ''">#{dataFrom},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
</insert>
<update id="updateEmisSiteSettleRecord" parameterType="EmisSiteSettleRecord">
update emis_site_settle_record
<trim prefix="SET" suffixOverrides=",">
<if test="accCode != null and accCode != ''">acc_code = #{accCode},</if>
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
<if test="recPayType != null and recPayType != ''">rec_pay_type = #{recPayType},</if>
<if test="settleType != null and settleType != ''">settle_type = #{settleType},</if>
<if test="settleName != null and settleName != ''">settle_name = #{settleName},</if>
<if test="preBalance != null">pre_balance = #{preBalance},</if>
<if test="preConfirmBalance != null">pre_confirm_balance = #{preConfirmBalance},</if>
<if test="curMoney != null">cur_money = #{curMoney},</if>
<if test="curConfirmMoney != null">cur_confirm_money = #{curConfirmMoney},</if>
<if test="backBalance != null">back_balance = #{backBalance},</if>
<if test="backConfirmBalance != null">back_confirm_balance = #{backConfirmBalance},</if>
<if test="currency != null and currency != ''">currency = #{currency},</if>
<if test="changeType != null and changeType != ''">change_type = #{changeType},</if>
<if test="changeDate != null">change_date = #{changeDate},</if>
<if test="centerCode != null and centerCode != ''">center_code = #{centerCode},</if>
<if test="centerName != null and centerName != ''">center_name = #{centerName},</if>
<if test="centerManCode != null and centerManCode != ''">center_man_code = #{centerManCode},</if>
<if test="centerManName != null and centerManName != ''">center_man_name = #{centerManName},</if>
<if test="siteCode != null and siteCode != ''">site_code = #{siteCode},</if>
<if test="siteName != null and siteName != ''">site_name = #{siteName},</if>
<if test="siteManCode != null and siteManCode != ''">site_man_code = #{siteManCode},</if>
<if test="siteManName != null and siteManName != ''">site_man_name = #{siteManName},</if>
<if test="financeDate != null">finance_date = #{financeDate},</if>
<if test="operataDate != null">operata_date = #{operataDate},</if>
<if test="centerDate != null">center_date = #{centerDate},</if>
<if test="blConfirm != null and blConfirm != ''">bl_confirm = #{blConfirm},</if>
<if test="confirmSiteCode != null and confirmSiteCode != ''">confirm_site_code = #{confirmSiteCode},</if>
<if test="confirmManCode != null and confirmManCode != ''">confirm_man_code = #{confirmManCode},</if>
<if test="settleSiteCode != null and settleSiteCode != ''">settle_site_code = #{settleSiteCode},</if>
<if test="settleManCode != null and settleManCode != ''">settle_man_code = #{settleManCode},</if>
<if test="blCenter != null and blCenter != ''">bl_center = #{blCenter},</if>
<if test="blSite != null and blSite != ''">bl_site = #{blSite},</if>
<if test="siteDate != null">site_date = #{siteDate},</if>
<if test="blChargeFee != null and blChargeFee != ''">bl_charge_fee = #{blChargeFee},</if>
<if test="transferCode != null and transferCode != ''">transfer_code = #{transferCode},</if>
<if test="settleEbrCode != null and settleEbrCode != ''">settle_ebr_code = #{settleEbrCode},</if>
<if test="settleEbrDate != null">settle_ebr_date = #{settleEbrDate},</if>
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
<if test="dataFrom != null and dataFrom != ''">data_from = #{dataFrom},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisSiteSettleRecordById" parameterType="Long">
update emis_site_settle_record set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisSiteSettleRecordByIds" parameterType="String">
update emis_site_settle_record set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>