diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/board/AlertPlanController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/board/AlertPlanController.java new file mode 100644 index 00000000..c3f5cadf --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/board/AlertPlanController.java @@ -0,0 +1,91 @@ +package com.ruoyi.web.controller.board; + +import com.ruoyi.board.domain.AlertPlan; +import com.ruoyi.board.service.AlertPlanService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 预警计划Controller + * + * @author fuhao + * @Date 2024-08-06 + */ +@RestController +@RequestMapping("/alertPlan") +public class AlertPlanController extends BaseController { + @Autowired + private AlertPlanService alertPlanService; + + /** + * 查询预警计划列表 + */ + @PreAuthorize("@ss.hasPermi('alert:plan:list')") + @GetMapping("/list") + public TableDataInfo list(AlertPlan alertPlan) { + startPage(); + List list = alertPlanService.list(); + return getDataTable(list); + } + + /** + * 导出预警计划列表 + */ + @PreAuthorize("@ss.hasPermi('alert:plan:export')") + @Log(title = "预警计划", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, AlertPlan alertPlan) { + List list = alertPlanService.list(); + ExcelUtil util = new ExcelUtil(AlertPlan.class); + util.exportExcel(response, list, "预警计划数据"); + } + + /** + * 获取预警计划详细信息 + */ + @PreAuthorize("@ss.hasPermi('alert:plan:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(alertPlanService.getById(id)); + } + + /** + * 新增预警计划 + */ + @PreAuthorize("@ss.hasPermi('alert:plan:add')") + @Log(title = "预警计划", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody AlertPlan alertPlan) { + return toAjax(alertPlanService.save(alertPlan)); + } + + /** + * 修改预警计划 + */ + @PreAuthorize("@ss.hasPermi('alert:plan:edit')") + @Log(title = "预警计划", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody AlertPlan alertPlan) { + return toAjax(alertPlanService.saveOrUpdate(alertPlan)); + } + + /** + * 删除预警计划 + */ + @PreAuthorize("@ss.hasPermi('alert:plan:remove')") + @Log(title = "预警计划", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable List ids) { + return toAjax(alertPlanService.removeByIds(ids)); + } +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/board/domain/AlertPlan.java b/ruoyi-system/src/main/java/com/ruoyi/board/domain/AlertPlan.java new file mode 100644 index 00000000..b5b6da8a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/board/domain/AlertPlan.java @@ -0,0 +1,53 @@ +package com.ruoyi.board.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 警报计划表 + */ +@Data +@EqualsAndHashCode(callSuper=true) +@TableName(value = "pub_alert_plan") +public class AlertPlan extends BaseEntity { + /** + * 主键自增 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 类型 + */ + @TableField(value = "`type`") + private Integer type; + + /** + * 等级 + */ + @TableField(value = "`level`") + private Integer level; + + /** + * 最大值 + */ + @TableField(value = "max_value") + private Integer maxValue; + + /** + * 最小值 + */ + @TableField(value = "min_value") + private Integer minValue; + + /** + * 显示内容 + */ + @TableField(value = "display_content") + private String displayContent; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/board/mapper/AlertPlanMapper.java b/ruoyi-system/src/main/java/com/ruoyi/board/mapper/AlertPlanMapper.java new file mode 100644 index 00000000..ce5198bc --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/board/mapper/AlertPlanMapper.java @@ -0,0 +1,7 @@ +package com.ruoyi.board.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.board.domain.AlertPlan; + +public interface AlertPlanMapper extends BaseMapper { +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/board/service/AlertPlanService.java b/ruoyi-system/src/main/java/com/ruoyi/board/service/AlertPlanService.java new file mode 100644 index 00000000..43eab511 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/board/service/AlertPlanService.java @@ -0,0 +1,6 @@ +package com.ruoyi.board.service; + +import com.ruoyi.board.domain.AlertPlan; +import com.baomidou.mybatisplus.extension.service.IService; +public interface AlertPlanService extends IService{ +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/board/service/impl/AlertPlanServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/board/service/impl/AlertPlanServiceImpl.java new file mode 100644 index 00000000..92ee56bf --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/board/service/impl/AlertPlanServiceImpl.java @@ -0,0 +1,11 @@ +package com.ruoyi.board.service.impl; + +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.board.domain.AlertPlan; +import com.ruoyi.board.mapper.AlertPlanMapper; +import com.ruoyi.board.service.AlertPlanService; +@Service +public class AlertPlanServiceImpl extends ServiceImpl implements AlertPlanService{ + +} diff --git a/ruoyi-system/src/main/resources/mapper/board/AlertPlanMapper.xml b/ruoyi-system/src/main/resources/mapper/board/AlertPlanMapper.xml new file mode 100644 index 00000000..fe08b958 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/board/AlertPlanMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + id, `type`, `level`, max_value, min_value, display_content + + \ No newline at end of file