using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Ropin.Inspection.Api.Common; using Ropin.Inspection.Model; using Ropin.Inspection.Service.TAIC; using Ropin.Inspection.Service.TAIC.Interface; using System.Threading.Tasks; namespace Ropin.Inspection.Api.Controllers.TAIC { /// /// ai盒子模板表 /// public class TaicAIBoxTemplateController : BaseController { private readonly ITaicAIBoxTemplateService _taicAIBoxTemplateService; public TaicAIBoxTemplateController(ITaicAIBoxTemplateService taicAIBoxTemplateService) { _taicAIBoxTemplateService = taicAIBoxTemplateService; } /// /// 获取模板分页列表 /// /// /// [HttpPost("GetTemplatePage")] public async Task GetTemplatePage(TaicTemplateSearchModel searchModel) { var taicTemplates =await _taicAIBoxTemplateService.GetTemplatePage(searchModel); PagesModel datas = new PagesModel(taicTemplates, searchModel); return new ApiResult>(datas); } [HttpGet("GetTemplate/{id}")] public async Task GetTemplate(string id) { TaicTemplateModel taicTemplate = await _taicAIBoxTemplateService.GetTemplate(id); return new ApiResult(taicTemplate); } /// /// 新增模板 /// /// /// [HttpPost("AddTempalte")] public async Task AddTempalte(TaicTemplateModel templateModel) { await _taicAIBoxTemplateService.CreateOneAsync(templateModel); return new ApiResult(ReturnCode.Success); } /// /// 删除模板 /// /// /// [HttpDelete("DelTempalte/{id}")] public async Task DelTempalte(string id) { await _taicAIBoxTemplateService.DeleteAsync(id); return new ApiResult(ReturnCode.Success); } /// /// 更新模板 /// /// /// /// [HttpPost("UpdateTemplate/{id}")] public async Task UpdateTemplate(string id, TaicTemplateModel templateModel) { await _taicAIBoxTemplateService.UpdateTemplate(id,templateModel); return new ApiResult(true,ReturnCode.Success); } /// /// 获取AI盒子分页列表 /// /// /// [HttpPost("GetAiBoxPage")] public async Task GetAiBoxPage(AiBoxSearchModel searchModel) { var aiBoxModels = await _taicAIBoxTemplateService.GetAiBoxPage(searchModel); PagesModel datas = new PagesModel(aiBoxModels, searchModel); return new ApiResult>(datas); } [HttpGet("GetAiBox/{id}")] public async Task GetAiBox(string id) { AiBoxModel aiBoxModel = await _taicAIBoxTemplateService.GetAiBox(id); return new ApiResult(aiBoxModel); } /// /// 新增ai盒子 /// /// /// [HttpPost("AddAiBox")] public async Task AddAiBox(AiBoxModel aiBoxModel) { var result =await _taicAIBoxTemplateService.AddAiBox(aiBoxModel); return new ApiResult(result,ReturnCode.Success); } /// /// 删除盒子 /// /// /// [HttpDelete("DelAiBox/{id}")] public async Task DelAiBox(string id) { await _taicAIBoxTemplateService.DelAiBox(id); return new ApiResult(ReturnCode.Success); } /// /// 更新盒子 /// /// /// /// [HttpPost("UpdateAiBox/{id}")] public async Task UpdateAiBox(string id, AiBoxModel aiBoxModel) { var result=await _taicAIBoxTemplateService.UpdateAiBox(id, aiBoxModel); return new ApiResult(result, ReturnCode.Success); } /// /// 关联盒子/摄像头 /// /// /// [HttpPost("AddDevAIBox")] public async Task AddDevAIBox(DevAiboxModel devAiboxModel) { var result = await _taicAIBoxTemplateService.AddDevAIBox(devAiboxModel); return new ApiResult(result, ReturnCode.Success); } } }