You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.6 KiB
61 lines
1.6 KiB
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> _baseRep;
|
|
|
|
public SysDictDataService(SqlSugarRepository<SysDictData> baseRep)
|
|
{
|
|
_baseRep = baseRep;
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<bool> Add([FromForm] SysDictData entity)
|
|
{
|
|
return await _baseRep.InsertAsync(entity);
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<bool> Update([FromForm] SysDictData entity)
|
|
{
|
|
return await _baseRep.UpdateAsync(entity);
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<bool> Delete([FromForm] SysDictData entity)
|
|
{
|
|
return await _baseRep.DeleteAsync(entity);
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<SysDictData> Get(long id)
|
|
{
|
|
SysDictData entity = await _baseRep.GetByIdAsync(id);
|
|
return entity;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<List<SysDictData>> GetList(string queryJson)
|
|
{
|
|
JObject queryObj = queryJson.ToJObject();
|
|
List<SysDictData> list = await _baseRep.AsQueryable()
|
|
.ToListAsync();
|
|
return list;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<List<SysDictData>> GetPageList(string queryJson, string pagination)
|
|
{
|
|
Pagination pageObj = pagination.ToObject<Pagination>();
|
|
JObject queryObj = queryJson.ToJObject();
|
|
List<SysDictData> list = await _baseRep.AsQueryable()
|
|
.ToPageListAsync(pageObj.Index, pageObj.Size);
|
|
return list;
|
|
}
|
|
}
|