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.7 KiB

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