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

181 lines
12 KiB
XML
Raw Normal View History

2024-01-10 05:17:13 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
2024-01-11 06:23:19 +00:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2024-01-10 05:17:13 +00:00
<mapper namespace="com.xdadan.erp.emis.mapper.EmisTransProductMapper">
2024-01-11 06:23:19 +00:00
2024-01-10 05:17:13 +00:00
<resultMap type="EmisTransProduct" id="EmisTransProductResult">
<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" />
2024-05-11 08:04:21 +00:00
<result property="transLine" column="trans_line" />
2024-01-10 05:17:13 +00:00
<result property="carryType" column="carry_type" />
<result property="transType" column="trans_type" />
<result property="agingDesc" column="aging_desc" />
<result property="minAging" column="min_aging" />
<result property="maxAging" column="max_aging" />
2024-05-11 08:04:21 +00:00
<result property="orderNum" column="order_num" />
2024-01-10 05:17:13 +00:00
<result property="remark" column="remark" />
<result property="tenantId" column="tenant_id" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
2024-05-11 08:04:21 +00:00
<result property="createSite" column="create_site" />
<result property="updateSite" column="update_site" />
2024-04-18 02:59:40 +00:00
<association property="transLine" column="trans_line_code" select="selectLineNameByCode"/>
<association property="countryName" column="country" select="selectCountryNameByCode"/>
2024-01-10 05:17:13 +00:00
</resultMap>
2024-05-11 08:04:21 +00:00
2024-01-10 05:17:13 +00:00
2024-04-18 02:59:40 +00:00
<select id="selectCountryNameByCode" parameterType="String" resultType="string">
select a.name from emis_country a where a.code = #{code} limit 1
</select>
<select id="selectLineNameByCode" parameterType="String" resultType="string">
select a.line_name from emis_trans_line a where a.line_code = #{code} limit 1
</select>
2024-05-11 08:04:21 +00:00
<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, 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>
2024-04-29 03:44:42 +00:00
2024-01-10 05:17:13 +00:00
<select id="selectEmisTransProductList" parameterType="EmisTransProduct" resultMap="EmisTransProductResult">
<include refid="selectEmisTransProductVo"/>
2024-01-11 06:23:19 +00:00
<where>
2024-05-11 08:19:03 +00:00
del_flag = '0'
2024-01-10 05:17:13 +00:00
<if test="id != null "> and id = #{id}</if>
2024-05-11 08:04:21 +00:00
<if test="prodCode != null and prodCode != ''"> and prod_code=#{prodCode}</if>
2024-01-10 05:17:13 +00:00
<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 like concat('%', #{country}, '%')</if>
2024-05-15 09:50:02 +00:00
<if test="transLineCode != null and transLineCode != ''"> and trans_line_code=#{transLineCode}</if>
2024-01-10 05:17:13 +00:00
<if test="transLine != null and transLine != ''"> and trans_line like concat('%', #{transLine}, '%')</if>
2024-05-15 09:50:02 +00:00
<if test="carryType != null and carryType != ''"> and carry_type=#{carryType}</if>
<if test="transType != null and transType != ''"> and trans_type=#{transType}</if>
2024-01-10 05:17:13 +00:00
<if test="agingDesc != null and agingDesc != ''"> and aging_desc like concat('%', #{agingDesc}, '%')</if>
<if test="minAging != null "> and min_aging = #{minAging}</if>
<if test="maxAging != null "> and max_aging = #{maxAging}</if>
2024-05-11 08:04:21 +00:00
<if test="orderNum != null "> and order_num = #{orderNum}</if>
2024-01-10 05:17:13 +00:00
<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>
2024-05-11 08:04:21 +00:00
<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>
2024-01-10 05:17:13 +00:00
</where>
2024-05-11 08:04:21 +00:00
order by order_num desc
2024-01-10 05:17:13 +00:00
</select>
2024-01-11 06:23:19 +00:00
2024-01-10 05:17:13 +00:00
<select id="selectEmisTransProductById" parameterType="Long" resultMap="EmisTransProductResult">
2024-05-11 08:04:21 +00:00
select id, prod_code, prod_name, prod_name_en, status, country, trans_line_code, trans_line, carry_type, trans_type, aging_desc, min_aging, max_aging, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2024-01-10 05:17:13 +00:00
from emis_trans_product a
where a.id = #{id}
</select>
2024-01-11 06:23:19 +00:00
2024-01-10 05:17:13 +00:00
<insert id="insertEmisTransProduct" parameterType="EmisTransProduct">
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="minAging != null">min_aging,</if>
<if test="maxAging != null">max_aging,</if>
2024-05-11 08:04:21 +00:00
<if test="orderNum != null">order_num,</if>
2024-01-10 05:17:13 +00:00
<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>
2024-05-11 08:04:21 +00:00
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
2024-01-11 06:23:19 +00:00
</trim>
2024-01-10 05:17:13 +00:00
<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="minAging != null">#{minAging},</if>
<if test="maxAging != null">#{maxAging},</if>
2024-05-11 08:04:21 +00:00
<if test="orderNum != null">#{orderNum},</if>
2024-01-10 05:17:13 +00:00
<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>
2024-05-11 08:04:21 +00:00
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
2024-01-11 06:23:19 +00:00
</trim>
2024-01-10 05:17:13 +00:00
</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="minAging != null">min_aging = #{minAging},</if>
<if test="maxAging != null">max_aging = #{maxAging},</if>
2024-05-11 08:04:21 +00:00
<if test="orderNum != null">order_num = #{orderNum},</if>
2024-01-10 05:17:13 +00:00
<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>
2024-05-11 08:04:21 +00:00
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
2024-01-10 05:17:13 +00:00
</trim>
where id = #{id}
</update>
<delete id="deleteEmisTransProductById" parameterType="Long">
2024-05-11 08:04:21 +00:00
update emis_trans_product set del_flag='1' where id = #{id}
2024-01-10 05:17:13 +00:00
</delete>
<delete id="deleteEmisTransProductByIds" parameterType="String">
2024-05-11 08:04:21 +00:00
update emis_trans_product set del_flag='1' where id in
2024-01-10 05:17:13 +00:00
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>