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