package com.ruoyi.envaccess.controller;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.envaccess.pojo.EnvInspection;
|
import com.ruoyi.envaccess.service.IEnvInspectionService;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.List;
|
|
/**
|
* 环保门禁--智能巡检台账(含路径规划/AI视频分析/报告/无人机机器人,AI与无人机字段预留)
|
*/
|
@RestController
|
@RequestMapping("/environmentAccess/inspection")
|
public class EnvInspectionController {
|
|
@Resource
|
private IEnvInspectionService envInspectionService;
|
|
@GetMapping("/page")
|
public AjaxResult page(Page page, EnvInspection req) {
|
return AjaxResult.success(envInspectionService.listPage(page, req));
|
}
|
|
@GetMapping("/{id}")
|
public AjaxResult detail(@PathVariable Long id) {
|
return AjaxResult.success(envInspectionService.getById(id));
|
}
|
|
@PostMapping("/add")
|
@Log(title = "智能巡检-新增", businessType = BusinessType.INSERT)
|
public AjaxResult add(@RequestBody EnvInspection inspection) {
|
inspection.setId(null);
|
if (inspection.getStatus() == null) {
|
inspection.setStatus(0);
|
}
|
return envInspectionService.save(inspection) ? AjaxResult.success() : AjaxResult.error("新增失败");
|
}
|
|
@PostMapping("/update")
|
@Log(title = "智能巡检-修改", businessType = BusinessType.UPDATE)
|
public AjaxResult update(@RequestBody EnvInspection inspection) {
|
return envInspectionService.updateById(inspection) ? AjaxResult.success() : AjaxResult.error("修改失败");
|
}
|
|
@DeleteMapping("/delete")
|
@Log(title = "智能巡检-删除", businessType = BusinessType.DELETE)
|
public AjaxResult delete(@RequestBody List<Long> ids) {
|
return envInspectionService.removeByIds(ids) ? AjaxResult.success() : AjaxResult.error("删除失败");
|
}
|
|
/**
|
* 自动生成巡检报告
|
*/
|
@GetMapping("/report/{id}")
|
@Log(title = "智能巡检-生成报告", businessType = BusinessType.OTHER)
|
public AjaxResult generateReport(@PathVariable Long id) {
|
return AjaxResult.success((Object) envInspectionService.generateReport(id));
|
}
|
|
@PostMapping("/export")
|
public void export(HttpServletResponse response, EnvInspection req) {
|
envInspectionService.export(response, req);
|
}
|
}
|