Camera Information System
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.5 KiB

using Newtonsoft.Json.Linq;
namespace Cis.Application.Cm;
/// <summary>
/// 标记分组服务
/// </summary>
[ApiDescriptionSettings(CmInfo.GroupName, Order = CmInfo.GroupOrder)]
public class CmMarkGroupService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<CmMarkGroup> _cmMarkGroupRep;
public CmMarkGroupService(SqlSugarRepository<CmMarkGroup> cmMarkGroupRep)
{
_cmMarkGroupRep = cmMarkGroupRep;
}
[HttpPost]
public async Task<bool> Add([FromForm] CmMarkGroup entity)
{
return await _cmMarkGroupRep.InsertAsync(entity);
}
[HttpPost]
public async Task<bool> Update([FromForm] CmMarkGroup entity)
{
return await _cmMarkGroupRep.UpdateAsync(entity);
}
[HttpPost]
public async Task<bool> Delete([FromForm] CmMarkGroup entity)
{
return await _cmMarkGroupRep.DeleteAsync(entity);
}
[HttpGet]
public async Task<CmMarkGroup> Get(long id)
{
CmMarkGroup entity = await _cmMarkGroupRep.GetByIdAsync(id);
return entity;
}
[HttpGet]
public async Task<List<CmMarkGroup>> GetList(string queryJson)
{
JObject queryObj = queryJson.ToJObject();
List<CmMarkGroup> list = await _cmMarkGroupRep.AsQueryable()
.ToListAsync();
return list;
}
[HttpGet]
public async Task<List<CmMarkGroup>> GetPageList(string queryJson, string pagination)
{
Pagination pageObj = pagination.ToObject<Pagination>();
JObject queryObj = queryJson.ToJObject();
List<CmMarkGroup> list = await _cmMarkGroupRep.AsQueryable()
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}
}