1. 开始迁移通知模块的代码

pull/2/head
YunaiV 2021-01-13 08:48:12 +08:00
parent fc444728c9
commit 42a984c8d0
17 changed files with 160 additions and 1037 deletions

View File

@ -1,92 +0,0 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.SecurityUtils;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/notice")
public class SysNoticeController extends BaseController
{
@Autowired
private ISysNoticeService noticeService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list")
public TableDataInfo list(SysNotice notice)
{
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable Long noticeId)
{
return AjaxResult.success(noticeService.selectNoticeById(noticeId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:add')")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice)
{
notice.setCreateBy(SecurityUtils.getUsername());
return toAjax(noticeService.insertNotice(notice));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
{
notice.setUpdateBy(SecurityUtils.getUsername());
return toAjax(noticeService.updateNotice(notice));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds)
{
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}

View File

@ -1,110 +0,0 @@
package com.ruoyi.framework.config;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import javax.sql.DataSource;
import org.apache.ibatis.io.VFS;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.util.ClassUtils;
import com.ruoyi.common.utils.StringUtils;
/**
* Mybatis*
*
* @author ruoyi
*/
@Configuration
public class MyBatisConfig {
@Autowired
private Environment env;
static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
public static String setTypeAliasesPackage(String typeAliasesPackage) {
ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
List<String> allResult = new ArrayList<String>();
try {
for (String aliasesPackage : typeAliasesPackage.split(",")) {
List<String> result = new ArrayList<String>();
aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
Resource[] resources = resolver.getResources(aliasesPackage);
if (resources != null && resources.length > 0) {
MetadataReader metadataReader = null;
for (Resource resource : resources) {
if (resource.isReadable()) {
metadataReader = metadataReaderFactory.getMetadataReader(resource);
try {
result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
}
if (result.size() > 0) {
HashSet<String> hashResult = new HashSet<String>(result);
allResult.addAll(hashResult);
}
}
if (allResult.size() > 0) {
typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
} else {
throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
}
} catch (IOException e) {
e.printStackTrace();
}
return typeAliasesPackage;
}
public Resource[] resolveMapperLocations(String[] mapperLocations) {
ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
List<Resource> resources = new ArrayList<Resource>();
if (mapperLocations != null) {
for (String mapperLocation : mapperLocations) {
try {
Resource[] mappers = resourceResolver.getResources(mapperLocation);
resources.addAll(Arrays.asList(mappers));
} catch (IOException e) {
// ignore
}
}
}
return resources.toArray(new Resource[resources.size()]);
}
@Bean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
String mapperLocations = env.getProperty("mybatis.mapperLocations");
String configLocation = env.getProperty("mybatis.configLocation");
typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
VFS.addImplClass(SpringBootVFS.class);
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource);
sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
return sessionFactory.getObject();
}
}

View File

@ -8,7 +8,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* 访 sys_logininfor * 访 sys_logininfor
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysLogininfor extends BaseEntity public class SysLogininfor extends BaseEntity
@ -52,93 +52,4 @@ public class SysLogininfor extends BaseEntity
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date loginTime; private Date loginTime;
public Long getInfoId()
{
return infoId;
}
public void setInfoId(Long infoId)
{
this.infoId = infoId;
}
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getIpaddr()
{
return ipaddr;
}
public void setIpaddr(String ipaddr)
{
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
this.loginLocation = loginLocation;
}
public String getBrowser()
{
return browser;
}
public void setBrowser(String browser)
{
this.browser = browser;
}
public String getOs()
{
return os;
}
public void setOs(String os)
{
this.os = os;
}
public String getMsg()
{
return msg;
}
public void setMsg(String msg)
{
this.msg = msg;
}
public Date getLoginTime()
{
return loginTime;
}
public void setLoginTime(Date loginTime)
{
this.loginTime = loginTime;
}
} }

View File

@ -1,100 +0,0 @@
package com.ruoyi.system.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* sys_notice
*
* @author ruoyi
*/
public class SysNotice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 公告ID */
private Long noticeId;
/** 公告标题 */
private String noticeTitle;
/** 公告类型1通知 2公告 */
private String noticeType;
/** 公告内容 */
private String noticeContent;
/** 公告状态0正常 1关闭 */
private String status;
public Long getNoticeId()
{
return noticeId;
}
public void setNoticeId(Long noticeId)
{
this.noticeId = noticeId;
}
public void setNoticeTitle(String noticeTitle)
{
this.noticeTitle = noticeTitle;
}
@NotBlank(message = "公告标题不能为空")
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
public String getNoticeTitle()
{
return noticeTitle;
}
public void setNoticeType(String noticeType)
{
this.noticeType = noticeType;
}
public String getNoticeType()
{
return noticeType;
}
public void setNoticeContent(String noticeContent)
{
this.noticeContent = noticeContent;
}
public String getNoticeContent()
{
return noticeContent;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("noticeId", getNoticeId())
.append("noticeTitle", getNoticeTitle())
.append("noticeType", getNoticeType())
.append("noticeContent", getNoticeContent())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -1,68 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysConfig;
/**
*
*
* @author ruoyi
*/
public interface SysConfigMapper {
/**
*
*
* @param config
* @return
*/
public SysConfig selectConfig(SysConfig config);
/**
*
*
* @param config
* @return
*/
public List<SysConfig> selectConfigList(SysConfig config);
/**
*
*
* @param configKey
* @return
*/
public SysConfig checkConfigKeyUnique(String configKey);
/**
*
*
* @param config
* @return
*/
public int insertConfig(SysConfig config);
/**
*
*
* @param config
* @return
*/
public int updateConfig(SysConfig config);
/**
*
*
* @param configId ID
* @return
*/
public int deleteConfigById(Long configId);
/**
*
*
* @param configIds ID
* @return
*/
public int deleteConfigByIds(Long[] configIds);
}

View File

@ -1,42 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysLogininfor;
/**
* 访
*
* @author ruoyi
*/
public interface SysLogininforMapper {
/**
*
*
* @param logininfor 访
*/
public void insertLogininfor(SysLogininfor logininfor);
/**
*
*
* @param logininfor 访
* @return
*/
public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor);
/**
*
*
* @param infoIds ID
* @return
*/
public int deleteLogininforByIds(Long[] infoIds);
/**
*
*
* @return
*/
public int cleanLogininfor();
}

View File

@ -1,60 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysNotice;
/**
*
*
* @author ruoyi
*/
public interface SysNoticeMapper {
/**
*
*
* @param noticeId ID
* @return
*/
public SysNotice selectNoticeById(Long noticeId);
/**
*
*
* @param notice
* @return
*/
public List<SysNotice> selectNoticeList(SysNotice notice);
/**
*
*
* @param notice
* @return
*/
public int insertNotice(SysNotice notice);
/**
*
*
* @param notice
* @return
*/
public int updateNotice(SysNotice notice);
/**
*
*
* @param noticeId ID
* @return
*/
public int deleteNoticeById(Long noticeId);
/**
*
*
* @param noticeIds ID
* @return
*/
public int deleteNoticeByIds(Long[] noticeIds);
}

View File

@ -1,48 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysOperLog;
/**
*
*
* @author ruoyi
*/
public interface SysOperLogMapper {
/**
*
*
* @param operLog
*/
public void insertOperlog(SysOperLog operLog);
/**
*
*
* @param operLog
* @return
*/
public List<SysOperLog> selectOperLogList(SysOperLog operLog);
/**
*
*
* @param operIds ID
* @return
*/
public int deleteOperLogByIds(Long[] operIds);
/**
*
*
* @param operId ID
* @return
*/
public SysOperLog selectOperLogById(Long operId);
/**
*
*/
public void cleanOperLog();
}

View File

@ -1,60 +0,0 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysNotice;
/**
*
*
* @author ruoyi
*/
public interface ISysNoticeService
{
/**
*
*
* @param noticeId ID
* @return
*/
public SysNotice selectNoticeById(Long noticeId);
/**
*
*
* @param notice
* @return
*/
public List<SysNotice> selectNoticeList(SysNotice notice);
/**
*
*
* @param notice
* @return
*/
public int insertNotice(SysNotice notice);
/**
*
*
* @param notice
* @return
*/
public int updateNotice(SysNotice notice);
/**
*
*
* @param noticeId ID
* @return
*/
public int deleteNoticeById(Long noticeId);
/**
*
*
* @param noticeIds ID
* @return
*/
public int deleteNoticeByIds(Long[] noticeIds);
}

View File

@ -1,101 +0,0 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.system.service.ISysDictDataService;
/**
*
*
* @author ruoyi
*/
@Service
public class SysDictDataServiceImpl implements ISysDictDataService {
@Autowired
private SysDictDataMapper dictDataMapper;
/**
*
*
* @param dictData
* @return
*/
@Override
public List<SysDictData> selectDictDataList(SysDictData dictData) {
return dictDataMapper.selectDictDataList(dictData);
}
/**
*
*
* @param dictType
* @param dictValue
* @return
*/
@Override
public String selectDictLabel(String dictType, String dictValue) {
return dictDataMapper.selectDictLabel(dictType, dictValue);
}
/**
* ID
*
* @param dictCode ID
* @return
*/
@Override
public SysDictData selectDictDataById(Long dictCode) {
return dictDataMapper.selectDictDataById(dictCode);
}
/**
*
*
* @param dictCodes ID
* @return
*/
@Override
public int deleteDictDataByIds(Long[] dictCodes) {
int row = dictDataMapper.deleteDictDataByIds(dictCodes);
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
}
/**
*
*
* @param dictData
* @return
*/
@Override
public int insertDictData(SysDictData dictData) {
int row = dictDataMapper.insertDictData(dictData);
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
}
/**
*
*
* @param dictData
* @return
*/
@Override
public int updateDictData(SysDictData dictData) {
int row = dictDataMapper.updateDictData(dictData);
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
}
}

View File

@ -1,177 +0,0 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.system.mapper.SysDictTypeMapper;
import com.ruoyi.system.service.ISysDictTypeService;
/**
*
*
* @author ruoyi
*/
@Service
public class SysDictTypeServiceImpl implements ISysDictTypeService {
@Autowired
private SysDictTypeMapper dictTypeMapper;
@Autowired
private SysDictDataMapper dictDataMapper;
/**
*
*/
@PostConstruct
public void init() {
List<SysDictType> dictTypeList = dictTypeMapper.selectDictTypeAll();
for (SysDictType dictType : dictTypeList) {
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType());
DictUtils.setDictCache(dictType.getDictType(), dictDatas);
}
}
/**
*
*
* @param dictType
* @return
*/
@Override
public List<SysDictType> selectDictTypeList(SysDictType dictType) {
return dictTypeMapper.selectDictTypeList(dictType);
}
/**
*
*
* @return
*/
@Override
public List<SysDictType> selectDictTypeAll() {
return dictTypeMapper.selectDictTypeAll();
}
/**
*
*
* @param dictType
* @return
*/
@Override
public List<SysDictData> selectDictDataByType(String dictType) {
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
if (StringUtils.isNotEmpty(dictDatas)) {
return dictDatas;
}
dictDatas = dictDataMapper.selectDictDataByType(dictType);
if (StringUtils.isNotEmpty(dictDatas)) {
DictUtils.setDictCache(dictType, dictDatas);
return dictDatas;
}
return null;
}
/**
* ID
*
* @param dictId ID
* @return
*/
@Override
public SysDictType selectDictTypeById(Long dictId) {
return dictTypeMapper.selectDictTypeById(dictId);
}
/**
*
*
* @param dictType
* @return
*/
@Override
public SysDictType selectDictTypeByType(String dictType) {
return dictTypeMapper.selectDictTypeByType(dictType);
}
/**
*
*
* @param dictIds ID
* @return
*/
@Override
public int deleteDictTypeByIds(Long[] dictIds) {
for (Long dictId : dictIds) {
SysDictType dictType = selectDictTypeById(dictId);
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0) {
throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
}
}
int count = dictTypeMapper.deleteDictTypeByIds(dictIds);
if (count > 0) {
DictUtils.clearDictCache();
}
return count;
}
/**
*
*
* @param dictType
* @return
*/
@Override
public int insertDictType(SysDictType dictType) {
int row = dictTypeMapper.insertDictType(dictType);
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
}
/**
*
*
* @param dictType
* @return
*/
@Override
@Transactional
public int updateDictType(SysDictType dictType) {
SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId());
dictDataMapper.updateDictDataType(oldDict.getDictType(), dictType.getDictType());
int row = dictTypeMapper.updateDictType(dictType);
if (row > 0) {
DictUtils.clearDictCache();
}
return row;
}
/**
*
*
* @param dict
* @return
*/
@Override
public String checkDictTypeUnique(SysDictType dict) {
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
}

View File

@ -1,89 +0,0 @@
<?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.system.mapper.SysNoticeMapper">
<resultMap type="SysNotice" id="SysNoticeResult">
<result property="noticeId" column="notice_id" />
<result property="noticeTitle" column="notice_title" />
<result property="noticeType" column="notice_type" />
<result property="noticeContent" column="notice_content" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectNoticeVo">
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
from sys_notice
</sql>
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
where notice_id = #{noticeId}
</select>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
</if>
</where>
</select>
<insert id="insertNotice" parameterType="SysNotice">
insert into sys_notice (
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
<if test="status != null and status != '' ">status, </if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
<if test="status != null and status != ''">#{status}, </if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateNotice" parameterType="SysNotice">
update sys_notice
<set>
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>
<if test="status != null and status != ''">status = #{status}, </if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where notice_id = #{noticeId}
</update>
<delete id="deleteNoticeById" parameterType="Long">
delete from sys_notice where notice_id = #{noticeId}
</delete>
<delete id="deleteNoticeByIds" parameterType="Long">
delete from sys_notice where notice_id in
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
#{noticeId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,64 @@
package cn.iocoder.dashboard.modules.system.controller.notice;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "通知公告 API")
@RestController
@RequestMapping("/system/notice")
public class SysNoticeController {
// /**
// * 获取通知公告列表
// */
// @PreAuthorize("@ss.hasPermi('system:notice:list')")
// @GetMapping("/list")
// public TableDataInfo list(SysNotice notice) {
// startPage();
// List<SysNotice> list = noticeService.selectNoticeList(notice);
// return getDataTable(list);
// }
//
// /**
// * 根据通知公告编号获取详细信息
// */
// @PreAuthorize("@ss.hasPermi('system:notice:query')")
// @GetMapping(value = "/{noticeId}")
// public AjaxResult getInfo(@PathVariable Long noticeId) {
// return AjaxResult.success(noticeService.selectNoticeById(noticeId));
// }
//
// /**
// * 新增通知公告
// */
// @PreAuthorize("@ss.hasPermi('system:notice:add')")
// @Log(title = "通知公告", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@Validated @RequestBody SysNotice notice) {
// notice.setCreateBy(SecurityUtils.getUsername());
// return toAjax(noticeService.insertNotice(notice));
// }
//
// /**
// * 修改通知公告
// */
// @PreAuthorize("@ss.hasPermi('system:notice:edit')")
// @Log(title = "通知公告", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
// notice.setUpdateBy(SecurityUtils.getUsername());
// return toAjax(noticeService.updateNotice(notice));
// }
//
// /**
// * 删除通知公告
// */
// @PreAuthorize("@ss.hasPermi('system:notice:remove')")
// @Log(title = "通知公告", businessType = BusinessType.DELETE)
// @DeleteMapping("/{noticeIds}")
// public AjaxResult remove(@PathVariable Long[] noticeIds) {
// return toAjax(noticeService.deleteNoticeByIds(noticeIds));
// }
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.dashboard.modules.system.convert.notice;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface SysNoticeConvert {
SysNoticeConvert INSTANCE = Mappers.getMapper(SysNoticeConvert.class);
}

View File

@ -0,0 +1,9 @@
package cn.iocoder.dashboard.modules.system.dal.mysql.dao.notice;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysNoticeMapper extends BaseMapper<SysNoticeDO> {
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice;
import cn.iocoder.dashboard.common.enums.CommonStatusEnum;
import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.dashboard.modules.system.enums.notice.SysNoticeTypeEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
*
*
* @author ruoyi
*/
@TableName("sys_notice")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysNoticeDO extends BaseDO {
/**
* ID
*/
private Long id;
/**
*
*/
@NotBlank(message = "公告标题不能为空")
@Size(max = 50, message = "公告标题不能超过50个字符")
private String title;
/**
*
*
* {@link SysNoticeTypeEnum}
*/
@TableField("notice_type")
private String type;
/**
*
*/
private String content;
/**
*
*
* {@link CommonStatusEnum}
*/
private Integer status;
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.dashboard.modules.system.enums.notice;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
*
* @author
*/
@Getter
@AllArgsConstructor
public enum SysNoticeTypeEnum {
NOTICE(1),
ANNOUNCEMENT(2);
/**
*
*/
private final Integer type;
}