172 lines
10 KiB
XML
172 lines
10 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.EmisTmsTransferTraceMapper">
|
|
|
|
<resultMap type="EmisTmsTransferTrace" id="EmisTmsTransferTraceResult">
|
|
<result property="id" column="id" />
|
|
<result property="billCode" column="bill_code" />
|
|
<result property="lastTraceDate" column="last_trace_date" />
|
|
<result property="lastWaybillStatus" column="last_waybill_status" />
|
|
<result property="traceInfo" column="trace_info" />
|
|
<result property="chId" column="ch_id" />
|
|
<result property="transferBillCode" column="transfer_bill_code" />
|
|
<result property="transferExpress" column="transfer_express" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEmisTmsTransferTraceVo">
|
|
select id, bill_code, last_trace_date, last_waybill_status, trace_info, ch_id, transfer_bill_code, transfer_express, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_transfer_trace
|
|
</sql>
|
|
|
|
<select id="selectEmisTmsTransferTraceList" parameterType="EmisTmsTransferTrace" resultMap="EmisTmsTransferTraceResult">
|
|
<include refid="selectEmisTmsTransferTraceVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
<if test="id != null "> and id = #{id}</if>
|
|
<if test="billCode != null and billCode != ''"> and bill_code =#{billCode}</if>
|
|
<if test="lastTraceDate != null "> and last_trace_date = #{lastTraceDate}</if>
|
|
<if test="lastWaybillStatus != null and lastWaybillStatus != ''"> and last_waybill_status=#{lastWaybillStatus}</if>
|
|
<if test="traceInfo != null and traceInfo != ''"> and trace_info like concat('%', #{traceInfo}, '%')</if>
|
|
<if test="chId != null and chId != ''"> and ch_id like concat('%', #{chId}, '%')</if>
|
|
<if test="transferBillCode != null and transferBillCode != ''"> and transfer_bill_code=#{transferBillCode}</if>
|
|
<if test="transferExpress != null and transferExpress != ''"> and transfer_express=#{transferExpress}</if>
|
|
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</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>
|
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
|
|
|
<if test="params.beginLastTraceDate != null and params.beginLastTraceDate != ''">
|
|
and last_trace_date <![CDATA[ >= ]]> #{params.beginLastTraceDate}
|
|
</if>
|
|
<if test="params.endLastTraceDate != null and params.endLastTraceDate != ''">
|
|
and last_trace_date <![CDATA[ <= ]]> #{params.endLastTraceDate}
|
|
</if>
|
|
|
|
<if test="params.needTrace != null and params.needTrace != '1'">
|
|
and last_waybill_status != '50'
|
|
and last_trace_date <![CDATA[ > ]]> DATE_SUB(CURDATE(), INTERVAL 30 DAY)
|
|
and update_time <![CDATA[ < ]]> SUBDATE(now(),interval 2 hour)
|
|
or last_trace_date is null
|
|
</if>
|
|
|
|
</where>
|
|
order by last_trace_date asc
|
|
</select>
|
|
|
|
<select id="checkUnique" parameterType="EmisTmsTransferTrace" resultType="int">
|
|
select count(1) from emis_tms_transfer_trace
|
|
where del_flag='0'
|
|
and bill_code = #{billCode}
|
|
<if test="transferExpress != null and transferExpress != ''">
|
|
and transfer_express = #{transferExpress}
|
|
</if>
|
|
<if test="transferBillCode != null and transferBillCode != ''">
|
|
and transfer_bill_code = #{transferBillCode}
|
|
</if>
|
|
limit 1
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectEmisTmsTransferTraceById" parameterType="Long" resultMap="EmisTmsTransferTraceResult">
|
|
select id, bill_code, last_trace_date, last_waybill_status, trace_info, ch_id, transfer_bill_code, transfer_express, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_tms_transfer_trace a
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<select id="selectEmisTmsTransferTraceByBillCode" parameterType="String" resultMap="EmisTmsTransferTraceResult">
|
|
select
|
|
a.id, a.bill_code, a.last_trace_date, a.last_waybill_status, a.trace_info, a.ch_id,
|
|
a.transfer_bill_code, a.transfer_express, a.remark, a.del_flag, a.create_by, a.create_time,
|
|
a.update_by, a.update_time, a.create_site,
|
|
a.update_site
|
|
from emis_tms_transfer_trace a,emis_waybill b
|
|
where a.del_flag='0' and b.del_flag='0'
|
|
and a.bill_code=b.bill_code and a.transfer_express=b.transfer_code and a.transfer_bill_code=b.transfer_billcode
|
|
and a.bill_code = #{billCode} order by create_time desc limit 1
|
|
</select>
|
|
|
|
|
|
<insert id="insertEmisTmsTransferTrace" parameterType="EmisTmsTransferTrace" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_tms_transfer_trace
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="billCode != null and billCode != ''">bill_code,</if>
|
|
<if test="lastTraceDate != null">last_trace_date,</if>
|
|
<if test="lastWaybillStatus != null and lastWaybillStatus != ''">last_waybill_status,</if>
|
|
<if test="traceInfo != null and traceInfo != ''">trace_info,</if>
|
|
<if test="chId != null and chId != ''">ch_id,</if>
|
|
<if test="transferBillCode != null and transferBillCode != ''">transfer_bill_code,</if>
|
|
<if test="transferExpress != null and transferExpress != ''">transfer_express,</if>
|
|
<if test="remark != null and remark != ''">remark,</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="billCode != null and billCode != ''">#{billCode},</if>
|
|
<if test="lastTraceDate != null">#{lastTraceDate},</if>
|
|
<if test="lastWaybillStatus != null and lastWaybillStatus != ''">#{lastWaybillStatus},</if>
|
|
<if test="traceInfo != null and traceInfo != ''">#{traceInfo},</if>
|
|
<if test="chId != null and chId != ''">#{chId},</if>
|
|
<if test="transferBillCode != null and transferBillCode != ''">#{transferBillCode},</if>
|
|
<if test="transferExpress != null and transferExpress != ''">#{transferExpress},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</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="updateEmisTmsTransferTrace" parameterType="EmisTmsTransferTrace">
|
|
update emis_tms_transfer_trace
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
|
|
<if test="lastTraceDate != null">last_trace_date = #{lastTraceDate},</if>
|
|
<if test="lastWaybillStatus != null and lastWaybillStatus != ''">last_waybill_status = #{lastWaybillStatus},</if>
|
|
<if test="traceInfo != null and traceInfo != ''">trace_info = #{traceInfo},</if>
|
|
<if test="chId != null and chId != ''">ch_id = #{chId},</if>
|
|
<if test="transferBillCode != null and transferBillCode != ''">transfer_bill_code = #{transferBillCode},</if>
|
|
<if test="transferExpress != null and transferExpress != ''">transfer_express = #{transferExpress},</if>
|
|
<if test="remark != null and remark != ''">remark = #{remark},</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="deleteEmisTmsTransferTraceByBillCode" parameterType="String">
|
|
update emis_tms_transfer_trace set del_flag='1' where bill_code=#{billCode}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisTmsTransferTraceById" parameterType="Long">
|
|
update emis_tms_transfer_trace set del_flag='1' where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisTmsTransferTraceByIds" parameterType="String">
|
|
update emis_tms_transfer_trace set del_flag='1' where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |