rtos-mini-service4/mapper/target/classes/mappers/admin/PunchClockAdminMapper.xml

101 lines
4.3 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.admin.PunchClockAdminMapper">
<!--打卡条件查询-->
<select id="PunchClockListForCondition" resultType="com.haitongauto.models.pojo.PunchClock">
select
applet_punch_clock.id,
applet_punch_clock.users_id,
appointment_id,
applet_punch_clock.biz_type,
queue_number,
start_time,
over_time,
applet_punch_clock.port_area_id,
punch_address,
over_address,
punch_clock_type,
punch_clock_poi,
applet_punch_clock.create_time,
applet_punch_clock.update_time,
applet_punch_clock.is_del
from applet_punch_clock
join applet_appointment on applet_punch_clock.appointment_id=applet_appointment.id
join applet_users on applet_punch_clock.users_id=applet_users.id
join applet_truck on applet_punch_clock.users_id=applet_truck.users_id
where applet_punch_clock.is_del=0
<if test="users_id!=null and users_id!=''">
and applet_punch_clock.users_id=#{users_id}
</if>
<if test="port_area_id!=null and port_area_id!=''">
and applet_punch_clock.port_area_id=#{port_area_id}
</if>
<if test="biz_type!=null and biz_type!=''">
and applet_appointment.biz_type=#{biz_type}
</if>
<if test="keywords!=null and keywords!=''">
and (applet_users.users_name like concat('%',#{keywords},'%') or applet_truck.truck_number like
concat('%',#{keywords},'%') or applet_users.tel_number like concat('%',#{keywords},'%'))
</if>
<if test="approach_date_start!=null and approach_date_start!=''">
and to_char(applet_appointment.check_in_time,'yyyy-mm-dd')&gt;=#{approach_date_start}
</if>
<if test="approach_date_end!=null and approach_date_end!=''">
and to_char(applet_appointment.check_in_time,'yyyy-mm-dd')&lt;=#{approach_date_end}
</if>
<!--无条件-->
<if test="sign_in_state==null and punch_state==null">
and 0=0
</if>
<!--未完成的-->
<if test="sign_in_state==null and punch_state==0">
and applet_punch_clock.punch_clock_type &lt;4
</if>
<!--已完成的-->
<if test="sign_in_state==null and punch_state==1 ">
and applet_punch_clock.punch_clock_type &gt;=4 and over_time is not null
</if>
<!--未签到的-->
<if test="sign_in_state==0 and punch_state==null">
and (applet_punch_clock.punch_clock_type=0 or start_time is null)
</if>
<!--未签到和未完成的-->
<if test="sign_in_state==0 and punch_state==0">
and applet_punch_clock.punch_clock_type&lt;4 and start_time is null
</if>
<!--未签到和已完成的-->
<if test="sign_in_state==0 and punch_state==1 ">
and applet_punch_clock.punch_clock_type &gt;=4 and start_time is null and over_time is not null
</if>
<!--已签到的-->
<if test="sign_in_state==1 and punch_state==null ">
and applet_punch_clock.punch_clock_type&gt;=1 and start_time is not null
</if>
<!--已签到和未完成的-->
<if test="sign_in_state==1 and punch_state==0 ">
and (applet_punch_clock.punch_clock_type=1 or applet_punch_clock.punch_clock_type=2 or
applet_punch_clock.punch_clock_type=3) and start_time is not null
</if>
<!--已签到和已完成的-->
<if test="sign_in_state==1 and punch_state==1 ">
and applet_punch_clock.punch_clock_type &gt;=4 and start_time is not null and over_time is not null
</if>
order by applet_punch_clock.create_time desc
</select>
<select id="getPunchClockListExportByIds" resultType="com.haitongauto.models.pojo.PunchClock">
select *
from applet_punch_clock
where is_del=0
<if test="list!=null">
and id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
order by create_time desc
</select>
</mapper>