325 lines
19 KiB
XML
325 lines
19 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.EmisCommissionQuoteMapper">
|
|
|
|
<resultMap type="EmisCommissionQuote" id="EmisCommissionQuoteResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<result property="quoteId" column="quote_id" />
|
|
<result property="quoteCode" column="quote_code" />
|
|
<result property="quoteName" column="quote_name" />
|
|
<result property="transLineCode" column="trans_line_code" />
|
|
<result property="sendSiteCode" column="send_site_code" />
|
|
<result property="nextSiteCode" column="next_site_code" />
|
|
<result property="prodCode" column="prod_code" />
|
|
<result property="fromCountry" column="from_country" />
|
|
<result property="country" column="country" />
|
|
<result property="feeType" column="fee_type" />
|
|
<result property="calcType" column="calc_type" />
|
|
<result property="calcWeightType" column="calc_weight_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" />
|
|
|
|
<association property="prodName" column="prod_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectProdNameByCode"/>
|
|
<association property="transLine" column="trans_line_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectMutiLineNameByCode"/>
|
|
<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"/>
|
|
<association property="sendSiteName" column="send_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectGroupSiteNameByCode"/>
|
|
<association property="nextSiteName" column="next_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectGroupSiteNameByCode"/>
|
|
|
|
<association property="exprList" column="quote_id" select="com.xdadan.erp.emis.mapper.EmisCommissionExpressionMapper.selectExprListByQuoteId"/>
|
|
|
|
</resultMap>
|
|
|
|
<sql id="selectEmisCommissionQuoteVo">
|
|
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, calc_weight_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
|
|
</sql>
|
|
|
|
<select id="selectEmisCommissionQuoteList" parameterType="EmisCommissionQuote" resultMap="EmisCommissionQuoteResult">
|
|
<include refid="selectEmisCommissionQuoteVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
|
|
<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>
|
|
<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>
|
|
|
|
<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>
|
|
<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>
|
|
|
|
<if test="feeType != null and feeType != ''"> and fee_type=#{feeType}</if>
|
|
<if test="calcType != null and calcType != ''"> and calc_type=#{calcType}</if>
|
|
<if test="calcWeightType != null and calcWeightType != ''"> and calc_weight_type=#{calcWeightType}</if>
|
|
<if test="postType != null and postType != ''"> and post_type=#{postType}</if>
|
|
<if test="transType != null and transType != ''"> and ( FIND_IN_SET(#{transType},trans_type) )</if>
|
|
<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>
|
|
|
|
<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>
|
|
|
|
<if test="startDate != null">
|
|
and DATE(start_date) >= DATE(#{startDate})
|
|
</if>
|
|
<if test="endDate != null">
|
|
and DATE(end_date) <= DATE(#{endDate})
|
|
</if>
|
|
|
|
</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}
|
|
</if>
|
|
|
|
<if test="quoteName != null and quoteName != ''"> and quote_name like concat('%', #{quoteName}, '%')</if>
|
|
<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' ) or from_country='-3')</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' ) or country='-3' ) </if>
|
|
|
|
<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>
|
|
<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>
|
|
|
|
<if test="feeType != null and feeType != ''"> and fee_type=#{feeType}</if>
|
|
<if test="calcType != null and calcType != ''"> and calc_type=#{calcType}</if>
|
|
<if test="calcWeightType != null and calcWeightType != ''"> and calc_weight_type=#{calcWeightType}</if>
|
|
<if test="postType != null and postType != ''"> and post_type=#{postType}</if>
|
|
<if test="transType != null and transType != ''"> and ( FIND_IN_SET(#{transType},trans_type) or trans_type='-1') </if>
|
|
<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>
|
|
<if test="transLineCode != null and transLineCode != ''">and (
|
|
FIND_IN_SET(#{transLineCode},trans_line_code)
|
|
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>
|
|
|
|
</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}
|
|
and from_country = #{fromCountry}
|
|
and country = #{country}
|
|
and fee_type = #{feeType}
|
|
and calc_type = #{calcType}
|
|
and calc_weight_type = #{calcWeightType}
|
|
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>
|
|
|
|
<select id="selectEmisCommissionQuoteByQuoteId" parameterType="Long" resultMap="EmisCommissionQuoteResult">
|
|
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, calc_weight_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 a
|
|
where a.quote_id = #{quoteId}
|
|
</select>
|
|
|
|
<insert id="insertEmisCommissionQuote" parameterType="EmisCommissionQuote" useGeneratedKeys="true" keyProperty="quoteId">
|
|
insert into emis_commission_quote
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="quoteId != null">quote_id,</if>
|
|
<if test="quoteCode != null and quoteCode != ''">quote_code,</if>
|
|
<if test="quoteName != null and quoteName != ''">quote_name,</if>
|
|
<if test="transLineCode != null and transLineCode != ''">trans_line_code,</if>
|
|
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code,</if>
|
|
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code,</if>
|
|
<if test="prodCode != null and prodCode != ''">prod_code,</if>
|
|
<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>
|
|
<if test="calcType != null and calcType != ''">calc_type,</if>
|
|
<if test="calcWeightType != null and calcWeightType != ''">calc_weight_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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="quoteId != null">#{quoteId},</if>
|
|
<if test="quoteCode != null and quoteCode != ''">#{quoteCode},</if>
|
|
<if test="quoteName != null and quoteName != ''">#{quoteName},</if>
|
|
<if test="transLineCode != null and transLineCode != ''">#{transLineCode},</if>
|
|
<if test="sendSiteCode != null and sendSiteCode != ''">#{sendSiteCode},</if>
|
|
<if test="nextSiteCode != null and nextSiteCode != ''">#{nextSiteCode},</if>
|
|
<if test="prodCode != null and prodCode != ''">#{prodCode},</if>
|
|
<if test="fromCountry != null and fromCountry != ''">#{fromCountry},</if>
|
|
<if test="country != null and country != ''">#{country},</if>
|
|
<if test="feeType != null and feeType != ''">#{feeType},</if>
|
|
<if test="calcType != null and calcType != ''">#{calcType},</if>
|
|
<if test="calcWeightType != null and calcWeightType != ''">#{calcWeightType},</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>
|
|
</trim>
|
|
</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>
|
|
|
|
trans_line_code = #{transLineCode},
|
|
prod_code = #{prodCode},
|
|
from_country = #{fromCountry},
|
|
country = #{country},
|
|
send_site_code = #{sendSiteCode},
|
|
next_site_code = #{nextSiteCode},
|
|
|
|
<if test="feeType != null and feeType != ''">fee_type = #{feeType},</if>
|
|
<if test="calcType != null and calcType != ''">calc_type = #{calcType},</if>
|
|
<if test="calcWeightType != null and calcWeightType != ''">calc_weight_type = #{calcWeightType},</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">
|
|
delete from emis_commission_quote where quote_id in
|
|
<foreach item="quoteId" collection="array" open="(" separator="," close=")">
|
|
#{quoteId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="checkDateOverlap" parameterType="EmisCommissionQuote" resultMap="EmisCommissionQuoteResult">
|
|
<include refid="selectEmisCommissionQuoteVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
<if test="quoteId != null and quoteId != ''">
|
|
and quote_id != #{quoteId}
|
|
</if>
|
|
and (
|
|
start_date <= #{endDate} and end_date >= #{startDate}
|
|
)
|
|
and (
|
|
emp_code = #{empCode}
|
|
or FIND_IN_SET(#{empCode}, emp_code)
|
|
or FIND_IN_SET(emp_code, #{empCode})
|
|
or emp_code='-1'
|
|
)
|
|
and (
|
|
emp_name = #{empName}
|
|
or FIND_IN_SET(#{empName}, emp_name)
|
|
or FIND_IN_SET(emp_name, #{empName})
|
|
or emp_name='全部'
|
|
)
|
|
and fee_type=#{feeType}
|
|
and bl_open=#{blOpen}
|
|
and calc_type=#{calcType}
|
|
and calc_weight_type=#{calcWeightType}
|
|
and post_type=#{postType}
|
|
and (
|
|
trans_type = #{transType}
|
|
or FIND_IN_SET(#{transType}, trans_type)
|
|
or FIND_IN_SET(trans_type, #{transType})
|
|
)
|
|
and (
|
|
from_country = #{fromCountry}
|
|
or FIND_IN_SET(#{fromCountry}, from_country)
|
|
or FIND_IN_SET(from_country, #{fromCountry})
|
|
or from_country='-1'
|
|
)
|
|
and (
|
|
country = #{country}
|
|
or FIND_IN_SET(#{country}, country)
|
|
or FIND_IN_SET(country, #{country})
|
|
or country='-1'
|
|
)
|
|
and (
|
|
trans_line_code = #{transLineCode}
|
|
or FIND_IN_SET(#{transLineCode}, trans_line_code)
|
|
or FIND_IN_SET(trans_line_code, #{transLineCode})
|
|
or trans_line_code='-1'
|
|
)
|
|
and (
|
|
prod_code = #{prodCode}
|
|
or FIND_IN_SET(#{prodCode}, prod_code)
|
|
or FIND_IN_SET(prod_code, #{prodCode})
|
|
or prod_code='-1'
|
|
)
|
|
</where>
|
|
order by create_time desc
|
|
</select>
|
|
</mapper> |