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