|
|
@@ -40,44 +40,150 @@
|
|
|
|
|
|
<!-- 查询房屋个数 add by wuxw 2018-07-03 -->
|
|
|
<select id="getMonthAttendance" parameterType="Map" resultType="Map">
|
|
|
- select distinct t.class_id classId,t.staff_id staffId,
|
|
|
- s.name staffName,uo.org_name departmentName,
|
|
|
- (select count(1) from attendance_classes_task_detail b where t.task_id = b.task_id and b.state = '10000')
|
|
|
- noClockIn,
|
|
|
- (select count(1) from attendance_classes_task_detail b where t.task_id = b.task_id and b.state = '30000')
|
|
|
- clockIn,
|
|
|
- (select count(1) from attendance_classes_task_detail b where t.task_id = b.task_id and b.state = '40000') late,
|
|
|
- (select count(1) from attendance_classes_task_detail b where t.task_id = b.task_id and b.state = '50000') early,
|
|
|
- (select count(1) from attendance_classes_task_detail b where t.task_id = b.task_id and b.state = '60000') free
|
|
|
- from attendance_classes_task t
|
|
|
- left join u_user s on t.staff_id = s.user_id and s.status_cd = '0'
|
|
|
- left join u_org_staff_rel uosr on uosr.staff_id = s.user_id and uosr.status_cd = '0'
|
|
|
- left join u_org uo on uosr.org_id = uo.org_id and uo.status_cd = '0'
|
|
|
- where 1 =1
|
|
|
- and t.status_cd = '0'
|
|
|
+ SELECT
|
|
|
+ t.staff_name staffName,
|
|
|
+ t.staff_id staffId,
|
|
|
+ uo.org_name departmentName,
|
|
|
+ t.classes_id classesId,
|
|
|
+ ac.classes_name classesName,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ attendance_classes_task_detail b,
|
|
|
+ attendance_classes_task act
|
|
|
+ WHERE
|
|
|
+ ac.classes_id = act.class_id
|
|
|
+ AND act.status_cd = '0'
|
|
|
+ AND act.task_id = b.task_id
|
|
|
+ AND b.state = '10000'
|
|
|
+ <if test="taskYear !=null and taskYear != ''">
|
|
|
+ and act.task_year= #{taskYear}
|
|
|
+ </if>
|
|
|
+ <if test="taskMonth !=null and taskMonth != ''">
|
|
|
+ and act.task_month= #{taskMonth}
|
|
|
+ </if>
|
|
|
+ ) noClockIn,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ attendance_classes_task_detail b,
|
|
|
+ attendance_classes_task act
|
|
|
+ WHERE
|
|
|
+ ac.classes_id = act.class_id
|
|
|
+ AND act.status_cd = '0'
|
|
|
+ AND act.task_id = b.task_id
|
|
|
+ AND b.state = '30000'
|
|
|
+ <if test="taskYear !=null and taskYear != ''">
|
|
|
+ and act.task_year= #{taskYear}
|
|
|
+ </if>
|
|
|
+ <if test="taskMonth !=null and taskMonth != ''">
|
|
|
+ and act.task_month= #{taskMonth}
|
|
|
+ </if>
|
|
|
+ ) clockIn,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ attendance_classes_task_detail b,
|
|
|
+ attendance_classes_task act
|
|
|
+ WHERE
|
|
|
+ ac.classes_id = act.class_id
|
|
|
+ AND act.status_cd = '0'
|
|
|
+ AND act.task_id = b.task_id
|
|
|
+ AND b.state = '40000'
|
|
|
+ <if test="taskYear !=null and taskYear != ''">
|
|
|
+ and act.task_year= #{taskYear}
|
|
|
+ </if>
|
|
|
+ <if test="taskMonth !=null and taskMonth != ''">
|
|
|
+ and act.task_month= #{taskMonth}
|
|
|
+ </if>
|
|
|
+ ) late,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ attendance_classes_task_detail b,
|
|
|
+ attendance_classes_task act
|
|
|
+ WHERE
|
|
|
+ ac.classes_id = act.class_id
|
|
|
+ AND act.status_cd = '0'
|
|
|
+ AND act.task_id = b.task_id
|
|
|
+ AND b.state = '50000'
|
|
|
+ <if test="taskYear !=null and taskYear != ''">
|
|
|
+ and act.task_year= #{taskYear}
|
|
|
+ </if>
|
|
|
+ <if test="taskMonth !=null and taskMonth != ''">
|
|
|
+ and act.task_month= #{taskMonth}
|
|
|
+ </if>
|
|
|
+ ) early,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ attendance_classes_task_detail b,
|
|
|
+ attendance_classes_task act
|
|
|
+ WHERE
|
|
|
+ ac.classes_id = act.class_id
|
|
|
+ AND act.status_cd = '0'
|
|
|
+ AND act.task_id = b.task_id
|
|
|
+ AND b.state = '60000'
|
|
|
+ <if test="taskYear !=null and taskYear != ''">
|
|
|
+ and act.task_year= #{taskYear}
|
|
|
+ </if>
|
|
|
+ <if test="taskMonth !=null and taskMonth != ''">
|
|
|
+ and act.task_month= #{taskMonth}
|
|
|
+ </if>
|
|
|
+ ) free
|
|
|
+ FROM
|
|
|
+ attendance_classes_staff t
|
|
|
+ INNER JOIN attendance_classes ac ON t.classes_id = ac.classes_id
|
|
|
+ AND ac.status_cd = '0'
|
|
|
+ LEFT JOIN u_user s ON t.staff_id = s.user_id
|
|
|
+ AND s.status_cd = '0'
|
|
|
+ LEFT JOIN u_org_staff_rel uosr ON uosr.staff_id = s.user_id
|
|
|
+ AND uosr.status_cd = '0'
|
|
|
+ LEFT JOIN u_org uo ON uosr.org_id = uo.org_id
|
|
|
+ AND uo.status_cd = '0'
|
|
|
+ WHERE
|
|
|
+ t.status_cd = '0'
|
|
|
<if test="staffName !=null and staffName != ''">
|
|
|
- and s.staff_name like concat('%',#{staffName},'%')
|
|
|
+ and t.staff_name like concat('%',#{staffName},'%')
|
|
|
</if>
|
|
|
<if test="departmentId !=null and departmentId != ''">
|
|
|
and uo.org_id = #{departmentId}
|
|
|
</if>
|
|
|
- <if test="taskId !=null and taskId != ''">
|
|
|
- and t.task_id= #{taskId}
|
|
|
- </if>
|
|
|
<if test="classId !=null and classId != ''">
|
|
|
- and t.class_id= #{classId}
|
|
|
+ and t.classes_id= #{classId}
|
|
|
</if>
|
|
|
<if test="staffId !=null and staffId != ''">
|
|
|
and t.staff_id= #{staffId}
|
|
|
</if>
|
|
|
- <if test="taskYear !=null and taskYear != ''">
|
|
|
- and t.task_year= #{taskYear}
|
|
|
- </if>
|
|
|
- <if test="taskMonth !=null and taskMonth != ''">
|
|
|
- and t.task_month= #{taskMonth}
|
|
|
+ <if test="storeId !=null and storeId != ''">
|
|
|
+ and t.store_id = #{storeId}
|
|
|
</if>
|
|
|
<if test="page != -1 and page != null ">
|
|
|
limit #{page}, #{row}
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getMonthAttendanceDetail" parameterType="Map" resultType="Map">
|
|
|
+ select t.detail_id detailId,t.spec_cd specCd,t.`value`,t.check_time checkTime,t.state,t.face_path facePath,t.create_time createTime,act.task_day taskDay
|
|
|
+ from attendance_classes_task_detail t
|
|
|
+ left join attendance_classes_task act on t.task_id = act.task_id and act.status_cd = '0'
|
|
|
+ where
|
|
|
+ t.status_cd = '0'
|
|
|
+ and act.class_id = #{classId}
|
|
|
+ and act.staff_id in
|
|
|
+ <foreach collection="staffIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ <if test="taskYear !=null and taskYear != ''">
|
|
|
+ and act.task_year= #{taskYear}
|
|
|
+ </if>
|
|
|
+ <if test="taskMonth !=null and taskMonth != ''">
|
|
|
+ and act.task_month= #{taskMonth}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|