2024-09-05 03:07:27 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
2024-10-24 11:32:09 +00:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2024-09-05 03:07:27 +00:00
<mapper namespace= "com.xdadan.erp.emis.mapper.EmisCommissionQuoteMapper" >
2024-10-24 11:32:09 +00:00
2024-10-28 03:45:54 +00:00
<resultMap type= "EmisCommissionQuote" id= "EmisCommissionQuoteResult" extends= "com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult" >
2024-09-05 03:07:27 +00:00
<result property= "quoteId" column= "quote_id" />
<result property= "quoteCode" column= "quote_code" />
<result property= "quoteName" column= "quote_name" />
2024-11-04 23:36:12 +00:00
<result property= "transLineCode" column= "trans_line_code" />
2025-03-03 08:35:37 +00:00
<result property= "sendSiteCode" column= "send_site_code" />
2025-03-06 11:29:18 +00:00
<result property= "nextSiteCode" column= "next_site_code" />
2024-11-04 23:36:12 +00:00
<result property= "prodCode" column= "prod_code" />
2024-10-24 11:32:09 +00:00
<result property= "fromCountry" column= "from_country" />
<result property= "country" column= "country" />
<result property= "feeType" column= "fee_type" />
2024-09-05 03:07:27 +00:00
<result property= "calcType" column= "calc_type" />
<result property= "postType" column= "post_type" />
<result property= "transType" column= "trans_type" />
<result property= "blOpen" column= "bl_open" />
<result property= "empCode" column= "emp_code" />
<result property= "empName" column= "emp_name" />
<result property= "startDate" column= "start_date" />
<result property= "endDate" column= "end_date" />
<result property= "priorityLevel" column= "priority_level" />
2024-10-28 03:45:54 +00:00
2024-11-04 23:36:12 +00:00
<association property= "prodName" column= "prod_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectProdNameByCode" />
2025-03-01 03:26:22 +00:00
<association property= "transLine" column= "trans_line_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectMutiLineNameByCode" />
2024-11-14 00:14:20 +00:00
<association property= "fromCountryName" column= "from_country" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectGroupCountryNameByCode" />
<association property= "countryName" column= "country" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectGroupCountryNameByCode" />
2025-03-03 08:35:37 +00:00
<association property= "sendSiteName" column= "send_site_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectGroupSiteNameByCode" />
2025-03-06 11:29:18 +00:00
<association property= "nextSiteName" column= "next_site_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectGroupSiteNameByCode" />
2024-11-04 23:36:12 +00:00
2024-11-04 08:28:10 +00:00
<association property= "exprList" column= "quote_id" select= "com.xdadan.erp.emis.mapper.EmisCommissionExpressionMapper.selectExprListByQuoteId" />
2024-10-28 03:45:54 +00:00
2024-09-05 03:07:27 +00:00
</resultMap>
<sql id= "selectEmisCommissionQuoteVo" >
2025-03-06 11:29:18 +00:00
select quote_id, quote_code, quote_name, trans_line_code, send_site_code, next_site_code, prod_code, from_country, country, fee_type, calc_type, post_type, trans_type, bl_open, emp_code, emp_name, start_date, end_date, priority_level, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_commission_quote
2024-09-05 03:07:27 +00:00
</sql>
<select id= "selectEmisCommissionQuoteList" parameterType= "EmisCommissionQuote" resultMap= "EmisCommissionQuoteResult" >
<include refid= "selectEmisCommissionQuoteVo" />
2024-10-24 11:32:09 +00:00
<where >
del_flag='0'
2024-11-13 22:12:53 +00:00
2024-09-05 03:07:27 +00:00
<if test= "quoteId != null " > and quote_id = #{quoteId}</if>
<if test= "quoteCode != null and quoteCode != ''" > and quote_code like concat('%', #{quoteCode}, '%')</if>
<if test= "quoteName != null and quoteName != ''" > and quote_name like concat('%', #{quoteName}, '%')</if>
2024-11-13 22:02:38 +00:00
<if test= "fromCountry != null and fromCountry != ''" > and ( FIND_IN_SET(#{fromCountry},from_country) or from_country='-1')</if>
<if test= "country != null and country != ''" > and ( FIND_IN_SET(#{country},country) or country='-1' ) </if>
2025-03-03 08:35:37 +00:00
<if test= "sendSiteCode != null and sendSiteCode != ''" > and ( ( FIND_IN_SET(#{sendSiteCode},send_site_code) and send_site_code is not null ) or send_site_code is null ) </if>
2025-03-06 11:29:18 +00:00
<if test= "nextSiteCode != null and nextSiteCode != ''" > and ( ( FIND_IN_SET(#{nextSiteCode},next_site_code) and next_site_code is not null ) or next_site_code is null ) </if>
2025-03-03 08:35:37 +00:00
2024-11-11 06:00:08 +00:00
<if test= "feeType != null and feeType != ''" > and fee_type=#{feeType}</if>
<if test= "calcType != null and calcType != ''" > and calc_type=#{calcType}</if>
<if test= "postType != null and postType != ''" > and post_type=#{postType}</if>
2024-11-14 22:29:13 +00:00
<if test= "transType != null and transType != ''" > and ( FIND_IN_SET(#{transType},trans_type) )</if>
2024-11-11 06:00:08 +00:00
<if test= "blOpen != null and blOpen != ''" > and bl_open=#{blOpen}</if>
2024-11-13 22:02:38 +00:00
<if test= "empCode != null and empCode != ''" > and ( FIND_IN_SET(#{empCode},emp_code) or emp_code='-1')</if>
<if test= "empName != null and empName != ''" > and ( FIND_IN_SET(#{empName},emp_name) or emp_name='全部') </if>
<if test= "transLineCode != null and transLineCode != ''" > and trans_line_code=#{transLineCode} </if>
<if test= "prodCode != null and prodCode != ''" > and FIND_IN_SET(#{prodCode},prod_code) </if>
2024-11-11 06:00:08 +00:00
2024-11-13 22:12:53 +00:00
</where>
order by create_time desc
</select>
<select id= "selectValidQuoteList" parameterType= "EmisCommissionQuote" resultMap= "EmisCommissionQuoteResult" >
<include refid= "selectEmisCommissionQuoteVo" />
<where >
del_flag='0'
and bl_open='1'
<if test= "params.validDate != null " >
and start_date <![CDATA[ <= ]]> #{params.validDate} and end_date <![CDATA[ > ]]> #{params.validDate}
2024-11-11 06:00:08 +00:00
</if>
2024-11-13 22:12:53 +00:00
<if test= "quoteName != null and quoteName != ''" > and quote_name like concat('%', #{quoteName}, '%')</if>
2025-03-02 12:58:59 +00:00
<if test= "fromCountry != null and fromCountry != ''" > and ( FIND_IN_SET(#{fromCountry},from_country) or from_country='-1' or from_country is null or from_country='' or ( #{fromCountry}!='0086' and from_country='-2' ) )</if>
<if test= "country != null and country != ''" > and ( FIND_IN_SET(#{country},country) or country='-1' or country is null or country='' or ( #{country}!='0086' and country='-2' ) ) </if>
2025-03-03 08:35:37 +00:00
<if test= "sendSiteCode != null and sendSiteCode != ''" > and ( ( FIND_IN_SET(#{sendSiteCode},send_site_code) and send_site_code is not null ) or send_site_code is null ) </if>
2025-03-06 11:29:18 +00:00
<if test= "nextSiteCode != null and nextSiteCode != ''" > and ( ( FIND_IN_SET(#{nextSiteCode},next_site_code) and next_site_code is not null ) or next_site_code is null ) </if>
2025-03-03 08:35:37 +00:00
2024-11-13 22:12:53 +00:00
<if test= "feeType != null and feeType != ''" > and fee_type=#{feeType}</if>
<if test= "calcType != null and calcType != ''" > and calc_type=#{calcType}</if>
<if test= "postType != null and postType != ''" > and post_type=#{postType}</if>
2024-11-14 22:49:31 +00:00
<if test= "transType != null and transType != ''" > and ( FIND_IN_SET(#{transType},trans_type) or trans_type='-1') </if>
2024-11-13 22:12:53 +00:00
<if test= "blOpen != null and blOpen != ''" > and bl_open=#{blOpen}</if>
<if test= "empCode != null and empCode != ''" > and ( FIND_IN_SET(#{empCode},emp_code) or emp_code='-1')</if>
<if test= "empName != null and empName != ''" > and ( FIND_IN_SET(#{empName},emp_name) or emp_name='全部') </if>
2024-11-15 00:07:17 +00:00
<if test= "transLineCode != null and transLineCode != ''" > and ( trans_line_code=#{transLineCode} or trans_line_code is null or trans_line_code='') </if>
<if test= "prodCode != null and prodCode != ''" > and ( FIND_IN_SET(#{prodCode},prod_code) or prod_code is null or prod_code='') </if>
2024-11-13 22:12:53 +00:00
2024-09-05 03:07:27 +00:00
</where>
order by create_time desc
</select>
<select id= "checkUnique" parameterType= "EmisCommissionQuote" resultType= "int" >
select count(1) from emis_commission_quote
where del_flag='0'
and quote_id = #{quoteId}
and quote_code = #{quoteCode}
and quote_name = #{quoteName}
2024-10-24 11:32:09 +00:00
and from_country = #{fromCountry}
and country = #{country}
and fee_type = #{feeType}
2024-09-05 03:07:27 +00:00
and calc_type = #{calcType}
and post_type = #{postType}
and trans_type = #{transType}
and bl_open = #{blOpen}
and emp_code = #{empCode}
and emp_name = #{empName}
and start_date = #{startDate}
and end_date = #{endDate}
and priority_level = #{priorityLevel}
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>
2024-10-24 11:32:09 +00:00
2024-09-05 03:07:27 +00:00
<select id= "selectEmisCommissionQuoteByQuoteId" parameterType= "Long" resultMap= "EmisCommissionQuoteResult" >
2025-03-06 11:29:18 +00:00
select quote_id, quote_code, quote_name, trans_line_code, send_site_code, next_site_code, prod_code, from_country, country, fee_type, calc_type, post_type, trans_type, bl_open, emp_code, emp_name, start_date, end_date, priority_level, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2024-09-05 03:07:27 +00:00
from emis_commission_quote a
where a.quote_id = #{quoteId}
</select>
2024-10-24 11:32:09 +00:00
2024-09-05 03:07:27 +00:00
<insert id= "insertEmisCommissionQuote" parameterType= "EmisCommissionQuote" useGeneratedKeys= "true" keyProperty= "quoteId" >
insert into emis_commission_quote
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
2025-03-06 11:29:18 +00:00
<if test= "quoteId != null" > quote_id,</if>
2024-09-05 03:07:27 +00:00
<if test= "quoteCode != null and quoteCode != ''" > quote_code,</if>
<if test= "quoteName != null and quoteName != ''" > quote_name,</if>
2024-11-04 23:36:12 +00:00
<if test= "transLineCode != null and transLineCode != ''" > trans_line_code,</if>
2025-03-03 08:35:37 +00:00
<if test= "sendSiteCode != null and sendSiteCode != ''" > send_site_code,</if>
2025-03-06 11:29:18 +00:00
<if test= "nextSiteCode != null and nextSiteCode != ''" > next_site_code,</if>
2024-11-04 23:36:12 +00:00
<if test= "prodCode != null and prodCode != ''" > prod_code,</if>
2024-10-24 11:32:09 +00:00
<if test= "fromCountry != null and fromCountry != ''" > from_country,</if>
<if test= "country != null and country != ''" > country,</if>
<if test= "feeType != null and feeType != ''" > fee_type,</if>
2024-09-05 03:07:27 +00:00
<if test= "calcType != null and calcType != ''" > calc_type,</if>
<if test= "postType != null and postType != ''" > post_type,</if>
<if test= "transType != null and transType != ''" > trans_type,</if>
<if test= "blOpen != null and blOpen != ''" > bl_open,</if>
<if test= "empCode != null and empCode != ''" > emp_code,</if>
<if test= "empName != null and empName != ''" > emp_name,</if>
<if test= "startDate != null" > start_date,</if>
<if test= "endDate != null" > end_date,</if>
<if test= "priorityLevel != null" > priority_level,</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>
2024-10-24 11:32:09 +00:00
</trim>
2024-09-05 03:07:27 +00:00
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
2025-03-06 11:29:18 +00:00
<if test= "quoteId != null" > #{quoteId},</if>
2024-09-05 03:07:27 +00:00
<if test= "quoteCode != null and quoteCode != ''" > #{quoteCode},</if>
<if test= "quoteName != null and quoteName != ''" > #{quoteName},</if>
2024-11-04 23:36:12 +00:00
<if test= "transLineCode != null and transLineCode != ''" > #{transLineCode},</if>
2025-03-03 08:35:37 +00:00
<if test= "sendSiteCode != null and sendSiteCode != ''" > #{sendSiteCode},</if>
2025-03-06 11:29:18 +00:00
<if test= "nextSiteCode != null and nextSiteCode != ''" > #{nextSiteCode},</if>
2024-11-04 23:36:12 +00:00
<if test= "prodCode != null and prodCode != ''" > #{prodCode},</if>
2024-10-24 11:32:09 +00:00
<if test= "fromCountry != null and fromCountry != ''" > #{fromCountry},</if>
<if test= "country != null and country != ''" > #{country},</if>
<if test= "feeType != null and feeType != ''" > #{feeType},</if>
2024-09-05 03:07:27 +00:00
<if test= "calcType != null and calcType != ''" > #{calcType},</if>
<if test= "postType != null and postType != ''" > #{postType},</if>
<if test= "transType != null and transType != ''" > #{transType},</if>
<if test= "blOpen != null and blOpen != ''" > #{blOpen},</if>
<if test= "empCode != null and empCode != ''" > #{empCode},</if>
<if test= "empName != null and empName != ''" > #{empName},</if>
<if test= "startDate != null" > #{startDate},</if>
<if test= "endDate != null" > #{endDate},</if>
<if test= "priorityLevel != null" > #{priorityLevel},</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>
2024-10-24 11:32:09 +00:00
</trim>
2024-09-05 03:07:27 +00:00
</insert>
<update id= "updateEmisCommissionQuote" parameterType= "EmisCommissionQuote" >
update emis_commission_quote
<trim prefix= "SET" suffixOverrides= "," >
<if test= "quoteCode != null and quoteCode != ''" > quote_code = #{quoteCode},</if>
<if test= "quoteName != null and quoteName != ''" > quote_name = #{quoteName},</if>
2024-11-14 21:33:40 +00:00
trans_line_code = #{transLineCode},
prod_code = #{prodCode},
from_country = #{fromCountry},
country = #{country},
2025-03-03 08:35:37 +00:00
send_site_code = #{sendSiteCode},
2025-03-06 11:29:18 +00:00
next_site_code = #{nextSiteCode},
2024-11-14 21:21:53 +00:00
2024-10-24 11:32:09 +00:00
<if test= "feeType != null and feeType != ''" > fee_type = #{feeType},</if>
2024-09-05 03:07:27 +00:00
<if test= "calcType != null and calcType != ''" > calc_type = #{calcType},</if>
<if test= "postType != null and postType != ''" > post_type = #{postType},</if>
<if test= "transType != null and transType != ''" > trans_type = #{transType},</if>
<if test= "blOpen != null and blOpen != ''" > bl_open = #{blOpen},</if>
<if test= "empCode != null and empCode != ''" > emp_code = #{empCode},</if>
<if test= "empName != null and empName != ''" > emp_name = #{empName},</if>
<if test= "startDate != null" > start_date = #{startDate},</if>
<if test= "endDate != null" > end_date = #{endDate},</if>
<if test= "priorityLevel != null" > priority_level = #{priorityLevel},</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 quote_id = #{quoteId}
</update>
<delete id= "deleteEmisCommissionQuoteByQuoteId" parameterType= "Long" >
delete from emis_commission_quote where quote_id = #{quoteId}
</delete>
<delete id= "deleteEmisCommissionQuoteByQuoteIds" parameterType= "String" >
2024-10-24 11:32:09 +00:00
delete from emis_commission_quote where quote_id in
2024-09-05 03:07:27 +00:00
<foreach item= "quoteId" collection= "array" open= "(" separator= "," close= ")" >
#{quoteId}
</foreach>
</delete>
</mapper>