Compare commits

..

2 Commits

Author SHA1 Message Date
fuhao bcd4a39822
feat(预警信息后端代码搭建生成): 2024-08-06 19:46:20 +08:00
fuhao f9589d5a90
fix(修改board信息字段controller): 2024-08-06 19:45:47 +08:00
7 changed files with 252 additions and 32 deletions

View File

@ -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));
}
}

View File

@ -2,63 +2,97 @@ package com.ruoyi.web.controller.board;
import com.ruoyi.board.domain.BoardInfo;
import com.ruoyi.board.service.BoardInfoService;
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 org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 情报板信息(pub_board_info)表控制层
* 情报板信息Controller
*
* @author fuhao
* @author HueFu
* @date 2024-08-06
*/
@RestController
@RequestMapping("/board")
public class BoardInfoController extends BaseController {
/**
* 服务对象
*/
public class BoardInfoController extends BaseController
{
@Autowired
private BoardInfoService boardInfoService;
private BoardInfoService BoardInfoService;
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
* 查询情报板信息列表
*/
@GetMapping
public BoardInfo selectOne(Integer id) {
return boardInfoService.getById(id);
}
@PreAuthorize("@ss.hasPermi('board:info:list')")
@GetMapping("/list")
public TableDataInfo methodsName() {
public TableDataInfo list(BoardInfo BoardInfo)
{
startPage();
List<BoardInfo> list = boardInfoService.list();
List<BoardInfo> list = BoardInfoService.list();
return getDataTable(list);
}
/**
* 导出情报板信息列表
*/
@PreAuthorize("@ss.hasPermi('board:info:export')")
@Log(title = "情报板信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BoardInfo BoardInfo)
{
List<BoardInfo> list = BoardInfoService.list();
ExcelUtil<BoardInfo> util = new ExcelUtil<BoardInfo>(BoardInfo.class);
util.exportExcel(response, list, "情报板信息数据");
}
/**
* 获取情报板信息详细信息
*/
@PreAuthorize("@ss.hasPermi('board:info:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(BoardInfoService.getById(id));
}
/**
* 新增情报板信息
*/
@PreAuthorize("@ss.hasPermi('board:info:add')")
@Log(title = "情报板信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult addBoard(BoardInfo boardInfo){
boardInfoService.save(boardInfo);
return null;
public AjaxResult add(@RequestBody BoardInfo BoardInfo)
{
return toAjax(BoardInfoService.save(BoardInfo));
}
/**
* 修改情报板信息
*/
@PreAuthorize("@ss.hasPermi('board:info:edit')")
@Log(title = "情报板信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult updateBoard(BoardInfo boardInfo){
boardInfoService.updateById(boardInfo);
return null;
public AjaxResult edit(@RequestBody BoardInfo BoardInfo)
{
return toAjax(BoardInfoService.saveOrUpdate(BoardInfo));
}
@DeleteMapping
public AjaxResult delBoard(BoardInfo boardInfo){
boardInfoService.removeById(boardInfo);
return null;
/**
* 删除情报板信息
*/
@PreAuthorize("@ss.hasPermi('board:info:remove')")
@Log(title = "情报板信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids)
{
return toAjax(BoardInfoService.removeByIds(ids));
}
}
}

View File

@ -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;
}

View File

@ -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> {
}

View File

@ -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>{
}

View File

@ -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{
}

View File

@ -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>