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.SurProjectAttendanceDataMapper" >
<resultMap type= "SurProjectAttendanceData" id= "SurProjectAttendanceDataResult" >
<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" />
2024-03-22 22:44:32 +08:00
<result property= "projectId" column= "projectId" />
<result property= "projectName" column= "projectName" />
<result property= "deptId" column= "deptId" />
<result property= "deptName" column= "deptName" />
2023-09-24 18:35:52 +08:00
<result property= "vendorsCode" column= "vendors_code" />
2023-09-25 00:32:36 +08:00
<result property= "serverid" column= "serverid" />
2023-09-24 18:35:52 +08:00
<result property= "workerId" column= "workerId" />
2024-03-22 22:44:32 +08:00
<result property= "workerName" column= "workerName" />
2023-09-25 00:32:36 +08:00
<result property= "identification" column= "identification" />
2024-03-22 22:44:32 +08:00
<result property= "workerPhoto" column= "workerPhoto" />
<result property= "workerGender" column= "workerGender" />
<result property= "birthDate" column= "birthDate" />
<result property= "ethnic" column= "ethnic" />
<result property= "nativePlace" column= "nativePlace" />
<result property= "phone" column= "phone" />
<result property= "workTypeName" column= "workTypeName" />
<result property= "specWorkType" column= "specWorkType" />
<result property= "groupName" column= "groupName" />
<result property= "companyTypeId" column= "companyTypeId" />
<result property= "companyName" column= "companyName" />
<result property= "attendanceTime" column= "attendance_time" />
<result property= "attendanceOutTime" column= "attendance_out_time" />
<result property= "scanPhoto" column= "scanPhoto" />
2023-09-25 00:32:36 +08:00
<result property= "teamId" column= "teamId" />
<result property= "workTypeCode" column= "workTypeCode" />
<result property= "companyId" column= "companyId" />
<result property= "vendorId" column= "vendorId" />
2023-09-24 18:35:52 +08:00
<result property= "deviceCode" column= "device_code" />
<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" />
2024-03-22 22:44:32 +08:00
<result property= "remark" column= "remark" />
2023-09-24 18:35:52 +08:00
</resultMap>
<sql id= "selectSurProjectAttendanceDataVo" >
2024-03-23 00:57:06 +08:00
select * from sur_project_attendance_data_${year}
2023-09-24 18:35:52 +08:00
</sql>
2024-03-23 02:29:43 +08:00
<select id= "findCurrentAttendanceData" parameterType= "SurProjectAttendanceData" resultMap= "SurProjectAttendanceDataResult" >
select * from sur_project_attendance_data_${year}
<where >
<if test= "cfgid != null " > and cfgid = #{cfgid}</if>
<if test= "appId != null " > and app_id = #{appId}</if>
2024-03-28 23:20:21 +08:00
<if test= "workerId != null and workerId != ''" > and workerId = #{workerId}</if>
<if test= "attendanceTime != null and attendanceTime != ''" > and date(attendance_time) = date(#{attendanceTime})</if>
2024-03-23 02:29:43 +08:00
</where>
2024-03-28 23:29:21 +08:00
order by attendance_time desc LIMIT 1
2024-03-23 02:29:43 +08:00
</select>
2024-03-16 15:29:07 +08:00
<select id= "selectSurProjectAttendanceDataListEx" parameterType= "SurProjectAttendanceData" resultMap= "SurProjectAttendanceDataResult" >
2024-03-22 22:44:32 +08:00
select * from sur_project_attendance_data_${year}
2024-03-16 15:29:07 +08:00
<where >
<if test= "cfgid != null " > and cfgid = #{cfgid}</if>
<if test= "appId != null " > and app_id = #{appId}</if>
2024-03-23 01:27:13 +08:00
<if test= "projectId != null " > and projectId = #{projectId}</if>
<if test= "deptId != null " > and deptId = #{deptId}</if>
2024-03-16 15:29:07 +08:00
<if test= "vendorsCode != null and vendorsCode != ''" > and vendors_code = #{vendorsCode}</if>
<if test= "serverid != null " > and serverid = #{serverid}</if>
<if test= "workerId != null " > and workerId = #{workerId}</if>
2024-03-22 23:44:12 +08:00
<if test= "attendanceTime != null and attendanceTime != ''" > and date(attendance_time) = date(#{attendanceTime})</if>
2024-03-16 15:29:07 +08:00
<if test= "identification != null and identification != ''" > and identification = #{identification}</if>
<if test= "teamId != null " > and teamId = #{teamId}</if>
<if test= "workTypeCode != null and workTypeCode != ''" > and workTypeCode = #{workTypeCode}</if>
<if test= "companyId != null " > and companyId = #{companyId}</if>
2024-03-23 00:22:47 +08:00
<if test= "vendorId != null " > and vendorId = #{vendorId}</if>
2024-03-23 18:32:18 +08:00
<if test= "deviceCode != null and deviceCode != ''" > and device_code = #{deviceCode}</if>
<if test= "companyTypeId!=null" >
<if test= "companyTypeId>100" >
<if test= "companyTypeId==101" >
and companyTypeId in (1,6)
</if>
<if test= "companyTypeId==102" >
and companyTypeId =8
</if>
<if test= "companyTypeId==103" >
and companyTypeId in (0,2,3,4,5)
</if>
</if>
<if test= "companyTypeId <100" >
and companyTypeId=#{companyTypeId}
</if>
</if>
2024-03-16 15:29:07 +08:00
<if test= "scanPhoto != null and scanPhoto != ''" > and scanPhoto = #{scanPhoto}</if>
<if test= "isDel != null " > and is_del = #{isDel}</if>
</where>
2024-03-23 03:02:33 +08:00
order by attendance_time desc
2024-03-16 15:29:07 +08:00
</select>
2023-09-24 18:35:52 +08:00
<select id= "selectSurProjectAttendanceDataList" parameterType= "SurProjectAttendanceData" resultMap= "SurProjectAttendanceDataResult" >
<include refid= "selectSurProjectAttendanceDataVo" />
2024-03-16 15:29:07 +08:00
<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>
2024-03-23 01:27:13 +08:00
<if test= "projectId != null " > and projectId = #{projectId}</if>
<if test= "deptId != null " > and deptId = #{deptId}</if>
2023-09-24 18:35:52 +08:00
<if test= "vendorsCode != null and vendorsCode != ''" > and vendors_code = #{vendorsCode}</if>
2023-09-25 00:32:36 +08:00
<if test= "serverid != null " > and serverid = #{serverid}</if>
2023-09-24 18:35:52 +08:00
<if test= "workerId != null " > and workerId = #{workerId}</if>
2024-04-08 23:34:32 +08:00
<if test= "attendanceTime != null and attendanceTime != ''" > and ( date(attendance_time) =date(#{attendanceTime}) or date(attendance_out_time) =date(#{attendanceTime}))</if>
2023-09-25 00:32:36 +08:00
<if test= "identification != null and identification != ''" > and identification = #{identification}</if>
<if test= "teamId != null " > and teamId = #{teamId}</if>
<if test= "workTypeCode != null and workTypeCode != ''" > and workTypeCode = #{workTypeCode}</if>
<if test= "companyId != null " > and companyId = #{companyId}</if>
2024-03-23 18:32:18 +08:00
<if test= "companyTypeId!=null" >
<if test= "companyTypeId>100" >
<if test= "companyTypeId==101" >
and companyTypeId in (1,6)
</if>
<if test= "companyTypeId==102" >
and companyTypeId =8
</if>
<if test= "companyTypeId==103" >
and companyTypeId in (0,2,3,4,5)
</if>
</if>
<if test= "companyTypeId <100" >
and companyTypeId=#{companyTypeId}
</if>
</if>
2024-03-23 00:22:47 +08:00
<if test= "vendorId != null " > and vendorId = #{vendorId}</if>
<if test= "deviceCode != null and deviceCode != ''" > and device_code = #{deviceCode}</if>
<if test= "scanPhoto != null and scanPhoto != ''" > and scanPhoto = #{scanPhoto}</if>
2023-09-24 18:35:52 +08:00
<if test= "isDel != null " > and is_del = #{isDel}</if>
</where>
2024-03-23 03:02:33 +08:00
order by attendance_time desc
2023-09-24 18:35:52 +08:00
</select>
<select id= "selectSurProjectAttendanceDataById" parameterType= "Long" resultMap= "SurProjectAttendanceDataResult" >
<include refid= "selectSurProjectAttendanceDataVo" />
where id = #{id}
</select>
2024-03-23 00:22:47 +08:00
<insert id= "insertSurProjectAttendanceData" parameterType= "SurProjectAttendanceData" useGeneratedKeys= "true" keyProperty= "id" >
2024-03-22 22:44:32 +08:00
insert into sur_project_attendance_data_${year}
2023-09-24 18:35:52 +08:00
<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>
2024-03-22 22:44:32 +08:00
<if test= "projectId != null" > projectId,</if>
<if test= "projectName != null" > projectName,</if>
<if test= "deptId != null" > deptId,</if>
<if test= "deptName != null" > deptName,</if>
2023-09-24 18:35:52 +08:00
<if test= "vendorsCode != null" > vendors_code,</if>
2023-09-25 00:32:36 +08:00
<if test= "serverid != null" > serverid,</if>
2023-09-24 18:35:52 +08:00
<if test= "workerId != null" > workerId,</if>
2024-03-22 22:44:32 +08:00
<if test= "workerName != null" > workerName,</if>
2023-09-25 00:32:36 +08:00
<if test= "identification != null" > identification,</if>
2024-03-22 22:44:32 +08:00
<if test= "workerPhoto != null" > workerPhoto,</if>
<if test= "workerGender != null" > workerGender,</if>
<if test= "birthDate != null" > birthDate,</if>
<if test= "ethnic != null" > ethnic,</if>
<if test= "nativePlace != null" > nativePlace,</if>
<if test= "phone != null" > phone,</if>
<if test= "workTypeName != null" > workTypeName,</if>
<if test= "specWorkType != null" > specWorkType,</if>
<if test= "groupName != null" > groupName,</if>
<if test= "companyTypeId != null" > companyTypeId,</if>
<if test= "companyName != null" > companyName,</if>
<if test= "attendanceTime != null" > attendance_time,</if>
<if test= "attendanceOutTime != null" > attendance_out_time,</if>
<if test= "scanPhoto != null" > scanPhoto,</if>
2023-09-25 00:32:36 +08:00
<if test= "teamId != null" > teamId,</if>
<if test= "workTypeCode != null" > workTypeCode,</if>
<if test= "companyId != null" > companyId,</if>
<if test= "vendorId != null" > vendorId,</if>
2023-09-24 18:35:52 +08:00
<if test= "deviceCode != null" > device_code,</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>
2024-03-22 22:44:32 +08:00
<if test= "remark != null" > remark,</if>
2023-09-24 18:35:52 +08:00
</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>
2024-03-22 22:44:32 +08:00
<if test= "projectId != null" > #{projectId},</if>
<if test= "projectName != null" > #{projectName},</if>
<if test= "deptId != null" > #{deptId},</if>
<if test= "deptName != null" > #{deptName},</if>
2023-09-24 18:35:52 +08:00
<if test= "vendorsCode != null" > #{vendorsCode},</if>
2023-09-25 00:32:36 +08:00
<if test= "serverid != null" > #{serverid},</if>
2023-09-24 18:35:52 +08:00
<if test= "workerId != null" > #{workerId},</if>
2024-03-22 22:44:32 +08:00
<if test= "workerName != null" > #{workerName},</if>
2023-09-25 00:32:36 +08:00
<if test= "identification != null" > #{identification},</if>
2024-03-22 22:44:32 +08:00
<if test= "workerPhoto != null" > #{workerPhoto},</if>
<if test= "workerGender != null" > #{workerGender},</if>
<if test= "birthDate != null" > #{birthDate},</if>
<if test= "ethnic != null" > #{ethnic},</if>
<if test= "nativePlace != null" > #{nativePlace},</if>
<if test= "phone != null" > #{phone},</if>
<if test= "workTypeName != null" > #{workTypeName},</if>
<if test= "specWorkType != null" > #{specWorkType},</if>
<if test= "groupName != null" > #{groupName},</if>
<if test= "companyTypeId != null" > #{companyTypeId},</if>
<if test= "companyName != null" > #{companyName},</if>
<if test= "attendanceTime != null" > #{attendanceTime},</if>
<if test= "attendanceOutTime != null" > #{attendanceOutTime},</if>
<if test= "scanPhoto != null" > #{scanPhoto},</if>
2023-09-25 00:32:36 +08:00
<if test= "teamId != null" > #{teamId},</if>
<if test= "workTypeCode != null" > #{workTypeCode},</if>
<if test= "companyId != null" > #{companyId},</if>
<if test= "vendorId != null" > #{vendorId},</if>
2023-09-24 18:35:52 +08:00
<if test= "deviceCode != null" > #{deviceCode},</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>
2024-03-22 22:44:32 +08:00
<if test= "remark != null" > #{remark},</if>
2023-09-24 18:35:52 +08:00
</trim>
</insert>
2024-03-23 00:22:47 +08:00
<update id= "updateSurProjectAttendanceData" parameterType= "SurProjectAttendanceData" >
2024-03-22 22:44:32 +08:00
update sur_project_attendance_data_${year}
2023-09-24 18:35:52 +08:00
<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>
2024-03-22 22:44:32 +08:00
<if test= "projectId != null" > projectId = #{projectId},</if>
<if test= "projectName != null" > projectName = #{projectName},</if>
<if test= "deptId != null" > deptId = #{deptId},</if>
<if test= "deptName != null" > deptName = #{deptName},</if>
2023-09-24 18:35:52 +08:00
<if test= "vendorsCode != null" > vendors_code = #{vendorsCode},</if>
2023-09-25 00:32:36 +08:00
<if test= "serverid != null" > serverid = #{serverid},</if>
2023-09-24 18:35:52 +08:00
<if test= "workerId != null" > workerId = #{workerId},</if>
2024-03-22 22:44:32 +08:00
<if test= "workerName != null" > workerName = #{workerName},</if>
2023-09-25 00:32:36 +08:00
<if test= "identification != null" > identification = #{identification},</if>
2024-03-22 22:44:32 +08:00
<if test= "workerPhoto != null" > workerPhoto = #{workerPhoto},</if>
<if test= "workerGender != null" > workerGender = #{workerGender},</if>
<if test= "birthDate != null" > birthDate = #{birthDate},</if>
<if test= "ethnic != null" > ethnic = #{ethnic},</if>
<if test= "nativePlace != null" > nativePlace = #{nativePlace},</if>
<if test= "phone != null" > phone = #{phone},</if>
<if test= "workTypeName != null" > workTypeName = #{workTypeName},</if>
<if test= "specWorkType != null" > specWorkType = #{specWorkType},</if>
<if test= "groupName != null" > groupName = #{groupName},</if>
<if test= "companyTypeId != null" > companyTypeId = #{companyTypeId},</if>
<if test= "companyName != null" > companyName = #{companyName},</if>
<if test= "attendanceTime != null" > attendance_time = #{attendanceTime},</if>
<if test= "attendanceOutTime != null" > attendance_out_time = #{attendanceOutTime},</if>
<if test= "scanPhoto != null" > scanPhoto = #{scanPhoto},</if>
2023-09-25 00:32:36 +08:00
<if test= "teamId != null" > teamId = #{teamId},</if>
<if test= "workTypeCode != null" > workTypeCode = #{workTypeCode},</if>
<if test= "companyId != null" > companyId = #{companyId},</if>
<if test= "vendorId != null" > vendorId = #{vendorId},</if>
2023-09-24 18:35:52 +08:00
<if test= "deviceCode != null" > device_code = #{deviceCode},</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>
2024-03-22 22:44:32 +08:00
<if test= "remark != null" > remark = #{remark},</if>
2023-09-24 18:35:52 +08:00
</trim>
where id = #{id}
</update>
<delete id= "deleteSurProjectAttendanceDataById" parameterType= "Long" >
2024-03-22 22:44:32 +08:00
delete from sur_project_attendance_data_${year} where id = #{id}
2023-09-24 18:35:52 +08:00
</delete>
<delete id= "deleteSurProjectAttendanceDataByIds" parameterType= "String" >
2024-03-22 22:44:32 +08:00
delete from sur_project_attendance_data_${year} where id in
2023-09-24 18:35:52 +08:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
2024-01-13 19:53:12 +08:00
<delete id= "deleteSurProjectAttendanceDataByParams" parameterType= "String" >
2024-03-22 22:44:32 +08:00
delete from sur_project_attendance_data_${year} where CONCAT(app_id,'-',serverid,'-',workerId) in
2024-01-13 19:53:12 +08:00
<foreach collection= "list" item= "item" separator= "," open= "(" close= ")" >
#{item}
</foreach>
</delete>
<insert id= "batchSurProjectAttendanceData" >
2024-03-23 02:29:43 +08:00
insert into sur_project_attendance_data_${year}( id, cfgid, app_id, projectId, projectName, deptId, deptName, vendors_code, serverid, workerId, workerName, identification, workerPhoto, workerGender, birthDate, ethnic, nativePlace, phone, workTypeName, specWorkType, groupName, companyTypeId,
companyName, attendance_time, attendance_out_time, scanPhoto, teamId,workTypeCode, companyId, vendorId, device_code, is_del, create_by, create_time, update_by, update_time) values
2024-01-13 19:53:12 +08:00
<foreach item= "item" index= "index" collection= "list" separator= "," >
2024-03-23 02:29:43 +08:00
( #{item.id}, #{item.cfgid},#{item.appId}, #{item.projectId}, #{item.projectName}, #{item.deptId}, #{item.deptName}, #{item.vendorsCode}, #{item.serverid}, #{item.workerId}, #{item.workerName}, #{item.identification},#{item.workerPhoto}, #{item.workerGender}, #{item.birthDate},#{item.ethnic}, #{item.nativePlace}, #{item.phone}, #{item.workTypeName}, #{item.specWorkType}, #{item.groupName}, #{item.companyTypeId},
#{item.companyName}, #{item.attendanceTime}, #{item.attendanceOutTime}, #{item.scanPhoto},#{item.teamId}, #{item.workTypeCode}, #{item.companyId}, #{item.vendorId}, #{item.deviceCode},#{item.isDel}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
2024-01-13 19:53:12 +08:00
</foreach>
</insert>
2023-09-25 00:32:36 +08:00
<select id= "getLastServerId" parameterType= "SurProjectAttendanceData" resultType= "Long" >
2024-03-22 22:44:32 +08:00
SELECT IF(MAX(serverid+0),MAX(serverid+0),0) serverid FROM sur_project_attendance_data_${year} WHERE cfgid=#{cfgid}
2023-09-25 00:32:36 +08:00
</select>
2024-01-26 22:45:20 +08:00
<select id= "groupByComanyOld" parameterType= "SurProjectAttendanceData" resultMap= "SurProjectAttendanceDataResult" >
2023-09-27 00:37:24 +08:00
select companyTypeId,count(1) id from ( <include refid= "selectSurProjectAttendanceDataVo" /> ) x2 where id in (
select min(id) from ( <include refid= "selectSurProjectAttendanceDataVo" /> ) x1
where date(attendance_time)=#{attendanceTime}
<if test= "subDeptId!=null and subDeptId>0" > and project_id in (
SELECT id FROM sur_project WHERE isdel=0 AND deptid = #{subDeptId}
)
</if>
2023-10-11 23:24:45 +08:00
<if test= "prjIds !=null and prjIds.size()>0" >
and project_id in
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
2023-09-27 00:37:24 +08:00
<if test= "projectId!=null and projectId>0" > and project_id=#{projectId}</if>
group by workerId )
2024-01-26 22:45:20 +08:00
and companyTypeId in (1,2,3,4,5,6,8) group by companyTypeId
</select>
<select id= "groupByComany" parameterType= "SurProjectAttendanceData" resultMap= "SurProjectAttendanceDataResult" >
select g.companyTypeId,count(1) id 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)=CURDATE()
2024-03-22 22:00:33 +08:00
and cfgid in (select id from sur_project_attendance_cfg
<where >
<if test= "projectId!=null and projectId>0" >
and project_id=#{projectId}
</if>
<if test= "subDeptId!=null and subDeptId>0" >
and project_id in (SELECT id FROM sur_project WHERE deptid=#{subDeptId})
</if>
<if test= "prjIds !=null and prjIds.size()>0" >
and project_id in
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
</where>
)
2024-01-26 22:45:20 +08:00
)
and g.companyTypeId in (1,2,3,4,5,6,8)
<if test= "projectId!=null and projectId>0" >
and c.project_id=#{projectId}
</if>
<if test= "subDeptId!=null and subDeptId>0" >
and c.project_id in (SELECT id FROM sur_project WHERE deptid=#{subDeptId})
</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>
group by g.companyTypeId
2023-09-27 00:37:24 +08:00
</select>
2024-04-06 01:31:05 +08:00
2024-03-01 23:34:15 +08:00
<select id= "groupAllByComany" parameterType= "SurProjectAttendanceData" resultMap= "SurProjectAttendanceDataResult" >
2024-04-06 21:21:55 +08:00
select g.companyTypeId,count(1) id
from sur_project_attendance_user u, sur_project_attendance_cfg c,view_sur_project_attendance_group g,
sur_project sp
2024-04-06 13:54:56 +08:00
where u.cfgid=c.id and u.state=0 and u.companyId=g.companyId and u.state=0 and c.project_id = sp.id
2024-04-06 21:21:55 +08:00
and sp.isDel=0 and sp.progressVisible=0
2024-03-30 00:04:23 +08:00
and g.companyTypeId in (0,1,2,3,4,5,6,8)
2024-03-01 23:34:15 +08:00
<if test= "projectId!=null and projectId>0" >
and c.project_id=#{projectId}
</if>
<if test= "subDeptId!=null and subDeptId>0" >
2024-04-06 01:31:05 +08:00
and sp.deptId=#{subDeptId}
2024-03-01 23:34:15 +08:00
</if>
2024-04-06 01:31:05 +08:00
<if test= 'proType != null and proType != "" and proType != "0"' > and sp.projectType = #{proType}</if>
2024-03-01 23:34:15 +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>
group by g.companyTypeId
</select>
2024-04-08 23:34:32 +08:00
<select id= "getHuazhuPage" parameterType= "SurProjectAttendanceData" resultType= "Long" >
2024-03-22 22:44:32 +08:00
select max(vendorId) vendorId from sur_project_attendance_data_${year} WHERE cfgid=#{id}
2024-01-13 00:03:25 +08:00
</select>
2024-03-23 00:11:43 +08:00
<select id= "initOtherData" parameterType= "map" resultType= "map" >
2024-03-23 00:58:57 +08:00
select d.workerId,d.app_id,d.serverid,u.companyId,u.companyName,u.`name`,d.identification,u.recentPhoto,u.gender,u.birthDate,u.ethnic,u.nativePlace,u.phone,
u.workTypeName,u.specWorkType,u.groupName,g.companyTypeId,d.teamId,u.workTypeCode,d.vendorId,d.device_code,d.scanPhoto,d.is_del
2024-03-23 00:11:43 +08:00
from sur_project_attendance_data d
left JOIN sur_project_attendance_user u on d.workerId = u.workerId and d.cfgid = u.cfgid
2024-03-23 02:29:43 +08:00
left join sur_project_attendance_group g on u.companyId = g.companyId and g.cfgid = u.cfgid
2024-03-23 00:11:43 +08:00
where d.cfgid=#{cfgid} and date(d.attendance_time) = #{date}
GROUP BY d.workerId
</select>
<select id= "initHuaZhuData" parameterType= "map" resultType= "map" >
2024-03-23 00:58:57 +08:00
select d.workerId,d.app_id,d.serverid,u.companyId,u.companyName,u.`name`,d.identification,u.recentPhoto,u.gender,u.birthDate,u.ethnic,u.nativePlace,u.phone,
u.workTypeName,u.specWorkType,u.groupName,d.teamId,u.workTypeCode,d.vendorId,d.device_code,d.scanPhoto,d.is_del,
2024-03-23 00:11:43 +08:00
CASE WHEN sd.type_flag = 2 THEN '1' WHEN sd.type_flag = 3 THEN '2' WHEN sd.type_flag = 4 THEN '8' else '0' end as companyTypeId
from sur_project_attendance_data d
left JOIN sur_project_attendance_user u on d.workerId = u.workerId and d.cfgid = u.cfgid
left join sys_dept sd on u.companyName = sd.dept_name
where d.cfgid=#{cfgid} and date(d.attendance_time) = #{date}
GROUP BY d.workerId
</select>
2024-03-23 00:26:38 +08:00
<select id= "findHuaZhuCompanyType" parameterType= "string" resultType= "string" >
select CASE WHEN sd.type_flag = 2 THEN '1' WHEN sd.type_flag = 3 THEN '2' WHEN sd.type_flag = 4 THEN '8' else '0' end as companyTypeId
from sys_dept sd
where sd.dept_name = #{deptName}
</select>
2024-03-23 02:17:39 +08:00
<select id= "todayAttendance" parameterType= "SurProjectAttendanceData" resultMap= "SurProjectAttendanceDataResult" >
2024-04-06 01:31:05 +08:00
select ady.* from sur_project_attendance_data_${year} ady
left join sur_project sp on sp.id = ady.projectId
2024-04-06 21:21:55 +08:00
where sp.isDel=0 and sp.progressVisible=0
2024-04-06 01:31:05 +08:00
<if test= "projectId!=null and projectId>0" >
and ady.projectId=#{projectId}
</if>
2024-03-23 02:17:39 +08:00
<if test= "id==1" >
2024-04-06 01:31:05 +08:00
and ady.companyTypeId in (1,6)
2024-03-23 02:17:39 +08:00
</if>
<if test= "id==2" >
2024-04-06 01:31:05 +08:00
and ady.companyTypeId in (0,2,3,4,5)
2024-03-23 02:17:39 +08:00
</if>
<if test= "id==8" >
2024-04-06 01:31:05 +08:00
and ady.companyTypeId =8
2024-03-23 02:17:39 +08:00
</if>
<if test= "deptId!=null and deptId>0" >
2024-04-06 01:31:05 +08:00
and sp.deptId=#{deptId}
2024-03-23 02:17:39 +08:00
</if>
2024-04-06 01:31:05 +08:00
<if test= 'proType != null and proType != "" and proType != "0"' > and sp.projectType = #{proType}</if>
2024-03-23 02:17:39 +08:00
<if test= "prjIds !=null and prjIds.size()>0" >
2024-04-06 01:31:05 +08:00
and ady.projectId in
2024-03-23 02:17:39 +08:00
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
2024-04-06 01:31:05 +08:00
<if test= "attendanceTime != null and attendanceTime != ''" > and date(ady.attendance_time) =date(#{attendanceTime})</if>
2024-03-23 02:17:39 +08:00
</select>
2024-03-23 02:28:39 +08:00
<select id= "groupTodayCompanyTypeId" parameterType= "SurProjectAttendanceData" resultMap= "SurProjectAttendanceDataResult" >
2024-04-06 01:31:05 +08:00
select ady.companyTypeId,count(1) id from sur_project_attendance_data_${year} ady
left join sur_project sp on sp.id = ady.projectId
2024-04-06 21:21:55 +08:00
where sp.isDel=0 and sp.progressVisible=0
2024-03-23 02:28:39 +08:00
<if test= "projectId!=null and projectId>0" >
2024-04-06 01:31:05 +08:00
and ady.projectId=#{projectId}
2024-03-23 02:28:39 +08:00
</if>
<if test= "deptId!=null and deptId>0" >
2024-04-06 01:31:05 +08:00
and sp.deptId=#{deptId}
2024-03-23 02:28:39 +08:00
</if>
2024-04-06 01:31:05 +08:00
<if test= 'proType != null and proType != "" and proType != "0"' > and sp.projectType = #{proType}</if>
2024-03-23 02:28:39 +08:00
<if test= "prjIds !=null and prjIds.size()>0" >
2024-04-06 01:31:05 +08:00
and ady.projectId in
2024-03-23 02:28:39 +08:00
<foreach collection= "prjIds" item= "item" index= "index" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</if>
2024-04-06 01:31:05 +08:00
<if test= "attendanceTime != null and attendanceTime != ''" > and date(ady.attendance_time) =date(#{attendanceTime})</if>
2024-04-06 21:21:55 +08:00
2024-04-06 01:31:05 +08:00
group by ady.companyTypeId
2024-03-23 02:28:39 +08:00
</select>
2023-09-24 18:35:52 +08:00
</mapper>