feat(预警信息后端代码搭建生成):
This commit is contained in:
parent
f9589d5a90
commit
bcd4a39822
|
@ -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<AlertPlan> 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<AlertPlan> list = alertPlanService.list();
|
||||
ExcelUtil<AlertPlan> util = new ExcelUtil<AlertPlan>(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<Long> ids) {
|
||||
return toAjax(alertPlanService.removeByIds(ids));
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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<AlertPlan> {
|
||||
}
|
|
@ -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<AlertPlan>{
|
||||
}
|
|
@ -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<AlertPlanMapper, AlertPlan> implements AlertPlanService{
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.board.mapper.AlertPlanMapper">
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.board.domain.AlertPlan">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table pub_alert_plan-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="type" jdbcType="INTEGER" property="type" />
|
||||
<result column="level" jdbcType="INTEGER" property="level" />
|
||||
<result column="max_value" jdbcType="INTEGER" property="maxValue" />
|
||||
<result column="min_value" jdbcType="INTEGER" property="minValue" />
|
||||
<result column="display_content" jdbcType="VARCHAR" property="displayContent" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, `type`, `level`, max_value, min_value, display_content
|
||||
</sql>
|
||||
</mapper>
|
Loading…
Reference in New Issue