rtos-mini-service4/mapper/target/classes/mappers/client/AppointmentExtendMapper.xml

148 lines
5.6 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.client.AppointmentExtendMapper">
<!--获取指定用户指定状态(appointment_state: 1-已预约2-已签到3-已进港5-操作中6-已完成7-已出港4-已取消9-异常)的数据 -->
<select id="getAppointmentListForAny" resultType="com.haitongauto.models.pojo.Appointment">
select *
from applet_appointment
where is_del=0
and users_id=#{users_id}
and appointment_state=#{appointment_state}
order by create_time desc
</select>
<!--我的预约信息列表-->
<select id="getMyAppointmentList" resultType="com.haitongauto.models.pojo.Appointment">
select *
from applet_appointment
where is_del=0
and users_id=#{users_id}
order by create_time desc
</select>
<!--根据预约日期查询我的预约信息-->
<select id="getMyAppointmentListForDate" resultType="com.haitongauto.models.pojo.Appointment">
select *
from applet_appointment
where is_del=0
and users_id=#{users_id}
and approach_date=#{approach_date}
order by create_time desc
</select>
<!--根据idList查询我的预约信息-->
<select id="getMyAppointmentListForIdList" resultType="com.haitongauto.models.pojo.Appointment">
SELECT *
from applet_appointment
WHERE is_del=0 and users_id=#{users_id} and id IN
<foreach collection="id_list" item="id" index="index" open="(" separator="," close=")">
#{id}
</foreach>
order by create_time desc
</select>
<!--获取指定用户预约未完成的数据(备注appointment_state: 1-已预约2-已签到3-已进港5-操作中6-已完成7-已出港4-已取消9-异常)数据 -->
<select id="getActiveAppointment" resultType="com.haitongauto.models.pojo.Appointment">
select *
from applet_appointment
where is_del=0
and users_id=#{users_id}
and appointment_state &lt;&gt; 4
and appointment_state &lt; 6
order by create_time desc
limit 1
</select>
2024-07-16 14:09:17 +08:00
<select id="getActiveAppointmentNew" resultType="com.haitongauto.models.pojo.Appointment">
select *
from applet_appointment
where is_del=0
and (truck_number=#{truck_number} or id_code=#{truck_number})
and appointment_state &lt;&gt; 4
and appointment_state &lt;&gt; 9
and appointment_state &lt; 6
order by create_time desc
limit 1
</select>
2024-06-13 15:27:54 +08:00
<select id="getActiveAppointmentByTruckNumber" resultType="com.haitongauto.models.pojo.Appointment">
select *
from applet_appointment
where is_del=0
and (truck_number=#{truck_number} or id_code=#{truck_number})
and appointment_state &lt;&gt; 4
and appointment_state &lt;&gt; 9
and appointment_state &lt; 6
order by create_time desc
limit 1
</select>
<!--取消预约-->
<update id="cancelAppointment">
update applet_appointment
set
cancel_time = #{cancel_time}::timestamp,
appointment_state=4
where id=#{appointment_id}
</update>
<!--取消预约明细-->
<update id="cancelAppointmentDetails">
update applet_appointment_detail
set is_del=1
where id=#{appointment_id}
</update>
<!--获取我的当前预约-->
<select id="getMyAppointment" resultType="com.haitongauto.models.pojo.Appointment">
select *
from applet_appointment
where is_del=0
and users_id=#{users_id}
and appointment_state &lt;= 3
order by create_time desc
limit 1
</select>
<!--模糊查询(船名、航次),返回符合条件的预约记录明细Id列表-->
<select id="getAppointmentDetailListForKeyWords" resultType="String">
select
appointment_id
from applet_appointment_detail
where is_del=0
<if test="keywords!=null and keywords!=''">
and (ship_name like concat('%',#{keywords},'%') or voy_number like concat('%',#{keywords},'%'))
</if>
order by create_time desc
</select>
<!--查询指定用户和指定车辆是否存在已预约但未完成预约信息 (备注appointment_state: 1-已预约2-已签到3-已进港5-操作中6-已完成7-已出港4-已取消9-异常)数据-->
<select id="getActiveAppointmentByUserAndTruck" resultType="com.haitongauto.models.pojo.Appointment">
select *
from applet_appointment
where is_del=0
and appointment_state &lt;&gt; 4
and appointment_state &lt; 6
and users_id=#{users_id}
and truck_number=#{truck_number}
order by create_time desc
limit 1
</select>
<!-- 用户id(必要条件), 模糊查询(板车号),预约进场日期,等条件的 预约信息-->
<select id="getAppointmentListForCondition" resultType="com.haitongauto.models.pojo.Appointment">
select *
from applet_appointment
where is_del=0
and users_id=#{users_id}
<if test="keywords!=null and keywords!=''">
and (truck_number like concat('%',#{keywords},'%') or id_code like concat('%',#{keywords},'%'))
</if>
<if test="approach_date!=null and approach_date!=''">
and to_char(approach_date,'YYYY-MM-DD') = #{approach_date}
</if>
order by create_time desc
</select>
</mapper>