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

139 lines
8.5 KiB
XML
Raw Normal View History

2024-03-01 09:13:00 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
2024-05-08 01:02:10 +00:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2024-03-01 09:13:00 +00:00
<mapper namespace="com.xdadan.erp.emis.mapper.EmisTmsTransPlanDtlMapper">
2024-05-08 01:02:10 +00:00
2024-03-01 09:13:00 +00:00
<resultMap type="EmisTmsTransPlanDtl" id="EmisTmsTransPlanDtlResult">
<result property="id" column="id" />
<result property="planId" column="plan_id" />
2024-05-08 01:02:10 +00:00
<result property="startSite" column="start_site" />
<result property="destSite" column="dest_site" />
2024-03-01 09:13:00 +00:00
<result property="transType" column="trans_type" />
<result property="estCostDay" column="est_cost_day" />
<result property="orderNum" column="order_num" />
<result property="status" column="status" />
<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" />
<result property="remark" column="remark" />
2024-05-08 01:02:10 +00:00
<result property="createSite" column="create_site" />
<result property="updateSite" column="update_site" />
<association property="startSiteName" column="start_site" select="selectSiteNameByCode"/>
<association property="destSiteName" column="dest_site" select="selectSiteNameByCode"/>
2024-03-01 09:13:00 +00:00
</resultMap>
<sql id="selectEmisTmsTransPlanDtlVo">
2024-05-08 01:02:10 +00:00
select id, plan_id, start_site, dest_site, trans_type, est_cost_day, order_num, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_tms_trans_plan_dtl
2024-03-01 09:13:00 +00:00
</sql>
2024-05-08 01:02:10 +00:00
<select id="selectSiteNameByCode" parameterType="String" resultType="string">
select a.site_name from emis_site a where a.site_code = #{code} limit 1
</select>
2024-03-01 09:13:00 +00:00
<select id="selectEmisTmsTransPlanDtlList" parameterType="EmisTmsTransPlanDtl" resultMap="EmisTmsTransPlanDtlResult">
<include refid="selectEmisTmsTransPlanDtlVo"/>
2024-05-08 01:02:10 +00:00
<where>
2024-03-01 09:13:00 +00:00
<if test="id != null "> and id = #{id}</if>
<if test="planId != null "> and plan_id = #{planId}</if>
2024-05-08 01:02:10 +00:00
<if test="startSite != null and startSite != ''"> and start_site like concat('%', #{startSite}, '%')</if>
<if test="destSite != null and destSite != ''"> and dest_site like concat('%', #{destSite}, '%')</if>
2024-03-01 09:13:00 +00:00
<if test="transType != null and transType != ''"> and trans_type like concat('%', #{transType}, '%')</if>
<if test="estCostDay != null and estCostDay != ''"> and est_cost_day like concat('%', #{estCostDay}, '%')</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="status != null and status != ''"> and status like concat('%', #{status}, '%')</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="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
2024-05-08 01:02:10 +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-03-01 09:13:00 +00:00
</where>
order by create_time desc
</select>
2024-05-08 01:02:10 +00:00
2024-03-01 09:13:00 +00:00
<select id="selectEmisTmsTransPlanDtlById" parameterType="Long" resultMap="EmisTmsTransPlanDtlResult">
2024-05-08 01:02:10 +00:00
select id, plan_id, start_site, dest_site, trans_type, est_cost_day, order_num, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
2024-03-01 09:13:00 +00:00
from emis_tms_trans_plan_dtl a
where a.id = #{id}
</select>
2024-05-08 01:02:10 +00:00
2024-03-01 09:13:00 +00:00
<insert id="insertEmisTmsTransPlanDtl" parameterType="EmisTmsTransPlanDtl">
insert into emis_tms_trans_plan_dtl
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="planId != null">plan_id,</if>
2024-05-08 01:02:10 +00:00
<if test="startSite != null and startSite != ''">start_site,</if>
<if test="destSite != null and destSite != ''">dest_site,</if>
2024-03-01 09:13:00 +00:00
<if test="transType != null and transType != ''">trans_type,</if>
<if test="estCostDay != null and estCostDay != ''">est_cost_day,</if>
<if test="orderNum != null">order_num,</if>
<if test="status != null and status != ''">status,</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="remark != null and remark != ''">remark,</if>
2024-05-08 01:02:10 +00:00
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
2024-03-01 09:13:00 +00:00
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="planId != null">#{planId},</if>
2024-05-08 01:02:10 +00:00
<if test="startSite != null and startSite != ''">#{startSite},</if>
<if test="destSite != null and destSite != ''">#{destSite},</if>
2024-03-01 09:13:00 +00:00
<if test="transType != null and transType != ''">#{transType},</if>
<if test="estCostDay != null and estCostDay != ''">#{estCostDay},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="status != null and status != ''">#{status},</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="remark != null and remark != ''">#{remark},</if>
2024-05-08 01:02:10 +00:00
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
2024-03-01 09:13:00 +00:00
</insert>
<update id="updateEmisTmsTransPlanDtl" parameterType="EmisTmsTransPlanDtl">
update emis_tms_trans_plan_dtl
<trim prefix="SET" suffixOverrides=",">
<if test="planId != null">plan_id = #{planId},</if>
2024-05-08 01:02:10 +00:00
<if test="startSite != null and startSite != ''">start_site = #{startSite},</if>
<if test="destSite != null and destSite != ''">dest_site = #{destSite},</if>
2024-03-01 09:13:00 +00:00
<if test="transType != null and transType != ''">trans_type = #{transType},</if>
<if test="estCostDay != null and estCostDay != ''">est_cost_day = #{estCostDay},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="status != null and status != ''">status = #{status},</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="remark != null and remark != ''">remark = #{remark},</if>
2024-05-08 01:02:10 +00:00
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
2024-03-01 09:13:00 +00:00
</trim>
where id = #{id}
</update>
<delete id="deleteEmisTmsTransPlanDtlById" parameterType="Long">
delete from emis_tms_trans_plan_dtl where id = #{id}
</delete>
<delete id="deleteEmisTmsTransPlanDtlByIds" parameterType="String">
2024-05-08 01:02:10 +00:00
delete from emis_tms_trans_plan_dtl where id in
2024-03-01 09:13:00 +00:00
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>