110 lines
5.3 KiB
XML
110 lines
5.3 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.EmisCustomsLevelMapper">
|
|
|
|
<resultMap type="EmisCustomsLevel" id="EmisCustomsLevelResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<result property="id" column="id"/>
|
|
<result property="customerName" column="customer_name"/>
|
|
<result property="category" column="category"/>
|
|
<result property="bizType" column="biz_type"/>
|
|
<result property="startDate" column="start_date"/>
|
|
<result property="endDate" column="end_date"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectEmisCustomsLevelVo">
|
|
select id, customer_name, category, biz_type, start_date, end_date,
|
|
remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_customs_level
|
|
</sql>
|
|
|
|
<select id="selectEmisCustomsLevelList" parameterType="EmisCustomsLevel" resultMap="EmisCustomsLevelResult">
|
|
<include refid="selectEmisCustomsLevelVo"/>
|
|
<where>
|
|
del_flag = '0'
|
|
<if test="customerName != null and customerName != ''">
|
|
and customer_name like concat('%', #{customerName}, '%')
|
|
</if>
|
|
<if test="category != null">and category = #{category}</if>
|
|
<if test="bizType != null">and biz_type = #{bizType}</if>
|
|
<if test="startDate != null">and start_date >= DATE(#{startDate})</if>
|
|
<if test="endDate != null">and end_date <= DATE(#{endDate})</if>
|
|
<if test="params.customerName != null">and customer_name = #{params.customerName}</if>
|
|
</where>
|
|
order by id desc
|
|
</select>
|
|
|
|
<select id="selectEmisCustomsLevelById" parameterType="long" resultMap="EmisCustomsLevelResult">
|
|
<include refid="selectEmisCustomsLevelVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<select id="checkUnique" parameterType="EmisCustomsLevel" resultType="int">
|
|
select count(1)
|
|
from emis_customs_level
|
|
where del_flag = '0'
|
|
and customer_name = #{customerName}
|
|
and biz_type = #{bizType}
|
|
<if test="id != null">and id != #{id}</if>
|
|
and (
|
|
(start_date <= DATE(#{endDate}) and end_date >= DATE(#{startDate}))
|
|
)
|
|
</select>
|
|
|
|
<insert id="insertEmisCustomsLevel" parameterType="EmisCustomsLevel" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_customs_level
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="customerName != null and customerName != ''">customer_name,</if>
|
|
<if test="category != null and category != ''">category,</if>
|
|
<if test="bizType != null and bizType != ''">biz_type,</if>
|
|
<if test="startDate != null">start_date,</if>
|
|
<if test="endDate != null">end_date,</if>
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="createSite != null and createSite != ''">create_site,</if>
|
|
del_flag
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="customerName != null and customerName != ''">#{customerName},</if>
|
|
<if test="category != null and category != ''">#{category},</if>
|
|
<if test="bizType != null and bizType != ''">#{bizType},</if>
|
|
<if test="startDate != null">#{startDate},</if>
|
|
<if test="endDate != null">#{endDate},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="createSite != null and createSite != ''">#{createSite},</if>
|
|
'0'
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmisCustomsLevel" parameterType="EmisCustomsLevel">
|
|
update emis_customs_level
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
|
|
<if test="category != null and category != ''">category = #{category},</if>
|
|
<if test="bizType != null and bizType != ''">biz_type = #{bizType},</if>
|
|
<if test="startDate != null">start_date = #{startDate},</if>
|
|
<if test="endDate != null">end_date = #{endDate},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteEmisCustomsLevelById" parameterType="long">
|
|
update emis_customs_level set del_flag='2', update_time=now() where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteEmisCustomsLevelByIds" parameterType="long">
|
|
update emis_customs_level set del_flag='2', update_time=now() where id in
|
|
<foreach collection="array" item="id" open="(" separator="," close=")">#{id}</foreach>
|
|
</update>
|
|
|
|
</mapper>
|
|
|
|
|