UserWageMinidaoDao_getViewEntities.sql 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. select
  2. IF(dt.org_type=1 or dt.org_type =4,'其他管理层',dt.departname ) as belongUnitname,
  3. dt.id as belongUnitid,
  4. w.monthly as monthly,
  5. COUNT(w.pjt_id) as sumcount,
  6. SUM(w.basic_wage) as basic_wage,
  7. SUM(w.duties_allowance) as duties_allowance,
  8. SUM(IFNULL(w.certificate_subsidy,0.00)+IFNULL(w.traffic_subsidy,0.00)+IFNULL(w.megathermal_subsidy,0.00)
  9. +IFNULL(w.only_child_cost,0.00)+IFNULL(w.other_subsidy,0.00)) as certificate_subsidy,
  10. SUM(IFNULL(w.project_performance,0.00)+IFNULL(w.bonus,0.00)) as project_performance,
  11. SUM(IFNULL(w.meals_subsidy_day,0.00)+IFNULL(w.meals_subsidy_night,0.00)+IFNULL(w.meals_subsidy,0.00)) as meals_subsidy,
  12. sum(IFNULL(w.overtimepay_timeout,0.00)+IFNULL(w.overtimepay_fixed,0.00)+IFNULL(w.duty+w.special_overtime,0.00)) as special_overtime,
  13. SUM(IFNULL(w.absence_debit,0.00)+IFNULL(w.sick_leave_debit,0.00)+IFNULL(w.thing_leave_debit,0.00)) as absence_debit,
  14. SUM(IFNULL(w.payment_subsidy,0.00)) as payment_subsidy,
  15. SUM(IFNULL(w.social_security_debit,0.00)+IFNULL(w.provident_fund_debit,0.00)) as deductions,
  16. SUM(IFNULL(w.com_social_security_debit,0.00)+IFNULL(w.com_provident_fund_debit,0.00)) as comDeductions,
  17. SUM(IFNULL(w.comcost,0.00)) as com_cost,
  18. SUM(daikou_debit) daikou_debit,
  19. SUM(w.other_debit) as other_debit,
  20. SUM(w.reissue) as reissue ,
  21. SUM(w.pre_tax_mone) as pre_tax_mone,
  22. SUM(w.tax_money) as tax_money,
  23. SUM(w.actual_money) as actual_money
  24. from t_bus_user_wage w LEFT JOIN t_s_base_user u on w.userid= u.ID and u.delete_flag='0'
  25. left join t_s_user_org uo on u.id = uo.user_id and uo.ifpluralism = 0 and uo.status= 0
  26. LEFT JOIN t_s_depart dt on w.pjt_id = dt.id
  27. LEFT JOIN t_s_depart d on uo.org_id = d.ID where 1=1 and u.delete_flag='0'
  28. <#if ( userWageViewDto.orgIdList )?? && userWageViewDto.orgIdList ?size gt 0>
  29. /* 所属单位*/
  30. and w.pjt_id in(
  31. <#list userWageViewDto.orgIdList as item>
  32. '${item}'
  33. <#if item_has_next>,</#if>
  34. </#list>
  35. )
  36. </#if>
  37. <#if ( userWageViewDto.monthly )?? && userWageViewDto.monthly ?length gt 0>
  38. /* 申请状态*/
  39. and w.monthly = :userWageViewDto.monthly
  40. </#if>
  41. <#if ( uidList )?? && uidList ?size gt 0>
  42. /* 可见的用户id */
  43. and u.id in(
  44. <#list uidList as item>
  45. '${item}'
  46. <#if item_has_next>,</#if>
  47. </#list>
  48. )
  49. </#if>
  50. GROUP BY belongUnitname