SELECT w.pjt_id pid,d.description pName,u.realname pidName,w.yearmonth <#if (wageEntity.attType)?? && wageEntity.attType != 0> ,round(avg(w.unit_people_total)) peopleTotal,sum(w.wage_pay_total) wagePayTotal <#if (wageEntity.attType)?? && wageEntity.attType == 0> ,w.unit_people_total peopleTotal,w.wage_pay_total wagePayTotal from t_bus_proj_wage_statistics w LEFT JOIN t_s_depart d ON w.pjt_id = d.ID LEFT JOIN t_s_base_user u ON w.pm_id = u.ID where 1=1 <#if (wageEntity.attType)?? && wageEntity.attType == 2> and w.yearmonth like CONCAT('%', :wageEntity.attYear ,'%') <#if (wageEntity.attType)?? && wageEntity.attType != 2> <#if ( wageEntity.yearMonthList )?? && wageEntity.yearMonthList ?size gt 0> and w.yearmonth in( <#list wageEntity.yearMonthList as item> '${item}' <#if item_has_next>, ) <#if (wageEntity.attType)?? && wageEntity.attType != 0> GROUP BY w.pjt_id order by wagePayTotal desc