2023-09-24 18:35:52 +08:00
<?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.yanzhu.jh.project.mapper.SurProjectAttendanceUserMapper" >
<resultMap type= "SurProjectAttendanceUser" id= "SurProjectAttendanceUserResult" >
<result property= "id" column= "id" />
2023-09-25 00:32:36 +08:00
<result property= "cfgid" column= "cfgid" />
2024-01-13 19:53:12 +08:00
<result property= "appId" column= "app_id" />
2023-09-25 00:32:36 +08:00
<result property= "vendorsCode" column= "vendors_code" />
2023-09-24 18:35:52 +08:00
<result property= "workerId" column= "workerId" />
<result property= "laborWorkerId" column= "laborWorkerId" />
<result property= "workerCategory" column= "workerCategory" />
<result property= "qrCode" column= "qrCode" />
<result property= "name" column= "name" />
<result property= "ethnic" column= "ethnic" />
<result property= "nativePlace" column= "nativePlace" />
<result property= "gender" column= "gender" />
<result property= "birthDate" column= "birthDate" />
<result property= "phone" column= "phone" />
<result property= "degreeName" column= "degreeName" />
<result property= "photo" column= "photo" />
<result property= "recentPhoto" column= "recentPhoto" />
<result property= "groupId" column= "groupId" />
<result property= "groupName" column= "groupName" />
<result property= "leader" column= "leader" />
<result property= "workTypeCode" column= "workTypeCode" />
<result property= "workTypeName" column= "workTypeName" />
<result property= "specWorkType" column= "specWorkType" />
<result property= "hatCode" column= "hatCode" />
<result property= "state" column= "state" />
<result property= "enterDate" column= "enterDate" />
<result property= "exitDate" column= "exitDate" />
<result property= "companyId" column= "companyId" />
<result property= "companyName" column= "companyName" />
<result property= "vendorId" column= "vendorId" />
<result property= "teamId" column= "teamId" />
<result property= "teamName" column= "teamName" />
<result property= "enterType" column= "enterType" />
<result property= "other" column= "other" />
<result property= "remark" column= "remark" />
<result property= "isDel" column= "is_del" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
2023-09-29 00:24:15 +08:00
<result property= "projectId" column= "project_id" />
<result property= "subDeptId" column= "sub_dept_id" />
2024-03-23 02:29:43 +08:00
<result property= "companyTypeId" column= "companyTypeId" />
2023-09-24 18:35:52 +08:00
</resultMap>
<sql id= "selectSurProjectAttendanceUserVo" >
2023-09-29 00:24:15 +08:00
SELECT * FROM (
SELECT a.*,b.project_id,b.sub_dept_id
FROM sur_project_attendance_user a,sur_project_attendance_cfg b
WHERE a.cfgid=b.id )
sur_project_attendance_user
2023-09-24 18:35:52 +08:00
</sql>
<select id= "selectSurProjectAttendanceUserList" parameterType= "SurProjectAttendanceUser" resultMap= "SurProjectAttendanceUserResult" >
<include refid= "selectSurProjectAttendanceUserVo" />
<where >
2023-09-25 00:32:36 +08:00
<if test= "cfgid != null " > and cfgid = #{cfgid}</if>
2024-01-13 19:53:12 +08:00
<if test= "appId != null " > and app_id = #{appId}</if>
2023-09-25 00:32:36 +08:00
<if test= "vendorsCode != null and vendorsCode != ''" > and vendors_code = #{vendorsCode}</if>
2023-09-24 18:35:52 +08:00
<if test= "workerId != null " > and workerId = #{workerId}</if>
<if test= "laborWorkerId != null " > and laborWorkerId = #{laborWorkerId}</if>
<if test= "workerCategory != null " > and workerCategory = #{workerCategory}</if>
<if test= "qrCode != null " > and qrCode = #{qrCode}</if>
<if test= "name != null and name != ''" > and name like concat('%', #{name}, '%')</if>
<if test= "ethnic != null and ethnic != ''" > and ethnic = #{ethnic}</if>
<if test= "nativePlace != null and nativePlace != ''" > and nativePlace = #{nativePlace}</if>
<if test= "gender != null " > and gender = #{gender}</if>
<if test= "birthDate != null " > and birthDate = #{birthDate}</if>
<if test= "phone != null and phone != ''" > and phone = #{phone}</if>
<if test= "degreeName != null and degreeName != ''" > and degreeName like concat('%', #{degreeName}, '%')</if>
<if test= "photo != null and photo != ''" > and photo = #{photo}</if>
<if test= "recentPhoto != null and recentPhoto != ''" > and recentPhoto = #{recentPhoto}</if>
<if test= "groupId != null " > and groupId = #{groupId}</if>
<if test= "groupName != null and groupName != ''" > and groupName like concat('%', #{groupName}, '%')</if>
<if test= "leader != null " > and leader = #{leader}</if>
<if test= "workTypeCode != null and workTypeCode != ''" > and workTypeCode = #{workTypeCode}</if>
<if test= "workTypeName != null and workTypeName != ''" > and workTypeName like concat('%', #{workTypeName}, '%')</if>
<if test= "specWorkType != null " > and specWorkType = #{specWorkType}</if>
<if test= "hatCode != null and hatCode != ''" > and hatCode = #{hatCode}</if>
<if test= "state != null " > and state = #{state}</if>
<if test= "enterDate != null and enterDate != ''" > and enterDate = #{enterDate}</if>
<if test= "exitDate != null and exitDate != ''" > and exitDate = #{exitDate}</if>
<if test= "companyId != null " > and companyId = #{companyId}</if>
<if test= "companyName != null and companyName != ''" > and companyName like concat('%', #{companyName}, '%')</if>
<if test= "vendorId != null " > and vendorId = #{vendorId}</if>
<if test= "teamId != null " > and teamId = #{teamId}</if>
<if test= "teamName != null and teamName != ''" > and teamName like concat('%', #{teamName}, '%')</if>
<if test= "enterType != null and enterType != ''" > and enterType = #{enterType}</if>
<if test= "other != null and other != ''" > and other = #{other}</if>
2023-09-29 00:24:15 +08:00
<if test= "projectId != null and projectId > 0 " > and project_id = #{projectId}</if>
<if test= "subDeptId != null and subDeptId >0 " > and sub_dept_id = #{subDeptId}</if>
2023-09-24 18:35:52 +08:00
<if test= "isDel != null " > and is_del = #{isDel}</if>
</where>
</select>
<select id= "selectSurProjectAttendanceUserById" parameterType= "Long" resultMap= "SurProjectAttendanceUserResult" >
<include refid= "selectSurProjectAttendanceUserVo" />
where id = #{id}
</select>
2024-03-23 02:29:43 +08:00
<select id= "findCurrentAttendanceUser" parameterType= "SurProjectAttendanceUser" resultType= "SurProjectAttendanceUserResult" >
select u.companyId,u.companyName,u.`name`,u.recentPhoto,u.gender,u.birthDate,u.ethnic,u.nativePlace,u.phone,
u.workTypeName,u.specWorkType,u.groupName,g.companyTypeId,u.workTypeCode
from sur_project_attendance_user u
left join sur_project_attendance_group g on u.companyId = g.companyId and g.cfgid = u.cfgid
where u.cfgid=#{cfgid} and u.workerId=#{workerId}
</select>
2023-09-24 18:35:52 +08:00
<insert id= "insertSurProjectAttendanceUser" parameterType= "SurProjectAttendanceUser" useGeneratedKeys= "true" keyProperty= "id" >
insert into sur_project_attendance_user
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
2023-09-25 00:32:36 +08:00
<if test= "cfgid != null" > cfgid,</if>
2024-01-13 19:53:12 +08:00
<if test= "appId != null" > app_id,</if>
2023-09-25 00:32:36 +08:00
<if test= "vendorsCode != null" > vendors_code,</if>
2023-09-24 18:35:52 +08:00
<if test= "workerId != null" > workerId,</if>
<if test= "laborWorkerId != null" > laborWorkerId,</if>
<if test= "workerCategory != null" > workerCategory,</if>
<if test= "qrCode != null" > qrCode,</if>
<if test= "name != null" > name,</if>
<if test= "ethnic != null" > ethnic,</if>
<if test= "nativePlace != null" > nativePlace,</if>
<if test= "gender != null" > gender,</if>
<if test= "birthDate != null" > birthDate,</if>
<if test= "phone != null and phone != ''" > phone,</if>
<if test= "degreeName != null" > degreeName,</if>
<if test= "photo != null" > photo,</if>
<if test= "recentPhoto != null" > recentPhoto,</if>
<if test= "groupId != null" > groupId,</if>
<if test= "groupName != null" > groupName,</if>
<if test= "leader != null" > leader,</if>
<if test= "workTypeCode != null" > workTypeCode,</if>
<if test= "workTypeName != null" > workTypeName,</if>
<if test= "specWorkType != null" > specWorkType,</if>
<if test= "hatCode != null" > hatCode,</if>
<if test= "state != null" > state,</if>
<if test= "enterDate != null" > enterDate,</if>
<if test= "exitDate != null" > exitDate,</if>
<if test= "companyId != null" > companyId,</if>
<if test= "companyName != null" > companyName,</if>
<if test= "vendorId != null" > vendorId,</if>
<if test= "teamId != null" > teamId,</if>
<if test= "teamName != null" > teamName,</if>
<if test= "enterType != null" > enterType,</if>
<if test= "other != null and other != ''" > other,</if>
<if test= "remark != null" > remark,</if>
<if test= "isDel != null" > is_del,</if>
<if test= "createBy != null" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
2023-09-25 00:32:36 +08:00
<if test= "cfgid != null" > #{cfgid},</if>
2024-01-13 19:53:12 +08:00
<if test= "appId != null" > #{appId},</if>
2023-09-25 00:32:36 +08:00
<if test= "vendorsCode != null" > #{vendorsCode},</if>
2023-09-24 18:35:52 +08:00
<if test= "workerId != null" > #{workerId},</if>
<if test= "laborWorkerId != null" > #{laborWorkerId},</if>
<if test= "workerCategory != null" > #{workerCategory},</if>
<if test= "qrCode != null" > #{qrCode},</if>
<if test= "name != null" > #{name},</if>
<if test= "ethnic != null" > #{ethnic},</if>
<if test= "nativePlace != null" > #{nativePlace},</if>
<if test= "gender != null" > #{gender},</if>
<if test= "birthDate != null" > #{birthDate},</if>
<if test= "phone != null and phone != ''" > #{phone},</if>
<if test= "degreeName != null" > #{degreeName},</if>
<if test= "photo != null" > #{photo},</if>
<if test= "recentPhoto != null" > #{recentPhoto},</if>
<if test= "groupId != null" > #{groupId},</if>
<if test= "groupName != null" > #{groupName},</if>
<if test= "leader != null" > #{leader},</if>
<if test= "workTypeCode != null" > #{workTypeCode},</if>
<if test= "workTypeName != null" > #{workTypeName},</if>
<if test= "specWorkType != null" > #{specWorkType},</if>
<if test= "hatCode != null" > #{hatCode},</if>
<if test= "state != null" > #{state},</if>
<if test= "enterDate != null" > #{enterDate},</if>
<if test= "exitDate != null" > #{exitDate},</if>
<if test= "companyId != null" > #{companyId},</if>
<if test= "companyName != null" > #{companyName},</if>
<if test= "vendorId != null" > #{vendorId},</if>
<if test= "teamId != null" > #{teamId},</if>
<if test= "teamName != null" > #{teamName},</if>
<if test= "enterType != null" > #{enterType},</if>
<if test= "other != null and other != ''" > #{other},</if>
<if test= "remark != null" > #{remark},</if>
<if test= "isDel != null" > #{isDel},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
</trim>
</insert>
<update id= "updateSurProjectAttendanceUser" parameterType= "SurProjectAttendanceUser" >
update sur_project_attendance_user
<trim prefix= "SET" suffixOverrides= "," >
2023-09-25 00:32:36 +08:00
<if test= "cfgid != null" > cfgid = #{cfgid},</if>
2024-01-13 19:53:12 +08:00
<if test= "appId != null" > app_id = #{appId},</if>
2023-09-25 00:32:36 +08:00
<if test= "vendorsCode != null" > vendors_code = #{vendorsCode},</if>
2023-09-24 18:35:52 +08:00
<if test= "workerId != null" > workerId = #{workerId},</if>
<if test= "laborWorkerId != null" > laborWorkerId = #{laborWorkerId},</if>
<if test= "workerCategory != null" > workerCategory = #{workerCategory},</if>
<if test= "qrCode != null" > qrCode = #{qrCode},</if>
<if test= "name != null" > name = #{name},</if>
<if test= "ethnic != null" > ethnic = #{ethnic},</if>
<if test= "nativePlace != null" > nativePlace = #{nativePlace},</if>
<if test= "gender != null" > gender = #{gender},</if>
<if test= "birthDate != null" > birthDate = #{birthDate},</if>
<if test= "phone != null and phone != ''" > phone = #{phone},</if>
<if test= "degreeName != null" > degreeName = #{degreeName},</if>
<if test= "photo != null" > photo = #{photo},</if>
<if test= "recentPhoto != null" > recentPhoto = #{recentPhoto},</if>
<if test= "groupId != null" > groupId = #{groupId},</if>
<if test= "groupName != null" > groupName = #{groupName},</if>
<if test= "leader != null" > leader = #{leader},</if>
<if test= "workTypeCode != null" > workTypeCode = #{workTypeCode},</if>
<if test= "workTypeName != null" > workTypeName = #{workTypeName},</if>
<if test= "specWorkType != null" > specWorkType = #{specWorkType},</if>
<if test= "hatCode != null" > hatCode = #{hatCode},</if>
<if test= "state != null" > state = #{state},</if>
<if test= "enterDate != null" > enterDate = #{enterDate},</if>
<if test= "exitDate != null" > exitDate = #{exitDate},</if>
<if test= "companyId != null" > companyId = #{companyId},</if>
<if test= "companyName != null" > companyName = #{companyName},</if>
<if test= "vendorId != null" > vendorId = #{vendorId},</if>
<if test= "teamId != null" > teamId = #{teamId},</if>
<if test= "teamName != null" > teamName = #{teamName},</if>
<if test= "enterType != null" > enterType = #{enterType},</if>
<if test= "other != null and other != ''" > other = #{other},</if>
<if test= "remark != null" > remark = #{remark},</if>
<if test= "isDel != null" > is_del = #{isDel},</if>
<if test= "createBy != null" > create_by = #{createBy},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
<if test= "updateBy != null" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id= "deleteSurProjectAttendanceUserById" parameterType= "Long" >
delete from sur_project_attendance_user where id = #{id}
</delete>
<delete id= "deleteSurProjectAttendanceUserByIds" parameterType= "String" >
delete from sur_project_attendance_user where id in
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
2024-01-13 19:53:12 +08:00
<delete id= "deleteSurProjectAttendanceUserByParams" parameterType= "String" >
delete from sur_project_attendance_user where CONCAT(app_id,'-',workerId) in
<foreach collection= "list" item= "item" separator= "," open= "(" close= ")" >
#{item}
</foreach>
</delete>
<insert id= "batchSurProjectAttendanceUser" >
insert into sur_project_attendance_user( id, cfgid, vendors_code, workerId, laborWorkerId, workerCategory, qrCode, name, ethnic, nativePlace, gender, birthDate, phone, degreeName, photo, recentPhoto, groupId, groupName, leader, workTypeCode, workTypeName, specWorkType, hatCode, state, enterDate, exitDate, companyId, companyName, vendorId, teamId, teamName, enterType, other, remark, is_del, create_by, create_time, update_by, update_time) values
<foreach item= "item" index= "index" collection= "list" separator= "," >
( #{item.id}, #{item.cfgid}, #{item.vendorsCode}, #{item.workerId}, #{item.laborWorkerId}, #{item.workerCategory}, #{item.qrCode}, #{item.name}, #{item.ethnic}, #{item.nativePlace}, #{item.gender}, #{item.birthDate}, #{item.phone}, #{item.degreeName}, #{item.photo}, #{item.recentPhoto}, #{item.groupId}, #{item.groupName}, #{item.leader}, #{item.workTypeCode}, #{item.workTypeName}, #{item.specWorkType}, #{item.hatCode}, #{item.state}, #{item.enterDate}, #{item.exitDate}, #{item.companyId}, #{item.companyName}, #{item.vendorId}, #{item.teamId}, #{item.teamName}, #{item.enterType}, #{item.other}, #{item.remark}, #{item.isDel}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
2023-09-26 00:01:20 +08:00
<sql id= "sqlAttendanceData" >
(
SELECT * FROM sur_project_attendance_data WHERE DATE(attendance_time)=date(#{createBy}) AND cfgid IN (
2024-01-13 00:03:25 +08:00
SELECT id FROM sur_project_attendance_cfg WHERE project_id=#{projectId} AND sub_dept_id=#{subDeptId}
2023-09-26 00:01:20 +08:00
) ) xx
</sql>
<select id= "queryAttendanceData" parameterType= "SurProjectAttendanceCfg" resultMap= "SurProjectAttendanceUserResult" >
2023-09-27 00:09:47 +08:00
select * from (
2023-09-26 00:01:20 +08:00
select n.*,m.inTime,m.outTime from (
SELECT * FROM (
SELECT workerId,attendance_time inTime,null outtime FROM sur_project_attendance_data WHERE id IN (
SELECT min(id) id FROM <include refid= "sqlAttendanceData" /> WHERE attendance_type='e' GROUP BY workerId )) X WHERE workerId NOT IN (
SELECT workerId FROM <include refid= "sqlAttendanceData" /> WHERE attendance_type='l' GROUP BY workerId
)
union
select * from (
select workerId,null inTime,attendance_time outTime from sur_project_attendance_data where id in (
select max(id) id from <include refid= "sqlAttendanceData" /> where attendance_type='l' group by workerId )) x where workerId not in (
SELECT workerId FROM <include refid= "sqlAttendanceData" /> WHERE attendance_type='e' GROUP BY workerId
)
union
select x.workerId,y.attendance_time inTime,x.attendance_time outTime from (
SELECT id,workerId,attendance_time FROM sur_project_attendance_data WHERE id IN (
SELECT MAX(id) id FROM <include refid= "sqlAttendanceData" /> WHERE attendance_type='l' GROUP BY workerId )
) x cross join (
SELECT id,workerId,attendance_time FROM sur_project_attendance_data WHERE id IN (
SELECT MIN(id) id FROM <include refid= "sqlAttendanceData" /> WHERE attendance_type='e' GROUP BY workerId )
) y on x.workerId=y.workerId
) m left join sur_project_attendance_user n on m.workerId=n.workerId
2023-09-27 00:09:47 +08:00
) oo
2023-09-26 00:01:20 +08:00
</select>
2024-02-01 23:05:24 +08:00
<select id= "countAttendance" resultType= "Long" parameterType= "SurProjectAttendanceCfg" >
select count(1) cnt from sur_project_attendance_user u, sur_project_attendance_cfg c,view_sur_project_attendance_group g
where u.cfgid=c.id and u.state=0 and u.companyId=g.companyId
and u.workerid in(
SELECT workerid FROM sur_project_attendance_data WHERE DATE(attendance_time)=date(#{createBy}) AND cfgid IN (
SELECT id FROM sur_project_attendance_cfg WHERE project_id=#{projectId} AND sub_dept_id=#{subDeptId}
2024-03-01 23:34:15 +08:00
) group by workerid
2024-02-01 23:05:24 +08:00
)
</select>
<select id= "queryAttendanceByUserIds" parameterType= "SurProjectAttendanceUser" resultMap= "SurProjectAttendanceUserResult" >
2024-03-01 23:34:15 +08:00
select workerid,attendance_type name,min(attendance_time) inTime,max(attendance_time) outTime from sur_project_attendance_data
2024-02-01 23:05:24 +08:00
where DATE(attendance_time)=date(#{createBy})
<if test= "workerIds !=null and workerIds.size()>0" >
and workerid in
<foreach collection= "workerIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
group by workerid,attendance_type
</select>
<select id= "queryAttendanceUsers" parameterType= "SurProjectAttendanceUser" resultMap= "SurProjectAttendanceUserResult" >
select u.* from sur_project_attendance_user u, sur_project_attendance_cfg c,view_sur_project_attendance_group g
where u.cfgid=c.id and u.state=0 and u.companyId=g.companyId
and u.workerid in(
SELECT workerid FROM sur_project_attendance_data WHERE DATE(attendance_time)=date(#{createBy}) AND cfgid IN (
SELECT id FROM sur_project_attendance_cfg WHERE project_id=#{projectId} AND sub_dept_id=#{subDeptId}
2024-03-01 23:34:15 +08:00
) group by workerid
2024-02-01 23:05:24 +08:00
)
order by u.id limit #{index},#{size}
</select>
2024-03-01 23:34:15 +08:00
2023-09-30 23:03:37 +08:00
<select id= "countTodayAttendance" resultType= "Long" parameterType= "SurProjectAttendanceUser" >
2024-01-25 22:51:56 +08:00
select count(1) cnt from sur_project_attendance_user u, sur_project_attendance_cfg c,view_sur_project_attendance_group g
2023-09-30 23:03:37 +08:00
where u.cfgid=c.id and u.state=0 and u.companyId=g.companyId
2024-01-26 22:45:20 +08:00
and u.workerid in(
2024-03-01 23:34:15 +08:00
SELECT workerid FROM sur_project_attendance_data WHERE DATE(attendance_time)=CURDATE() group by workerid
2024-01-26 22:45:20 +08:00
)
2023-09-30 23:03:37 +08:00
<if test= "id==1" >
2024-03-01 23:34:15 +08:00
and g.companyTypeId in (1,6)
2023-09-30 23:03:37 +08:00
</if>
<if test= "id==2" >
2024-03-01 23:34:15 +08:00
and g.companyTypeId in (2,3,4,5)
2023-09-30 23:03:37 +08:00
</if>
<if test= "id==8" >
and g.companyTypeId =8
</if>
<if test= "projectId!=null and projectId>0" >
and c.project_id=#{projectId}
</if>
<if test= "deptId!=null and deptId>0" >
and c.project_id in (SELECT id FROM sur_project WHERE deptid=#{deptId})
</if>
2023-10-11 23:24:45 +08:00
<if test= "prjIds !=null and prjIds.size()>0" >
and c.project_id in
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
2023-09-30 23:03:37 +08:00
</select>
2024-01-26 22:45:20 +08:00
<select id= "todayAttendanceOld" parameterType= "SurProjectAttendanceUser" resultMap= "SurProjectAttendanceUserResult" >
2023-09-30 23:03:37 +08:00
select a.* ,
2024-01-14 22:03:38 +08:00
(select min(attendance_time) from sur_project_attendance_data b where b.workerId=a.workerId and date(b.attendance_time)=CURDATE() and b.attendance_type='e') inTime,
(SELECT Max(attendance_time) FROM sur_project_attendance_data b WHERE b.workerId=a.workerId AND DATE(b.attendance_time)=CURDATE() AND b.attendance_type='l') outTime
2023-09-30 23:03:37 +08:00
from (
2024-01-25 22:51:56 +08:00
select u.* from sur_project_attendance_user u, sur_project_attendance_cfg c,view_sur_project_attendance_group g
2023-09-30 23:03:37 +08:00
where u.cfgid=c.id and u.state=0 and u.companyId=g.companyId
2024-01-26 22:45:20 +08:00
and u.workerid in(
SELECT workerid FROM sur_project_attendance_data WHERE DATE(attendance_time)=CURDATE()
)
2023-09-30 23:03:37 +08:00
<if test= "id==1" >
2024-01-25 22:51:56 +08:00
and g.companyTypeId in (1,6)
2023-09-30 23:03:37 +08:00
</if>
<if test= "id==2" >
2024-01-25 22:51:56 +08:00
and g.companyTypeId in (2,3,4,5)
2023-09-30 23:03:37 +08:00
</if>
<if test= "id==8" >
and g.companyTypeId =8
</if>
<if test= "projectId!=null and projectId>0" >
and c.project_id=#{projectId}
</if>
<if test= "deptId!=null and deptId>0" >
and c.project_id in (SELECT id FROM sur_project WHERE deptid=#{deptId})
</if>
2023-10-11 23:24:45 +08:00
<if test= "prjIds !=null and prjIds.size()>0" >
and c.project_id in
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
2023-09-30 23:03:37 +08:00
order by u.id limit #{index},#{size} ) a
</select>
2024-01-26 22:45:20 +08:00
<select id= "todayAttendance" parameterType= "SurProjectAttendanceUser" resultMap= "SurProjectAttendanceUserResult" >
select u.* from sur_project_attendance_user u, sur_project_attendance_cfg c,view_sur_project_attendance_group g
where u.cfgid=c.id and u.state=0 and u.companyId=g.companyId
and u.workerid in(
2024-03-01 23:34:15 +08:00
SELECT workerid FROM sur_project_attendance_data WHERE DATE(attendance_time)=CURDATE() group by workerid
2024-01-26 22:45:20 +08:00
)
<if test= "id==1" >
and g.companyTypeId in (1,6)
</if>
<if test= "id==2" >
and g.companyTypeId in (2,3,4,5)
</if>
<if test= "id==8" >
and g.companyTypeId =8
</if>
<if test= "projectId!=null and projectId>0" >
and c.project_id=#{projectId}
</if>
<if test= "deptId!=null and deptId>0" >
and c.project_id in (SELECT id FROM sur_project WHERE deptid=#{deptId})
</if>
<if test= "prjIds !=null and prjIds.size()>0" >
and c.project_id in
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
order by u.id limit #{index},#{size}
</select>
<select id= "todayAttendanceData" parameterType= "java.util.List" resultMap= "SurProjectAttendanceUserResult" >
2024-03-01 23:34:15 +08:00
select workerid,attendance_type name,min(attendance_time) inTime,max(attendance_time) outTime from sur_project_attendance_data where DATE(attendance_time)=CURDATE()
2024-01-26 22:45:20 +08:00
<if test= "list !=null and list.size()>0" >
and workerid in
<foreach collection= "list" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
group by workerid,attendance_type
</select>
2024-03-23 00:11:43 +08:00
<select id= "todayAttendanceOtherData" parameterType= "map" resultMap= "SurProjectAttendanceUserResult" >
2024-03-23 01:02:50 +08:00
select workerid,attendance_type name,min(attendance_time) inTime,max(attendance_time) outTime from sur_project_attendance_data where cfgid=#{cfgid} and DATE(attendance_time)=#{date}
2024-03-23 00:11:43 +08:00
<if test= "list !=null and list.size()>0" >
and workerid in
<foreach collection= "list" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
group by workerid,attendance_type
</select>
2023-09-24 18:35:52 +08:00
</mapper>