227 lines
12 KiB
XML
227 lines
12 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.EmisTmsTransPlanDtlMapper">
|
|
|
|
<resultMap type="EmisTmsTransPlanDtl" id="EmisTmsTransPlanDtlResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<result property="id" column="id" />
|
|
<result property="planId" column="plan_id" />
|
|
<result property="stepName" column="step_name" />
|
|
<result property="startSite" column="start_site" />
|
|
<result property="destSite" column="dest_site" />
|
|
<result property="transType" column="trans_type" />
|
|
<result property="estCostDay" column="est_cost_day" />
|
|
<result property="orderNum" column="order_num" />
|
|
<result property="status" column="status" />
|
|
|
|
|
|
<association property="startSiteName" column="start_site" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectGroupSiteNameByCode"/>
|
|
<association property="destSiteName" column="dest_site" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectGroupSiteNameByCode"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="selectEmisTmsTransPlanDtlList_tmp" parameterType="EmisTmsTransPlanDtl" resultMap="EmisTmsTransPlanDtlResult">
|
|
select 1 as id, 1 as plan_id, a.site_code as start_site , a.site_code as dest_site
|
|
from emis_site a
|
|
where a.del_flag='0' and site_type not in(1,2)
|
|
<if test="startSite != null and startSite != ''"> and a.site_code!=#{startSite} </if>
|
|
<if test="destSite != null and destSite != ''"> and a.site_code!=#{destSite} </if>
|
|
<if test="params.searchValue != null and params.searchValue != ''"> and a.site_name like concat('%',#{params.searchValue},'%') </if>
|
|
|
|
order by site_code asc
|
|
</select>
|
|
|
|
|
|
<sql id="selectEmisTmsTransPlanDtlVo">
|
|
select id, plan_id, step_name, 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
|
|
</sql>
|
|
|
|
<!-- 获取下一站点-->
|
|
<select id="selectPreOrNextSiteList" parameterType="EmisTmsTransPlanDtl" resultMap="EmisTmsTransPlanDtlResult">
|
|
select
|
|
distinct
|
|
<if test="startSite != null and startSite != ''">
|
|
#{startSite} as start_site, dest_site
|
|
</if>
|
|
<if test="destSite != null and destSite != ''">
|
|
start_site, #{destSite} as dest_site
|
|
</if>
|
|
|
|
from emis_tms_trans_plan_dtl
|
|
<where>
|
|
del_flag='0'
|
|
<if test="planId != null "> and plan_id = #{planId}</if>
|
|
<if test="stepName != null and stepName != ''"> and step_name like concat('%', #{stepName}, '%')</if>
|
|
<if test="startSite != null and startSite != ''"> and FIND_IN_SET( #{startSite}, start_site ) </if>
|
|
<if test="destSite != null and destSite != ''"> and FIND_IN_SET( #{destSite}, dest_site )</if>
|
|
<if test="transType != null and transType != ''"> and FIND_IN_SET(trans_type,#{transType} )</if>
|
|
<if test="estCostDay != null "> 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=#{status}</if>
|
|
|
|
<if test="searchValue != null and searchValue != '' and startSite != null and startSite != '' ">
|
|
and dest_site in (select site_code from emis_site where site_name like concat('%',#{searchValue},'%') )
|
|
</if>
|
|
|
|
<if test="searchValue != null and searchValue != '' and destSite != null and destSite != '' ">
|
|
and start_site in (select site_code from emis_site where site_name like concat('%',#{searchValue},'%') )
|
|
</if>
|
|
|
|
</where>
|
|
order by order_num asc
|
|
</select>
|
|
|
|
|
|
<!-- 获取上一站点-->
|
|
<select id="selectPreSiteList" parameterType="EmisTmsTransPlanDtl" resultMap="EmisTmsTransPlanDtlResult">
|
|
select
|
|
site_code start_site, #{destSite} as dest_site
|
|
from emis_site
|
|
<where>
|
|
del_flag='0'
|
|
<if test="status != null and status != ''"> and status=#{status}</if>
|
|
<if test="searchValue != null and searchValue != '' and destSite != null and destSite != '' ">
|
|
and site_name like concat('%',#{searchValue},'%')
|
|
</if>
|
|
|
|
</where>
|
|
order by order_num asc
|
|
</select>
|
|
|
|
|
|
<select id="selectEmisTmsTransPlanDtlList" parameterType="EmisTmsTransPlanDtl" resultMap="EmisTmsTransPlanDtlResult">
|
|
<include refid="selectEmisTmsTransPlanDtlVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
<if test="id != null "> and id = #{id}</if>
|
|
<if test="planId != null "> and plan_id = #{planId}</if>
|
|
<if test="stepName != null and stepName != ''"> and step_name like concat('%', #{stepName}, '%')</if>
|
|
<if test="startSite != null and startSite != ''"> and FIND_IN_SET( #{startSite}, start_site ) </if>
|
|
<if test="destSite != null and destSite != ''"> and FIND_IN_SET( #{destSite}, dest_site )</if>
|
|
<if test="transType != null and transType != ''"> and trans_type=#{transType}</if>
|
|
<if test="estCostDay != null "> 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=#{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>
|
|
<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 asc
|
|
</select>
|
|
|
|
<select id="checkUnique" parameterType="EmisTmsTransPlanDtl" resultType="int">
|
|
select count(1) from emis_tms_trans_plan_dtl
|
|
where del_flag='0'
|
|
and id = #{id}
|
|
and plan_id = #{planId}
|
|
and step_name = #{stepName}
|
|
and start_site = #{startSite}
|
|
and dest_site = #{destSite}
|
|
and trans_type = #{transType}
|
|
and est_cost_day = #{estCostDay}
|
|
and order_num = #{orderNum}
|
|
and status = #{status}
|
|
and del_flag = #{delFlag}
|
|
and create_by = #{createBy}
|
|
and create_time = #{createTime}
|
|
and update_by = #{updateBy}
|
|
and update_time = #{updateTime}
|
|
and remark = #{remark}
|
|
and create_site = #{createSite}
|
|
and update_site = #{updateSite}
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="selectEmisTmsTransPlanDtlById" parameterType="Long" resultMap="EmisTmsTransPlanDtlResult">
|
|
select id, plan_id, step_name, 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 a
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertEmisTmsTransPlanDtl" parameterType="EmisTmsTransPlanDtl" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_tms_trans_plan_dtl
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="planId != null">plan_id,</if>
|
|
<if test="stepName != null and stepName != ''">step_name,</if>
|
|
<if test="startSite != null and startSite != ''">start_site,</if>
|
|
<if test="destSite != null and destSite != ''">dest_site,</if>
|
|
<if test="transType != null and transType != ''">trans_type,</if>
|
|
<if test="estCostDay != null">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>
|
|
<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="planId != null">#{planId},</if>
|
|
<if test="stepName != null and stepName != ''">#{stepName},</if>
|
|
<if test="startSite != null and startSite != ''">#{startSite},</if>
|
|
<if test="destSite != null and destSite != ''">#{destSite},</if>
|
|
<if test="transType != null and transType != ''">#{transType},</if>
|
|
<if test="estCostDay != null">#{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>
|
|
<if test="createSite != null and createSite != ''">#{createSite},</if>
|
|
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmisTmsTransPlanDtl" parameterType="EmisTmsTransPlanDtl">
|
|
update emis_tms_trans_plan_dtl
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="planId != null">plan_id = #{planId},</if>
|
|
<if test="stepName != null and stepName != ''">step_name = #{stepName},</if>
|
|
<if test="startSite != null and startSite != ''">start_site = #{startSite},</if>
|
|
<if test="destSite != null and destSite != ''">dest_site = #{destSite},</if>
|
|
<if test="transType != null and transType != ''">trans_type = #{transType},</if>
|
|
<if test="estCostDay != null">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>
|
|
<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="deleteEmisTmsTransPlanDtlById" parameterType="Long">
|
|
delete from emis_tms_trans_plan_dtl where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisTmsTransPlanDtlByIds" parameterType="String">
|
|
delete from emis_tms_trans_plan_dtl where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteEmisTmsTransPlanDtlByPlanId" parameterType="Long">
|
|
delete from emis_tms_trans_plan_dtl where plan_id = #{planId}
|
|
</delete>
|
|
|
|
</mapper> |