rtos-mini-service4/mapper/target/classes/mappers/base/EntryInstructMapper.xml

90 lines
3.0 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.haitongauto.mapper.base.EntryInstructMapper">
<!--添加-->
<select id="insert" parameterType="com.haitongauto.models.pojo.EntryInstruct" resultType="String">
insert into applet_entry_instruct
(
id,
appointment_id,
users_id,
users_name,
truck_number,
yard_name,
create_time,
update_time,
is_del
)
values
(
#{id},
#{appointment_id},
#{users_id},
#{users_name},
#{truck_number},
#{yard_name},
current_timestamp,
current_timestamp,
#{is_del}
)
returning id
</select>
<!--软删除-->
<update id="logicDel" parameterType="String">
update applet_entry_instruct set is_del=1 where id=#{id}
</update>
<!--硬删除-->
<delete id="delete" parameterType="String">
delete from applet_entry_instruct where id=#{id}
</delete>
<!--数据更新-->
<update id="update" parameterType="com.haitongauto.models.pojo.EntryInstruct">
update applet_entry_instruct
<set>
<if test="id != null and id != ''">
id = #{id},
</if>
<if test="appointment_id != null and appointment_id != ''">
appointment_id = #{appointment_id},
</if>
<if test="users_id != null and users_id != ''">
users_id = #{users_id},
</if>
<if test="users_name != null and users_name != ''">
users_name = #{users_name},
</if>
<if test="truck_number != null and truck_number != ''">
truck_number = #{truck_number},
</if>
<if test="yard_name != null and yard_name != ''">
yard_name = #{yard_name},
</if>
<if test="is_del != null and is_del != ''">
create_time = #{create_time}::timestamp,
</if>
<if test="is_del != null">
is_del = #{is_del},
</if>
update_time = current_timestamp
</set>
where id = #{id}
</update>
<!--指定Id的记录current_timestamp-->
<select id="getById" parameterType="String" resultType="com.haitongauto.models.pojo.EntryInstruct">
select
id,appointment_id,users_id,users_name,truck_number,yard_name,create_time,update_time,is_del
from applet_entry_instruct
where id=#{id} and is_del=0
</select>
<!--数据列表-->
<select id="getList" resultType="com.haitongauto.models.pojo.EntryInstruct">
select
id,appointment_id,users_id,users_name,truck_number,yard_name,create_time,update_time,is_del
from applet_entry_instruct
where is_del=0
order by create_time desc
</select>
</mapper>