package com.ruoyi.project.tr.specialCheck.controller; import com.ruoyi.doublePrevention.entity.PreventRiskControlMeasure; import com.ruoyi.doublePrevention.entity.dto.req.PreventRiskControlMeasureDeleteReqDTO; import com.ruoyi.doublePrevention.vo.ResultVO; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; import com.ruoyi.project.tr.riskList.domain.RiskList; import com.ruoyi.project.tr.riskList.service.IRiskListService; import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckTaskBO; import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckTaskLogBO; import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckTaskLogUpdateBO; import com.ruoyi.project.tr.specialCheck.domin.DTO.TbSpecialCheckTaskLogDTO; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckTask; import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckTaskLog; import com.ruoyi.project.tr.specialCheck.service.SpecialCheckTaskService; import com.ruoyi.project.tr.specialCheck.service.TbBaseCheckService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 隐患列表Controller * * @date 2020-05-08 */ @Controller @RequestMapping("/tr/specialCheckTaskLog") public class TBSpecialCheckTaskLogController extends BaseController { private String prefix = "tr/specialCheckTaskLog"; @Autowired private SpecialCheckTaskService specialCheckTaskService; @Autowired private IRiskListService riskListService; @Autowired private TbBaseCheckService tbBaseCheckService; // @GetMapping() // public String selectTbBaseCheckTaskPage(ModelMap mmap) // { // return prefix + "/specialCheckTaskLog"; // } @GetMapping("{id}") public String specialCheckTaskLog(@PathVariable("id")String id,ModelMap modelMap) { modelMap.put("id",id); return prefix + "/specialCheckTaskLog"; } @PostMapping("/list") @ResponseBody public TableDataInfo selectSpecialCheckTaskLogPage(TbSpecialCheckTaskLogBO specialCheckTaskLogBO) { ResultVO> resultVO = specialCheckTaskService.selectSpecialCheckTaskLogPage(specialCheckTaskLogBO); List data = (List) resultVO.getData(); TableDataInfo dataTable = getDataTable(data); dataTable.setTotal(resultVO.getCount()); return dataTable; } /** * 新增任务 */ @GetMapping("/add") public String add(ModelMap mmap) { List riskList = riskListService.listHazardSource(); mmap.put("hazardList", riskList); return prefix + "/add"; } /** * 新增任务保存 */ @PostMapping("/add") @ResponseBody public AjaxResult addSpecialTask(TbSpecialCheckTaskLog tbSpecialCheckTaskLog){ ResultVO resultVO = specialCheckTaskService.addSpecialTask(tbSpecialCheckTaskLog); String code = resultVO.getCode(); if ("200".equals(code)){ return toAjax(1); }else { return AjaxResult.error(resultVO.getMsg()); } } @GetMapping("/edit/{id}") public String edit(@PathVariable("indexId") Long indexId, ModelMap mmap) { TbSpecialCheckTaskLog specialCheckTaskLogByIndexId = specialCheckTaskService.getSpecialCheckTaskLogByIndexId(indexId); mmap.put("specialCheckTaskLog",specialCheckTaskLogByIndexId); TbBaseCheckTaskBO tbBaseCheckTaskBO = new TbBaseCheckTaskBO(); ResultVO> listResultVO = tbBaseCheckService.selectTbBaseCheckTaskPage(tbBaseCheckTaskBO); Object data = listResultVO.getData(); mmap.put("tbBaseCheckTask", data); return prefix + "/edit"; } /** * 修改保存 */ @PostMapping("/edit") @ResponseBody public AjaxResult editSave(TbSpecialCheckTaskLogUpdateBO updateBO) { ResultVO resultVO = specialCheckTaskService.updateSpecialCheckTaskLog(updateBO); String code = resultVO.getCode(); if ("200".equals(code)){ return toAjax(1); }else { return AjaxResult.error(resultVO.getMsg()); } } @PostMapping("/remove") @ResponseBody public AjaxResult remove(TbSpecialCheckTaskLogUpdateBO updateBO){ ResultVO resultVO = specialCheckTaskService.deleteTbSpecialCheckTaskLog(updateBO); String code = resultVO.getCode(); if ("200".equals(code)){ return toAjax(1); }else { return AjaxResult.error(resultVO.getMsg()); } } }