update code
parent
85b8ed616a
commit
017d41b96c
|
@ -82,4 +82,5 @@ public interface SurProjectAttendanceUserMapper
|
|||
public long countTodayAttendance(SurProjectAttendanceUser where);
|
||||
|
||||
public List<SurProjectAttendanceUser> todayAttendance(SurProjectAttendanceUser where);
|
||||
public List<SurProjectAttendanceUser> todayAttendanceData(List<String> list);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.yanzhu.jh.project.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
@ -154,6 +156,30 @@ public class SurProjectAttendanceUserServiceImpl implements ISurProjectAttendanc
|
|||
where.setIndex(1);
|
||||
}
|
||||
where.setIndex((where.getIndex()-1)* where.getSize());
|
||||
return surProjectAttendanceUserMapper.todayAttendance(where);
|
||||
List<SurProjectAttendanceUser> list= surProjectAttendanceUserMapper.todayAttendance(where);
|
||||
List<String> workerIds=new ArrayList<>();
|
||||
for(SurProjectAttendanceUser u: list){
|
||||
workerIds.add(u.getWorkerId());
|
||||
}
|
||||
List<SurProjectAttendanceUser> datas=surProjectAttendanceUserMapper.todayAttendanceData(workerIds);
|
||||
for (SurProjectAttendanceUser u:list) {
|
||||
u.setInTime(findDate(datas,u,"E"));
|
||||
u.setOutTime(findDate(datas,u,"L"));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private Date findDate(List<SurProjectAttendanceUser> datas, SurProjectAttendanceUser u, String type) {
|
||||
for (SurProjectAttendanceUser user:datas) {
|
||||
if(user.getWorkerId().equals(u.getWorkerId()) && user.getName().equals(type)){
|
||||
if(type.equals("L")){
|
||||
return user.getOutTime();
|
||||
}else{
|
||||
return user.getInTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getLastServerId" parameterType="SurProjectAttendanceData" resultType="Long">
|
||||
SELECT IF(MAX(serverid),MAX(serverid),0) serverid FROM sur_project_attendance_data WHERE cfgid=#{cfgid}
|
||||
</select>
|
||||
<select id="groupByComany" parameterType="SurProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
|
||||
<select id="groupByComanyOld" parameterType="SurProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
|
||||
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}
|
||||
|
@ -206,7 +206,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
<if test="projectId!=null and projectId>0"> and project_id=#{projectId}</if>
|
||||
group by workerId )
|
||||
and companyTypeId in (1,2,3,8) group by companyTypeId
|
||||
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()
|
||||
)
|
||||
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
|
||||
</select>
|
||||
<select id="getHuazhuPage" parameterType="long" resultType="Long">
|
||||
select max(vendorId) vendorId from sur_project_attendance_data WHERE cfgid=#{id}
|
||||
|
|
|
@ -302,6 +302,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="countTodayAttendance" resultType="Long" parameterType="SurProjectAttendanceUser">
|
||||
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)=CURDATE()
|
||||
)
|
||||
<if test="id==1">
|
||||
and g.companyTypeId =1
|
||||
</if>
|
||||
|
@ -324,13 +327,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
<select id="todayAttendance" parameterType="SurProjectAttendanceUser" resultMap="SurProjectAttendanceUserResult">
|
||||
<select id="todayAttendanceOld" parameterType="SurProjectAttendanceUser" 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>
|
||||
|
@ -354,4 +361,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
order by u.id limit #{index},#{size} ) a
|
||||
</select>
|
||||
<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(
|
||||
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 (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">
|
||||
select workerid,attendance_type name,min(attendance_time) inTime,max(attendance_time) max from sur_project_attendance_data where DATE(attendance_time)=CURDATE()
|
||||
<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>
|
||||
</mapper>
|
Loading…
Reference in New Issue