8 changed files with 56 additions and 3 deletions
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using Pingchuan.BeijingSafeguard.DAL; |
||||
|
using Pingchuan.BeijingSafeguard.Model; |
||||
|
|
||||
|
namespace Pingchuan.BeijingSafeguard.BLL |
||||
|
{ |
||||
|
public class ComputeBLL |
||||
|
{ |
||||
|
public static Pagination<Statistic> Statistics(DateTime fromTime, DateTime toTime, int pageIndex, int pageSize) |
||||
|
{ |
||||
|
return ComputeDAL.Statistics(fromTime, toTime, pageIndex, pageSize); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using PetaPoco; |
||||
|
using Pingchuan.BeijingSafeguard.Model; |
||||
|
|
||||
|
namespace Pingchuan.BeijingSafeguard.DAL |
||||
|
{ |
||||
|
public class ComputeDAL : BaseDAL |
||||
|
{ |
||||
|
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); |
||||
|
return Pagination<Statistic>.FromPage(page); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
using System; |
||||
|
using PetaPoco; |
||||
|
|
||||
|
namespace Pingchuan.BeijingSafeguard.Model |
||||
|
{ |
||||
|
public class Statistic |
||||
|
{ |
||||
|
[Column("user_id")] |
||||
|
public int UserId { get; set; } |
||||
|
|
||||
|
[Column("compute_count")] |
||||
|
public int ComputeCount { get; set; } |
||||
|
|
||||
|
[Column("last_compute_time")] |
||||
|
public DateTime LastComputeTime { get; set; } |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue