OvertimeStatsMinidaoDao_userOvertimeStatsData.sql 1.0 KB

123456789101112131415161718192021
  1. SELECT
  2. uat.user_id userId, uat.yearmonth yearmonth, uat.pid pjtId, uat.departid deptId,uat.pmId pmId,
  3. overtime_total_time overtimeDuration,
  4. datum_attendance_date datumWorkDuration,
  5. CONVERT(overtimeFee ,decimal(10,2)) overtimeFee
  6. from
  7. (
  8. SELECT uat.id,bos.multiple,uat.user_id ,uat.pid,uat.departid ,uat.yearmonth,d.dept_proj_managerid pmId,
  9. IFNULL(uat.overtime_total_time,0) overtime_total_time,IFNULL(uat.datum_attendance_date,0) datum_attendance_date,
  10. (IFNULL(uw.overtimepay_fixed, 0) + IFNULL(uw.overtimepay_timeout, 0) + IFNULL(uw.special_overtime,0)) overtimeFee
  11. from t_bus_user_attendance_total uat
  12. LEFT JOIN t_bus_user_wage uw
  13. ON uat.user_id = uw.userid and uat.yearmonth = uw.monthly
  14. LEFT JOIN t_bus_user_wagestrategy uws
  15. ON uat.user_id = uws.userid
  16. LEFT JOIN t_bus_overtimepay_strategy bos
  17. ON uws.overtimepay_strategyid = bos.id
  18. LEFT JOIN t_s_depart d
  19. ON uat.pid = d.ID
  20. ) uat
  21. WHERE uat.yearmonth =:params.yearmonth AND uat.pid != '' and overtime_total_time != 0 order by overtimeDuration desc