diff --git a/doc/db/boot_backend.sql b/doc/db/boot_backend.sql
index d97966c143bb1be8202187477ed37d4e8c76b05b..b1d1964b28a6023a558539aa29ead58c69e1a8c9 100644
--- a/doc/db/boot_backend.sql
+++ b/doc/db/boot_backend.sql
@@ -1,38 +1,20 @@
/*
Navicat MySQL Data Transfer
-Source Server : localhost
-Source Server Version : 50717
+Source Server : zhangw
+Source Server Version : 50624
Source Host : localhost:3306
Source Database : boot_backend
Target Server Type : MYSQL
-Target Server Version : 50717
+Target Server Version : 50624
File Encoding : 65001
-Date: 2017-09-27 17:40:56
+Date: 2017-10-02 19:26:05
*/
SET FOREIGN_KEY_CHECKS=0;
--- ----------------------------
--- Table structure for articles
--- ----------------------------
-DROP TABLE IF EXISTS `articles`;
-CREATE TABLE `articles` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(128) NOT NULL,
- `content` text NOT NULL,
- `status` tinyint(1) NOT NULL DEFAULT '1',
- `createTime` datetime NOT NULL,
- `updateTime` datetime NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-
--- ----------------------------
--- Records of articles
--- ----------------------------
-
-- ----------------------------
-- Table structure for file_info
-- ----------------------------
@@ -299,7 +281,7 @@ CREATE TABLE `sys_permission` (
`permission` varchar(50) DEFAULT NULL,
`sort` int(11) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4;
+) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of sys_permission
@@ -324,10 +306,10 @@ INSERT INTO `sys_permission` VALUES ('18', '16', '删除', '', '', '2', 'sys:fil
INSERT INTO `sys_permission` VALUES ('19', '0', '数据源监控', 'fa-eye', 'druid/index.html', '1', '', '9');
INSERT INTO `sys_permission` VALUES ('20', '0', '接口swagger', 'fa-file-pdf-o', 'swagger-ui.html', '1', '', '10');
INSERT INTO `sys_permission` VALUES ('21', '0', '代码生成', 'fa-wrench', 'pages/generate/edit.html', '1', 'generate:edit', '11');
-INSERT INTO `sys_permission` VALUES ('22', '0', '公告管理', 'fa-book', 'pages/article/articleList.html', '1', '', '12');
-INSERT INTO `sys_permission` VALUES ('23', '22', '查询', '', '', '2', 'articles:query', '100');
-INSERT INTO `sys_permission` VALUES ('24', '22', '添加', '', '', '2', 'articles:add', '100');
-INSERT INTO `sys_permission` VALUES ('25', '22', '删除', '', '', '2', 'articles:del', '100');
+INSERT INTO `sys_permission` VALUES ('22', '0', '公告管理', 'fa-book', 'pages/notice/noticeList.html', '1', '', '12');
+INSERT INTO `sys_permission` VALUES ('23', '22', '查询', '', '', '2', 'notice:query', '100');
+INSERT INTO `sys_permission` VALUES ('24', '22', '添加', '', '', '2', 'notice:add', '100');
+INSERT INTO `sys_permission` VALUES ('25', '22', '删除', '', '', '2', 'notice:del', '100');
INSERT INTO `sys_permission` VALUES ('26', '0', '日志查询', 'fa-reorder', 'pages/log/logList.html', '1', 'sys:log:query', '13');
INSERT INTO `sys_permission` VALUES ('27', '0', '邮件管理', 'fa-envelope', 'pages/mail/mailList.html', '1', '', '14');
INSERT INTO `sys_permission` VALUES ('28', '27', '发送邮件', '', '', '2', 'mail:send', '100');
@@ -474,24 +456,6 @@ CREATE TABLE `sys_user` (
INSERT INTO `sys_user` VALUES ('1', 'admin', '1015ed3b5f1345911198c995f9ad097e', '87e03afa1f0122531f729c9a7453f475', '管理员', null, '', '', '', '1998-07-01', '0', '1', '2017-04-10 15:21:38', '2017-07-06 09:20:19');
INSERT INTO `sys_user` VALUES ('2', 'user', '72c2e62dba72e5f178542313803f33d1', '143292269df8c63e2da1a9ba2aeff43c', '用户', null, '', '', '', null, '1', '1', '2017-08-01 21:47:18', '2017-08-01 21:47:18');
--- ----------------------------
--- Table structure for t_mail
--- ----------------------------
-DROP TABLE IF EXISTS `t_mail`;
-CREATE TABLE `t_mail` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `userId` int(11) NOT NULL COMMENT '发送人',
- `subject` varchar(255) NOT NULL COMMENT '标题',
- `content` longtext NOT NULL COMMENT '正文',
- `createTime` datetime NOT NULL,
- `updateTime` datetime NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4;
-
--- ----------------------------
--- Records of t_mail
--- ----------------------------
-
-- ----------------------------
-- Table structure for t_job
-- ----------------------------
@@ -511,6 +475,28 @@ CREATE TABLE `t_job` (
UNIQUE KEY `jobName` (`jobName`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
+-- ----------------------------
+-- Records of t_job
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for t_mail
+-- ----------------------------
+DROP TABLE IF EXISTS `t_mail`;
+CREATE TABLE `t_mail` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `userId` int(11) NOT NULL COMMENT '发送人',
+ `subject` varchar(255) NOT NULL COMMENT '标题',
+ `content` longtext NOT NULL COMMENT '正文',
+ `createTime` datetime NOT NULL,
+ `updateTime` datetime NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of t_mail
+-- ----------------------------
+
-- ----------------------------
-- Table structure for t_mail_to
-- ----------------------------
@@ -526,3 +512,36 @@ CREATE TABLE `t_mail_to` (
-- ----------------------------
-- Records of t_mail_to
-- ----------------------------
+
+-- ----------------------------
+-- Table structure for t_notice
+-- ----------------------------
+DROP TABLE IF EXISTS `t_notice`;
+CREATE TABLE `t_notice` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `title` varchar(128) NOT NULL,
+ `content` text NOT NULL,
+ `status` tinyint(1) NOT NULL DEFAULT '1',
+ `createTime` datetime NOT NULL,
+ `updateTime` datetime NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of t_notice
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for t_notice_read
+-- ----------------------------
+DROP TABLE IF EXISTS `t_notice_read`;
+CREATE TABLE `t_notice_read` (
+ `noticeId` int(11) NOT NULL,
+ `userId` int(11) NOT NULL,
+ `createTime` datetime NOT NULL,
+ PRIMARY KEY (`noticeId`,`userId`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of t_notice_read
+-- ----------------------------
diff --git a/src/main/java/com/zw/admin/server/controller/ArticlesController.java b/src/main/java/com/zw/admin/server/controller/NoticeController.java
similarity index 31%
rename from src/main/java/com/zw/admin/server/controller/ArticlesController.java
rename to src/main/java/com/zw/admin/server/controller/NoticeController.java
index 2b9128fcf92f53926d287c162dfc4c5ecac6d015..12e511d0fcf4e18bfd95bd3ad97c1c50a6bf1ae9 100644
--- a/src/main/java/com/zw/admin/server/controller/ArticlesController.java
+++ b/src/main/java/com/zw/admin/server/controller/NoticeController.java
@@ -14,74 +14,128 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zw.admin.server.annotation.LogAnnotation;
-import com.zw.admin.server.dao.ArticlesDao;
-import com.zw.admin.server.model.Articles;
-import com.zw.admin.server.page.table.PageTableRequest;
+import com.zw.admin.server.dao.NoticeDao;
+import com.zw.admin.server.dto.NoticeReadVO;
+import com.zw.admin.server.dto.NoticeVO;
+import com.zw.admin.server.model.Notice;
+import com.zw.admin.server.model.Notice.Status;
+import com.zw.admin.server.model.User;
import com.zw.admin.server.page.table.PageTableHandler;
-import com.zw.admin.server.page.table.PageTableResponse;
import com.zw.admin.server.page.table.PageTableHandler.CountHandler;
import com.zw.admin.server.page.table.PageTableHandler.ListHandler;
+import com.zw.admin.server.page.table.PageTableRequest;
+import com.zw.admin.server.page.table.PageTableResponse;
+import com.zw.admin.server.utils.UserUtil;
import io.swagger.annotations.ApiOperation;
@RestController
-@RequestMapping("/articles")
-public class ArticlesController {
+@RequestMapping("/notices")
+public class NoticeController {
@Autowired
- private ArticlesDao articlesDao;
+ private NoticeDao noticeDao;
@LogAnnotation
@PostMapping
- @ApiOperation(value = "保存文章")
- @RequiresPermissions("articles:add")
- public Articles saveArticles(@RequestBody Articles articles) {
- articlesDao.save(articles);
+ @ApiOperation(value = "保存公告")
+ @RequiresPermissions("notice:add")
+ public Notice saveNotice(@RequestBody Notice notice) {
+ noticeDao.save(notice);
- return articles;
+ return notice;
}
@GetMapping("/{id}")
- @ApiOperation(value = "根据id获取文章")
- @RequiresPermissions("articles:query")
- public Articles get(@PathVariable Long id) {
- return articlesDao.getById(id);
+ @ApiOperation(value = "根据id获取公告")
+ @RequiresPermissions("notice:query")
+ public Notice get(@PathVariable Long id) {
+ return noticeDao.getById(id);
+ }
+
+ @GetMapping(params = "id")
+ public NoticeVO readNotice(Long id) {
+ NoticeVO vo = new NoticeVO();
+
+ Notice notice = noticeDao.getById(id);
+ if (notice == null || notice.getStatus() == Status.DRAFT) {
+ return vo;
+ }
+ vo.setNotice(notice);
+
+ noticeDao.saveReadRecord(notice.getId(), UserUtil.getCurrentUser().getId());
+
+ List
+
diff --git a/src/main/resources/public/pages/dashboard.html b/src/main/resources/public/pages/dashboard.html
index 509c94935dfe47b181505ea62f5416bcd2b8eae6..8bf7a54d419a7bfb127622170d42014863f9d6d2 100644
--- a/src/main/resources/public/pages/dashboard.html
+++ b/src/main/resources/public/pages/dashboard.html
@@ -45,7 +45,7 @@
文件管理:上传文件、文件列表
- 公告管理:发布公告、查询公告 + 公告管理:公告未读提醒、发布公告、查询公告、公告阅读人列表
个人信息修改 diff --git a/src/main/resources/public/pages/article/addArticle.html b/src/main/resources/public/pages/notice/addNotice.html similarity index 96% rename from src/main/resources/public/pages/article/addArticle.html rename to src/main/resources/public/pages/notice/addNotice.html index ed1a209771f61869bd88b16879b47b5300eead81..44892b7ecf892f90a2044d44cb658edb0bea306f 100644 --- a/src/main/resources/public/pages/article/addArticle.html +++ b/src/main/resources/public/pages/notice/addNotice.html @@ -34,7 +34,7 @@
+ + | +