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