emis-service/emis-biz/src/main/resources/mapper/EmisTmsMapTraceMapper.xml
2025-08-13 04:55:51 +08:00

140 lines
8.4 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.EmisTmsMapTraceMapper">
<resultMap type="EmisTmsMapTrace" id="EmisTmsMapTraceResult">
<result property="id" column="id" />
<result property="orderNo" column="order_no" />
<result property="deviceNo" column="device_no" />
<result property="traceType" column="trace_type" />
<result property="lastTraceDate" column="last_trace_date" />
<result property="lastTraceStatus" column="last_trace_status" />
<result property="lastLocationInfo" column="last_location_info" />
</resultMap>
<sql id="selectEmisTmsMapTraceVo">
select id, order_no, device_no, trace_type, last_trace_date, last_trace_status, last_location_info, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_map_trace
</sql>
<select id="selectEmisTmsMapTraceList" parameterType="EmisTmsMapTrace" resultMap="EmisTmsMapTraceResult">
<include refid="selectEmisTmsMapTraceVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="orderNo != null and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
<if test="deviceNo != null and deviceNo != ''"> and device_no like concat('%', #{deviceNo}, '%')</if>
<if test="traceType != null and traceType != ''"> and trace_type like concat('%', #{traceType}, '%')</if>
<if test="lastTraceDate != null "> and last_trace_date = #{lastTraceDate}</if>
<if test="lastTraceStatus != null and lastTraceStatus != ''"> and last_trace_status like concat('%', #{lastTraceStatus}, '%')</if>
<if test="lastLocationInfo != null and lastLocationInfo != ''"> and last_location_info like concat('%', #{lastLocationInfo}, '%')</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>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisTmsMapTrace" resultType="int">
select count(1) from emis_tms_map_trace
where del_flag='0'
and id = #{id}
and order_no = #{orderNo}
and device_no = #{deviceNo}
and trace_type = #{traceType}
and last_trace_date = #{lastTraceDate}
and last_trace_status = #{lastTraceStatus}
and last_location_info = #{lastLocationInfo}
and remark = #{remark}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
<select id="selectEmisTmsMapTraceById" parameterType="Long" resultMap="EmisTmsMapTraceResult">
select id, order_no, device_no, trace_type, last_trace_date, last_trace_status, last_location_info, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_map_trace a
where a.id = #{id}
</select>
<insert id="insertEmisTmsMapTrace" parameterType="EmisTmsMapTrace" useGeneratedKeys="true" keyProperty="id">
insert into emis_tms_map_trace
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="orderNo != null and orderNo != ''">order_no,</if>
<if test="deviceNo != null and deviceNo != ''">device_no,</if>
<if test="traceType != null and traceType != ''">trace_type,</if>
<if test="lastTraceDate != null">last_trace_date,</if>
<if test="lastTraceStatus != null and lastTraceStatus != ''">last_trace_status,</if>
<if test="lastLocationInfo != null and lastLocationInfo != ''">last_location_info,</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="orderNo != null and orderNo != ''">#{orderNo},</if>
<if test="deviceNo != null and deviceNo != ''">#{deviceNo},</if>
<if test="traceType != null and traceType != ''">#{traceType},</if>
<if test="lastTraceDate != null">#{lastTraceDate},</if>
<if test="lastTraceStatus != null and lastTraceStatus != ''">#{lastTraceStatus},</if>
<if test="lastLocationInfo != null and lastLocationInfo != ''">#{lastLocationInfo},</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="updateEmisTmsMapTrace" parameterType="EmisTmsMapTrace">
update emis_tms_map_trace
<trim prefix="SET" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
<if test="deviceNo != null and deviceNo != ''">device_no = #{deviceNo},</if>
<if test="traceType != null and traceType != ''">trace_type = #{traceType},</if>
<if test="lastTraceDate != null">last_trace_date = #{lastTraceDate},</if>
<if test="lastTraceStatus != null and lastTraceStatus != ''">last_trace_status = #{lastTraceStatus},</if>
<if test="lastLocationInfo != null and lastLocationInfo != ''">last_location_info = #{lastLocationInfo},</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="deleteEmisTmsMapTraceById" parameterType="Long">
delete from emis_tms_map_trace where id = #{id}
</delete>
<delete id="deleteEmisTmsMapTraceByIds" parameterType="String">
delete from emis_tms_map_trace where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>