select count(*) total_lines from (
select @y:=@y+1 num, c.* from (
select b.depart_no, b.depart_name, sum(a.accept_money)/100 total_money
from tsc_accept a
left join tbosc_sc_base b on a.sc_no = b.sc_no
where (b.close_date is null or year(b.close_date)>=${year(p_sign_date)})
and year(a.accept_date)=${year(p_sign_date)} and a.accept_date<='${p_sign_date}'
and ${rights("b.depart_no",hierarchy,'',departs)}
group by b.depart_no,b.depart_name
)c, (SELECT @y:=0) z
order by c.total_money desc
) t