You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.4 KiB
63 lines
2.4 KiB
using Cis.Core.Common;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace Cis.Application.Cm;
|
|
|
|
/// <summary>
|
|
/// 标记分组服务
|
|
/// </summary>
|
|
[ApiDescriptionSettings(CmInfo.GroupName, Order = CmInfo.GroupOrder)]
|
|
public class CmMarkGroupService : ServiceBase<CmMarkGroup>, ITransient
|
|
{
|
|
public CmMarkGroupService(SqlSugarRepository<CmMarkGroup> baseRep) : base(baseRep)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="queryJson">like:name; between:[startTime,endTime];</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public override async Task<List<CmMarkGroup>> GetList(string queryJson)
|
|
{
|
|
JObject queryObj = queryJson.ToJObject();
|
|
|
|
var exp = Expressionable.Create<CmMarkGroup>();
|
|
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
|
|
exp.And(it => it.Name.Contains(name.ToString()));
|
|
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
|
|
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
|
|
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
|
|
|
|
var list = await _baseRep.AsQueryable()
|
|
.Where(exp.ToExpression())
|
|
.ToListAsync();
|
|
return list;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="queryJson">like:name; between:[startTime,endTime];</param>
|
|
/// <param name="pagination">index,size</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public override async Task<List<CmMarkGroup>> GetPageList(string queryJson, string pagination)
|
|
{
|
|
Pagination pageObj = pagination.ToObject<Pagination>();
|
|
JObject queryObj = queryJson.ToJObject();
|
|
|
|
var exp = Expressionable.Create<CmMarkGroup>();
|
|
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
|
|
exp.And(it => it.Name.Contains(name.ToString()));
|
|
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
|
|
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
|
|
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
|
|
|
|
var list = await _baseRep.AsQueryable()
|
|
.Where(exp.ToExpression())
|
|
.ToPageListAsync(pageObj.Index, pageObj.Size);
|
|
return list;
|
|
}
|
|
}
|