From e776cb2abf987a7c827cadca8091140ccdff2693 Mon Sep 17 00:00:00 2001 From: huxin Date: Fri, 14 Feb 2025 16:46:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=8E=E9=99=A9=E9=A2=84=E8=AD=A6=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DklWarningRulesController.java | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 Dkl-Vue-master/dkl-large/src/main/java/com/dkl/large/controller/DklWarningRulesController.java diff --git a/Dkl-Vue-master/dkl-large/src/main/java/com/dkl/large/controller/DklWarningRulesController.java b/Dkl-Vue-master/dkl-large/src/main/java/com/dkl/large/controller/DklWarningRulesController.java new file mode 100644 index 0000000..c6fb60c --- /dev/null +++ b/Dkl-Vue-master/dkl-large/src/main/java/com/dkl/large/controller/DklWarningRulesController.java @@ -0,0 +1,121 @@ +package com.dkl.large.controller; + +import java.util.Date; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.dkl.common.annotation.DataScope; +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.dkl.common.annotation.Log; +import com.dkl.common.core.controller.BaseController; +import com.dkl.common.core.domain.AjaxResult; +import com.dkl.common.enums.BusinessType; +import com.dkl.large.domain.DklWarningRules; +import com.dkl.large.service.IDklWarningRulesService; +import com.dkl.common.utils.poi.ExcelUtil; +import com.dkl.common.core.page.TableDataInfo; + +/** + * 预警规则Controller + * + * @author Dkl + * @date 2025-06-16 + */ +@RestController +@RequestMapping("/large/rules") +public class DklWarningRulesController extends BaseController +{ + @Autowired + private IDklWarningRulesService dklWarningRulesService; + + /** + * 查询预警规则列表 + */ +// @PreAuthorize("@ss.hasPermi('large:rules:list')") + @GetMapping("/list") + public TableDataInfo list(DklWarningRules dklWarningRules) + { + startPage(); + List list = dklWarningRulesService.selectDklWarningRulesList(dklWarningRules); + return getDataTable(list); + } +// @PreAuthorize("@ss.hasPermi('large:rules:list')") + @GetMapping("/listAll") +// @DataScope(deptAlias = "d") + public TableDataInfo listAll(DklWarningRules dklWarningRules) + { + dklWarningRules.setDelFlag("0"); + List list = dklWarningRulesService.selectDklWarningRulesList(dklWarningRules); + return getDataTable(list); + } + + + /** + * 导出预警规则列表 + */ + @Log(title = "预警规则", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DklWarningRules dklWarningRules) + { + List list = dklWarningRulesService.selectDklWarningRulesList(dklWarningRules); + ExcelUtil util = new ExcelUtil(DklWarningRules.class); + util.exportExcel(response, list, "预警规则数据"); + } + + /** + * 获取预警规则详细信息 + */ + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(dklWarningRulesService.selectDklWarningRulesById(id)); + } + + /** + * 新增预警规则 + */ + @Log(title = "预警规则", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DklWarningRules dklWarningRules) + { + //添加系统信息 + dklWarningRules.setDelFlag("0"); + dklWarningRules.setCreateTime(new Date()); + dklWarningRules.setCreateBy(getUsername()); + dklWarningRules.setUpdateTime(new Date()); + dklWarningRules.setUpdateBy(getUsername()); + return toAjax(dklWarningRulesService.insertDklWarningRules(dklWarningRules)); + } + + /** + * 修改预警规则 + */ + @Log(title = "预警规则", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DklWarningRules dklWarningRules) + { + //添加系统信息 + dklWarningRules.setUpdateTime(new Date()); + dklWarningRules.setUpdateBy(getUsername()); + return toAjax(dklWarningRulesService.updateDklWarningRules(dklWarningRules)); + } + + /** + * 删除预警规则 + */ + @Log(title = "预警规则", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable int[] ids) + { + return toAjax(dklWarningRulesService.deleteDklWarningRulesByIds(ids)); + } +}