mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-10 08:57:14 +08:00
refactor: 公告管理 Announcement => Notice
This commit is contained in:
@@ -102,7 +102,7 @@ public class CommonController {
|
||||
}
|
||||
|
||||
@Operation(summary = "查询字典", description = "查询字典列表")
|
||||
@Parameter(name = "code", description = "字典编码", example = "announcement_type", in = ParameterIn.PATH)
|
||||
@Parameter(name = "code", description = "字典编码", example = "notice_type", in = ParameterIn.PATH)
|
||||
@GetMapping("/dict/{code}")
|
||||
public R<List<LabelValueResp<Serializable>>> listDict(@PathVariable String code) {
|
||||
Optional<Class<?>> enumClassOptional = this.getEnumClassByName(code);
|
||||
|
@@ -36,7 +36,7 @@ import top.continew.admin.system.model.resp.DashboardGeoDistributionResp;
|
||||
import top.continew.admin.system.model.resp.DashboardPopularModuleResp;
|
||||
import top.continew.admin.system.model.resp.DashboardTotalResp;
|
||||
import top.continew.admin.system.service.DashboardService;
|
||||
import top.continew.admin.system.model.resp.DashboardAnnouncementResp;
|
||||
import top.continew.admin.system.model.resp.DashboardNoticeResp;
|
||||
import top.continew.starter.core.util.validate.ValidationUtils;
|
||||
import top.continew.starter.web.model.R;
|
||||
import top.continew.starter.log.core.annotation.Log;
|
||||
@@ -89,8 +89,8 @@ public class DashboardController {
|
||||
}
|
||||
|
||||
@Operation(summary = "查询公告列表", description = "查询公告列表")
|
||||
@GetMapping("/announcement")
|
||||
public R<List<DashboardAnnouncementResp>> listAnnouncement() {
|
||||
return R.ok(dashboardService.listAnnouncement());
|
||||
@GetMapping("/notice")
|
||||
public R<List<DashboardNoticeResp>> listNotice() {
|
||||
return R.ok(dashboardService.listNotice());
|
||||
}
|
||||
}
|
||||
|
@@ -16,26 +16,26 @@
|
||||
|
||||
package top.continew.admin.webapi.system;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import top.continew.admin.system.model.query.AnnouncementQuery;
|
||||
import top.continew.admin.system.model.req.AnnouncementReq;
|
||||
import top.continew.admin.system.model.resp.AnnouncementDetailResp;
|
||||
import top.continew.admin.system.model.resp.AnnouncementResp;
|
||||
import top.continew.admin.system.service.AnnouncementService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.continew.admin.system.model.query.NoticeQuery;
|
||||
import top.continew.admin.system.model.req.NoticeReq;
|
||||
import top.continew.admin.system.model.resp.NoticeDetailResp;
|
||||
import top.continew.admin.system.model.resp.NoticeResp;
|
||||
import top.continew.admin.system.service.NoticeService;
|
||||
import top.continew.starter.core.util.validate.ValidationUtils;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
import top.continew.starter.extension.crud.util.ValidateGroup;
|
||||
import top.continew.starter.web.model.R;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 公告管理 API
|
||||
*
|
||||
@@ -44,19 +44,19 @@ import top.continew.starter.web.model.R;
|
||||
*/
|
||||
@Tag(name = "公告管理 API")
|
||||
@RestController
|
||||
@CrudRequestMapping("/system/announcement")
|
||||
public class AnnouncementController extends BaseController<AnnouncementService, AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> {
|
||||
@CrudRequestMapping(value = "/system/notice", api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE})
|
||||
public class NoticeController extends BaseController<NoticeService, NoticeResp, NoticeDetailResp, NoticeQuery, NoticeReq> {
|
||||
|
||||
@Override
|
||||
@SaCheckPermission("system:announcement:add")
|
||||
public R<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody AnnouncementReq req) {
|
||||
@SaCheckPermission("system:notice:add")
|
||||
public R<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody NoticeReq req) {
|
||||
this.checkTime(req);
|
||||
return super.add(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SaCheckPermission("system:announcement:update")
|
||||
public R<Void> update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody AnnouncementReq req,
|
||||
@SaCheckPermission("system:notice:update")
|
||||
public R<Void> update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody NoticeReq req,
|
||||
@PathVariable Long id) {
|
||||
this.checkTime(req);
|
||||
return super.update(req, id);
|
||||
@@ -67,7 +67,7 @@ public class AnnouncementController extends BaseController<AnnouncementService,
|
||||
*
|
||||
* @param req 创建或修改信息
|
||||
*/
|
||||
private void checkTime(AnnouncementReq req) {
|
||||
private void checkTime(NoticeReq req) {
|
||||
LocalDateTime effectiveTime = req.getEffectiveTime();
|
||||
LocalDateTime terminateTime = req.getTerminateTime();
|
||||
if (null != effectiveTime && null != terminateTime) {
|
@@ -120,7 +120,7 @@ VALUES
|
||||
INSERT INTO `sys_dict`
|
||||
(`id`, `name`, `code`, `description`, `is_system`, `create_user`, `create_time`, `update_user`, `update_time`)
|
||||
VALUES
|
||||
(547889614262632491, '公告类型', 'announcement_type', NULL, b'1', 1, NOW(), NULL, NULL);
|
||||
(547889614262632491, '公告类型', 'notice_type', NULL, b'1', 1, NOW(), NULL, NULL);
|
||||
|
||||
INSERT INTO `sys_dict_item`
|
||||
(`id`, `label`, `value`, `color`, `sort`, `description`, `status`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`)
|
||||
|
@@ -215,7 +215,7 @@ CREATE TABLE IF NOT EXISTS `sys_message_user` (
|
||||
PRIMARY KEY (`message_id`, `user_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='消息和用户关联表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `sys_announcement` (
|
||||
CREATE TABLE IF NOT EXISTS `sys_notice` (
|
||||
`id` bigint(20) NOT NULL COMMENT 'ID',
|
||||
`title` varchar(150) NOT NULL COMMENT '标题',
|
||||
`content` mediumtext NOT NULL COMMENT '内容',
|
||||
|
@@ -120,7 +120,7 @@ VALUES
|
||||
INSERT INTO "sys_dict"
|
||||
("id", "name", "code", "description", "is_system", "create_user", "create_time", "update_user", "update_time")
|
||||
VALUES
|
||||
(547889614262632491, '公告类型', 'announcement_type', NULL, true, 1, NOW(), NULL, NULL);
|
||||
(547889614262632491, '公告类型', 'notice_type', NULL, true, 1, NOW(), NULL, NULL);
|
||||
|
||||
INSERT INTO "sys_dict_item"
|
||||
("id", "label", "value", "color", "sort", "description", "status", "dict_id", "create_user", "create_time", "update_user", "update_time")
|
||||
|
@@ -360,7 +360,7 @@ COMMENT ON COLUMN "sys_message_user"."is_read" IS '是否已读';
|
||||
COMMENT ON COLUMN "sys_message_user"."read_time" IS '读取时间';
|
||||
COMMENT ON TABLE "sys_message_user" IS '消息和用户关联表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "sys_announcement" (
|
||||
CREATE TABLE IF NOT EXISTS "sys_notice" (
|
||||
"id" int8 NOT NULL,
|
||||
"title" varchar(150) NOT NULL,
|
||||
"content" text NOT NULL,
|
||||
@@ -374,20 +374,20 @@ CREATE TABLE IF NOT EXISTS "sys_announcement" (
|
||||
"update_time" timestamp DEFAULT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
CREATE INDEX "idx_announcement_create_user" ON "sys_announcement" ("create_user");
|
||||
CREATE INDEX "idx_announcement_update_user" ON "sys_announcement" ("update_user");
|
||||
COMMENT ON COLUMN "sys_announcement"."id" IS 'ID';
|
||||
COMMENT ON COLUMN "sys_announcement"."title" IS '标题';
|
||||
COMMENT ON COLUMN "sys_announcement"."content" IS '内容';
|
||||
COMMENT ON COLUMN "sys_announcement"."type" IS '类型';
|
||||
COMMENT ON COLUMN "sys_announcement"."effective_time" IS '生效时间';
|
||||
COMMENT ON COLUMN "sys_announcement"."terminate_time" IS '终止时间';
|
||||
COMMENT ON COLUMN "sys_announcement"."sort" IS '排序';
|
||||
COMMENT ON COLUMN "sys_announcement"."create_user" IS '创建人';
|
||||
COMMENT ON COLUMN "sys_announcement"."create_time" IS '创建时间';
|
||||
COMMENT ON COLUMN "sys_announcement"."update_user" IS '修改人';
|
||||
COMMENT ON COLUMN "sys_announcement"."update_time" IS '修改时间';
|
||||
COMMENT ON TABLE "sys_announcement" IS '公告表';
|
||||
CREATE INDEX "idx_notice_create_user" ON "sys_notice" ("create_user");
|
||||
CREATE INDEX "idx_notice_update_user" ON "sys_notice" ("update_user");
|
||||
COMMENT ON COLUMN "sys_notice"."id" IS 'ID';
|
||||
COMMENT ON COLUMN "sys_notice"."title" IS '标题';
|
||||
COMMENT ON COLUMN "sys_notice"."content" IS '内容';
|
||||
COMMENT ON COLUMN "sys_notice"."type" IS '类型';
|
||||
COMMENT ON COLUMN "sys_notice"."effective_time" IS '生效时间';
|
||||
COMMENT ON COLUMN "sys_notice"."terminate_time" IS '终止时间';
|
||||
COMMENT ON COLUMN "sys_notice"."sort" IS '排序';
|
||||
COMMENT ON COLUMN "sys_notice"."create_user" IS '创建人';
|
||||
COMMENT ON COLUMN "sys_notice"."create_time" IS '创建时间';
|
||||
COMMENT ON COLUMN "sys_notice"."update_user" IS '修改人';
|
||||
COMMENT ON COLUMN "sys_notice"."update_time" IS '修改时间';
|
||||
COMMENT ON TABLE "sys_notice" IS '公告表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "sys_storage" (
|
||||
"id" int8 NOT NULL,
|
||||
|
Reference in New Issue
Block a user