import { DataSource } from 'typeorm';

export async function handler(dataSource: DataSource) {
  return dataSource.query(`
    select
      count(u.id) as value
      ,o.name
    from user u 
    left join role r 
    on u.role_id = r.id 
    left join org o 
    on u.org_id = o.id 
    where u.del_flag = 0 and r.base = 3
    group by u.org_id 
  `);
}
