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

139 lines
4.8 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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.PunchClockMapper">
<!--添加数据并返回Id-->
<select id="insert" parameterType="com.haitongauto.models.pojo.PunchClock" resultType="String">
insert into applet_punch_clock
(
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
)
values
(
#{id},
#{users_id},
#{appointment_id},
#{biz_type},
#{queue_number},
#{start_time}::timestamp,
#{over_time}::timestamp,
#{port_area_id},
#{punch_address},
#{over_address},
#{punch_clock_type},
#{punch_clock_poi},
#{create_time}::timestamp,
#{update_time}::timestamp,
0
)
returning id
</select>
<!--软删除-->
<update id="logicDel" parameterType="String">
update applet_punch_clock set is_del=1 where id=#{id}
</update>
<!--硬删除-->
<delete id="delete" parameterType="String">
delete from applet_punch_clock where id=#{id}
</delete>
<!--数据更新-->
<update id="update" parameterType="com.haitongauto.models.pojo.PunchClock">
update applet_punch_clock
<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="appointment_id != null and appointment_id != ''">
appointment_id = #{appointment_id},
</if>
<if test="biz_type != null">
biz_type = #{biz_type},
</if>
<if test="queue_number != null and queue_number != ''">
queue_number = #{queue_number},
</if>
<if test="start_time != null and start_time != ''">
start_time = #{start_time}::timestamp,
</if>
<if test="over_time != null and over_time != ''">
over_time = #{over_time}::timestamp,
</if>
<if test="port_area_id != null and port_area_id != ''">
port_area_id = #{port_area_id},
</if>
<if test="punch_address != null and punch_address != ''">
punch_address = #{punch_address},
</if>
<if test="over_address != null and over_address != ''">
over_address = #{over_address},
</if>
<if test="punch_clock_type != null">
punch_clock_type = #{punch_clock_type},
</if>
<if test="punch_clock_poi != null and punch_clock_poi != ''">
punch_clock_poi = #{punch_clock_poi},
</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.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 id=#{id} and is_del=0
</select>
<!--数据列表-->
<select id="getList" 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
order by create_time desc
</select>
<!--指定appointment_id的记录-->
<select id="getPunchClockByAppointmentId" parameterType="String" resultType="com.haitongauto.models.pojo.PunchClock">
select *
from applet_punch_clock
where
appointment_id=#{appointment_id}
and is_del=0
limit 1
</select>
<!--指定appointment_id的记录-->
<select id="getPunchClockByAppointmentIdList" parameterType="String" resultType="com.haitongauto.models.pojo.PunchClock">
select *
from applet_punch_clock
where is_del=0
and appointment_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>