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

175 lines
11 KiB
XML
Raw Normal View History

2024-09-05 03:07:27 +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.EmisCommissionQuoteMapper">
<resultMap type="EmisCommissionQuote" id="EmisCommissionQuoteResult">
<result property="quoteId" column="quote_id" />
<result property="quoteCode" column="quote_code" />
<result property="quoteName" column="quote_name" />
<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" />
</resultMap>
<sql id="selectEmisCommissionQuoteVo">
select quote_id, quote_code, quote_name, 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
</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="calcType != null and calcType != ''"> and calc_type like concat('%', #{calcType}, '%')</if>
<if test="postType != null and postType != ''"> and post_type like concat('%', #{postType}, '%')</if>
<if test="transType != null and transType != ''"> and trans_type like concat('%', #{transType}, '%')</if>
<if test="blOpen != null and blOpen != ''"> and bl_open like concat('%', #{blOpen}, '%')</if>
<if test="empCode != null and empCode != ''"> and emp_code like concat('%', #{empCode}, '%')</if>
<if test="empName != null and empName != ''"> and emp_name like concat('%', #{empName}, '%')</if>
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="priorityLevel != null "> and priority_level = #{priorityLevel}</if>
<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>
<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="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 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>
<select id="selectEmisCommissionQuoteByQuoteId" parameterType="Long" resultMap="EmisCommissionQuoteResult">
select quote_id, quote_code, quote_name, 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 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="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>
</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="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>
</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>
<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">
delete from emis_commission_quote where quote_id in
<foreach item="quoteId" collection="array" open="(" separator="," close=")">
#{quoteId}
</foreach>
</delete>
</mapper>