java110
2023-05-29 2e58c159ce00b874640172a026a3e44f018a69a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?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="reportAttendanceServiceDaoImpl">
 
    <!-- 查询实收金额 -->
    <select id="getMonthAttendanceCount" parameterType="Map" resultType="Map">
        select count(1) count 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'
        <if test="departmentId !=null and departmentId != ''">
            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'
        </if>
        WHERE
        t.status_cd = '0'
        <if test="staffName !=null and staffName != ''">
            and t.staff_name like concat('%',#{staffName},'%')
        </if>
        <if test="departmentId !=null and departmentId != ''">
            and uo.org_id = #{departmentId}
        </if>
        <if test="classId !=null and classId != ''">
            and t.classes_id= #{classId}
        </if>
        <if test="staffId !=null and staffId != ''">
            and t.staff_id= #{staffId}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id = #{storeId}
        </if>
    </select>
 
    <!-- 查询房屋个数 add by wuxw 2018-07-03 -->
    <select id="getMonthAttendance" parameterType="Map" resultType="Map">
        SELECT
        t.staff_name staffName,
        t.staff_id staffId,
        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 act.staff_id = t.staff_id
        AND b.state = '10000'
        and b.value &lt; now()
        <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 act.staff_id = t.staff_id
        AND b.state in ('30000','70000')
        <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 act.staff_id = t.staff_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 act.staff_id = t.staff_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 act.staff_id = t.staff_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'
        <if test="departmentId !=null and departmentId != ''">
            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'
        </if>
        WHERE
        t.status_cd = '0'
        <if test="staffName !=null and staffName != ''">
            and t.staff_name like concat('%',#{staffName},'%')
        </if>
        <if test="departmentId !=null and departmentId != ''">
            and uo.org_id = #{departmentId}
        </if>
        <if test="classId !=null and classId != ''">
            and t.classes_id= #{classId}
        </if>
        <if test="staffId !=null and staffId != ''">
            and t.staff_id= #{staffId}
        </if>
        <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,
        td.`name` stateName,act.staff_id staffId
        from attendance_classes_task_detail t
        left join attendance_classes_task act on t.task_id = act.task_id and act.status_cd = '0'
        left join t_dict td on t.state = td.status_cd and td.table_name = 'attendance_classes_task_detail' and td.table_columns = 'state'
        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>
        order by t.`value`
    </select>
</mapper>