Commit 42a984c8d0cabef5b8073c05ebf0b0af3d2642e6

Authored by YunaiV
1 parent fc444728

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

ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java deleted
1 -package com.ruoyi.web.controller.system;  
2 -  
3 -import java.util.List;  
4 -import org.springframework.beans.factory.annotation.Autowired;  
5 -import org.springframework.security.access.prepost.PreAuthorize;  
6 -import org.springframework.validation.annotation.Validated;  
7 -import org.springframework.web.bind.annotation.DeleteMapping;  
8 -import org.springframework.web.bind.annotation.GetMapping;  
9 -import org.springframework.web.bind.annotation.PathVariable;  
10 -import org.springframework.web.bind.annotation.PostMapping;  
11 -import org.springframework.web.bind.annotation.PutMapping;  
12 -import org.springframework.web.bind.annotation.RequestBody;  
13 -import org.springframework.web.bind.annotation.RequestMapping;  
14 -import org.springframework.web.bind.annotation.RestController;  
15 -import com.ruoyi.common.annotation.Log;  
16 -import com.ruoyi.common.core.controller.BaseController;  
17 -import com.ruoyi.common.core.domain.AjaxResult;  
18 -import com.ruoyi.common.core.page.TableDataInfo;  
19 -import com.ruoyi.common.enums.BusinessType;  
20 -import com.ruoyi.common.utils.SecurityUtils;  
21 -import com.ruoyi.system.domain.SysNotice;  
22 -import com.ruoyi.system.service.ISysNoticeService;  
23 -  
24 -/**  
25 - * 公告 信息操作处理  
26 - *  
27 - * @author ruoyi  
28 - */  
29 -@RestController  
30 -@RequestMapping("/system/notice")  
31 -public class SysNoticeController extends BaseController  
32 -{  
33 - @Autowired  
34 - private ISysNoticeService noticeService;  
35 -  
36 - /**  
37 - * 获取通知公告列表  
38 - */  
39 - @PreAuthorize("@ss.hasPermi('system:notice:list')")  
40 - @GetMapping("/list")  
41 - public TableDataInfo list(SysNotice notice)  
42 - {  
43 - startPage();  
44 - List<SysNotice> list = noticeService.selectNoticeList(notice);  
45 - return getDataTable(list);  
46 - }  
47 -  
48 - /**  
49 - * 根据通知公告编号获取详细信息  
50 - */  
51 - @PreAuthorize("@ss.hasPermi('system:notice:query')")  
52 - @GetMapping(value = "/{noticeId}")  
53 - public AjaxResult getInfo(@PathVariable Long noticeId)  
54 - {  
55 - return AjaxResult.success(noticeService.selectNoticeById(noticeId));  
56 - }  
57 -  
58 - /**  
59 - * 新增通知公告  
60 - */  
61 - @PreAuthorize("@ss.hasPermi('system:notice:add')")  
62 - @Log(title = "通知公告", businessType = BusinessType.INSERT)  
63 - @PostMapping  
64 - public AjaxResult add(@Validated @RequestBody SysNotice notice)  
65 - {  
66 - notice.setCreateBy(SecurityUtils.getUsername());  
67 - return toAjax(noticeService.insertNotice(notice));  
68 - }  
69 -  
70 - /**  
71 - * 修改通知公告  
72 - */  
73 - @PreAuthorize("@ss.hasPermi('system:notice:edit')")  
74 - @Log(title = "通知公告", businessType = BusinessType.UPDATE)  
75 - @PutMapping  
76 - public AjaxResult edit(@Validated @RequestBody SysNotice notice)  
77 - {  
78 - notice.setUpdateBy(SecurityUtils.getUsername());  
79 - return toAjax(noticeService.updateNotice(notice));  
80 - }  
81 -  
82 - /**  
83 - * 删除通知公告  
84 - */  
85 - @PreAuthorize("@ss.hasPermi('system:notice:remove')")  
86 - @Log(title = "通知公告", businessType = BusinessType.DELETE)  
87 - @DeleteMapping("/{noticeIds}")  
88 - public AjaxResult remove(@PathVariable Long[] noticeIds)  
89 - {  
90 - return toAjax(noticeService.deleteNoticeByIds(noticeIds));  
91 - }  
92 -}  
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java deleted
1 -package com.ruoyi.framework.config;  
2 -  
3 -import java.io.IOException;  
4 -import java.util.ArrayList;  
5 -import java.util.Arrays;  
6 -import java.util.HashSet;  
7 -import java.util.List;  
8 -import javax.sql.DataSource;  
9 -  
10 -import org.apache.ibatis.io.VFS;  
11 -import org.apache.ibatis.session.SqlSessionFactory;  
12 -import org.mybatis.spring.SqlSessionFactoryBean;  
13 -import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;  
14 -import org.springframework.beans.factory.annotation.Autowired;  
15 -import org.springframework.context.annotation.Bean;  
16 -import org.springframework.context.annotation.Configuration;  
17 -import org.springframework.core.env.Environment;  
18 -import org.springframework.core.io.DefaultResourceLoader;  
19 -import org.springframework.core.io.Resource;  
20 -import org.springframework.core.io.support.PathMatchingResourcePatternResolver;  
21 -import org.springframework.core.io.support.ResourcePatternResolver;  
22 -import org.springframework.core.type.classreading.CachingMetadataReaderFactory;  
23 -import org.springframework.core.type.classreading.MetadataReader;  
24 -import org.springframework.core.type.classreading.MetadataReaderFactory;  
25 -import org.springframework.util.ClassUtils;  
26 -import com.ruoyi.common.utils.StringUtils;  
27 -  
28 -/**  
29 - * Mybatis支持*匹配扫描包  
30 - *  
31 - * @author ruoyi  
32 - */  
33 -@Configuration  
34 -public class MyBatisConfig {  
35 - @Autowired  
36 - private Environment env;  
37 -  
38 - static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";  
39 -  
40 - public static String setTypeAliasesPackage(String typeAliasesPackage) {  
41 - ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();  
42 - MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);  
43 - List<String> allResult = new ArrayList<String>();  
44 - try {  
45 - for (String aliasesPackage : typeAliasesPackage.split(",")) {  
46 - List<String> result = new ArrayList<String>();  
47 - aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX  
48 - + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;  
49 - Resource[] resources = resolver.getResources(aliasesPackage);  
50 - if (resources != null && resources.length > 0) {  
51 - MetadataReader metadataReader = null;  
52 - for (Resource resource : resources) {  
53 - if (resource.isReadable()) {  
54 - metadataReader = metadataReaderFactory.getMetadataReader(resource);  
55 - try {  
56 - result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());  
57 - } catch (ClassNotFoundException e) {  
58 - e.printStackTrace();  
59 - }  
60 - }  
61 - }  
62 - }  
63 - if (result.size() > 0) {  
64 - HashSet<String> hashResult = new HashSet<String>(result);  
65 - allResult.addAll(hashResult);  
66 - }  
67 - }  
68 - if (allResult.size() > 0) {  
69 - typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));  
70 - } else {  
71 - throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");  
72 - }  
73 - } catch (IOException e) {  
74 - e.printStackTrace();  
75 - }  
76 - return typeAliasesPackage;  
77 - }  
78 -  
79 - public Resource[] resolveMapperLocations(String[] mapperLocations) {  
80 - ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();  
81 - List<Resource> resources = new ArrayList<Resource>();  
82 - if (mapperLocations != null) {  
83 - for (String mapperLocation : mapperLocations) {  
84 - try {  
85 - Resource[] mappers = resourceResolver.getResources(mapperLocation);  
86 - resources.addAll(Arrays.asList(mappers));  
87 - } catch (IOException e) {  
88 - // ignore  
89 - }  
90 - }  
91 - }  
92 - return resources.toArray(new Resource[resources.size()]);  
93 - }  
94 -  
95 - @Bean  
96 - public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {  
97 - String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");  
98 - String mapperLocations = env.getProperty("mybatis.mapperLocations");  
99 - String configLocation = env.getProperty("mybatis.configLocation");  
100 - typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);  
101 - VFS.addImplClass(SpringBootVFS.class);  
102 -  
103 - final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();  
104 - sessionFactory.setDataSource(dataSource);  
105 - sessionFactory.setTypeAliasesPackage(typeAliasesPackage);  
106 - sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));  
107 - sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));  
108 - return sessionFactory.getObject();  
109 - }  
110 -}  
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java
@@ -8,7 +8,7 @@ import com.ruoyi.common.core.domain.BaseEntity; @@ -8,7 +8,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
8 8
9 /** 9 /**
10 * 系统访问记录表 sys_logininfor 10 * 系统访问记录表 sys_logininfor
11 - * 11 + *
12 * @author ruoyi 12 * @author ruoyi
13 */ 13 */
14 public class SysLogininfor extends BaseEntity 14 public class SysLogininfor extends BaseEntity
@@ -52,93 +52,4 @@ public class SysLogininfor extends BaseEntity @@ -52,93 +52,4 @@ public class SysLogininfor extends BaseEntity
52 @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") 52 @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
53 private Date loginTime; 53 private Date loginTime;
54 54
55 - public Long getInfoId()  
56 - {  
57 - return infoId;  
58 - }  
59 -  
60 - public void setInfoId(Long infoId)  
61 - {  
62 - this.infoId = infoId;  
63 - }  
64 -  
65 - public String getUserName()  
66 - {  
67 - return userName;  
68 - }  
69 -  
70 - public void setUserName(String userName)  
71 - {  
72 - this.userName = userName;  
73 - }  
74 -  
75 - public String getStatus()  
76 - {  
77 - return status;  
78 - }  
79 -  
80 - public void setStatus(String status)  
81 - {  
82 - this.status = status;  
83 - }  
84 -  
85 - public String getIpaddr()  
86 - {  
87 - return ipaddr;  
88 - }  
89 -  
90 - public void setIpaddr(String ipaddr)  
91 - {  
92 - this.ipaddr = ipaddr;  
93 - }  
94 -  
95 - public String getLoginLocation()  
96 - {  
97 - return loginLocation;  
98 - }  
99 -  
100 - public void setLoginLocation(String loginLocation)  
101 - {  
102 - this.loginLocation = loginLocation;  
103 - }  
104 -  
105 - public String getBrowser()  
106 - {  
107 - return browser;  
108 - }  
109 -  
110 - public void setBrowser(String browser)  
111 - {  
112 - this.browser = browser;  
113 - }  
114 -  
115 - public String getOs()  
116 - {  
117 - return os;  
118 - }  
119 -  
120 - public void setOs(String os)  
121 - {  
122 - this.os = os;  
123 - }  
124 -  
125 - public String getMsg()  
126 - {  
127 - return msg;  
128 - }  
129 -  
130 - public void setMsg(String msg)  
131 - {  
132 - this.msg = msg;  
133 - }  
134 -  
135 - public Date getLoginTime()  
136 - {  
137 - return loginTime;  
138 - }  
139 -  
140 - public void setLoginTime(Date loginTime)  
141 - {  
142 - this.loginTime = loginTime;  
143 - }  
144 } 55 }
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java deleted
1 -package com.ruoyi.system.domain;  
2 -  
3 -import javax.validation.constraints.NotBlank;  
4 -import javax.validation.constraints.Size;  
5 -import org.apache.commons.lang3.builder.ToStringBuilder;  
6 -import org.apache.commons.lang3.builder.ToStringStyle;  
7 -import com.ruoyi.common.core.domain.BaseEntity;  
8 -  
9 -/**  
10 - * 通知公告表 sys_notice  
11 - *  
12 - * @author ruoyi  
13 - */  
14 -public class SysNotice extends BaseEntity  
15 -{  
16 - private static final long serialVersionUID = 1L;  
17 -  
18 - /** 公告ID */  
19 - private Long noticeId;  
20 -  
21 - /** 公告标题 */  
22 - private String noticeTitle;  
23 -  
24 - /** 公告类型(1通知 2公告) */  
25 - private String noticeType;  
26 -  
27 - /** 公告内容 */  
28 - private String noticeContent;  
29 -  
30 - /** 公告状态(0正常 1关闭) */  
31 - private String status;  
32 -  
33 - public Long getNoticeId()  
34 - {  
35 - return noticeId;  
36 - }  
37 -  
38 - public void setNoticeId(Long noticeId)  
39 - {  
40 - this.noticeId = noticeId;  
41 - }  
42 -  
43 - public void setNoticeTitle(String noticeTitle)  
44 - {  
45 - this.noticeTitle = noticeTitle;  
46 - }  
47 -  
48 - @NotBlank(message = "公告标题不能为空")  
49 - @Size(min = 0, max = 50, message = "公告标题不能超过50个字符")  
50 - public String getNoticeTitle()  
51 - {  
52 - return noticeTitle;  
53 - }  
54 -  
55 - public void setNoticeType(String noticeType)  
56 - {  
57 - this.noticeType = noticeType;  
58 - }  
59 -  
60 - public String getNoticeType()  
61 - {  
62 - return noticeType;  
63 - }  
64 -  
65 - public void setNoticeContent(String noticeContent)  
66 - {  
67 - this.noticeContent = noticeContent;  
68 - }  
69 -  
70 - public String getNoticeContent()  
71 - {  
72 - return noticeContent;  
73 - }  
74 -  
75 - public void setStatus(String status)  
76 - {  
77 - this.status = status;  
78 - }  
79 -  
80 - public String getStatus()  
81 - {  
82 - return status;  
83 - }  
84 -  
85 - @Override  
86 - public String toString() {  
87 - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)  
88 - .append("noticeId", getNoticeId())  
89 - .append("noticeTitle", getNoticeTitle())  
90 - .append("noticeType", getNoticeType())  
91 - .append("noticeContent", getNoticeContent())  
92 - .append("status", getStatus())  
93 - .append("createBy", getCreateBy())  
94 - .append("createTime", getCreateTime())  
95 - .append("updateBy", getUpdateBy())  
96 - .append("updateTime", getUpdateTime())  
97 - .append("remark", getRemark())  
98 - .toString();  
99 - }  
100 -}  
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java deleted
1 -package com.ruoyi.system.mapper;  
2 -  
3 -import java.util.List;  
4 -  
5 -import com.ruoyi.system.domain.SysConfig;  
6 -  
7 -/**  
8 - * 参数配置 数据层  
9 - *  
10 - * @author ruoyi  
11 - */  
12 -public interface SysConfigMapper {  
13 - /**  
14 - * 查询参数配置信息  
15 - *  
16 - * @param config 参数配置信息  
17 - * @return 参数配置信息  
18 - */  
19 - public SysConfig selectConfig(SysConfig config);  
20 -  
21 - /**  
22 - * 查询参数配置列表  
23 - *  
24 - * @param config 参数配置信息  
25 - * @return 参数配置集合  
26 - */  
27 - public List<SysConfig> selectConfigList(SysConfig config);  
28 -  
29 - /**  
30 - * 根据键名查询参数配置信息  
31 - *  
32 - * @param configKey 参数键名  
33 - * @return 参数配置信息  
34 - */  
35 - public SysConfig checkConfigKeyUnique(String configKey);  
36 -  
37 - /**  
38 - * 新增参数配置  
39 - *  
40 - * @param config 参数配置信息  
41 - * @return 结果  
42 - */  
43 - public int insertConfig(SysConfig config);  
44 -  
45 - /**  
46 - * 修改参数配置  
47 - *  
48 - * @param config 参数配置信息  
49 - * @return 结果  
50 - */  
51 - public int updateConfig(SysConfig config);  
52 -  
53 - /**  
54 - * 删除参数配置  
55 - *  
56 - * @param configId 参数ID  
57 - * @return 结果  
58 - */  
59 - public int deleteConfigById(Long configId);  
60 -  
61 - /**  
62 - * 批量删除参数信息  
63 - *  
64 - * @param configIds 需要删除的参数ID  
65 - * @return 结果  
66 - */  
67 - public int deleteConfigByIds(Long[] configIds);  
68 -}  
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java deleted
1 -package com.ruoyi.system.mapper;  
2 -  
3 -import java.util.List;  
4 -  
5 -import com.ruoyi.system.domain.SysLogininfor;  
6 -  
7 -/**  
8 - * 系统访问日志情况信息 数据层  
9 - *  
10 - * @author ruoyi  
11 - */  
12 -public interface SysLogininforMapper {  
13 - /**  
14 - * 新增系统登录日志  
15 - *  
16 - * @param logininfor 访问日志对象  
17 - */  
18 - public void insertLogininfor(SysLogininfor logininfor);  
19 -  
20 - /**  
21 - * 查询系统登录日志集合  
22 - *  
23 - * @param logininfor 访问日志对象  
24 - * @return 登录记录集合  
25 - */  
26 - public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor);  
27 -  
28 - /**  
29 - * 批量删除系统登录日志  
30 - *  
31 - * @param infoIds 需要删除的登录日志ID  
32 - * @return 结果  
33 - */  
34 - public int deleteLogininforByIds(Long[] infoIds);  
35 -  
36 - /**  
37 - * 清空系统登录日志  
38 - *  
39 - * @return 结果  
40 - */  
41 - public int cleanLogininfor();  
42 -}  
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java deleted
1 -package com.ruoyi.system.mapper;  
2 -  
3 -import java.util.List;  
4 -  
5 -import com.ruoyi.system.domain.SysNotice;  
6 -  
7 -/**  
8 - * 通知公告表 数据层  
9 - *  
10 - * @author ruoyi  
11 - */  
12 -public interface SysNoticeMapper {  
13 - /**  
14 - * 查询公告信息  
15 - *  
16 - * @param noticeId 公告ID  
17 - * @return 公告信息  
18 - */  
19 - public SysNotice selectNoticeById(Long noticeId);  
20 -  
21 - /**  
22 - * 查询公告列表  
23 - *  
24 - * @param notice 公告信息  
25 - * @return 公告集合  
26 - */  
27 - public List<SysNotice> selectNoticeList(SysNotice notice);  
28 -  
29 - /**  
30 - * 新增公告  
31 - *  
32 - * @param notice 公告信息  
33 - * @return 结果  
34 - */  
35 - public int insertNotice(SysNotice notice);  
36 -  
37 - /**  
38 - * 修改公告  
39 - *  
40 - * @param notice 公告信息  
41 - * @return 结果  
42 - */  
43 - public int updateNotice(SysNotice notice);  
44 -  
45 - /**  
46 - * 批量删除公告  
47 - *  
48 - * @param noticeId 公告ID  
49 - * @return 结果  
50 - */  
51 - public int deleteNoticeById(Long noticeId);  
52 -  
53 - /**  
54 - * 批量删除公告信息  
55 - *  
56 - * @param noticeIds 需要删除的公告ID  
57 - * @return 结果  
58 - */  
59 - public int deleteNoticeByIds(Long[] noticeIds);  
60 -}  
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java deleted
1 -package com.ruoyi.system.mapper;  
2 -  
3 -import java.util.List;  
4 -  
5 -import com.ruoyi.system.domain.SysOperLog;  
6 -  
7 -/**  
8 - * 操作日志 数据层  
9 - *  
10 - * @author ruoyi  
11 - */  
12 -public interface SysOperLogMapper {  
13 - /**  
14 - * 新增操作日志  
15 - *  
16 - * @param operLog 操作日志对象  
17 - */  
18 - public void insertOperlog(SysOperLog operLog);  
19 -  
20 - /**  
21 - * 查询系统操作日志集合  
22 - *  
23 - * @param operLog 操作日志对象  
24 - * @return 操作日志集合  
25 - */  
26 - public List<SysOperLog> selectOperLogList(SysOperLog operLog);  
27 -  
28 - /**  
29 - * 批量删除系统操作日志  
30 - *  
31 - * @param operIds 需要删除的操作日志ID  
32 - * @return 结果  
33 - */  
34 - public int deleteOperLogByIds(Long[] operIds);  
35 -  
36 - /**  
37 - * 查询操作日志详细  
38 - *  
39 - * @param operId 操作ID  
40 - * @return 操作日志对象  
41 - */  
42 - public SysOperLog selectOperLogById(Long operId);  
43 -  
44 - /**  
45 - * 清空操作日志  
46 - */  
47 - public void cleanOperLog();  
48 -}  
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java deleted
1 -package com.ruoyi.system.service;  
2 -  
3 -import java.util.List;  
4 -import com.ruoyi.system.domain.SysNotice;  
5 -  
6 -/**  
7 - * 公告 服务层  
8 - *  
9 - * @author ruoyi  
10 - */  
11 -public interface ISysNoticeService  
12 -{  
13 - /**  
14 - * 查询公告信息  
15 - *  
16 - * @param noticeId 公告ID  
17 - * @return 公告信息  
18 - */  
19 - public SysNotice selectNoticeById(Long noticeId);  
20 -  
21 - /**  
22 - * 查询公告列表  
23 - *  
24 - * @param notice 公告信息  
25 - * @return 公告集合  
26 - */  
27 - public List<SysNotice> selectNoticeList(SysNotice notice);  
28 -  
29 - /**  
30 - * 新增公告  
31 - *  
32 - * @param notice 公告信息  
33 - * @return 结果  
34 - */  
35 - public int insertNotice(SysNotice notice);  
36 -  
37 - /**  
38 - * 修改公告  
39 - *  
40 - * @param notice 公告信息  
41 - * @return 结果  
42 - */  
43 - public int updateNotice(SysNotice notice);  
44 -  
45 - /**  
46 - * 删除公告信息  
47 - *  
48 - * @param noticeId 公告ID  
49 - * @return 结果  
50 - */  
51 - public int deleteNoticeById(Long noticeId);  
52 -  
53 - /**  
54 - * 批量删除公告信息  
55 - *  
56 - * @param noticeIds 需要删除的公告ID  
57 - * @return 结果  
58 - */  
59 - public int deleteNoticeByIds(Long[] noticeIds);  
60 -}  
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java deleted
1 -package com.ruoyi.system.service.impl;  
2 -  
3 -import java.util.List;  
4 -  
5 -import org.springframework.beans.factory.annotation.Autowired;  
6 -import org.springframework.stereotype.Service;  
7 -import com.ruoyi.common.core.domain.entity.SysDictData;  
8 -import com.ruoyi.common.utils.DictUtils;  
9 -import com.ruoyi.system.mapper.SysDictDataMapper;  
10 -import com.ruoyi.system.service.ISysDictDataService;  
11 -  
12 -/**  
13 - * 字典 业务层处理  
14 - *  
15 - * @author ruoyi  
16 - */  
17 -@Service  
18 -public class SysDictDataServiceImpl implements ISysDictDataService {  
19 -  
20 - @Autowired  
21 - private SysDictDataMapper dictDataMapper;  
22 -  
23 - /**  
24 - * 根据条件分页查询字典数据  
25 - *  
26 - * @param dictData 字典数据信息  
27 - * @return 字典数据集合信息  
28 - */  
29 - @Override  
30 - public List<SysDictData> selectDictDataList(SysDictData dictData) {  
31 - return dictDataMapper.selectDictDataList(dictData);  
32 - }  
33 -  
34 - /**  
35 - * 根据字典类型和字典键值查询字典数据信息  
36 - *  
37 - * @param dictType 字典类型  
38 - * @param dictValue 字典键值  
39 - * @return 字典标签  
40 - */  
41 - @Override  
42 - public String selectDictLabel(String dictType, String dictValue) {  
43 - return dictDataMapper.selectDictLabel(dictType, dictValue);  
44 - }  
45 -  
46 - /**  
47 - * 根据字典数据ID查询信息  
48 - *  
49 - * @param dictCode 字典数据ID  
50 - * @return 字典数据  
51 - */  
52 - @Override  
53 - public SysDictData selectDictDataById(Long dictCode) {  
54 - return dictDataMapper.selectDictDataById(dictCode);  
55 - }  
56 -  
57 - /**  
58 - * 批量删除字典数据信息  
59 - *  
60 - * @param dictCodes 需要删除的字典数据ID  
61 - * @return 结果  
62 - */  
63 - @Override  
64 - public int deleteDictDataByIds(Long[] dictCodes) {  
65 - int row = dictDataMapper.deleteDictDataByIds(dictCodes);  
66 - if (row > 0) {  
67 - DictUtils.clearDictCache();  
68 - }  
69 - return row;  
70 - }  
71 -  
72 - /**  
73 - * 新增保存字典数据信息  
74 - *  
75 - * @param dictData 字典数据信息  
76 - * @return 结果  
77 - */  
78 - @Override  
79 - public int insertDictData(SysDictData dictData) {  
80 - int row = dictDataMapper.insertDictData(dictData);  
81 - if (row > 0) {  
82 - DictUtils.clearDictCache();  
83 - }  
84 - return row;  
85 - }  
86 -  
87 - /**  
88 - * 修改保存字典数据信息  
89 - *  
90 - * @param dictData 字典数据信息  
91 - * @return 结果  
92 - */  
93 - @Override  
94 - public int updateDictData(SysDictData dictData) {  
95 - int row = dictDataMapper.updateDictData(dictData);  
96 - if (row > 0) {  
97 - DictUtils.clearDictCache();  
98 - }  
99 - return row;  
100 - }  
101 -}  
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java deleted
1 -package com.ruoyi.system.service.impl;  
2 -  
3 -import java.util.List;  
4 -import javax.annotation.PostConstruct;  
5 -  
6 -import org.springframework.beans.factory.annotation.Autowired;  
7 -import org.springframework.stereotype.Service;  
8 -import org.springframework.transaction.annotation.Transactional;  
9 -import com.ruoyi.common.constant.UserConstants;  
10 -import com.ruoyi.common.core.domain.entity.SysDictData;  
11 -import com.ruoyi.common.core.domain.entity.SysDictType;  
12 -import com.ruoyi.common.exception.CustomException;  
13 -import com.ruoyi.common.utils.DictUtils;  
14 -import com.ruoyi.common.utils.StringUtils;  
15 -import com.ruoyi.system.mapper.SysDictDataMapper;  
16 -import com.ruoyi.system.mapper.SysDictTypeMapper;  
17 -import com.ruoyi.system.service.ISysDictTypeService;  
18 -  
19 -/**  
20 - * 字典 业务层处理  
21 - *  
22 - * @author ruoyi  
23 - */  
24 -@Service  
25 -public class SysDictTypeServiceImpl implements ISysDictTypeService {  
26 - @Autowired  
27 - private SysDictTypeMapper dictTypeMapper;  
28 -  
29 - @Autowired  
30 - private SysDictDataMapper dictDataMapper;  
31 -  
32 - /**  
33 - * 项目启动时,初始化字典到缓存  
34 - */  
35 - @PostConstruct  
36 - public void init() {  
37 - List<SysDictType> dictTypeList = dictTypeMapper.selectDictTypeAll();  
38 - for (SysDictType dictType : dictTypeList) {  
39 - List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType());  
40 - DictUtils.setDictCache(dictType.getDictType(), dictDatas);  
41 - }  
42 - }  
43 -  
44 - /**  
45 - * 根据条件分页查询字典类型  
46 - *  
47 - * @param dictType 字典类型信息  
48 - * @return 字典类型集合信息  
49 - */  
50 - @Override  
51 - public List<SysDictType> selectDictTypeList(SysDictType dictType) {  
52 - return dictTypeMapper.selectDictTypeList(dictType);  
53 - }  
54 -  
55 - /**  
56 - * 根据所有字典类型  
57 - *  
58 - * @return 字典类型集合信息  
59 - */  
60 - @Override  
61 - public List<SysDictType> selectDictTypeAll() {  
62 - return dictTypeMapper.selectDictTypeAll();  
63 - }  
64 -  
65 - /**  
66 - * 根据字典类型查询字典数据  
67 - *  
68 - * @param dictType 字典类型  
69 - * @return 字典数据集合信息  
70 - */  
71 - @Override  
72 - public List<SysDictData> selectDictDataByType(String dictType) {  
73 - List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);  
74 - if (StringUtils.isNotEmpty(dictDatas)) {  
75 - return dictDatas;  
76 - }  
77 - dictDatas = dictDataMapper.selectDictDataByType(dictType);  
78 - if (StringUtils.isNotEmpty(dictDatas)) {  
79 - DictUtils.setDictCache(dictType, dictDatas);  
80 - return dictDatas;  
81 - }  
82 - return null;  
83 - }  
84 -  
85 - /**  
86 - * 根据字典类型ID查询信息  
87 - *  
88 - * @param dictId 字典类型ID  
89 - * @return 字典类型  
90 - */  
91 - @Override  
92 - public SysDictType selectDictTypeById(Long dictId) {  
93 - return dictTypeMapper.selectDictTypeById(dictId);  
94 - }  
95 -  
96 - /**  
97 - * 根据字典类型查询信息  
98 - *  
99 - * @param dictType 字典类型  
100 - * @return 字典类型  
101 - */  
102 - @Override  
103 - public SysDictType selectDictTypeByType(String dictType) {  
104 - return dictTypeMapper.selectDictTypeByType(dictType);  
105 - }  
106 -  
107 - /**  
108 - * 批量删除字典类型信息  
109 - *  
110 - * @param dictIds 需要删除的字典ID  
111 - * @return 结果  
112 - */  
113 - @Override  
114 - public int deleteDictTypeByIds(Long[] dictIds) {  
115 - for (Long dictId : dictIds) {  
116 - SysDictType dictType = selectDictTypeById(dictId);  
117 - if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0) {  
118 - throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName()));  
119 - }  
120 - }  
121 - int count = dictTypeMapper.deleteDictTypeByIds(dictIds);  
122 - if (count > 0) {  
123 - DictUtils.clearDictCache();  
124 - }  
125 - return count;  
126 - }  
127 -  
128 -  
129 - /**  
130 - * 新增保存字典类型信息  
131 - *  
132 - * @param dictType 字典类型信息  
133 - * @return 结果  
134 - */  
135 - @Override  
136 - public int insertDictType(SysDictType dictType) {  
137 - int row = dictTypeMapper.insertDictType(dictType);  
138 - if (row > 0) {  
139 - DictUtils.clearDictCache();  
140 - }  
141 - return row;  
142 - }  
143 -  
144 - /**  
145 - * 修改保存字典类型信息  
146 - *  
147 - * @param dictType 字典类型信息  
148 - * @return 结果  
149 - */  
150 - @Override  
151 - @Transactional  
152 - public int updateDictType(SysDictType dictType) {  
153 - SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId());  
154 - dictDataMapper.updateDictDataType(oldDict.getDictType(), dictType.getDictType());  
155 - int row = dictTypeMapper.updateDictType(dictType);  
156 - if (row > 0) {  
157 - DictUtils.clearDictCache();  
158 - }  
159 - return row;  
160 - }  
161 -  
162 - /**  
163 - * 校验字典类型称是否唯一  
164 - *  
165 - * @param dict 字典类型  
166 - * @return 结果  
167 - */  
168 - @Override  
169 - public String checkDictTypeUnique(SysDictType dict) {  
170 - Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();  
171 - SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());  
172 - if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) {  
173 - return UserConstants.NOT_UNIQUE;  
174 - }  
175 - return UserConstants.UNIQUE;  
176 - }  
177 -}  
ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml deleted
1 -<?xml version="1.0" encoding="UTF-8" ?>  
2 -<!DOCTYPE mapper  
3 -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"  
4 -"http://mybatis.org/dtd/mybatis-3-mapper.dtd">  
5 -<mapper namespace="com.ruoyi.system.mapper.SysNoticeMapper">  
6 -  
7 - <resultMap type="SysNotice" id="SysNoticeResult">  
8 - <result property="noticeId" column="notice_id" />  
9 - <result property="noticeTitle" column="notice_title" />  
10 - <result property="noticeType" column="notice_type" />  
11 - <result property="noticeContent" column="notice_content" />  
12 - <result property="status" column="status" />  
13 - <result property="createBy" column="create_by" />  
14 - <result property="createTime" column="create_time" />  
15 - <result property="updateBy" column="update_by" />  
16 - <result property="updateTime" column="update_time" />  
17 - <result property="remark" column="remark" />  
18 - </resultMap>  
19 -  
20 - <sql id="selectNoticeVo">  
21 - 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  
22 - from sys_notice  
23 - </sql>  
24 -  
25 - <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">  
26 - <include refid="selectNoticeVo"/>  
27 - where notice_id = #{noticeId}  
28 - </select>  
29 -  
30 - <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">  
31 - <include refid="selectNoticeVo"/>  
32 - <where>  
33 - <if test="noticeTitle != null and noticeTitle != ''">  
34 - AND notice_title like concat('%', #{noticeTitle}, '%')  
35 - </if>  
36 - <if test="noticeType != null and noticeType != ''">  
37 - AND notice_type = #{noticeType}  
38 - </if>  
39 - <if test="createBy != null and createBy != ''">  
40 - AND create_by like concat('%', #{createBy}, '%')  
41 - </if>  
42 - </where>  
43 - </select>  
44 -  
45 - <insert id="insertNotice" parameterType="SysNotice">  
46 - insert into sys_notice (  
47 - <if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>  
48 - <if test="noticeType != null and noticeType != '' ">notice_type, </if>  
49 - <if test="noticeContent != null and noticeContent != '' ">notice_content, </if>  
50 - <if test="status != null and status != '' ">status, </if>  
51 - <if test="remark != null and remark != ''">remark,</if>  
52 - <if test="createBy != null and createBy != ''">create_by,</if>  
53 - create_time  
54 - )values(  
55 - <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>  
56 - <if test="noticeType != null and noticeType != ''">#{noticeType}, </if>  
57 - <if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>  
58 - <if test="status != null and status != ''">#{status}, </if>  
59 - <if test="remark != null and remark != ''">#{remark},</if>  
60 - <if test="createBy != null and createBy != ''">#{createBy},</if>  
61 - sysdate()  
62 - )  
63 - </insert>  
64 -  
65 - <update id="updateNotice" parameterType="SysNotice">  
66 - update sys_notice  
67 - <set>  
68 - <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>  
69 - <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>  
70 - <if test="noticeContent != null">notice_content = #{noticeContent}, </if>  
71 - <if test="status != null and status != ''">status = #{status}, </if>  
72 - <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>  
73 - update_time = sysdate()  
74 - </set>  
75 - where notice_id = #{noticeId}  
76 - </update>  
77 -  
78 - <delete id="deleteNoticeById" parameterType="Long">  
79 - delete from sys_notice where notice_id = #{noticeId}  
80 - </delete>  
81 -  
82 - <delete id="deleteNoticeByIds" parameterType="Long">  
83 - delete from sys_notice where notice_id in  
84 - <foreach item="noticeId" collection="array" open="(" separator="," close=")">  
85 - #{noticeId}  
86 - </foreach>  
87 - </delete>  
88 -  
89 -</mapper>  
90 \ No newline at end of file 0 \ No newline at end of file
src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/SysNoticeController.java 0 → 100644
  1 +package cn.iocoder.dashboard.modules.system.controller.notice;
  2 +
  3 +import io.swagger.annotations.Api;
  4 +import org.springframework.web.bind.annotation.RequestMapping;
  5 +import org.springframework.web.bind.annotation.RestController;
  6 +
  7 +@Api(tags = "通知公告 API")
  8 +@RestController
  9 +@RequestMapping("/system/notice")
  10 +public class SysNoticeController {
  11 +
  12 +// /**
  13 +// * 获取通知公告列表
  14 +// */
  15 +// @PreAuthorize("@ss.hasPermi('system:notice:list')")
  16 +// @GetMapping("/list")
  17 +// public TableDataInfo list(SysNotice notice) {
  18 +// startPage();
  19 +// List<SysNotice> list = noticeService.selectNoticeList(notice);
  20 +// return getDataTable(list);
  21 +// }
  22 +//
  23 +// /**
  24 +// * 根据通知公告编号获取详细信息
  25 +// */
  26 +// @PreAuthorize("@ss.hasPermi('system:notice:query')")
  27 +// @GetMapping(value = "/{noticeId}")
  28 +// public AjaxResult getInfo(@PathVariable Long noticeId) {
  29 +// return AjaxResult.success(noticeService.selectNoticeById(noticeId));
  30 +// }
  31 +//
  32 +// /**
  33 +// * 新增通知公告
  34 +// */
  35 +// @PreAuthorize("@ss.hasPermi('system:notice:add')")
  36 +// @Log(title = "通知公告", businessType = BusinessType.INSERT)
  37 +// @PostMapping
  38 +// public AjaxResult add(@Validated @RequestBody SysNotice notice) {
  39 +// notice.setCreateBy(SecurityUtils.getUsername());
  40 +// return toAjax(noticeService.insertNotice(notice));
  41 +// }
  42 +//
  43 +// /**
  44 +// * 修改通知公告
  45 +// */
  46 +// @PreAuthorize("@ss.hasPermi('system:notice:edit')")
  47 +// @Log(title = "通知公告", businessType = BusinessType.UPDATE)
  48 +// @PutMapping
  49 +// public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
  50 +// notice.setUpdateBy(SecurityUtils.getUsername());
  51 +// return toAjax(noticeService.updateNotice(notice));
  52 +// }
  53 +//
  54 +// /**
  55 +// * 删除通知公告
  56 +// */
  57 +// @PreAuthorize("@ss.hasPermi('system:notice:remove')")
  58 +// @Log(title = "通知公告", businessType = BusinessType.DELETE)
  59 +// @DeleteMapping("/{noticeIds}")
  60 +// public AjaxResult remove(@PathVariable Long[] noticeIds) {
  61 +// return toAjax(noticeService.deleteNoticeByIds(noticeIds));
  62 +// }
  63 +
  64 +}
src/main/java/cn/iocoder/dashboard/modules/system/convert/notice/SysNoticeConvert.java 0 → 100644
  1 +package cn.iocoder.dashboard.modules.system.convert.notice;
  2 +
  3 +import org.mapstruct.Mapper;
  4 +import org.mapstruct.factory.Mappers;
  5 +
  6 +@Mapper
  7 +public interface SysNoticeConvert {
  8 +
  9 + SysNoticeConvert INSTANCE = Mappers.getMapper(SysNoticeConvert.class);
  10 +
  11 +}
src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/notice/SysNoticeMapper.java 0 → 100644
  1 +package cn.iocoder.dashboard.modules.system.dal.mysql.dao.notice;
  2 +
  3 +import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO;
  4 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  5 +import org.apache.ibatis.annotations.Mapper;
  6 +
  7 +@Mapper
  8 +public interface SysNoticeMapper extends BaseMapper<SysNoticeDO> {
  9 +}
src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/notice/SysNoticeDO.java 0 → 100644
  1 +package cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice;
  2 +
  3 +import cn.iocoder.dashboard.common.enums.CommonStatusEnum;
  4 +import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
  5 +import cn.iocoder.dashboard.modules.system.enums.notice.SysNoticeTypeEnum;
  6 +import com.baomidou.mybatisplus.annotation.TableField;
  7 +import com.baomidou.mybatisplus.annotation.TableName;
  8 +import lombok.Data;
  9 +import lombok.EqualsAndHashCode;
  10 +
  11 +import javax.validation.constraints.NotBlank;
  12 +import javax.validation.constraints.Size;
  13 +
  14 +/**
  15 + * 通知公告表
  16 + *
  17 + * @author ruoyi
  18 + */
  19 +@TableName("sys_notice")
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +public class SysNoticeDO extends BaseDO {
  23 +
  24 + /**
  25 + * 公告ID
  26 + */
  27 + private Long id;
  28 + /**
  29 + * 公告标题
  30 + */
  31 + @NotBlank(message = "公告标题不能为空")
  32 + @Size(max = 50, message = "公告标题不能超过50个字符")
  33 + private String title;
  34 + /**
  35 + * 公告类型
  36 + *
  37 + * 枚举 {@link SysNoticeTypeEnum}
  38 + */
  39 + @TableField("notice_type")
  40 + private String type;
  41 + /**
  42 + * 公告内容
  43 + */
  44 + private String content;
  45 + /**
  46 + * 公告状态
  47 + *
  48 + * 枚举 {@link CommonStatusEnum}
  49 + */
  50 + private Integer status;
  51 +
  52 +}
src/main/java/cn/iocoder/dashboard/modules/system/enums/notice/SysNoticeTypeEnum.java 0 → 100644
  1 +package cn.iocoder.dashboard.modules.system.enums.notice;
  2 +
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Getter;
  5 +
  6 +/**
  7 + * 通知类型
  8 + *
  9 + * @author 芋道源码
  10 + */
  11 +@Getter
  12 +@AllArgsConstructor
  13 +public enum SysNoticeTypeEnum {
  14 +
  15 + NOTICE(1),
  16 + ANNOUNCEMENT(2);
  17 +
  18 + /**
  19 + * 类型
  20 + */
  21 + private final Integer type;
  22 +
  23 +}