using Newtonsoft.Json.Linq;
namespace Cis.Application.Cm;
///
/// 标记分组服务
///
[ApiDescriptionSettings(CmInfo.GroupName, Order = CmInfo.GroupOrder)]
public class CmMarkGroupService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository _cmMarkGroupRep;
public CmMarkGroupService(SqlSugarRepository cmMarkGroupRep)
{
_cmMarkGroupRep = cmMarkGroupRep;
}
[HttpPost]
public async Task Add(CmMarkGroup entity)
{
await _cmMarkGroupRep.InsertAsync(entity);
}
[HttpPost]
public async Task Update(CmMarkGroup entity)
{
await _cmMarkGroupRep.UpdateAsync(entity);
}
[HttpPost]
public async Task Delete(CmMarkGroup entity)
{
await _cmMarkGroupRep.DeleteAsync(entity);
}
[HttpGet]
public async Task Get(long id)
{
CmMarkGroup entity = await _cmMarkGroupRep.GetByIdAsync(id);
return entity;
}
[HttpGet]
public async Task> GetList(string queryJson)
{
JObject queryObj = queryJson.ToJObject();
List list = await _cmMarkGroupRep.AsQueryable()
.ToListAsync();
return list;
}
[HttpGet]
public async Task> GetPageList(string queryJson, string pagination)
{
Pagination pageObj = pagination.ToObject();
JObject queryObj = queryJson.ToJObject();
List list = await _cmMarkGroupRep.AsQueryable()
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}
}