emis-service/emis-biz/src/main/resources/mapper/EmisCreditCustomerRecordMapper.xml
2025-03-11 16:10:57 +08:00

151 lines
9.1 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.EmisCreditCustomerRecordMapper">
<resultMap type="EmisCreditCustomerRecord" id="EmisCreditCustomerRecordResult">
<result property="id" column="id" />
<result property="accCode" column="acc_code" />
<result property="customerCode" column="customer_code" />
<result property="billCode" column="bill_code" />
<result property="changeType" column="change_type" />
<result property="changeMoney" column="change_money" />
<result property="preBalance" column="pre_balance" />
<result property="backBalance" column="back_balance" />
<result property="currency" column="currency" />
</resultMap>
<sql id="selectEmisCreditCustomerRecordVo">
select id, acc_code, customer_code, bill_code, change_type, change_money, pre_balance, back_balance, currency, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_credit_customer_record
</sql>
<select id="selectEmisCreditCustomerRecordList" parameterType="EmisCreditCustomerRecord" resultMap="EmisCreditCustomerRecordResult">
<include refid="selectEmisCreditCustomerRecordVo"/>
<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="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
<if test="billCode != null and billCode != ''"> and bill_code=#{billCode}</if>
<if test="changeType != null and changeType != ''"> and change_type=#{changeType}</if>
<if test="changeMoney != null "> and change_money = #{changeMoney}</if>
<if test="preBalance != null "> and pre_balance = #{preBalance}</if>
<if test="backBalance != null "> and back_balance = #{backBalance}</if>
<if test="currency != null and currency != ''"> and currency like concat('%', #{currency}, '%')</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 like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisCreditCustomerRecord" resultType="int">
select count(1) from emis_credit_customer_record
where del_flag='0'
and id = #{id}
and customer_code = #{customerCode}
and bill_code = #{billCode}
and change_type = #{changeType}
and change_money = #{changeMoney}
and pre_balance = #{preBalance}
and back_balance = #{backBalance}
and currency = #{currency}
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="selectEmisCreditCustomerRecordById" parameterType="Long" resultMap="EmisCreditCustomerRecordResult">
select id, acc_code, customer_code, bill_code, change_type, change_money, pre_balance, back_balance, currency, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_credit_customer_record a
where a.id = #{id}
</select>
<insert id="insertEmisCreditCustomerRecord" parameterType="EmisCreditCustomerRecord" useGeneratedKeys="true" keyProperty="id">
insert into emis_credit_customer_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="accCode != null and accCode != ''">acc_code,</if>
<if test="customerCode != null and customerCode != ''">customer_code,</if>
<if test="billCode != null and billCode != ''">bill_code,</if>
<if test="changeType != null and changeType != ''">change_type,</if>
<if test="changeMoney != null">change_money,</if>
<if test="preBalance != null">pre_balance,</if>
<if test="backBalance != null">back_balance,</if>
<if test="currency != null and currency != ''">currency,</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="customerCode != null and customerCode != ''">#{customerCode},</if>
<if test="billCode != null and billCode != ''">#{billCode},</if>
<if test="changeType != null and changeType != ''">#{changeType},</if>
<if test="changeMoney != null">#{changeMoney},</if>
<if test="preBalance != null">#{preBalance},</if>
<if test="backBalance != null">#{backBalance},</if>
<if test="currency != null and currency != ''">#{currency},</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="updateEmisCreditCustomerRecord" parameterType="EmisCreditCustomerRecord">
update emis_credit_customer_record
<trim prefix="SET" suffixOverrides=",">
<if test="accCode != null and accCode != ''">acc_code = #{accCode},</if>
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
<if test="changeType != null and changeType != ''">change_type = #{changeType},</if>
<if test="changeMoney != null">change_money = #{changeMoney},</if>
<if test="preBalance != null">pre_balance = #{preBalance},</if>
<if test="backBalance != null">back_balance = #{backBalance},</if>
<if test="currency != null and currency != ''">currency = #{currency},</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="deleteEmisCreditCustomerRecordById" parameterType="Long">
update emis_credit_customer_record set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisCreditCustomerRecordByIds" parameterType="String">
update emis_credit_customer_record set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>