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