处理考勤系统

dev_xd
haha 2025-04-30 00:32:29 +08:00
parent ef1f1ff326
commit 8f8d4dbb08
6 changed files with 72 additions and 169 deletions

View File

@ -98,7 +98,6 @@ public interface IQuartzProjectAttendanceDataService
public List<QuartzProjectAttendanceData> groupAllByComany(QuartzProjectAttendanceData where);
public List<Map<String,Object>> initOtherData(Map<String,Object> data);
public List<Map<String,Object>> initHuaZhuData(Map<String,Object> data);

View File

@ -304,26 +304,6 @@ public class QuartzProjectAttendanceDataServiceImpl implements IQuartzProjectAtt
return quartzProjectAttendanceDataMapper.groupAllByComany(where);
}
@Override
public List<Map<String,Object>> initOtherData(Map<String,Object> data) {
List<Map<String,Object>> dataList = new ArrayList<>();
List<Map<String,Object>> list = quartzProjectAttendanceDataMapper.initOtherData(data);
if(StringUtils.isNotEmpty(list)){
List<String> workerIds = list.stream().map(Map -> Map.get("workerId").toString()).collect(Collectors.toList());
data.put("list",workerIds);
List<QuartzProjectAttendanceUser> datas= quartzProjectAttendanceUserMapper.todayAttendanceOtherData(data);
for (Map<String,Object> map:list) {
for(QuartzProjectAttendanceUser sau:datas){
if(Objects.equals(map.get("workerId").toString(),sau.getWorkerId())){
map.put("inTime",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,sau.getInTime()));
map.put("outTime",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,sau.getOutTime()));
dataList.add(map);
}
}
}
}
return dataList;
}
@Override
public List<Map<String,Object>> initHuaZhuData(Map<String,Object> data) {

View File

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yanzhu.job.mapper.QuartzProjectAttendanceCfgMapper">
<resultMap type="AttendanceCfg" id="AttendanceCfgResult">
<resultMap type="QuartzProjectAttendanceCfg" id="AttendanceCfgResult">
<result property="id" column="id" />
<result property="comId" column="com_id" />
<result property="projectId" column="project_id" />

View File

@ -142,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="cfgid != null "> and cfgid = #{cfgid}</if>
<if test="appId != null "> and app_id = #{appId}</if>
<if test="projectId != null ">and cfgid in (select id from sur_project_attendance_cfg where projectId = #{projectId})</if>
<if test="projectId != null ">and cfgid in (select id from attendance_cfg where projectId = #{projectId})</if>
<if test="deptId != null "> and deptId = #{deptId}</if>
<if test="vendorsCode != null and vendorsCode != ''"> and vendors_code = #{vendorsCode}</if>
<if test="serverid != null "> and serverid = #{serverid}</if>
@ -343,32 +343,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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 test="subDeptId!=null and subDeptId>0"> and projectId in (
SELECT id FROM pro_project_info WHERE is_del=0 AND dis_dept_id = #{subDeptId}
)
</if>
<if test="prjIds !=null and prjIds.size()>0">
and project_id in
and projectId in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="projectId!=null and projectId>0"> and project_id=#{projectId}</if>
<if test="projectId!=null and projectId>0"> and projectId=#{projectId}</if>
group by workerId )
and companyTypeId in (1,2,3,4,5,6,8) group by companyTypeId
</select>
<select id="groupByComany" parameterType="QuartzProjectAttendanceData" 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
select g.companyTypeId,count(1) id from sur_project_attendance_user u, 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()
and cfgid in (select id from sur_project_attendance_cfg
and cfgid in (select id from 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})
and project_id in (SELECT id FROM pro_project_info WHERE dis_dept_id=#{subDeptId})
</if>
<if test="prjIds !=null and prjIds.size()>0">
and project_id in
@ -385,7 +385,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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})
and c.project_id in (SELECT id FROM pro_project_info WHERE dis_dept_id=#{subDeptId})
</if>
<if test="prjIds !=null and prjIds.size()>0">
and c.project_id in
@ -398,18 +398,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="groupAllByComany" parameterType="QuartzProjectAttendanceData" 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,
sur_project sp
from sur_project_attendance_user u, attendance_cfg c,view_sur_project_attendance_group g,
pro_project_info sp
where u.cfgid=c.id and u.companyId=g.companyId and u.state=#{id} and c.project_id = sp.id
and sp.isDel=0
and sp.is_Del=0
and g.companyTypeId in (0,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 sp.deptId=#{subDeptId}
and sp.dis_dept_id=#{subDeptId}
</if>
<if test='proType != null and proType != "" and proType != "0"'> and sp.projectType = #{proType}</if>
<if test="prjIds !=null and prjIds.size()>0">
and c.project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
@ -436,7 +435,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="initHuaZhuData" parameterType="map" resultType="map">
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,
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
CASE WHEN sd.dept_type = 2 THEN '1' WHEN sd.dept_type = 3 THEN '2' WHEN sd.dept_type = 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
@ -453,7 +452,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="todayAttendance" parameterType="QuartzProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
select ady.* from sur_project_attendance_data_${year} ady
left join sur_project sp on sp.id = ady.projectId
where sp.isDel=0
where sp.is_Del=0
<if test="projectId!=null and projectId>0">
and ady.projectId=#{projectId}
</if>
@ -467,9 +466,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ady.companyTypeId =8
</if>
<if test="deptId!=null and deptId>0">
and sp.deptId=#{deptId}
and sp.dis_dept_id=#{deptId}
</if>
<if test='proType != null and proType != "" and proType != "0"'> and sp.projectType = #{proType}</if>
<if test="prjIds !=null and prjIds.size()>0">
and ady.projectId in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
@ -481,7 +479,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="attendanceDataList" parameterType="QuartzProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
select ady.* from sur_project_attendance_data_${year} ady
where ady.cfgid in (select cfg.id from sur_project_attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
where ady.cfgid in (select cfg.id from attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
<if test="companyTypeId==101">
and ady.companyTypeId in (1,6)
</if>
@ -500,7 +498,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="groupTodayCompanyTypeId" parameterType="QuartzProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
select ady.companyTypeId,count(1) id from sur_project_attendance_data_${year} ady
where ady.cfgid in (select id from sur_project_attendance_cfg where
where ady.cfgid in (select id from attendance_cfg where
is_del=0
<if test="projectId!=null and projectId>0">
and projectId=#{projectId}
@ -530,7 +528,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select '1' as type,g.companyTypeId,count(1) as total
from sur_project_attendance_user u
left join view_sur_project_attendance_group g on g.cfgid = u.cfgid and u.companyId=g.companyId
where u.cfgid in (select cfg.id from sur_project_attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
where u.cfgid in (select cfg.id from attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
and g.companyTypeId in (0,1,2,3,4,5,6,8)
and u.state=0
group by g.companyTypeId
@ -538,13 +536,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select '2' as type,g.companyTypeId,count(1) as total
from sur_project_attendance_user u
left join view_sur_project_attendance_group g on g.cfgid = u.cfgid and u.companyId=g.companyId
where u.cfgid in (select cfg.id from sur_project_attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
where u.cfgid in (select cfg.id from attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
and g.companyTypeId in (0,1,2,3,4,5,6,8)
and u.state=1
group by g.companyTypeId
UNION ALL
select '3' as type, d.companyTypeId,count(1) as total from sur_project_attendance_data_${year} d
where d.cfgid in (select cfg.id from sur_project_attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
where d.cfgid in (select cfg.id from attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
and d.is_del=0
and date(d.attendance_time) = date(now())
group by d.companyTypeId
@ -552,7 +550,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="groupDataByParams" parameterType="QuartzProjectAttendanceData" resultType="Map">
select d.companyTypeId,count(1) as total from sur_project_attendance_data_${year} d
where d.cfgid in (select cfg.id from sur_project_attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
where d.cfgid in (select cfg.id from attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
and d.is_del=0
<if test="attendanceTime != null and attendanceTime != ''"> and date(d.attendance_time) = date(#{attendanceTime})</if>
<if test="workerName != null and workerName != ''"> and d.workerName like concat('%', #{workerName}, '%')</if>
@ -562,7 +560,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="findGroupAllByDays" parameterType="QuartzProjectAttendanceData" resultType="Map">
select '3' as type, DATE_FORMAT(days.attendanceTime, '%m-%d') as attendanceTime,days.total from(
select date(d.attendance_time) as attendanceTime, DATE_FORMAT(d.attendance_time, '%m-%d'),count(1) as total from sur_project_attendance_data_${year} d
where d.cfgid in (select cfg.id from sur_project_attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
where d.cfgid in (select cfg.id from attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
and d.is_del=0
and date(d.attendance_time) between #{attendanceTime} and #{attendanceOutTime}
group by date(d.attendance_time)

View File

@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null "> and type = #{type}</if>
<if test="leaderId != null "> and leaderId = #{leaderId}</if>
<if test="deleted != null "> and deleted = #{deleted}</if>
<if test="createTime != null "> and createTime = #{createTime}</if>
<if test="createTime != null "> and create_Time = #{createTime}</if>
<if test="platformGroupId != null "> and platformGroupId = #{platformGroupId}</if>
<if test="platformTeamId != null "> and platformTeamId = #{platformTeamId}</if>
<if test="enterDate != null "> and enterDate = #{enterDate}</if>
@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null "> and type = #{type}</if>
<if test="leaderId != null "> and leaderId = #{leaderId}</if>
<if test="deleted != null "> and deleted = #{deleted}</if>
<if test="createTime != null "> and createTime = #{createTime}</if>
<if test="createTime != null "> and create_Time = #{createTime}</if>
<if test="platformGroupId != null "> and platformGroupId = #{platformGroupId}</if>
<if test="platformTeamId != null "> and platformTeamId = #{platformTeamId}</if>
<if test="enterDate != null "> and enterDate = #{enterDate}</if>

View File

@ -52,8 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectSurProjectAttendanceUserVo">
SELECT * FROM (
SELECT a.*,b.project_id,b.sub_dept_id
FROM sur_project_attendance_user a,sur_project_attendance_cfg b
SELECT a.*,b.project_id,b.dept_id
FROM sur_project_attendance_user a,attendance_cfg b
WHERE a.cfgid=b.id )
sur_project_attendance_user
</sql>
@ -63,8 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
u.groupId,u.leader,u.workTypeCode,u.specWorkType,
u.hatCode,u.state,u.enterDate,u.exitDate,u.companyId,u.vendorId,
u.teamId,u.teamName,u.enterType,u.is_del,u.create_by,u.create_time,u.update_by,u.update_time,
c.project_id,c.sub_dept_id,u.companyName,u.workTypeName,g.teamname groupName,g.companyName remark
FROM sur_project_attendance_user u,sur_project_attendance_cfg c,sur_project_attendance_group g
c.project_id,c.dept_id,u.companyName,u.workTypeName,g.teamname groupName,g.companyName remark
FROM sur_project_attendance_user u,attendance_cfg c,sur_project_attendance_group g
WHERE u.cfgid=c.id AND g.companyid=u.companyid AND u.vendors_code='jgw'
<if test="companyTypeId!=null">
<if test="companyTypeId>100">
@ -116,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="enterType != null and enterType != ''"> and u.enterType = #{enterType}</if>
<if test="other != null and other != ''"> and u.other = #{other}</if>
<if test="projectId != null and projectId > 0 "> and c.project_id = #{projectId}</if>
<if test="subDeptId != null and subDeptId >0 "> and c.sub_dept_id = #{subDeptId}</if>
<if test="subDeptId != null and subDeptId >0 "> and c.dept_id = #{subDeptId}</if>
<if test="isDel != null "> and u.is_del = #{isDel}</if>
</select>
@ -160,8 +160,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.create_by,
a.create_time,
a.update_by,
a.update_time,b.project_id,b.sub_dept_id,g.companyTypeId,g.companyName as remark
FROM sur_project_attendance_user a,sur_project_attendance_cfg b,view_sur_project_attendance_group g
a.update_time,b.project_id,b.dept_id,g.companyTypeId,g.companyName as remark
FROM sur_project_attendance_user a,attendance_cfg b,view_sur_project_attendance_group g
WHERE a.cfgid=b.id and a.companyId=g.companyId and g.id in(select min(id) from view_sur_project_attendance_group group by companyid)
)
sur_project_attendance_user
@ -216,7 +216,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="enterType != null and enterType != ''"> and enterType = #{enterType}</if>
<if test="other != null and other != ''"> and other = #{other}</if>
<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>
<if test="subDeptId != null and subDeptId >0 "> and dept_id = #{subDeptId}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
</where>
</select>
@ -273,7 +273,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="enterType != null and enterType != ''"> and enterType = #{enterType}</if>
<if test="other != null and other != ''"> and other = #{other}</if>
<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>
<if test="subDeptId != null and subDeptId >0 "> and dept_id = #{subDeptId}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
</where>
</select>
@ -455,51 +455,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</insert>
<sql id="sqlAttendanceData">
(
SELECT * 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}
) ) xx
</sql>
<select id="queryAttendanceData" parameterType="SurProjectAttendanceCfg" resultMap="SurProjectAttendanceUserResult">
select * from (
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
) oo
</select>
<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
<select id="countAttendance" resultType="Long" parameterType="QuartzProjectAttendanceCfg">
select count(1) cnt from sur_project_attendance_user u, 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=#{deptId}
SELECT id FROM attendance_cfg WHERE project_id=#{projectId} AND dept_id=#{deptId}
) group by workerid
)
</select>
@ -516,11 +477,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="queryAttendanceUsers" parameterType="QuartzProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
select u.* from sur_project_attendance_user u, sur_project_attendance_cfg c,view_sur_project_attendance_group g
select u.* from sur_project_attendance_user u, 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}
SELECT id FROM attendance_cfg WHERE project_id=#{projectId} AND dept_id=#{subDeptId}
) group by workerid
)
order by u.id limit #{index},#{size}
@ -528,7 +489,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="countTodayAttendance" resultType="Long" parameterType="QuartzProjectAttendanceUser">
select count(1) cnt from sur_project_attendance_user u, sur_project_attendance_cfg c,view_sur_project_attendance_group g
select count(1) cnt from sur_project_attendance_user u, 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() group by workerid
@ -555,43 +516,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
</select>
<select id="todayAttendanceOld" parameterType="QuartzProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
select a.* ,
(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
from (
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)=CURDATE()
)
<if test="id==1">
and g.companyTypeId in (1,6)
</if>
<if test="id==2">
and g.companyTypeId in (0,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} ) a
</select>
<select id="todayAttendance" parameterType="QuartzProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
select u.* from sur_project_attendance_user u, sur_project_attendance_cfg c,view_sur_project_attendance_group g
select u.* from sur_project_attendance_user u, 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() group by workerid
@ -648,10 +576,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
u.groupId,u.leader,u.workTypeCode,u.specWorkType,
u.hatCode,u.state,u.enterDate,u.exitDate,u.companyId,u.vendorId,
u.teamId,u.teamName,u.enterType,u.is_del,u.create_by,u.create_time,u.update_by,u.update_time,
b.project_id,b.sub_dept_id,u.companyName,u.workTypeName,u.groupName,
b.project_id,b.sub_dept_id, g.teamname remark,g.companyName degreeName
FROM sur_project_attendance_user u,sur_project_attendance_cfg b,view_sur_project_attendance_group g,sur_project sp
WHERE u.cfgid=b.id and u.state=0 and u.companyId=g.companyId and sp.isDel=0 and b.project_id = sp.id
u.companyName,u.workTypeName,u.groupName,
b.project_id,b.dept_id, g.teamname remark,g.companyName degreeName
FROM sur_project_attendance_user u,attendance_cfg b,view_sur_project_attendance_group g,pro_project_info sp
WHERE u.cfgid=b.id and u.state=0 and u.companyId=g.companyId and sp.is_Del=0 and b.project_id = sp.id
<if test="id==101">
and g.companyTypeId in (1,6)
</if>
@ -665,9 +593,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and b.project_id=#{projectId}
</if>
<if test="deptId!=null and deptId>0">
and sp.deptId=#{deptId}
and sp.dis_dept_id=#{deptId}
</if>
<if test='proType != null and proType != "" and proType != "0"'> and sp.projectType = #{proType}</if>
<if test="prjIds !=null and prjIds.size()>0">
and b.project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
@ -682,10 +610,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
u.groupId,u.leader,u.workTypeCode,u.specWorkType,
u.hatCode,u.state,u.enterDate,u.exitDate,u.companyId,u.vendorId,
u.teamId,u.teamName,u.enterType,u.is_del,u.create_by,u.create_time,u.update_by,u.update_time,
b.project_id,b.sub_dept_id,u.companyName,u.workTypeName,u.groupName,
b.project_id,b.sub_dept_id, g.teamname remark,g.companyName degreeName,g.companyTypeId
FROM sur_project_attendance_user u,sur_project_attendance_cfg b,view_sur_project_attendance_group g,sur_project sp
WHERE u.cfgid=b.id and u.companyId=g.companyId and sp.isDel=0 and b.project_id = sp.id
u.companyName,u.workTypeName,u.groupName,
b.project_id,b.dept_id, g.teamname remark,g.companyName degreeName,g.companyTypeId
FROM sur_project_attendance_user u,attendance_cfg b,view_sur_project_attendance_group g,pro_project_info sp
WHERE u.cfgid=b.id and u.companyId=g.companyId and sp.is_Del=0 and b.project_id = sp.id
<if test="companyTypeId==101">
and g.companyTypeId in (1,6)
</if>
@ -705,13 +633,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="groupByWorkerOnDutyByDept" parameterType="QuartzProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
SELECT p.id, p.projectName NAME,c.dept_name groupName,g.companyTypeId companyId,COUNT(1) cfgid
FROM sur_project_attendance_user u,sur_project_attendance_cfg b,view_sur_project_attendance_group g,sur_project p,sys_dept c
where u.cfgid=b.id and u.state=0 and u.companyId=g.companyId and b.project_id=p.id and c.dept_id=b.sub_dept_id
and p.isDel=0
SELECT p.id, p.project_name NAME,c.dept_name groupName,g.companyTypeId companyId,COUNT(1) cfgid
FROM sur_project_attendance_user u,attendance_cfg b,view_sur_project_attendance_group g,pro_project_info p,sys_dept c
where u.cfgid=b.id and u.state=0 and u.companyId=g.companyId and b.project_id=p.id and c.dept_id=b.dept_id
and p.is_Del=0
and g.companyTypeId in (1,6,0,2,3,4,5,8)
<if test="deptId!=null and deptId>0">
and p.deptId=#{deptId}
and p.dis_dept_id=#{deptId}
</if>
<if test='proType != null and proType != "" and proType != "0"'> and p.projectType = #{proType}</if>
<if test="prjIds !=null and prjIds.size()>0">
@ -720,7 +648,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</if>
group by p.projectName,c.dept_name,g.companyTypeId,p.id
group by p.project_Name,c.dept_name,g.companyTypeId,p.id
order by p.id
</select>
@ -728,7 +656,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select '1' as type,g.companyTypeId,count(1) as total
from sur_project_attendance_user u
left join view_sur_project_attendance_group g on g.cfgid = u.cfgid and u.companyId=g.companyId
where u.cfgid in (select cfg.id from sur_project_attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
where u.cfgid in (select cfg.id from attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
and g.companyTypeId in (0,1,2,3,4,5,6,8)
and u.state=0
<if test="name != null and name != ''"> and u.name like concat('%', #{name}, '%')</if>
@ -737,7 +665,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select '2' as type,g.companyTypeId,count(1) as total
from sur_project_attendance_user u
left join view_sur_project_attendance_group g on g.cfgid = u.cfgid and u.companyId=g.companyId
where u.cfgid in (select cfg.id from sur_project_attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
where u.cfgid in (select cfg.id from attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
and g.companyTypeId in (0,1,2,3,4,5,6,8)
and u.state=1
<if test="name != null and name != ''"> and u.name like concat('%', #{name}, '%')</if>
@ -748,29 +676,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select '1' as type,g.companyTypeId,count(1) as total
from sur_project_attendance_user u
left join view_sur_project_attendance_group g on g.cfgid = u.cfgid and u.companyId=g.companyId
where u.cfgid in (select cfg.id from sur_project_attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
where u.cfgid in (select cfg.id from attendance_cfg cfg where cfg.project_id=#{projectId} and cfg.is_del=0)
and g.companyTypeId in (0,1,2,3,4,5,6,8)
and u.state=0
group by g.companyTypeId
</select>
<select id="groupByWorkerByDept" parameterType="QuartzProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
SELECT p.id, p.projectName NAME,c.dept_name groupName,g.companyTypeId companyId,COUNT(1) cfgid
FROM sur_project_attendance_user u,sur_project_attendance_cfg b,view_sur_project_attendance_group g,sur_project p,sys_dept c
where u.cfgid=b.id and u.state= #{state} and u.companyId=g.companyId and b.project_id=p.id and c.dept_id=b.sub_dept_id
and p.isDel=0
SELECT p.id, p.project_Name NAME,c.dept_name groupName,g.companyTypeId companyId,COUNT(1) cfgid
FROM sur_project_attendance_user u,attendance_cfg b,view_sur_project_attendance_group g,pro_project_info p,sys_dept c
where u.cfgid=b.id and u.state= #{state} and u.companyId=g.companyId and b.project_id=p.id and c.dept_id=b.dept_id
and p.is_Del=0
and g.companyTypeId in (1,6,0,2,3,4,5,8)
<if test="deptId!=null and deptId>0">
and p.deptId=#{deptId}
and p.dis_dept_id=#{deptId}
</if>
<if test='proType != null and proType != "" and proType != "0"'> and p.projectType = #{proType}</if>
<if test="prjIds !=null and prjIds.size()>0">
and b.project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by p.projectName,c.dept_name,g.companyTypeId,p.id
group by p.project_Name,c.dept_name,g.companyTypeId,p.id
order by p.id
</select>
@ -780,10 +707,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
u.groupId,u.leader,u.workTypeCode,u.specWorkType,
u.hatCode,u.state,u.enterDate,u.exitDate,u.companyId,u.vendorId,
u.teamId,u.teamName,u.enterType,u.is_del,u.create_by,u.create_time,u.update_by,u.update_time,
b.project_id,b.sub_dept_id,u.companyName,u.workTypeName,u.groupName,
b.project_id,b.sub_dept_id, g.teamname remark,g.companyName degreeName
FROM sur_project_attendance_user u,sur_project_attendance_cfg b,view_sur_project_attendance_group g,sur_project sp
WHERE u.cfgid=b.id and u.state=#{state} and u.companyId=g.companyId and sp.isDel=0 and b.project_id = sp.id
u.companyName,u.workTypeName,u.groupName,
b.project_id,b.dept_id, g.teamname remark,g.companyName degreeName
FROM sur_project_attendance_user u,attendance_cfg b,view_sur_project_attendance_group g,pro_project_info sp
WHERE u.cfgid=b.id and u.state=#{state} and u.companyId=g.companyId and sp.is_Del=0 and b.project_id = sp.id
<if test="id==101">
and g.companyTypeId in (1,6)
</if>
@ -797,9 +724,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and b.project_id=#{projectId}
</if>
<if test="deptId!=null and deptId>0">
and sp.deptId=#{deptId}
and sp.dis_dept_id=#{deptId}
</if>
<if test='proType != null and proType != "" and proType != "0"'> and sp.projectType = #{proType}</if>
<if test="prjIds !=null and prjIds.size()>0">
and b.project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">