feat(预置信息逻辑):
This commit is contained in:
parent
ba39ca8472
commit
39b7e2f354
|
@ -0,0 +1,99 @@
|
||||||
|
package com.ruoyi.web.controller.board;
|
||||||
|
|
||||||
|
import com.ruoyi.board.domain.PresetContent;
|
||||||
|
import com.ruoyi.board.service.IPresetContentService;
|
||||||
|
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.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预置信息及模版Controller
|
||||||
|
*
|
||||||
|
* @author fuhao
|
||||||
|
* @date 2024-08-12
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/board/content")
|
||||||
|
public class PresetContentController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IPresetContentService presetContentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预置信息及模版列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('board:content:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(PresetContent presetContent)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<PresetContent> list = presetContentService.list();
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出预置信息及模版列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('board:content:export')")
|
||||||
|
@Log(title = "预置信息及模版", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, PresetContent presetContent)
|
||||||
|
{
|
||||||
|
List<PresetContent> list = presetContentService.list();
|
||||||
|
ExcelUtil<PresetContent> util = new ExcelUtil<PresetContent>(PresetContent.class);
|
||||||
|
util.exportExcel(response, list, "预置信息及模版数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预置信息及模版详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('board:content:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(presetContentService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预置信息及模版
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('board:content:add')")
|
||||||
|
@Log(title = "预置信息及模版", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody PresetContent presetContent)
|
||||||
|
{
|
||||||
|
return toAjax(presetContentService.save(presetContent));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预置信息及模版
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('board:content:edit')")
|
||||||
|
@Log(title = "预置信息及模版", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody PresetContent presetContent)
|
||||||
|
{
|
||||||
|
return toAjax(presetContentService.updateById(presetContent));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预置信息及模版
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('board:content:remove')")
|
||||||
|
@Log(title = "预置信息及模版", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(presetContentService.removeByIds(Arrays.asList(ids)));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
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 java.util.Date;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预置信息及模版表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "pub_preset_content")
|
||||||
|
public class PresetContent {
|
||||||
|
/**
|
||||||
|
* 主键自增
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预置信息名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "`name`")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 情报板尺寸
|
||||||
|
*/
|
||||||
|
@TableField(value = "board_size")
|
||||||
|
private String boardSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信息类型
|
||||||
|
*/
|
||||||
|
@TableField(value = "info_type")
|
||||||
|
private Integer infoType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预置内容
|
||||||
|
*/
|
||||||
|
@TableField(value = "content")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预览路径
|
||||||
|
*/
|
||||||
|
@TableField(value = "preview_path")
|
||||||
|
private String previewPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字体样式
|
||||||
|
*/
|
||||||
|
@TableField(value = "font_style")
|
||||||
|
private String fontStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字体大小
|
||||||
|
*/
|
||||||
|
@TableField(value = "font_size")
|
||||||
|
private Integer fontSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字体间距
|
||||||
|
*/
|
||||||
|
@TableField(value = "letter_spacing")
|
||||||
|
private Integer letterSpacing;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字体颜色
|
||||||
|
*/
|
||||||
|
@TableField(value = "font_color")
|
||||||
|
private String fontColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字体坐标X
|
||||||
|
*/
|
||||||
|
@TableField(value = "font_position_x")
|
||||||
|
private Integer fontPositionX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字体坐标Y
|
||||||
|
*/
|
||||||
|
@TableField(value = "font_position_y")
|
||||||
|
private Integer fontPositionY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 播放时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "play_time")
|
||||||
|
private Integer playTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前预置类型 1:内置模版 0:预发布信息
|
||||||
|
*/
|
||||||
|
@TableField(value = "preset_type")
|
||||||
|
private Integer presetType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@TableField(value = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "create_time")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "update_time")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
@TableField(value = "create_by")
|
||||||
|
private Integer createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人id
|
||||||
|
*/
|
||||||
|
@TableField(value = "update_by")
|
||||||
|
private Integer updateBy;
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.ruoyi.board.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.ruoyi.board.domain.PresetContent;
|
||||||
|
|
||||||
|
public interface PresetContentMapper extends MPJBaseMapper<PresetContent> {
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ruoyi.board.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.board.mapper.PresetContentMapper;
|
||||||
|
import com.ruoyi.board.domain.PresetContent;
|
||||||
|
import com.ruoyi.board.service.IPresetContentService;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PresetContentServiceImpl extends MPJBaseServiceImpl<PresetContentMapper, PresetContent> implements IPresetContentService {
|
||||||
|
@Override
|
||||||
|
public PresetContent getOneByContentAndBoardSize(String content, String boardSize, Integer type) {
|
||||||
|
LambdaQueryWrapper<PresetContent> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper
|
||||||
|
.eq(PresetContent::getContent, content)
|
||||||
|
.eq(PresetContent::getBoardSize, boardSize)
|
||||||
|
.eq(PresetContent::getInfoType, type);
|
||||||
|
return getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?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.PresetContentMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.ruoyi.board.domain.PresetContent">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table pub_preset_content-->
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||||
|
<result column="board_size" jdbcType="VARCHAR" property="boardSize" />
|
||||||
|
<result column="info_type" jdbcType="INTEGER" property="infoType" />
|
||||||
|
<result column="content" jdbcType="VARCHAR" property="content" />
|
||||||
|
<result column="preview_path" jdbcType="VARCHAR" property="previewPath" />
|
||||||
|
<result column="font_style" jdbcType="VARCHAR" property="fontStyle" />
|
||||||
|
<result column="font_size" jdbcType="INTEGER" property="fontSize" />
|
||||||
|
<result column="letter_spacing" jdbcType="INTEGER" property="letterSpacing" />
|
||||||
|
<result column="font_color" jdbcType="VARCHAR" property="fontColor" />
|
||||||
|
<result column="font_position_x" jdbcType="INTEGER" property="fontPositionX" />
|
||||||
|
<result column="font_position_y" jdbcType="INTEGER" property="fontPositionY" />
|
||||||
|
<result column="play_time" jdbcType="INTEGER" property="playTime" />
|
||||||
|
<result column="preset_type" jdbcType="INTEGER" property="presetType" />
|
||||||
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="create_by" jdbcType="INTEGER" property="createBy" />
|
||||||
|
<result column="update_by" jdbcType="INTEGER" property="updateBy" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, `name`, board_size, info_type, content, preview_path, font_style, font_size,
|
||||||
|
letter_spacing, font_color, font_position_x, font_position_y, play_time, preset_type,
|
||||||
|
remark, create_time, update_time, create_by, update_by
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue