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

144 lines
5.1 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.client.PunchClockExtendMapper">
<!--//根据预约Id获取获取打卡记录-->
<select id="getPunchClockForAppintementId" resultType="com.haitongauto.models.pojo.PunchClock">
select
id,
users_id,
appointment_id,
biz_type,
queue_number,
start_time,
over_time,
port_area_id,
punch_address,
over_address,
punch_clock_type,
punch_clock_poi,
create_time,
update_time,
is_del
from applet_punch_clock
where is_del=0 and appointment_id=#{appointment_id}
order by id desc
limit 1
</select>
<!--//获取指定日期的最后一个签到打卡编号-->
<select id="getLastQueueNumber" resultType="String">
select
queue_number
from applet_punch_clock
where is_del=0
and start_time &lt;= #{date}
and port_area_id = #{port_area_id}
order by create_time desc
limit 1
</select>
<!--//查询某一天(指定日期)里的打卡记录-->
<select id="getPunchClockForDate" resultType="com.haitongauto.models.pojo.PunchClock">
select
applet_punch_clock.id,
applet_punch_clock.users_id,
applet_punch_clock.appointment_id,
applet_punch_clock.biz_type,
applet_punch_clock.queue_number,
applet_punch_clock.start_time,
applet_punch_clock.over_time,
applet_punch_clock.port_area_id,
applet_punch_clock.punch_address,
applet_punch_clock.over_address,
applet_punch_clock.punch_clock_type,
applet_punch_clock.punch_clock_poi,
applet_punch_clock.create_time,
applet_punch_clock.update_time,
applet_punch_clock.is_del
from applet_punch_clock
where applet_punch_clock.is_del=0
and applet_punch_clock.users_id=#{users_id}
and to_char(applet_punch_clock.start_time,'YYYY-MM-DD') = #{date}
order by applet_punch_clock.create_time desc
</select>
<!--//查询指定司机某年某月的打卡记录-->
<select id="getPunchClockForYM" resultType="com.haitongauto.models.pojo.PunchClock">
select
applet_punch_clock.id,
applet_punch_clock.users_id,
applet_punch_clock.appointment_id,
applet_punch_clock.biz_type,
applet_punch_clock.queue_number,
applet_punch_clock.start_time,
applet_punch_clock.over_time,
applet_punch_clock.port_area_id,
applet_punch_clock.punch_address,
applet_punch_clock.over_address,
applet_punch_clock.punch_clock_type,
applet_punch_clock.punch_clock_poi,
applet_punch_clock.create_time,
applet_punch_clock.update_time,
applet_punch_clock.is_del
from applet_punch_clock
where applet_punch_clock.is_del=0
and applet_punch_clock.users_id=#{users_id}
<if test="year!=null">
and EXTRACT(YEAR FROM applet_punch_clock.start_time) = #{year}
</if>
<if test="month!=null">
and EXTRACT(MONTH FROM applet_punch_clock.start_time)=#{month}
</if>
order by applet_punch_clock.create_time asc
</select>
<!-- <select id="getPunchClockForYM" resultType="com.haitongauto.models.pojo.PunchClock">-->
<!-- select-->
<!-- id,-->
<!-- users_id,-->
<!-- appointment_id,-->
<!-- biz_type,-->
<!-- queue_number,-->
<!-- start_time,-->
<!-- over_time,-->
<!-- port_area_id,-->
<!-- punch_address,-->
<!-- over_address,-->
<!-- punch_clock_type,-->
<!-- punch_clock_poi,-->
<!-- create_time,-->
<!-- update_time,-->
<!-- is_del-->
<!-- from applet_punch_clock-->
<!-- where is_del=0 and users_id=#{users_id}-->
<!-- order by create_time asc-->
<!-- </select>-->
<!--//获取指定预约的签到打卡排队序号-->
<select id="getQueueNumberForIdDate" resultType="String">
select
queue_number
from applet_punch_clock
where is_del=0 and appointment_id=#{appointment_id}
order by create_time desc
limit 1
</select>
<!--//获取当前排队前面还剩多少车辆未进港,当天前面的未进港也算未进港的-->
<select id="getNumberBeforeMe" resultType="Integer">
select
count(*)
from applet_punch_clock join applet_appointment on applet_punch_clock.appointment_id = applet_appointment.id
where applet_punch_clock.is_del=0
<!-- and to_char(applet_punch_clock.start_time,'yyyy-mm-dd')=#{approach_date}-->
and applet_punch_clock.port_area_id=#{port_area_id}
and applet_punch_clock.punch_clock_type &lt; 2
<!-- and applet_punch_clock.punch_clock_type &lt; 1-->
and CAST(applet_punch_clock.queue_number AS bigint) &lt;CAST(#{queue_number} AS bigint)
and applet_appointment.appointment_state &lt;&gt; 4
</select>
</mapper>