371 lines
14 KiB
XML
371 lines
14 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.AppointmentMapper">
|
||
<!--添加数据-->
|
||
<select id="insert" parameterType="com.haitongauto.models.pojo.Appointment" resultType="String">
|
||
insert into
|
||
applet_appointment
|
||
(
|
||
id,
|
||
users_id,
|
||
transport_type,
|
||
truck_number,
|
||
tel_number,
|
||
id_code,
|
||
truck_vin,
|
||
vehicle_weight,
|
||
vehicle_frame_weight,
|
||
driving_license,
|
||
approach_date,
|
||
port_area_id,
|
||
biz_type,
|
||
enter_type,
|
||
goods_type,
|
||
goods_quantity,
|
||
appointment_state,
|
||
cancel_time,
|
||
create_time,
|
||
update_time,
|
||
appointment_type,
|
||
is_del,
|
||
yard,
|
||
gate_canal_in,
|
||
gate_canal_out,
|
||
instruct_state,
|
||
sender,
|
||
is_conventionality_in,
|
||
push_ids
|
||
)
|
||
values
|
||
(
|
||
#{id},
|
||
#{users_id},
|
||
#{transport_type},
|
||
#{truck_number},
|
||
#{tel_number},
|
||
#{id_code},
|
||
#{truck_vin},
|
||
#{vehicle_weight},
|
||
#{vehicle_frame_weight},
|
||
#{driving_license},
|
||
#{approach_date}::timestamp,
|
||
#{port_area_id},
|
||
#{biz_type},
|
||
#{enter_type},
|
||
#{goods_type},
|
||
#{goods_quantity},
|
||
#{appointment_state},
|
||
#{cancel_time}::timestamp,
|
||
#{create_time}::timestamp,
|
||
#{update_time}::timestamp,
|
||
#{appointment_type},
|
||
#{is_del},
|
||
#{yard},
|
||
#{gate_canal_in},
|
||
#{gate_canal_out},
|
||
0,
|
||
#{sender},
|
||
#{is_conventionality_in},
|
||
#{push_ids}
|
||
)
|
||
returning id
|
||
</select>
|
||
<!--软删除-->
|
||
<update id="logicDel" parameterType="String">
|
||
update applet_appointment set is_del=1 where id=#{id}
|
||
</update>
|
||
<!--硬删除-->
|
||
<delete id="delete" parameterType="String">
|
||
delete from applet_appointment where id=#{id}
|
||
</delete>
|
||
<!--数据更新-->
|
||
<update id="update" parameterType="com.haitongauto.models.pojo.Appointment">
|
||
update applet_appointment
|
||
<set>
|
||
<if test="id != null and id != ''">
|
||
id = #{id},
|
||
</if>
|
||
<if test="users_id != null and users_id != ''">
|
||
users_id = #{users_id},
|
||
</if>
|
||
<if test="transport_type != null and transport_type != ''">
|
||
transport_type = #{transport_type},
|
||
</if>
|
||
<if test="truck_number != null and truck_number != ''">
|
||
truck_number = #{truck_number},
|
||
</if>
|
||
<if test="tel_number != null and tel_number != ''">
|
||
tel_number = #{tel_number},
|
||
</if>
|
||
<if test="id_code != null and id_code != ''">
|
||
id_code = #{id_code},
|
||
</if>
|
||
<if test="truck_vin != null and truck_vin != ''">
|
||
truck_vin = #{truck_vin},
|
||
</if>
|
||
<if test="vehicle_weight != null">
|
||
vehicle_weight = #{vehicle_weight},
|
||
</if>
|
||
<if test="vehicle_frame_weight != null">
|
||
vehicle_frame_weight = #{vehicle_frame_weight},
|
||
</if>
|
||
<if test="driving_license != null and driving_license != ''">
|
||
driving_license = #{driving_license},
|
||
</if>
|
||
<if test="approach_date != null and approach_date != ''">
|
||
approach_date = #{approach_date}::date,
|
||
</if>
|
||
<if test="port_area_id != null and port_area_id != ''">
|
||
port_area_id = #{port_area_id},
|
||
</if>
|
||
<if test="biz_type != null and biz_type != ''">
|
||
biz_type = #{biz_type},
|
||
</if>
|
||
<if test="enter_type != null and enter_type != ''">
|
||
enter_type = #{enter_type},
|
||
</if>
|
||
<if test="goods_type != null and goods_type != ''">
|
||
goods_type = #{goods_type},
|
||
</if>
|
||
<if test="goods_quantity != null">
|
||
goods_quantity = #{goods_quantity},
|
||
</if>
|
||
<if test="appointment_state != null">
|
||
appointment_state = #{appointment_state},
|
||
</if>
|
||
<if test="cancel_time != null and cancel_time != ''">
|
||
cancel_time = #{cancel_time}::timestamp,
|
||
</if>
|
||
<if test="appointment_type != null">
|
||
appointment_type = #{appointment_type},
|
||
</if>
|
||
<if test="is_del != null">
|
||
is_del = #{is_del},
|
||
</if>
|
||
<if test="yard!=null and yard!=''">
|
||
yard = #{yard},
|
||
</if>
|
||
<if test="yard_name!=null and yard_name!=''">
|
||
yard_name = #{yard_name},
|
||
</if>
|
||
<if test="gate_canal_in!=null and gate_canal_in!=''">
|
||
gate_canal_in = #{gate_canal_in},
|
||
</if>
|
||
<if test="gate_canal_out!=null and gate_canal_out!=''">
|
||
gate_canal_out = #{gate_canal_out},
|
||
</if>
|
||
<if test="gate_canal_in_time!=null and gate_canal_in_time!=''">
|
||
gate_canal_in_time= #{gate_canal_in_time}::timestamp,
|
||
</if>
|
||
<if test="gate_canal_out_time!=null and gate_canal_out_time!=''">
|
||
gate_canal_out_time=#{gate_canal_out_time}::timestamp,
|
||
</if>
|
||
<if test="instruct_state!=null">
|
||
instruct_state = #{instruct_state},
|
||
</if>
|
||
<if test="send_time!=null and send_time!=''">
|
||
send_time =# {send_time}::timestamp,
|
||
</if>
|
||
<if test="sender!=null and sender!=''">
|
||
sender = #{sender},
|
||
</if>
|
||
<if test="check_in_time!=null and check_in_time!=''">
|
||
check_in_time = #{check_in_time}::timestamp,
|
||
</if>
|
||
<if test="check_over_time!=null and check_over_time!=''">
|
||
check_over_time = #{check_over_time}::timestamp,
|
||
</if>
|
||
<if test="plate_scan_time!=null and plate_scan_time!=''">
|
||
plate_scan_time = #{plate_scan_time}::timestamp,
|
||
</if>
|
||
<if test="is_conventionality_in!=null">
|
||
is_conventionality_in = #{is_conventionality_in},
|
||
</if>
|
||
<if test="push_ids!=null">
|
||
push_ids = #{push_ids},
|
||
</if>
|
||
update_time = current_timestamp
|
||
</set>
|
||
where id = #{id}
|
||
</update>
|
||
<!--指定Id的记录-->
|
||
<select id="getById" parameterType="String" resultType="com.haitongauto.models.pojo.Appointment">
|
||
select *
|
||
from applet_appointment
|
||
where id = #{id}
|
||
and is_del=0
|
||
limit 1
|
||
</select>
|
||
<!--数据列表-->
|
||
<select id="getList" resultType="com.haitongauto.models.pojo.Appointment">
|
||
select *
|
||
from applet_appointment
|
||
where is_del=0
|
||
order by create_time desc
|
||
</select>
|
||
|
||
<!--根据拖车号数据列表 预约打卡状态(1-已预约,2-已签到,3-已进港,5-操作中,6-已完成,7-已离港,4-已取消,9-异常:预期未完成操作的)-->
|
||
<select id="getListByTruckName" 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!=4
|
||
and appointment_state!=6
|
||
and appointment_state!=7
|
||
and appointment_state!=9
|
||
order by create_time desc
|
||
</select>
|
||
|
||
<!--根据拖车号数据列表 预约打卡状态(1-已预约,2-已签到,3-已进港,5-操作中,6-已完成,7-已离港,4-已取消,9-异常:预期未完成操作的)-->
|
||
<select id="getAppointmentByUserIdAndPortAreaIdAndApproachDate"
|
||
resultType="com.haitongauto.models.pojo.Appointment">
|
||
select *
|
||
from applet_appointment
|
||
where is_del=0
|
||
and users_id=#{users_id}
|
||
and port_area_id=#{port_area_id}
|
||
and approach_date >= #{approach_date}::date
|
||
and appointment_state < 7
|
||
and appointment_state != 4
|
||
order by create_time desc
|
||
limit 1
|
||
</select>
|
||
|
||
<!--根据拖车号数据列表 预约打卡状态(1-已预约,2-已签到,3-已进港,5-操作中,6-已完成,7-已离港,4-已取消,9-异常:预期未完成操作的)-->
|
||
<select id="getAppointmentListByCondition" resultType="com.haitongauto.models.pojo.Appointment">
|
||
select *
|
||
from applet_appointment
|
||
where is_del=0
|
||
<if test="truck_number!=null and truck_number!=''">
|
||
and truck_number=#{truck_number}
|
||
</if>
|
||
<if test="ship_id!=null and ship_id!=''">
|
||
and id in (select distinct appointment_id from applet_appointment_detail where ship_id= #{ship_id})
|
||
</if>
|
||
<if test="instruct_state!=null and instruct_state!=''">
|
||
and instruct_state=#{instruct_state}
|
||
</if>
|
||
<!-- <if test="brand_name!=null and brand_name!=''">-->
|
||
<!-- and id in (select distinct appointment_id from applet_appointment_detail where brand_name= #{brand_name})-->
|
||
<!-- </if>-->
|
||
order by create_time desc
|
||
</select>
|
||
|
||
<select id="getAppointmentByIds" resultType="com.haitongauto.models.pojo.Appointment">
|
||
select *
|
||
from applet_appointment
|
||
where is_del=0
|
||
and id in
|
||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
order by create_time desc
|
||
</select>
|
||
|
||
<!--根据拖车号数据列表 预约打卡状态(1-已预约,2-已签到,3-已进港,5-操作中,6-已完成,7-已离港,4-已取消,9-异常:预期未完成操作的)-->
|
||
<select id="getAppointmentByTruckName" resultType="com.haitongauto.models.pojo.Appointment">
|
||
select *
|
||
from applet_appointment
|
||
where is_del=0
|
||
and (truck_number=#{truck_number} or id_code=#{truck_number})
|
||
order by create_time desc
|
||
limit 1
|
||
</select>
|
||
|
||
<!--修改预约指令状态-->
|
||
<update id="batchUpdateAppointmentInstructState" parameterType="java.util.List">
|
||
<foreach collection="list" item="item" open="" close="" separator=";">
|
||
update applet_appointment
|
||
<set>
|
||
<if test="item.id!=null and item.id!=''">
|
||
id = #{item.id},
|
||
</if>
|
||
<if test="item.yard!=null and item.yard!=''">
|
||
yard = #{item.yard},
|
||
</if>
|
||
<if test="item.sender!=null and item.sender!=''">
|
||
sender = #{item.sender},
|
||
</if>
|
||
<if test="item.yard_name!=null and item.yard_name!=''">
|
||
yard_name = #{item.yard_name},
|
||
</if>
|
||
<if test="item.gate_canal_in!=null and item.gate_canal_in!=''">
|
||
gate_canal_in = #{item.gate_canal_in},
|
||
</if>
|
||
<if test="item.instruct_state!=null">
|
||
instruct_state = #{item.instruct_state},
|
||
</if>
|
||
send_time =current_timestamp,
|
||
update_time = current_timestamp
|
||
</set>
|
||
where id = #{item.id}
|
||
</foreach>
|
||
</update>
|
||
|
||
<!--修改预约指令状态-->
|
||
<update id="updateAppointmentPlateScanTime">
|
||
update applet_appointment
|
||
<set>
|
||
plate_scan_time = current_timestamp
|
||
</set>
|
||
where id = #{appointment_id}
|
||
</update>
|
||
|
||
<!--板车监控-->
|
||
<select id="getAppointmentListByConditionf" resultType="com.haitongauto.models.pojo.Appointment">
|
||
select DISTINCT t1.*
|
||
from applet_appointment t1 join applet_appointment_detail t2
|
||
on t1.id=t2.appointment_id
|
||
where t1.is_del=0
|
||
and t1.create_time >= #{startDate}
|
||
and t1.create_time <= #{endDate}
|
||
and t1.port_area_id= #{portAreaId}
|
||
<if test="truckNumber!=null and truckNumber!=''">
|
||
and t1.truck_number like concat('%',#{truckNumber},'%')
|
||
</if>
|
||
<if test="instructState!=null">
|
||
and t1.instruct_state= #{instructState}
|
||
</if>
|
||
<if test="shipId!=null and shipId!=''">
|
||
and t2.ship_id =#{shipId})
|
||
</if>
|
||
<if test="brandId!=null and brandId!=''">
|
||
and t2.brand_id =#{brandId})
|
||
</if>
|
||
order by t1.create_time desc
|
||
</select>
|
||
|
||
<!--数据列表-->
|
||
<select id="getIdListNoInEn" resultType="String">
|
||
select id from applet_appointment
|
||
where is_del=0
|
||
and appointment_state<>4
|
||
and appointment_state<>9
|
||
and appointment_state<6
|
||
and port_area_id=#{port_area_id}
|
||
</select>
|
||
<select id="getIdListNoInEnNew" resultType="String">
|
||
select id from applet_appointment
|
||
where is_del=0
|
||
and appointment_state<>4
|
||
and appointment_state<>9
|
||
and appointment_state<6
|
||
</select>
|
||
|
||
<select id="getAppointmentByVin" resultType="com.haitongauto.models.pojo.Appointment"></select>
|
||
<select id="getAppointmentByTruckNoForOutGate" 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=6 and appointment_state=7)
|
||
order by create_time desc
|
||
limit 1
|
||
</select>
|
||
|
||
</mapper>
|
||
|