|
|
@ -8,11 +8,14 @@ namespace Pingchuan.BeijingSafeguard.DAL |
|
|
|
{ |
|
|
|
public static Pagination<Statistic> Statistics(DateTime fromTime, DateTime toTime, int pageIndex, int pageSize) |
|
|
|
{ |
|
|
|
string sql = $@"select user_id, count(*) total_count, max(create_time) last_time from computes
|
|
|
|
where create_time >= @0 and create_time <= @1 |
|
|
|
group by user_id";
|
|
|
|
Page<Statistic> page = db.Page<Statistic>(pageIndex, pageSize, sql, pageIndex, pageSize); |
|
|
|
string sql = $@"select temp.*, u.real_name user_name, o.id org_id, o.name org_name from (
|
|
|
|
select user_id, count(*) total_count, max(create_time) last_time from computes |
|
|
|
where create_time >= @0 and create_time < @1 |
|
|
|
group by user_id) temp |
|
|
|
left join users u on u.id = temp.user_id |
|
|
|
left join orgs o on o.id = u.id";
|
|
|
|
Page<Statistic> page = db.Page<Statistic>(pageIndex, pageSize, sql, fromTime, toTime, pageIndex, pageSize); |
|
|
|
return Pagination<Statistic>.FromPage(page); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |