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.EmisTmsTransPlanMapper" >
2024-05-08 01:02:10 +00:00
2024-03-01 09:13:00 +00:00
<resultMap type= "EmisTmsTransPlan" id= "EmisTmsTransPlanResult" >
<result property= "id" column= "id" />
<result property= "planCode" column= "plan_code" />
<result property= "planName" column= "plan_name" />
<result property= "transLineType" column= "trans_line_type" />
<result property= "productType" column= "product_type" />
<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" />
2024-05-29 16:50:47 +00:00
2024-06-02 01:10:24 +00:00
<association property= "productTypeName" column= "product_type" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectProdNameByCode" />
<association property= "transLineTypeName" column= "trans_line_type" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectLineNameByCode" />
2024-05-29 16:50:47 +00:00
2024-06-02 01:10:24 +00:00
<!-- 个性化查询 -->
2024-05-29 17:04:02 +00:00
<association property= "totalEstCostDay" column= "id" select= "selectTotalEstCostDayByPlanId" />
2024-05-29 23:08:33 +00:00
<association property= "fromCountryName" column= "trans_line_type" select= "selectFromCountryNameByLineCode" />
<association property= "countryName" column= "trans_line_type" select= "selectCountryNameByLineCode" />
2024-05-29 16:56:13 +00:00
2024-03-01 09:13:00 +00:00
</resultMap>
2024-05-29 21:52:59 +00:00
<select id= "selectFromCountryNameByLineCode" parameterType= "String" resultType= "string" >
2024-05-29 22:30:59 +00:00
select a.name from emis_country a,emis_trans_line b where a.del_flag='0' and b.del_flag='0' and a.code=b.from_country and b.line_code = #{code} limit 1
2024-05-29 21:52:59 +00:00
</select>
<select id= "selectCountryNameByLineCode" parameterType= "String" resultType= "string" >
2024-05-29 22:30:59 +00:00
select a.name from emis_country a,emis_trans_line b where a.del_flag='0' and b.del_flag='0' and a.code=b.country and b.line_code = #{code} limit 1
2024-05-29 16:56:13 +00:00
</select>
2024-05-29 17:24:11 +00:00
<select id= "selectTotalEstCostDayByPlanId" parameterType= "long" resultType= "BigDecimal" >
2024-05-29 22:30:59 +00:00
select sum(a.est_cost_day) as est_cost_day from emis_tms_trans_plan_dtl a where a.del_flag='0' and a.plan_id = #{id} limit 1
2024-05-29 17:04:02 +00:00
</select>
2024-05-29 16:50:47 +00:00
2024-05-29 16:56:13 +00:00
2024-03-01 09:13:00 +00:00
<sql id= "selectEmisTmsTransPlanVo" >
2024-05-08 01:02:10 +00:00
select id, plan_code, plan_name, trans_line_type, product_type, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_tms_trans_plan
2024-03-01 09:13:00 +00:00
</sql>
<select id= "selectEmisTmsTransPlanList" parameterType= "EmisTmsTransPlan" resultMap= "EmisTmsTransPlanResult" >
<include refid= "selectEmisTmsTransPlanVo" />
2024-05-08 01:02:10 +00:00
<where >
2024-05-29 16:43:58 +00:00
del_flag='0'
2024-03-01 09:13:00 +00:00
<if test= "id != null " > and id = #{id}</if>
<if test= "planCode != null and planCode != ''" > and plan_code like concat('%', #{planCode}, '%')</if>
<if test= "planName != null and planName != ''" > and plan_name like concat('%', #{planName}, '%')</if>
<if test= "transLineType != null and transLineType != ''" > and trans_line_type like concat('%', #{transLineType}, '%')</if>
<if test= "productType != null and productType != ''" > and product_type like concat('%', #{productType}, '%')</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-05-29 16:43:58 +00:00
<select id= "checkUnique" parameterType= "EmisTmsTransPlan" resultType= "int" >
select count(1) from emis_tms_trans_plan
where del_flag='0'
and id = #{id}
and plan_code = #{planCode}
and plan_name = #{planName}
and trans_line_type = #{transLineType}
and product_type = #{productType}
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>
2024-03-01 09:13:00 +00:00
<select id= "selectEmisTmsTransPlanById" parameterType= "Long" resultMap= "EmisTmsTransPlanResult" >
2024-05-08 01:02:10 +00:00
select id, plan_code, plan_name, trans_line_type, product_type, 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 a
where a.id = #{id}
</select>
2024-05-08 01:02:10 +00:00
2024-05-29 16:43:58 +00:00
<insert id= "insertEmisTmsTransPlan" parameterType= "EmisTmsTransPlan" useGeneratedKeys= "true" keyProperty= "id" >
2024-03-01 09:13:00 +00:00
insert into emis_tms_trans_plan
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "id != null" > id,</if>
<if test= "planCode != null and planCode != ''" > plan_code,</if>
<if test= "planName != null and planName != ''" > plan_name,</if>
<if test= "transLineType != null and transLineType != ''" > trans_line_type,</if>
<if test= "productType != null and productType != ''" > product_type,</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= "planCode != null and planCode != ''" > #{planCode},</if>
<if test= "planName != null and planName != ''" > #{planName},</if>
<if test= "transLineType != null and transLineType != ''" > #{transLineType},</if>
<if test= "productType != null and productType != ''" > #{productType},</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= "updateEmisTmsTransPlan" parameterType= "EmisTmsTransPlan" >
update emis_tms_trans_plan
<trim prefix= "SET" suffixOverrides= "," >
<if test= "planCode != null and planCode != ''" > plan_code = #{planCode},</if>
<if test= "planName != null and planName != ''" > plan_name = #{planName},</if>
<if test= "transLineType != null and transLineType != ''" > trans_line_type = #{transLineType},</if>
<if test= "productType != null and productType != ''" > product_type = #{productType},</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= "deleteEmisTmsTransPlanById" parameterType= "Long" >
delete from emis_tms_trans_plan where id = #{id}
</delete>
<delete id= "deleteEmisTmsTransPlanByIds" parameterType= "String" >
2024-05-08 01:02:10 +00:00
delete from emis_tms_trans_plan where id in
2024-03-01 09:13:00 +00:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
</mapper>