using Newtonsoft.Json.Linq;
namespace Cis.Application.Cb;
///
/// 相机服务
///
[ApiDescriptionSettings(CbInfo.GroupName, Order = CbInfo.GroupOrder)]
public class CbCameraService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository _cbCameraRep;
public CbCameraService(SqlSugarRepository cbCameraRep)
{
_cbCameraRep = cbCameraRep;
}
[HttpPost]
public async Task Add([FromForm] CbCamera entity)
{
return await _cbCameraRep.InsertAsync(entity);
}
[HttpPost]
public async Task Update([FromForm] CbCamera entity)
{
return await _cbCameraRep.UpdateAsync(entity);
}
[HttpPost]
public async Task Delete([FromForm] CbCamera entity)
{
return await _cbCameraRep.DeleteAsync(entity);
}
[HttpGet]
public async Task Get(long id)
{
CbCamera entity = await _cbCameraRep.GetByIdAsync(id);
return entity;
}
[HttpGet]
public async Task> GetList(string queryJson = "")
{
JObject queryObj = queryJson.ToJObject();
List list = await _cbCameraRep.AsQueryable()
.ToListAsync();
return list;
}
[HttpGet]
public async Task> GetPageList(string queryJson, string pagination)
{
Pagination pageObj = pagination.ToObject();
JObject queryObj = queryJson.ToJObject();
List list = await _cbCameraRep.AsQueryable()
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}
}