using Newtonsoft.Json.Linq;
namespace Cis.Application.Sys;
///
/// 系统字典值服务
///
[ApiDescriptionSettings(SysInfo.GroupName, Order = SysInfo.GroupOrder)]
public class SysDictDataService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository _sysDictDataRep;
public SysDictDataService(SqlSugarRepository sysDictDataRep)
{
_sysDictDataRep = sysDictDataRep;
}
public async Task Get(long id)
{
SysDictData entity = await _sysDictDataRep.GetByIdAsync(id);
return entity;
}
public async Task> GetList(string queryJson)
{
JObject queryObj = queryJson.ToJObject();
List list = await _sysDictDataRep.AsQueryable()
.ToListAsync();
return list;
}
public async Task> GetPageList(string queryJson, string pagination)
{
Pagination pageObj = pagination.ToObject();
JObject queryObj = queryJson.ToJObject();
List list = await _sysDictDataRep.AsQueryable()
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}
public async Task Add(SysDictData entity)
{
await _sysDictDataRep.InsertAsync(entity);
}
public async Task Update(SysDictData entity)
{
await _sysDictDataRep.UpdateAsync(entity);
}
public async Task Delete(SysDictData entity)
{
await _sysDictDataRep.DeleteAsync(entity);
}
}