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

174 lines
6.7 KiB
XML
Raw Normal View History

2024-06-13 15:27:54 +08:00
<?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.AppointmentDetailMapper">
<!--添加数据-->
<select id="insert" parameterType="com.haitongauto.models.pojo.AppointmentDetail" resultType="String">
insert into applet_appointment_detail
(
id,
appointment_id,
ship_id,
ship_name,
voy_number,
destination_port,
destination_port_id,
brand_id,
brand_name,
vin,
create_time,
update_time,
is_del
)
values
(
#{id},
#{appointment_id},
#{ship_id},
#{ship_name},
#{voy_number},
#{destination_port},
#{destination_port_id},
#{brand_id},
#{brand_name},
#{vin},
current_timestamp,
current_timestamp,
0
)
returning id
</select>
<!--逻辑删除-->
<update id="logicDel" parameterType="String">
update applet_appointment_detail set is_del=1 where id=#{id}
</update>
<!--彻底删除-->
<delete id="delete" parameterType="String">
delete from applet_appointment_detail
where id=#{id}
</delete>
<!--数据更新-->
<update id="update" parameterType="com.haitongauto.models.pojo.AppointmentDetail">
update applet_appointment_detail
<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="ship_id != null and ship_id != ''">
ship_id = #{ship_id},
</if>
<if test="ship_name != null and ship_name != ''">
ship_name = #{ship_name},
</if>
<if test="voy_number != null and voy_number != ''">
voy_number = #{voy_number},
</if>
<if test="destination_port != null and destination_port != ''">
destination_port = #{destination_port},
</if>
<if test="destination_port_id != null and destination_port_id != ''">
destination_port_id = #{destination_port_id},
</if>
<if test="brand_id != null and brand_id != ''">
brand_id = #{brand_id},
</if>
<if test="brand_name != null and brand_name != ''">
brand_name = #{brand_name},
</if>
<if test="vin != null and vin != ''">
vin = #{vin},
</if>
<if test="create_time != null and create_time != ''">
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的记录-->
<select id="getById" parameterType="String" resultType="com.haitongauto.models.pojo.AppointmentDetail">
select
id,appointment_id,ship_id,ship_name,voy_number,destination_port,destination_port_id,brand_id,brand_name,vin,create_time,update_time,is_del
from applet_appointment_detail
where id = #{id}
limit 1
</select>
<!--数据列表-->
<select id="getList" resultType="com.haitongauto.models.pojo.AppointmentDetail">
select
id,appointment_id,ship_id,ship_name,voy_number,destination_port,destination_port_id,brand_id,brand_name,vin,create_time,update_time,is_del
from applet_appointment_detail
where is_del=0
order by create_time desc
</select>
<!--指定appointment_id的记录-->
<select id="getAppointmentDetailListByAppointmentId" parameterType="String" resultType="com.haitongauto.models.pojo.AppointmentDetail">
select
id,appointment_id,ship_id,ship_name,voy_number,destination_port,destination_port_id,brand_id,brand_name,vin,create_time,update_time,is_del
from applet_appointment_detail
where appointment_id = #{appointment_id}
</select>
<!--指定appointment_id的记录-->
<select id="getAppointmentDetailByGoodVin" parameterType="String" resultType="com.haitongauto.models.pojo.AppointmentDetail">
select
id,appointment_id,ship_id,ship_name,voy_number,destination_port,destination_port_id,brand_id,brand_name,vin,create_time,update_time,is_del
from applet_appointment_detail
where vin = #{vin}
limit 1
</select>
<select id="getAppointmentDetailByAppointmentIdList" resultType="com.haitongauto.models.pojo.AppointmentDetail">
select
id,appointment_id,ship_id,ship_name,voy_number,destination_port,destination_port_id,brand_id,brand_name,vin,create_time,update_time,is_del
from applet_appointment_detail
where is_del=0
and appointment_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<delete id="deleteAppointmentDetailByAppointmentId" parameterType="String">
delete from applet_appointment_detail
where appointment_id=#{appointment_id}
</delete>
<select id="getAppointmentDetailListByGoodVinList" resultType="String">
select
distinct vin
from applet_appointment_detail
where is_del=0
and vin in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getAppointmentDetailListByVinList" resultType="com.haitongauto.models.pojo.AppointmentDetail">
select
id,appointment_id,ship_id,ship_name,voy_number,destination_port,destination_port_id,brand_id,brand_name,vin,create_time,update_time,is_del
from applet_appointment_detail
where is_del=0
and vin in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getAppointmentDetailsByConditionf" resultType="com.haitongauto.models.pojo.AppointmentDetail">
select *
from applet_appointment_detail
where is_del=0
<if test="appointment_id != null and appointment_id != ''">
and appointment_id = #{appointment_id}
</if>
<if test="ship_id != null and ship_id != ''">
and ship_id = #{ship_id}
</if>
<if test="brand_id != null and brand_id != ''">
and brand_id = #{brand_id}
</if>
</select>
</mapper>