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

221 lines
14 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.EmisTransProductMapper">
<resultMap type="EmisTransProduct" id="EmisTransProductResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="prodCode" column="prod_code" />
<result property="prodName" column="prod_name" />
<result property="prodNameEn" column="prod_name_en" />
<result property="status" column="status" />
<result property="country" column="country" />
<result property="transLineCode" column="trans_line_code" />
<result property="transLine" column="trans_line" />
<result property="carryType" column="carry_type" />
<result property="transType" column="trans_type" />
<result property="agingDesc" column="aging_desc" />
<result property="agingFlag" column="aging_flag" />
<result property="minAging" column="min_aging" />
<result property="maxAging" column="max_aging" />
<result property="orderNum" column="order_num" />
<association property="transLine" column="trans_line_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectLineNameByCode"/>
<association property="countryName" column="country" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectCountryNameByCode"/>
</resultMap>
<sql id="selectEmisTransProductVo">
select id, prod_code, prod_name, prod_name_en, status, country, trans_line_code, trans_line, carry_type, trans_type, aging_desc, aging_flag, min_aging, max_aging, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_trans_product
</sql>
<select id="selectEmisTransProductList" parameterType="EmisTransProduct" resultMap="EmisTransProductResult">
<include refid="selectEmisTransProductVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="prodCode != null and prodCode != ''"> and FIND_IN_SET(prod_code,#{prodCode}) </if>
<if test="prodName != null and prodName != ''"> and prod_name like concat('%', #{prodName}, '%')</if>
<if test="prodNameEn != null and prodNameEn != ''"> and prod_name_en like concat('%', #{prodNameEn}, '%')</if>
<if test="status != null "> and status = #{status}</if>
<if test="country != null and country != ''"> and country=#{country}</if>
<if test="transLineCode != null and transLineCode != ''">
and trans_line_code in
<foreach collection="transLineCode.split(',')" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="transLine != null and transLine != ''"> and trans_line like concat('%', #{transLine}, '%')</if>
<if test="carryType != null and carryType != ''"> and carry_type=#{carryType}</if>
<if test="transType != null and transType != ''"> and trans_type= #{transType}</if>
<if test="agingDesc != null and agingDesc != ''"> and aging_desc like concat('%', #{agingDesc}, '%')</if>
<if test="agingFlag != null and agingFlag != ''"> and aging_flag like concat('%', #{agingFlag}, '%')</if>
<if test="minAging != null "> and min_aging = #{minAging}</if>
<if test="maxAging != null "> and max_aging = #{maxAging}</if>
<if test="orderNum != null "> and order_num = #{orderNum}</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 order_num desc
</select>
<select id="selectTransProductByName" parameterType="String" resultMap="EmisTransProductResult">
select id, prod_code, prod_name, prod_name_en, status, country, trans_line_code, trans_line, carry_type, trans_type, aging_desc, aging_flag, min_aging, max_aging, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_trans_product a
where a.trans_line_code=#{lineCode} and a.prod_name=#{prodName} limit 1
</select>
<select id="selectTransProductByCode" parameterType="String" resultMap="EmisTransProductResult">
select id, prod_code, prod_name, prod_name_en, status, country, trans_line_code, trans_line, carry_type, trans_type, aging_desc, aging_flag, min_aging, max_aging, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_trans_product a
where a.trans_line_code=#{lineCode} and a.prod_code=#{prodCode} limit 1
</select>
<select id="checkUnique" parameterType="EmisTransProduct" resultType="int">
select count(1) from emis_trans_product
where del_flag='0'
and id = #{id}
and prod_code = #{prodCode}
and prod_name = #{prodName}
and prod_name_en = #{prodNameEn}
and status = #{status}
and country = #{country}
and trans_line_code = #{transLineCode}
and trans_line = #{transLine}
and carry_type = #{carryType}
and trans_type = #{transType}
and aging_desc = #{agingDesc}
and aging_flag = #{agingFlag}
and min_aging = #{minAging}
and max_aging = #{maxAging}
and order_num = #{orderNum}
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="selectEmisTransProductById" parameterType="Long" resultMap="EmisTransProductResult">
select id, prod_code, prod_name, prod_name_en, status, country, trans_line_code, trans_line, carry_type, trans_type, aging_desc, aging_flag, min_aging, max_aging, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_trans_product a
where a.id = #{id}
</select>
<select id="getEmisTransProductByProdCode" parameterType="String" resultMap="EmisTransProductResult">
select id, prod_code, prod_name, prod_name_en, status, country, trans_line_code, trans_line, carry_type, trans_type, aging_desc, aging_flag, min_aging, max_aging, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_trans_product a
where a.del_flag='0' and a.prod_code = #{prodCode}
</select>
<insert id="insertEmisTransProduct" parameterType="EmisTransProduct" useGeneratedKeys="true" keyProperty="id">
insert into emis_trans_product
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="prodCode != null and prodCode != ''">prod_code,</if>
<if test="prodName != null and prodName != ''">prod_name,</if>
<if test="prodNameEn != null and prodNameEn != ''">prod_name_en,</if>
<if test="status != null">status,</if>
<if test="country != null and country != ''">country,</if>
<if test="transLineCode != null and transLineCode != ''">trans_line_code,</if>
<if test="transLine != null and transLine != ''">trans_line,</if>
<if test="carryType != null and carryType != ''">carry_type,</if>
<if test="transType != null and transType != ''">trans_type,</if>
<if test="agingDesc != null and agingDesc != ''">aging_desc,</if>
<if test="agingFlag != null and agingFlag != ''">aging_flag,</if>
<if test="minAging != null">min_aging,</if>
<if test="maxAging != null">max_aging,</if>
<if test="orderNum != null">order_num,</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="id != null">#{id},</if>
<if test="prodCode != null and prodCode != ''">#{prodCode},</if>
<if test="prodName != null and prodName != ''">#{prodName},</if>
<if test="prodNameEn != null and prodNameEn != ''">#{prodNameEn},</if>
<if test="status != null">#{status},</if>
<if test="country != null and country != ''">#{country},</if>
<if test="transLineCode != null and transLineCode != ''">#{transLineCode},</if>
<if test="transLine != null and transLine != ''">#{transLine},</if>
<if test="carryType != null and carryType != ''">#{carryType},</if>
<if test="transType != null and transType != ''">#{transType},</if>
<if test="agingDesc != null and agingDesc != ''">#{agingDesc},</if>
<if test="agingFlag != null and agingFlag != ''">#{agingFlag},</if>
<if test="minAging != null">#{minAging},</if>
<if test="maxAging != null">#{maxAging},</if>
<if test="orderNum != null">#{orderNum},</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="updateEmisTransProduct" parameterType="EmisTransProduct">
update emis_trans_product
<trim prefix="SET" suffixOverrides=",">
<if test="prodCode != null and prodCode != ''">prod_code = #{prodCode},</if>
<if test="prodName != null and prodName != ''">prod_name = #{prodName},</if>
<if test="prodNameEn != null and prodNameEn != ''">prod_name_en = #{prodNameEn},</if>
<if test="status != null">status = #{status},</if>
<if test="country != null and country != ''">country = #{country},</if>
<if test="transLineCode != null and transLineCode != ''">trans_line_code = #{transLineCode},</if>
<if test="transLine != null and transLine != ''">trans_line = #{transLine},</if>
<if test="carryType != null and carryType != ''">carry_type = #{carryType},</if>
<if test="transType != null and transType != ''">trans_type = #{transType},</if>
<if test="agingDesc != null and agingDesc != ''">aging_desc = #{agingDesc},</if>
<if test="agingFlag != null and agingFlag != ''">aging_flag = #{agingFlag},</if>
<if test="minAging != null">min_aging = #{minAging},</if>
<if test="maxAging != null">max_aging = #{maxAging},</if>
<if test="orderNum != null">order_num = #{orderNum},</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>
<delete id="deleteEmisTransProductById" parameterType="Long">
update emis_trans_product set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisTransProductByIds" parameterType="String">
update emis_trans_product set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>