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

194 lines
11 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.EmisCreditSalesmenMapper">
2025-03-08 16:27:34 +00:00
<resultMap type="EmisCreditSalesmen" id="EmisCreditSalesmenResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
2025-03-08 16:26:34 +00:00
<result property="id" column="id" />
2025-03-11 05:58:44 +00:00
<result property="accCode" column="acc_code" />
2025-03-08 16:26:34 +00:00
<result property="salesmen" column="salesmen" />
<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" />
</resultMap>
<sql id="selectEmisCreditSalesmenVo">
2025-03-11 09:34:26 +00:00
select id, acc_code, salesmen, 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_salesmen
2025-03-08 16:26:34 +00:00
</sql>
<select id="selectEmisCreditSalesmenList" parameterType="EmisCreditSalesmen" resultMap="EmisCreditSalesmenResult">
2025-03-11 09:34:26 +00:00
select id, acc_code, salesmen, 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
2025-03-10 22:49:04 +00:00
from emis_credit_salesmen a
<where>
2025-03-08 16:26:34 +00:00
del_flag='0'
<if test="id != null "> and id = #{id}</if>
2025-03-11 05:58:44 +00:00
<if test="accCode != null and accCode != ''"> and acc_code=#{accCode}</if>
<if test="salesmen != null and salesmen != ''"> and salesmen=#{salesmen}</if>
2025-03-08 16:26:34 +00:00
<if test="curMoney != null "> and cur_money = #{curMoney}</if>
<if test="curMoneyRate != null "> and cur_money_rate = #{curMoneyRate}</if>
<if test="creditMoney != null "> and credit_money = #{creditMoney}</if>
2025-03-11 09:03:40 +00:00
<if test="currency != null and currency != ''"> and currency=#{currency}</if>
<if test="transType != null and transType != ''"> and FIND_IN_SET(#{transType},a.trans_type)</if>
2025-03-08 16:26:34 +00:00
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
2025-03-11 09:03:40 +00:00
<if test="blOpen != null and blOpen != ''"> and bl_open=#{blOpen}</if>
2025-03-08 16:26:34 +00:00
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
2025-03-11 09:03:40 +00:00
<if test="delFlag != null and delFlag != ''"> and del_flag =#{delFlag}</if>
2025-03-08 16:26:34 +00:00
<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>
2025-03-10 22:49:04 +00:00
<if test="params.beginCurMoney != null and params.beginCurMoney != ''">
2025-03-11 14:38:22 +00:00
and a.cur_money <![CDATA[ >= ]]> #{params.beginCurMoney}
2025-03-10 22:49:04 +00:00
</if>
<if test="params.endCurMoney != null and params.endCurMoney != ''">
2025-03-11 15:04:24 +00:00
and a.cur_money <![CDATA[ < ]]> #{params.endCurMoney}
2025-03-11 05:58:44 +00:00
</if>
2025-03-10 22:49:04 +00:00
<if test="params.beginCurMoneyRate != null and params.beginCurMoneyRate != ''">
2025-03-11 14:59:46 +00:00
and (a.cur_money/a.credit_money)*100 <![CDATA[ >= ]]> #{params.beginCurMoneyRate}
2025-03-10 22:49:04 +00:00
</if>
<if test="params.endCurMoneyRate != null and params.endCurMoneyRate != ''">
2025-03-11 15:04:24 +00:00
and (a.cur_money/a.credit_money)*100 <![CDATA[ < ]]> #{params.endCurMoneyRate}
2025-03-11 14:38:22 +00:00
</if>
<if test="params.sendDate != null ">
2025-03-11 15:04:24 +00:00
and ( a.start_date <![CDATA[ <= ]]> #{params.sendDate} ) and ( #{params.sendDate} <![CDATA[ < ]]> a.end_date )
2025-03-10 22:49:04 +00:00
</if>
2025-03-11 14:38:22 +00:00
2025-03-08 16:26:34 +00:00
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisCreditSalesmen" resultType="int">
select count(1) from emis_credit_salesmen
where del_flag='0'
and id = #{id}
and salesmen = #{salesmen}
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="selectEmisCreditSalesmenById" parameterType="Long" resultMap="EmisCreditSalesmenResult">
2025-03-11 09:34:26 +00:00
select id, acc_code, salesmen, 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
2025-03-08 16:26:34 +00:00
from emis_credit_salesmen a
where a.id = #{id}
</select>
2025-03-11 05:58:44 +00:00
2025-03-08 16:26:34 +00:00
<insert id="insertEmisCreditSalesmen" parameterType="EmisCreditSalesmen" useGeneratedKeys="true" keyProperty="id">
insert into emis_credit_salesmen
<trim prefix="(" suffix=")" suffixOverrides=",">
2025-03-11 05:58:44 +00:00
<if test="accCode != null and accCode != ''">acc_code,</if>
2025-03-08 16:26:34 +00:00
<if test="salesmen != null and salesmen != ''">salesmen,</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>
2025-03-11 05:58:44 +00:00
</trim>
2025-03-08 16:26:34 +00:00
<trim prefix="values (" suffix=")" suffixOverrides=",">
2025-03-11 05:58:44 +00:00
<if test="accCode != null and accCode != ''">#{accCode},</if>
2025-03-08 16:26:34 +00:00
<if test="salesmen != null and salesmen != ''">#{salesmen},</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>
2025-03-11 05:58:44 +00:00
</trim>
2025-03-08 16:26:34 +00:00
</insert>
<update id="updateEmisCreditSalesmen" parameterType="EmisCreditSalesmen">
update emis_credit_salesmen
<trim prefix="SET" suffixOverrides=",">
2025-03-11 05:58:44 +00:00
<if test="accCode != null and accCode != ''">acc_code = #{accCode},</if>
2025-03-08 16:26:34 +00:00
<if test="salesmen != null and salesmen != ''">salesmen = #{salesmen},</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>
2025-03-11 06:38:46 +00:00
<update id="changeBalance" >
update emis_credit_salesmen set cur_money = cur_money + #{changeMoney} where acc_code = #{accCode}
</update>
2025-03-08 16:26:34 +00:00
<delete id="deleteEmisCreditSalesmenById" parameterType="Long">
2025-03-10 22:49:04 +00:00
update emis_credit_salesmen set del_flag='1' where id = #{id}
2025-03-08 16:26:34 +00:00
</delete>
<delete id="deleteEmisCreditSalesmenByIds" parameterType="String">
2025-03-10 22:49:04 +00:00
update emis_credit_salesmen set del_flag='1' where id in
2025-03-08 16:26:34 +00:00
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>