ReportAttendanceServiceDaoImplMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="reportAttendanceServiceDaoImpl">
  6. <!-- 查询实收金额 -->
  7. <select id="getMonthAttendanceCount" parameterType="Map" resultType="Map">
  8. select count(1) count from (
  9. select distinct t.staff_id
  10. from attendance_classes_task t
  11. left join u_user s on t.staff_id = s.user_id and s.status_cd = '0'
  12. left join u_org_staff_rel uosr on uosr.staff_id = s.user_id and uosr.status_cd = '0'
  13. left join u_org uo on uosr.org_id = uo.org_id and uo.status_cd = '0'
  14. where 1 =1
  15. and t.status_cd = '0'
  16. <if test="staffName !=null and staffName != ''">
  17. and s.staff_name like concat('%',#{staffName},'%')
  18. </if>
  19. <if test="departmentId !=null and departmentId != ''">
  20. and uo.org_id = #{departmentId}
  21. </if>
  22. <if test="taskId !=null and taskId != ''">
  23. and t.task_id= #{taskId}
  24. </if>
  25. <if test="classId !=null and classId != ''">
  26. and t.class_id= #{classId}
  27. </if>
  28. <if test="staffId !=null and staffId != ''">
  29. and t.staff_id= #{staffId}
  30. </if>
  31. <if test="taskYear !=null and taskYear != ''">
  32. and t.task_year= #{taskYear}
  33. </if>
  34. <if test="taskMonth !=null and taskMonth != ''">
  35. and t.task_month= #{taskMonth}
  36. </if>
  37. ) tt
  38. </select>
  39. <!-- 查询房屋个数 add by wuxw 2018-07-03 -->
  40. <select id="getMonthAttendance" parameterType="Map" resultType="Map">
  41. SELECT
  42. t.staff_name staffName,
  43. t.staff_id staffId,
  44. uo.org_name departmentName,
  45. t.classes_id classesId,
  46. ac.classes_name classesName,
  47. (
  48. SELECT
  49. count(1)
  50. FROM
  51. attendance_classes_task_detail b,
  52. attendance_classes_task act
  53. WHERE
  54. ac.classes_id = act.class_id
  55. AND act.status_cd = '0'
  56. AND act.task_id = b.task_id
  57. AND b.state = '10000'
  58. and b.value &lt; now()
  59. <if test="taskYear !=null and taskYear != ''">
  60. and act.task_year= #{taskYear}
  61. </if>
  62. <if test="taskMonth !=null and taskMonth != ''">
  63. and act.task_month= #{taskMonth}
  64. </if>
  65. ) noClockIn,
  66. (
  67. SELECT
  68. count(1)
  69. FROM
  70. attendance_classes_task_detail b,
  71. attendance_classes_task act
  72. WHERE
  73. ac.classes_id = act.class_id
  74. AND act.status_cd = '0'
  75. AND act.task_id = b.task_id
  76. AND b.state in ('30000','70000')
  77. <if test="taskYear !=null and taskYear != ''">
  78. and act.task_year= #{taskYear}
  79. </if>
  80. <if test="taskMonth !=null and taskMonth != ''">
  81. and act.task_month= #{taskMonth}
  82. </if>
  83. ) clockIn,
  84. (
  85. SELECT
  86. count(1)
  87. FROM
  88. attendance_classes_task_detail b,
  89. attendance_classes_task act
  90. WHERE
  91. ac.classes_id = act.class_id
  92. AND act.status_cd = '0'
  93. AND act.task_id = b.task_id
  94. AND b.state = '40000'
  95. <if test="taskYear !=null and taskYear != ''">
  96. and act.task_year= #{taskYear}
  97. </if>
  98. <if test="taskMonth !=null and taskMonth != ''">
  99. and act.task_month= #{taskMonth}
  100. </if>
  101. ) late,
  102. (
  103. SELECT
  104. count(1)
  105. FROM
  106. attendance_classes_task_detail b,
  107. attendance_classes_task act
  108. WHERE
  109. ac.classes_id = act.class_id
  110. AND act.status_cd = '0'
  111. AND act.task_id = b.task_id
  112. AND b.state = '50000'
  113. <if test="taskYear !=null and taskYear != ''">
  114. and act.task_year= #{taskYear}
  115. </if>
  116. <if test="taskMonth !=null and taskMonth != ''">
  117. and act.task_month= #{taskMonth}
  118. </if>
  119. ) early,
  120. (
  121. SELECT
  122. count(1)
  123. FROM
  124. attendance_classes_task_detail b,
  125. attendance_classes_task act
  126. WHERE
  127. ac.classes_id = act.class_id
  128. AND act.status_cd = '0'
  129. AND act.task_id = b.task_id
  130. AND b.state = '60000'
  131. <if test="taskYear !=null and taskYear != ''">
  132. and act.task_year= #{taskYear}
  133. </if>
  134. <if test="taskMonth !=null and taskMonth != ''">
  135. and act.task_month= #{taskMonth}
  136. </if>
  137. ) free
  138. FROM
  139. attendance_classes_staff t
  140. INNER JOIN attendance_classes ac ON t.classes_id = ac.classes_id
  141. AND ac.status_cd = '0'
  142. LEFT JOIN u_user s ON t.staff_id = s.user_id
  143. AND s.status_cd = '0'
  144. LEFT JOIN u_org_staff_rel uosr ON uosr.staff_id = s.user_id
  145. AND uosr.status_cd = '0'
  146. LEFT JOIN u_org uo ON uosr.org_id = uo.org_id
  147. AND uo.status_cd = '0'
  148. WHERE
  149. t.status_cd = '0'
  150. <if test="staffName !=null and staffName != ''">
  151. and t.staff_name like concat('%',#{staffName},'%')
  152. </if>
  153. <if test="departmentId !=null and departmentId != ''">
  154. and uo.org_id = #{departmentId}
  155. </if>
  156. <if test="classId !=null and classId != ''">
  157. and t.classes_id= #{classId}
  158. </if>
  159. <if test="staffId !=null and staffId != ''">
  160. and t.staff_id= #{staffId}
  161. </if>
  162. <if test="storeId !=null and storeId != ''">
  163. and t.store_id = #{storeId}
  164. </if>
  165. <if test="page != -1 and page != null ">
  166. limit #{page}, #{row}
  167. </if>
  168. </select>
  169. <select id="getMonthAttendanceDetail" parameterType="Map" resultType="Map">
  170. 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
  171. from attendance_classes_task_detail t
  172. left join attendance_classes_task act on t.task_id = act.task_id and act.status_cd = '0'
  173. left join t_dict td on t.state = td.status_cd and td.table_name = 'attendance_classes_task_detail' and td.table_columns = 'state'
  174. where
  175. t.status_cd = '0'
  176. and act.class_id = #{classId}
  177. and act.staff_id in
  178. <foreach collection="staffIds" item="item" index="index" open="(" close=")" separator=",">
  179. #{item}
  180. </foreach>
  181. <if test="taskYear !=null and taskYear != ''">
  182. and act.task_year= #{taskYear}
  183. </if>
  184. <if test="taskMonth !=null and taskMonth != ''">
  185. and act.task_month= #{taskMonth}
  186. </if>
  187. order by t.`value`
  188. </select>
  189. </mapper>