emis-service/emis-biz/src/main/resources/mapper/EmisCreditCustomerMapper.xml

172 lines
10 KiB
XML
Raw Normal View History

2025-03-08 16:26:34 +00:00
<?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.EmisCreditCustomerMapper">
2025-03-08 16:27:34 +00:00
<resultMap type="EmisCreditCustomer" id="EmisCreditCustomerResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
2025-03-08 16:26:34 +00:00
<result property="id" column="id" />
<result property="customerCode" column="customer_code" />
<result property="curMoney" column="cur_money" />
<result property="curMoneyRate" column="cur_money_rate" />
<result property="creditMoney" column="credit_money" />
<result property="currency" column="currency" />
<result property="transType" column="trans_type" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<result property="blOpen" column="bl_open" />
2025-03-10 04:50:52 +00:00
<result property="customerName" column="customer_name" />
2025-03-08 16:26:34 +00:00
</resultMap>
<sql id="selectEmisCreditCustomerVo">
2025-03-10 04:50:52 +00:00
select id, customer_code, cur_money, cur_money_rate, credit_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_credit_customer
2025-03-08 16:26:34 +00:00
</sql>
<select id="selectEmisCreditCustomerList" parameterType="EmisCreditCustomer" resultMap="EmisCreditCustomerResult">
2025-03-10 04:50:52 +00:00
select
a.id, a.customer_code, a.cur_money, a.cur_money_rate,
a.credit_money, a.currency, a.trans_type, a.start_date, a.end_date,
a.bl_open, a.remark, a.tenant_id, a.del_flag, a.create_by, a.create_time,
a.update_by, a.update_time, a.create_site, a.update_site,
b.customer_name
from emis_credit_customer a,emis_customer_user b
<where>
a.del_flag='0' and b.del_flag='0' and a.customer_code=b.customer_code
<if test="id != null "> and a.id = #{id}</if>
<if test="customerCode != null and customerCode != ''"> and a.customer_code=#{customerCode}</if>
<if test="curMoney != null "> and a.cur_money = #{curMoney}</if>
<if test="curMoneyRate != null "> and a.cur_money_rate = #{curMoneyRate}</if>
<if test="creditMoney != null "> and a.credit_money = #{creditMoney}</if>
<if test="currency != null and currency != ''"> and a.currency like concat('%', #{currency}, '%')</if>
<if test="transType != null and transType != ''"> and a.trans_type like concat('%', #{transType}, '%')</if>
<if test="startDate != null "> and a.start_date = #{startDate}</if>
<if test="endDate != null "> and a.end_date = #{endDate}</if>
<if test="blOpen != null and blOpen != ''"> and a.bl_open like concat('%', #{blOpen}, '%')</if>
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and a.tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and a.del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and a.create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and a.create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and a.update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and a.update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and a.create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and a.update_site like concat('%', #{updateSite}, '%')</if>
2025-03-08 16:26:34 +00:00
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisCreditCustomer" resultType="int">
select count(1) from emis_credit_customer
where del_flag='0'
and id = #{id}
and customer_code = #{customerCode}
and cur_money = #{curMoney}
and cur_money_rate = #{curMoneyRate}
and credit_money = #{creditMoney}
and currency = #{currency}
and trans_type = #{transType}
and start_date = #{startDate}
and end_date = #{endDate}
and bl_open = #{blOpen}
and remark = #{remark}
and tenant_id = #{tenantId}
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="selectEmisCreditCustomerById" parameterType="Long" resultMap="EmisCreditCustomerResult">
select id, customer_code, cur_money, cur_money_rate, credit_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_credit_customer a
where a.id = #{id}
</select>
<insert id="insertEmisCreditCustomer" parameterType="EmisCreditCustomer" useGeneratedKeys="true" keyProperty="id">
insert into emis_credit_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="customerCode != null and customerCode != ''">customer_code,</if>
<if test="curMoney != null">cur_money,</if>
<if test="curMoneyRate != null">cur_money_rate,</if>
<if test="creditMoney != null">credit_money,</if>
<if test="currency != null and currency != ''">currency,</if>
<if test="transType != null and transType != ''">trans_type,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
<if test="blOpen != null and blOpen != ''">bl_open,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</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="customerCode != null and customerCode != ''">#{customerCode},</if>
<if test="curMoney != null">#{curMoney},</if>
<if test="curMoneyRate != null">#{curMoneyRate},</if>
<if test="creditMoney != null">#{creditMoney},</if>
<if test="currency != null and currency != ''">#{currency},</if>
<if test="transType != null and transType != ''">#{transType},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="blOpen != null and blOpen != ''">#{blOpen},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</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="updateEmisCreditCustomer" parameterType="EmisCreditCustomer">
update emis_credit_customer
<trim prefix="SET" suffixOverrides=",">
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
<if test="curMoney != null">cur_money = #{curMoney},</if>
<if test="curMoneyRate != null">cur_money_rate = #{curMoneyRate},</if>
<if test="creditMoney != null">credit_money = #{creditMoney},</if>
<if test="currency != null and currency != ''">currency = #{currency},</if>
<if test="transType != null and transType != ''">trans_type = #{transType},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="blOpen != null and blOpen != ''">bl_open = #{blOpen},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</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="deleteEmisCreditCustomerById" parameterType="Long">
delete from emis_credit_customer where id = #{id}
</delete>
<delete id="deleteEmisCreditCustomerByIds" parameterType="String">
delete from emis_credit_customer where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>