<?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="org.jeecg.modules.mdc.mapper.MdcEquipmentPunchMapper">
|
|
<select id="list" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentPunch">
|
SELECT
|
p.id,
|
p.equipment_id,
|
p.punch_user,
|
p.check_in_time,
|
p.check_out_time,
|
p.record_date,
|
p.is_absent,
|
p.is_late,
|
p.is_early,
|
p.create_by,
|
p.create_time,
|
p.update_by,
|
p.update_time,
|
p.shift_schedule,
|
u.realname punchUserRealName,
|
u.username punchUserUserName,
|
d1.item_text shiftScheduleName
|
FROM
|
mdc_equipment_punch p
|
INNER JOIN sys_user u ON u.id = p.punch_user
|
INNER JOIN (SELECT i1.item_text, i1.item_value
|
FROM sys_dict_item i1
|
LEFT JOIN sys_dict i2 ON i2.id = i1.dict_id
|
WHERE i2.dict_code = 'shift_schedule') d1
|
ON d1.item_value = CAST (p.shift_schedule AS nvarchar)
|
where 1=1
|
AND p.equipment_id IN
|
<foreach collection="equipmentIds" item="equipmentId" open="(" close=")" separator=",">
|
#{equipmentId}
|
</foreach>
|
<if test="date != null and date != ''">
|
AND p.record_date = #{date}
|
</if>
|
order by p.equipment_id desc, p.shift_schedule asc
|
</select>
|
|
<!--查询所有设备数量-->
|
<select id="getTotalDeviceCount" resultType="int">
|
SELECT COUNT(*)
|
FROM mdc_equipment
|
</select>
|
|
<!-- 早班 上班打卡 -->
|
<select id="countMorningShiftIn" resultType="int">
|
SELECT COUNT(DISTINCT equipment_id)
|
FROM mdc_equipment_punch
|
WHERE record_date = #{date, jdbcType=VARCHAR}
|
AND shift_schedule = '1'
|
AND check_in_time IS NOT NULL
|
</select>
|
|
<!-- 晚班 上班打卡 -->
|
<select id="countEveningShiftIn" resultType="int">
|
SELECT COUNT(DISTINCT equipment_id)
|
FROM mdc_equipment_punch
|
WHERE record_date = #{date, jdbcType=VARCHAR}
|
AND shift_schedule = '2'
|
AND check_in_time IS NOT NULL
|
</select>
|
|
<!-- 早班 下班打卡 -->
|
<select id="countMorningShiftOut" resultType="int">
|
SELECT COUNT(DISTINCT equipment_id)
|
FROM mdc_equipment_punch
|
WHERE record_date = #{date, jdbcType=VARCHAR}
|
AND shift_schedule = '1'
|
AND check_out_time IS NOT NULL
|
</select>
|
|
<!-- 晚班 下班打卡 -->
|
<select id="countEveningShiftOut" resultType="int">
|
SELECT COUNT(DISTINCT equipment_id)
|
FROM mdc_equipment_punch
|
WHERE record_date = #{date, jdbcType=VARCHAR}
|
AND shift_schedule = '2'
|
AND check_out_time IS NOT NULL
|
</select>
|
|
</mapper>
|