|
|
|
@ -24,28 +24,78 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectMesAttendanceRecordsVo">
|
|
|
|
|
select id, user_id, user_name, attendance_status, sex, age, id_number, start_time, start_addr, end_time, end_addr, attendance_time, attendance_date, work_hours, create_time, post
|
|
|
|
|
from mes_attendance_records
|
|
|
|
|
-- select id, user_id, user_name, attendance_status, sex, age, id_number, start_time, start_addr, end_time, end_addr, attendance_time, attendance_date, work_hours, create_time, post
|
|
|
|
|
-- from mes_attendance_records
|
|
|
|
|
-- SELECT
|
|
|
|
|
-- id,
|
|
|
|
|
-- user_id,
|
|
|
|
|
-- user_name,
|
|
|
|
|
-- attendance_status,
|
|
|
|
|
-- start_time,
|
|
|
|
|
-- post
|
|
|
|
|
-- FROM
|
|
|
|
|
-- mes_attendance_records UNION
|
|
|
|
|
-- SELECT
|
|
|
|
|
-- null AS id,
|
|
|
|
|
-- workno AS user_id,
|
|
|
|
|
-- name AS user_name,
|
|
|
|
|
-- NULL as attendance_status,
|
|
|
|
|
-- clock_time AS startTime,
|
|
|
|
|
-- NULL AS post
|
|
|
|
|
--
|
|
|
|
|
-- FROM
|
|
|
|
|
-- mes_clock_record
|
|
|
|
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectMesAttendanceRecordsList" parameterType="MesAttendanceRecords" resultMap="MesAttendanceRecordsResult">
|
|
|
|
|
<include refid="selectMesAttendanceRecordsVo"/>
|
|
|
|
|
( SELECT id, user_id, user_name, attendance_status, start_time, post FROM mes_attendance_records
|
|
|
|
|
<where>
|
|
|
|
|
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
|
|
|
|
|
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
|
|
|
|
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%') </if>
|
|
|
|
|
<if test="attendanceStatus != null and attendanceStatus != ''"> and attendance_status = #{attendanceStatus}</if>
|
|
|
|
|
<if test="startTime != null "> and start_time = #{startTime}</if>
|
|
|
|
|
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
|
|
|
|
|
and start_time between #{params.beginTime} and #{params.endTime}
|
|
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
<!-- <if test="startTime != null "> and start_time = #{startTime}</if>-->
|
|
|
|
|
<if test="attendanceTime != null and attendanceTime != ''"> and attendance_time = #{attendanceTime}</if>
|
|
|
|
|
<if test="post != null and post != ''"> and post = #{post}</if>
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY attendance_date DESC, start_addr ASC;
|
|
|
|
|
)
|
|
|
|
|
UNION ALL
|
|
|
|
|
( SELECT NULL AS id, workno AS user_id, name AS user_name, NULL AS attendance_status, clock_time AS start_time, NULL AS post
|
|
|
|
|
FROM mes_clock_record
|
|
|
|
|
<where>
|
|
|
|
|
<if test="userId != null and userId != ''"> and workno = #{userId}</if>
|
|
|
|
|
<if test="userName != null and userName != ''"> and name like concat('%', #{userName}, '%') </if>
|
|
|
|
|
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
|
|
|
|
|
and clock_time between #{params.beginTime} and #{params.endTime}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectMesAttendanceRecordsById" parameterType="String" resultMap="MesAttendanceRecordsResult">
|
|
|
|
|
<include refid="selectMesAttendanceRecordsVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectMesClockRecord" parameterType="MesAttendanceRecords" resultMap="MesAttendanceRecordsResult">
|
|
|
|
|
SELECT
|
|
|
|
|
clock_time AS start_time,
|
|
|
|
|
workno AS user_id,
|
|
|
|
|
name AS user_name
|
|
|
|
|
FROM
|
|
|
|
|
mes_clock_record
|
|
|
|
|
<where>
|
|
|
|
|
<if test="userId != null and userId != ''"> and workno = #{userId}</if>
|
|
|
|
|
<if test="userName != null and userName != ''"> and name like concat('%', #{userName}, '%')</if>
|
|
|
|
|
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
|
|
|
|
|
and clock_time between #{params.beginTime} and #{params.endTime}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertMesAttendanceRecords" parameterType="MesAttendanceRecords">
|
|
|
|
|
insert into mes_attendance_records
|
|
|
|
|