|
@@ -821,29 +821,75 @@
|
|
<select id="getWaitingReviewList" resultType="java.util.Map">
|
|
<select id="getWaitingReviewList" resultType="java.util.Map">
|
|
<choose>
|
|
<choose>
|
|
<when test="stateKey==0">
|
|
<when test="stateKey==0">
|
|
- select us.name as userName,dp2.department_name as departmentName,COUNT(rp.state=0 or null) as num
|
|
|
|
- from department dp
|
|
|
|
- left join user us on dp.manager_id=us.id
|
|
|
|
- left join report rp on rp.dept_id=dp.department_id and rp.create_date between #{startDate} and #{endDate} and rp.audit_deptid !=0 and rp.is_dept_audit=1
|
|
|
|
- left join department dp2 on dp2.department_id=dp.department_id
|
|
|
|
|
|
+ SELECT dept_manager.name as userName,department.department_name as departmentName,COUNT(1) as num
|
|
|
|
+ FROM report AS a
|
|
|
|
+ left join user on user.id = a.creator_id
|
|
|
|
+ JOIN project AS b ON a.project_id=b.id
|
|
|
|
+ left join sub_project as d on d.id = a.sub_project_id
|
|
|
|
+ left join task on task.id = a.task_id
|
|
|
|
+ left join report_extra_degree on report_extra_degree.id = a.degree_id
|
|
|
|
+ left join department on department.department_id = a.audit_deptid
|
|
|
|
+ left join user dept_manager on dept_manager.id = a.audit_dept_managerid
|
|
|
|
+ left join department dept on dept.department_id = a.dept_id
|
|
|
|
+ left join task_group on task_group.id = a.group_id
|
|
|
|
+ left join user u on u.id = a.project_auditor_id
|
|
|
|
+ WHERE a.company_id =#{companyId}
|
|
|
|
+ and a.state = 0
|
|
|
|
+ <if test="startDate!=null and endDate!=null">
|
|
|
|
+ AND a.create_date between #{startDate} and #{endDate}
|
|
|
|
+ </if>
|
|
|
|
+ AND a.is_dept_audit=1
|
|
|
|
+ <if test="userId!=null">
|
|
|
|
+ and dept_manager.id=#{userId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="departmentId!=null">
|
|
|
|
+ and dept_manager.department_id=#{departmentId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deptIds!=null and deptIds.size()>0">
|
|
|
|
+ and dept_manager.department_id in
|
|
|
|
+ <foreach collection="deptIds" open="(" separator="," close=")" item="item">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ group by a.audit_dept_managerid
|
|
|
|
+ ORDER BY a.create_date desc, a.creator_id asc
|
|
</when>
|
|
</when>
|
|
<otherwise>
|
|
<otherwise>
|
|
- select us.name as userName,dp.department_name as departmentName,COUNT((rp.project_audit_state=0 and rp.state!=2 and rp.state!=3) or null) as num
|
|
|
|
- from project_auditor pa
|
|
|
|
- left join user us on pa.auditor_id=us.id
|
|
|
|
- left join report rp on rp.project_auditor_id=pa.auditor_id and pa.project_id=rp.project_id and rp.create_date between #{startDate} and #{endDate} and rp.is_dept_audit=0
|
|
|
|
- left join department dp on dp.department_id=us.department_id
|
|
|
|
|
|
+ SELECT u.name as userName,dp.department_name as departmentName,COUNT(1) as num
|
|
|
|
+ FROM report AS a
|
|
|
|
+ left join user on user.id = a.creator_id
|
|
|
|
+ JOIN project AS b ON a.project_id=b.id
|
|
|
|
+ left join sub_project as d on d.id = a.sub_project_id
|
|
|
|
+ left join task on task.id = a.task_id
|
|
|
|
+ left join report_extra_degree on report_extra_degree.id = a.degree_id
|
|
|
|
+ left join department on department.department_id = a.audit_deptid
|
|
|
|
+ left join user dept_manager on dept_manager.id = a.audit_dept_managerid
|
|
|
|
+ left join department dept on dept.department_id = a.dept_id
|
|
|
|
+ left join task_group on task_group.id = a.group_id
|
|
|
|
+ left join user u on u.id = a.project_auditor_id
|
|
|
|
+ left join department dp on u.department_id=dp.department_id
|
|
|
|
+ WHERE a.company_id =#{companyId}
|
|
|
|
+ and a.state = 0
|
|
|
|
+ <if test="startDate!=null and endDate!=null">
|
|
|
|
+ AND a.create_date between #{startDate} and #{endDate}
|
|
|
|
+ </if>
|
|
|
|
+ AND a.is_dept_audit=0 and a.project_audit_state = 0
|
|
|
|
+ <if test="userId!=null">
|
|
|
|
+ and u.id=#{userId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="departmentId!=null">
|
|
|
|
+ and u.department_id=#{departmentId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deptIds!=null and deptIds.size()>0">
|
|
|
|
+ and u.department_id in
|
|
|
|
+ <foreach collection="deptIds" open="(" separator="," close=")" item="item">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ group by a.project_auditor_id
|
|
|
|
+ ORDER BY a.create_date desc, a.creator_id asc
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
- where us.company_id=#{companyId} and us.is_active=1
|
|
|
|
- <if test="userId!=null">
|
|
|
|
- and us.id=#{userId}
|
|
|
|
- </if>
|
|
|
|
- <if test="departmentId!=null">
|
|
|
|
- and us.department_id=#{departmentId}
|
|
|
|
- </if>
|
|
|
|
- group by us.id
|
|
|
|
- order by us.department_id
|
|
|
|
<if test="start!=null and size!=null">
|
|
<if test="start!=null and size!=null">
|
|
limit #{start},#{size}
|
|
limit #{start},#{size}
|
|
</if>
|
|
</if>
|
|
@@ -853,29 +899,75 @@
|
|
select count(1)
|
|
select count(1)
|
|
from (<choose>
|
|
from (<choose>
|
|
<when test="stateKey==0">
|
|
<when test="stateKey==0">
|
|
- select us.name as userName,dp2.department_name as departmentName,COUNT(rp.state=0 or null) as num
|
|
|
|
- from department dp
|
|
|
|
- left join user us on dp.manager_id=us.id
|
|
|
|
- left join report rp on rp.audit_deptid=us.manage_dept_id and rp.create_date between #{startDate} and #{endDate} and rp.audit_deptid !=0 and rp.is_dept_audit=1
|
|
|
|
- left join department dp2 on dp2.department_id=dp.department_id
|
|
|
|
|
|
+ SELECT dept_manager.name as userName,department.department_name as departmentName,COUNT(1) as num
|
|
|
|
+ FROM report AS a
|
|
|
|
+ left join user on user.id = a.creator_id
|
|
|
|
+ JOIN project AS b ON a.project_id=b.id
|
|
|
|
+ left join sub_project as d on d.id = a.sub_project_id
|
|
|
|
+ left join task on task.id = a.task_id
|
|
|
|
+ left join report_extra_degree on report_extra_degree.id = a.degree_id
|
|
|
|
+ left join department on department.department_id = a.audit_deptid
|
|
|
|
+ left join user dept_manager on dept_manager.id = a.audit_dept_managerid
|
|
|
|
+ left join department dept on dept.department_id = a.dept_id
|
|
|
|
+ left join task_group on task_group.id = a.group_id
|
|
|
|
+ left join user u on u.id = a.project_auditor_id
|
|
|
|
+ WHERE a.company_id =#{companyId}
|
|
|
|
+ and a.state = 0
|
|
|
|
+ <if test="startDate!=null and endDate!=null">
|
|
|
|
+ AND a.create_date between #{startDate} and #{endDate}
|
|
|
|
+ </if>
|
|
|
|
+ AND a.is_dept_audit=1
|
|
|
|
+ <if test="userId!=null">
|
|
|
|
+ and dept_manager.id=#{userId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="departmentId!=null">
|
|
|
|
+ and dept_manager.department_id=#{departmentId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deptIds!=null and deptIds.size()>0">
|
|
|
|
+ and dept_manager.department_id in
|
|
|
|
+ <foreach collection="deptIds" open="(" separator="," close=")" item="item">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ group by a.audit_dept_managerid
|
|
|
|
+ ORDER BY a.create_date desc, a.creator_id asc
|
|
</when>
|
|
</when>
|
|
<otherwise>
|
|
<otherwise>
|
|
- select us.name as userName,dp.department_name as departmentName,COUNT(rp.project_audit_state=0 or null) as num
|
|
|
|
- from project_auditor pa
|
|
|
|
- left join user us on pa.auditor_id=us.id
|
|
|
|
- left join report rp on rp.project_auditor_id=us.id and pa.project_id=rp.project_id and rp.create_date between #{startDate} and #{endDate} and rp.is_dept_audit=0
|
|
|
|
- left join department dp on dp.department_id=us.department_id
|
|
|
|
|
|
+ SELECT u.name as userName,dp.department_name as departmentName,COUNT(1) as num
|
|
|
|
+ FROM report AS a
|
|
|
|
+ left join user on user.id = a.creator_id
|
|
|
|
+ JOIN project AS b ON a.project_id=b.id
|
|
|
|
+ left join sub_project as d on d.id = a.sub_project_id
|
|
|
|
+ left join task on task.id = a.task_id
|
|
|
|
+ left join report_extra_degree on report_extra_degree.id = a.degree_id
|
|
|
|
+ left join department on department.department_id = a.audit_deptid
|
|
|
|
+ left join user dept_manager on dept_manager.id = a.audit_dept_managerid
|
|
|
|
+ left join department dept on dept.department_id = a.dept_id
|
|
|
|
+ left join task_group on task_group.id = a.group_id
|
|
|
|
+ left join user u on u.id = a.project_auditor_id
|
|
|
|
+ left join department dp on u.department_id=dp.department_id
|
|
|
|
+ WHERE a.company_id =#{companyId}
|
|
|
|
+ and a.state = 0
|
|
|
|
+ <if test="startDate!=null and endDate!=null">
|
|
|
|
+ AND a.create_date between #{startDate} and #{endDate}
|
|
|
|
+ </if>
|
|
|
|
+ AND a.is_dept_audit=0 and a.project_audit_state = 0
|
|
|
|
+ <if test="userId!=null">
|
|
|
|
+ and u.id=#{userId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="departmentId!=null">
|
|
|
|
+ and u.department_id=#{departmentId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deptIds!=null and deptIds.size()>0">
|
|
|
|
+ and u.department_id in
|
|
|
|
+ <foreach collection="deptIds" open="(" separator="," close=")" item="item">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ group by a.project_auditor_id
|
|
|
|
+ ORDER BY a.create_date desc, a.creator_id asc
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
- where us.company_id=#{companyId} and us.is_active=1
|
|
|
|
- <if test="userId!=null">
|
|
|
|
- and us.id=#{userId}
|
|
|
|
- </if>
|
|
|
|
- <if test="departmentId!=null">
|
|
|
|
- and us.department_id=#{departmentId}
|
|
|
|
- </if>
|
|
|
|
- group by us.id
|
|
|
|
- order by us.department_id
|
|
|
|
<if test="start!=null and size!=null">
|
|
<if test="start!=null and size!=null">
|
|
limit #{start},#{size}
|
|
limit #{start},#{size}
|
|
</if>) total
|
|
</if>) total
|