package com.ruoyi.aibrain.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.aibrain.domain.AiCameraRule; import com.ruoyi.aibrain.service.IAiCameraRuleService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 设备算法规则Controller * * @author wf * @date 2023-03-08 */ @RestController @RequestMapping("/aibrain/cameraRule") public class AiCameraRuleController extends BaseController { @Autowired private IAiCameraRuleService aiCameraRuleService; /** * 查询设备算法规则列表 */ @PreAuthorize("@ss.hasPermi('aibrain:cameraRule:list')") @GetMapping("/list") public TableDataInfo list(AiCameraRule aiCameraRule) { startPage(); List list = aiCameraRuleService.selectAiCameraRuleList(aiCameraRule); return getDataTable(list); } /** * 导出设备算法规则列表 */ @PreAuthorize("@ss.hasPermi('aibrain:cameraRule:export')") @Log(title = "设备算法规则", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, AiCameraRule aiCameraRule) { List list = aiCameraRuleService.selectAiCameraRuleList(aiCameraRule); ExcelUtil util = new ExcelUtil(AiCameraRule.class); util.exportExcel(response, list, "设备算法规则数据"); } /** * 获取设备算法规则详细信息 */ @PreAuthorize("@ss.hasPermi('aibrain:cameraRule:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(aiCameraRuleService.selectAiCameraRuleById(id)); } /** * 新增设备算法规则 */ @PreAuthorize("@ss.hasPermi('aibrain:cameraRule:add')") @Log(title = "设备算法规则", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody AiCameraRule aiCameraRule) { return toAjax(aiCameraRuleService.insertAiCameraRule(aiCameraRule)); } /** * 修改设备算法规则 */ @PreAuthorize("@ss.hasPermi('aibrain:cameraRule:edit')") @Log(title = "设备算法规则", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody AiCameraRule aiCameraRule) { return toAjax(aiCameraRuleService.updateAiCameraRule(aiCameraRule)); } /** * 删除设备算法规则 */ @PreAuthorize("@ss.hasPermi('aibrain:cameraRule:remove')") @Log(title = "设备算法规则", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(aiCameraRuleService.deleteAiCameraRuleByIds(ids)); } }