select IF(dt.org_type=1 or dt.org_type =4,'其他管理层',dt.departname ) as belongUnitname, dt.id as belongUnitid, w.monthly as monthly, COUNT(w.pjt_id) as sumcount, SUM(w.basic_wage) as basic_wage, SUM(w.duties_allowance) as duties_allowance, SUM(IFNULL(w.certificate_subsidy,0.00)+IFNULL(w.traffic_subsidy,0.00)+IFNULL(w.megathermal_subsidy,0.00) +IFNULL(w.only_child_cost,0.00)+IFNULL(w.other_subsidy,0.00)) as certificate_subsidy, SUM(IFNULL(w.project_performance,0.00)+IFNULL(w.bonus,0.00)) as project_performance, SUM(IFNULL(w.meals_subsidy_day,0.00)+IFNULL(w.meals_subsidy_night,0.00)+IFNULL(w.meals_subsidy,0.00)) as meals_subsidy, sum(IFNULL(w.overtimepay_timeout,0.00)+IFNULL(w.overtimepay_fixed,0.00)+IFNULL(w.duty+w.special_overtime,0.00)) as special_overtime, SUM(IFNULL(w.absence_debit,0.00)+IFNULL(w.sick_leave_debit,0.00)+IFNULL(w.thing_leave_debit,0.00)) as absence_debit, SUM(IFNULL(w.payment_subsidy,0.00)) as payment_subsidy, SUM(IFNULL(w.social_security_debit,0.00)+IFNULL(w.provident_fund_debit,0.00)) as deductions, SUM(IFNULL(w.com_social_security_debit,0.00)+IFNULL(w.com_provident_fund_debit,0.00)) as comDeductions, SUM(IFNULL(w.comcost,0.00)) as com_cost, SUM(daikou_debit) daikou_debit, SUM(w.other_debit) as other_debit, SUM(w.reissue) as reissue , SUM(w.pre_tax_mone) as pre_tax_mone, SUM(w.tax_money) as tax_money, SUM(w.actual_money) as actual_money from t_bus_user_wage w LEFT JOIN t_s_base_user u on w.userid= u.ID and u.delete_flag='0' left join t_s_user_org uo on u.id = uo.user_id and uo.ifpluralism = 0 and uo.status= 0 LEFT JOIN t_s_depart dt on w.pjt_id = dt.id LEFT JOIN t_s_depart d on uo.org_id = d.ID where 1=1 and u.delete_flag='0' <#if ( userWageViewDto.orgIdList )?? && userWageViewDto.orgIdList ?size gt 0> /* 所属单位*/ and w.pjt_id in( <#list userWageViewDto.orgIdList as item> '${item}' <#if item_has_next>, ) <#if ( userWageViewDto.monthly )?? && userWageViewDto.monthly ?length gt 0> /* 申请状态*/ and w.monthly = :userWageViewDto.monthly <#if ( uidList )?? && uidList ?size gt 0> /* 可见的用户id */ and u.id in( <#list uidList as item> '${item}' <#if item_has_next>, ) GROUP BY belongUnitname