<?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.qianwen.smartman.modules.perf.mapper.EmployeeOnOffWorkMapper">
|
|
<select id="queryWork" resultType="com.qianwen.smartman.modules.perf.entity.EmployeeOnOffWork">
|
select *
|
from blade_employee_on_off_work beoow1
|
where beoow1.id in
|
(select max(id)
|
from blade_employee_on_off_work beoow2
|
where beoow2.workstation_id IN
|
<foreach collection="wIds" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
and beoow2.is_deleted = 0
|
<if test="onType != null">
|
and beoow2.online_type = #{onType}
|
</if>
|
group by beoow2.workstation_id)
|
</select>
|
|
<select id="willOnWork" resultType="com.qianwen.smartman.modules.smis.vo.GroupTreeVO">
|
select bw.id,
|
bw.code,
|
bw.name,
|
bw.avatar,
|
bcg.id parentId,
|
0 as isGroup
|
from blade_workstation bw
|
inner join blade_common_group_of_item bcgoi on bw.id = bcgoi.item_id
|
inner join blade_common_group bcg on bcgoi.group_id = bcg.id
|
where bw.is_deleted = 0
|
and bw.status = 1
|
and not exists(select max(beoow.id)
|
from blade_employee_on_off_work beoow
|
where beoow.workstation_id = bw.id
|
and beoow.is_deleted = 0
|
and beoow.online_type = #{onType}
|
group by beoow.workstation_id
|
)
|
</select>
|
|
<select id="willOffWork" resultType="com.qianwen.smartman.modules.perf.vo.OffEmployeeTreeVO">
|
select beoow.workstation_id as id,
|
beoow.workstation_code as code,
|
beoow.workstation_name as name,
|
bcg.id as parentId,
|
0 isGroup,
|
beoow.id as logId
|
from blade_employee_on_off_work beoow
|
inner join blade_common_group_of_item bcgoi on beoow.workstation_id = bcgoi.item_id
|
inner join blade_common_group bcg on bcgoi.group_id = bcg.id
|
where beoow.id in (select max(id)
|
from blade_employee_on_off_work beoow2
|
where beoow2.is_deleted = 0
|
and beoow2.online_type = #{onType}
|
group by beoow2.workstation_id)
|
</select>
|
|
<select id="currWorkLog" resultType="com.qianwen.smartman.modules.perf.vo.CurrWorkDetailVO">
|
select id,
|
online_time as onlineTime,
|
offline_time as offlineTime,
|
on_employee_id as employeeId,
|
on_employee_code as employeeCode,
|
on_employee_name as employeeName,
|
workstation_id as workstationId,
|
workstation_code as workstationCode,
|
workstation_name as workstationName,
|
create_time as createTime,
|
online_type as onlineType
|
from blade_employee_on_off_work
|
<if test="_databaseId == 'mysql' ">
|
where id in (select MAX(id) as id
|
from blade_employee_on_off_work
|
where is_deleted = 0
|
and workstation_id = #{workstationId}
|
group by on_employee_name)
|
order by online_time desc
|
limit 0,10;
|
</if>
|
<if test="_databaseId == 'dm' ">
|
where id in (select MAX(id) as id
|
from blade_employee_on_off_work
|
where is_deleted = 0
|
and workstation_id = #{workstationId}
|
group by on_employee_name)
|
order by online_time desc
|
limit 0,10;
|
</if>
|
<if test="_databaseId == 'oracle' ">
|
where id in (select MAX(id) as id
|
from blade_employee_on_off_work
|
where is_deleted = 0
|
and workstation_id = #{workstationId}
|
group by on_employee_name)
|
and ROWNUM <= 10
|
order by online_time desc;
|
</if>
|
</select>
|
</mapper>
|