mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-11-04 21:01:38 +08:00 
			
		
		
		
	refactor: 公告管理 Announcement => Notice
This commit is contained in:
		@@ -29,7 +29,7 @@ import top.continew.starter.data.mybatis.plus.base.IBaseEnum;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Getter
 | 
					@Getter
 | 
				
			||||||
@RequiredArgsConstructor
 | 
					@RequiredArgsConstructor
 | 
				
			||||||
public enum AnnouncementStatusEnum implements IBaseEnum<Integer> {
 | 
					public enum NoticeStatusEnum implements IBaseEnum<Integer> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 待发布
 | 
					     * 待发布
 | 
				
			||||||
@@ -16,8 +16,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package top.continew.admin.system.mapper;
 | 
					package top.continew.admin.system.mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import top.continew.admin.system.model.entity.AnnouncementDO;
 | 
					import top.continew.admin.system.model.entity.NoticeDO;
 | 
				
			||||||
import top.continew.admin.system.model.resp.DashboardAnnouncementResp;
 | 
					import top.continew.admin.system.model.resp.DashboardNoticeResp;
 | 
				
			||||||
import top.continew.starter.data.mybatis.plus.base.BaseMapper;
 | 
					import top.continew.starter.data.mybatis.plus.base.BaseMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@@ -28,12 +28,12 @@ import java.util.List;
 | 
				
			|||||||
 * @author Charles7c
 | 
					 * @author Charles7c
 | 
				
			||||||
 * @since 2023/8/20 10:55
 | 
					 * @since 2023/8/20 10:55
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public interface AnnouncementMapper extends BaseMapper<AnnouncementDO> {
 | 
					public interface NoticeMapper extends BaseMapper<NoticeDO> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 查询仪表盘公告列表
 | 
					     * 查询仪表盘公告列表
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @return 仪表盘公告列表
 | 
					     * @return 仪表盘公告列表
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<DashboardAnnouncementResp> selectDashboardList();
 | 
					    List<DashboardNoticeResp> selectDashboardList();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -30,8 +30,8 @@ import java.time.LocalDateTime;
 | 
				
			|||||||
 * @since 2023/8/20 10:55
 | 
					 * @since 2023/8/20 10:55
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
@TableName("sys_announcement")
 | 
					@TableName("sys_notice")
 | 
				
			||||||
public class AnnouncementDO extends BaseDO {
 | 
					public class NoticeDO extends BaseDO {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Serial
 | 
					    @Serial
 | 
				
			||||||
    private static final long serialVersionUID = 1L;
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
@@ -32,7 +32,7 @@ import java.io.Serializable;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
@Schema(description = "公告查询条件")
 | 
					@Schema(description = "公告查询条件")
 | 
				
			||||||
public class AnnouncementQuery implements Serializable {
 | 
					public class NoticeQuery implements Serializable {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Serial
 | 
					    @Serial
 | 
				
			||||||
    private static final long serialVersionUID = 1L;
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
@@ -50,7 +50,7 @@ public class DictReq extends BaseReq {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 编码
 | 
					     * 编码
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Schema(description = "编码", example = "announcement_type")
 | 
					    @Schema(description = "编码", example = "notice_type")
 | 
				
			||||||
    @NotBlank(message = "编码不能为空")
 | 
					    @NotBlank(message = "编码不能为空")
 | 
				
			||||||
    @Pattern(regexp = RegexConstants.GENERAL_CODE, message = "编码长度为 2 到 30 位,可以包含字母、数字,下划线,以字母开头")
 | 
					    @Pattern(regexp = RegexConstants.GENERAL_CODE, message = "编码长度为 2 到 30 位,可以包含字母、数字,下划线,以字母开头")
 | 
				
			||||||
    private String code;
 | 
					    private String code;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,7 @@ import java.time.LocalDateTime;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
@Schema(description = "创建或修改公告信息")
 | 
					@Schema(description = "创建或修改公告信息")
 | 
				
			||||||
public class AnnouncementReq extends BaseReq {
 | 
					public class NoticeReq extends BaseReq {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Serial
 | 
					    @Serial
 | 
				
			||||||
    private static final long serialVersionUID = 1L;
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
@@ -55,9 +55,9 @@ public class AnnouncementReq extends BaseReq {
 | 
				
			|||||||
    private String content;
 | 
					    private String content;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 类型(取值于字典 announcement_type)
 | 
					     * 类型(取值于字典 notice_type)
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Schema(description = "类型(取值于字典 announcement_type)", example = "1")
 | 
					    @Schema(description = "类型(取值于字典 notice_type)", example = "1")
 | 
				
			||||||
    @NotBlank(message = "类型不能为空")
 | 
					    @NotBlank(message = "类型不能为空")
 | 
				
			||||||
    @Length(max = 30, message = "类型长度不能超过 {max} 个字符")
 | 
					    @Length(max = 30, message = "类型长度不能超过 {max} 个字符")
 | 
				
			||||||
    private String type;
 | 
					    private String type;
 | 
				
			||||||
@@ -30,7 +30,7 @@ import java.io.Serializable;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
@Schema(description = "仪表盘-公告信息")
 | 
					@Schema(description = "仪表盘-公告信息")
 | 
				
			||||||
public class DashboardAnnouncementResp implements Serializable {
 | 
					public class DashboardNoticeResp implements Serializable {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Serial
 | 
					    @Serial
 | 
				
			||||||
    private static final long serialVersionUID = 1L;
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
@@ -48,8 +48,8 @@ public class DashboardAnnouncementResp implements Serializable {
 | 
				
			|||||||
    private String title;
 | 
					    private String title;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 类型(取值于字典 announcement_type)
 | 
					     * 类型(取值于字典 notice_type)
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Schema(description = "类型(取值于字典 announcement_type)", example = "1")
 | 
					    @Schema(description = "类型(取值于字典 notice_type)", example = "1")
 | 
				
			||||||
    private String type;
 | 
					    private String type;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -44,7 +44,7 @@ public class DictResp extends BaseDetailResp {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 编码
 | 
					     * 编码
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Schema(description = "编码", example = "announcement_type")
 | 
					    @Schema(description = "编码", example = "notice_type")
 | 
				
			||||||
    private String code;
 | 
					    private String code;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,7 @@ import java.time.LocalDateTime;
 | 
				
			|||||||
@Data
 | 
					@Data
 | 
				
			||||||
@ExcelIgnoreUnannotated
 | 
					@ExcelIgnoreUnannotated
 | 
				
			||||||
@Schema(description = "公告详情信息")
 | 
					@Schema(description = "公告详情信息")
 | 
				
			||||||
public class AnnouncementDetailResp extends BaseDetailResp {
 | 
					public class NoticeDetailResp extends BaseDetailResp {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Serial
 | 
					    @Serial
 | 
				
			||||||
    private static final long serialVersionUID = 1L;
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
@@ -54,9 +54,9 @@ public class AnnouncementDetailResp extends BaseDetailResp {
 | 
				
			|||||||
    private String content;
 | 
					    private String content;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 类型(取值于字典 announcement_type)
 | 
					     * 类型(取值于字典 notice_type)
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Schema(description = "类型(取值于字典 announcement_type)", example = "1")
 | 
					    @Schema(description = "类型(取值于字典 notice_type)", example = "1")
 | 
				
			||||||
    @ExcelProperty(value = "类型")
 | 
					    @ExcelProperty(value = "类型")
 | 
				
			||||||
    private String type;
 | 
					    private String type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -18,7 +18,7 @@ package top.continew.admin.system.model.resp;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
					import io.swagger.v3.oas.annotations.media.Schema;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
import top.continew.admin.system.enums.AnnouncementStatusEnum;
 | 
					import top.continew.admin.system.enums.NoticeStatusEnum;
 | 
				
			||||||
import top.continew.starter.extension.crud.model.resp.BaseResp;
 | 
					import top.continew.starter.extension.crud.model.resp.BaseResp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.Serial;
 | 
					import java.io.Serial;
 | 
				
			||||||
@@ -32,7 +32,7 @@ import java.time.LocalDateTime;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
@Schema(description = "公告信息")
 | 
					@Schema(description = "公告信息")
 | 
				
			||||||
public class AnnouncementResp extends BaseResp {
 | 
					public class NoticeResp extends BaseResp {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Serial
 | 
					    @Serial
 | 
				
			||||||
    private static final long serialVersionUID = 1L;
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
@@ -44,9 +44,9 @@ public class AnnouncementResp extends BaseResp {
 | 
				
			|||||||
    private String title;
 | 
					    private String title;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 类型(取值于字典 announcement_type)
 | 
					     * 类型(取值于字典 notice_type)
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Schema(description = "类型(取值于字典 announcement_type)", example = "1")
 | 
					    @Schema(description = "类型(取值于字典 notice_type)", example = "1")
 | 
				
			||||||
    private String type;
 | 
					    private String type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -67,13 +67,13 @@ public class AnnouncementResp extends BaseResp {
 | 
				
			|||||||
     * @return 公告状态
 | 
					     * @return 公告状态
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Schema(description = "状态(1:待发布;2:已发布;3:已过期)", type = "Integer", allowableValues = {"1", "2", "3"}, example = "1")
 | 
					    @Schema(description = "状态(1:待发布;2:已发布;3:已过期)", type = "Integer", allowableValues = {"1", "2", "3"}, example = "1")
 | 
				
			||||||
    public AnnouncementStatusEnum getStatus() {
 | 
					    public NoticeStatusEnum getStatus() {
 | 
				
			||||||
        if (null != this.effectiveTime && this.effectiveTime.isAfter(LocalDateTime.now())) {
 | 
					        if (null != this.effectiveTime && this.effectiveTime.isAfter(LocalDateTime.now())) {
 | 
				
			||||||
            return AnnouncementStatusEnum.PENDING_RELEASE;
 | 
					            return NoticeStatusEnum.PENDING_RELEASE;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (null != this.terminateTime && this.terminateTime.isBefore(LocalDateTime.now())) {
 | 
					        if (null != this.terminateTime && this.terminateTime.isBefore(LocalDateTime.now())) {
 | 
				
			||||||
            return AnnouncementStatusEnum.EXPIRED;
 | 
					            return NoticeStatusEnum.EXPIRED;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return AnnouncementStatusEnum.PUBLISHED;
 | 
					        return NoticeStatusEnum.PUBLISHED;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -62,5 +62,5 @@ public interface DashboardService {
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @return 公告列表
 | 
					     * @return 公告列表
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<DashboardAnnouncementResp> listAnnouncement();
 | 
					    List<DashboardNoticeResp> listNotice();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,12 +16,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package top.continew.admin.system.service;
 | 
					package top.continew.admin.system.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import top.continew.admin.system.model.entity.AnnouncementDO;
 | 
					import top.continew.admin.system.model.entity.NoticeDO;
 | 
				
			||||||
import top.continew.admin.system.model.query.AnnouncementQuery;
 | 
					import top.continew.admin.system.model.query.NoticeQuery;
 | 
				
			||||||
import top.continew.admin.system.model.req.AnnouncementReq;
 | 
					import top.continew.admin.system.model.req.NoticeReq;
 | 
				
			||||||
import top.continew.admin.system.model.resp.AnnouncementDetailResp;
 | 
					import top.continew.admin.system.model.resp.NoticeDetailResp;
 | 
				
			||||||
import top.continew.admin.system.model.resp.AnnouncementResp;
 | 
					import top.continew.admin.system.model.resp.NoticeResp;
 | 
				
			||||||
import top.continew.admin.system.model.resp.DashboardAnnouncementResp;
 | 
					import top.continew.admin.system.model.resp.DashboardNoticeResp;
 | 
				
			||||||
import top.continew.starter.extension.crud.service.BaseService;
 | 
					import top.continew.starter.extension.crud.service.BaseService;
 | 
				
			||||||
import top.continew.starter.data.mybatis.plus.service.IService;
 | 
					import top.continew.starter.data.mybatis.plus.service.IService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -33,12 +33,12 @@ import java.util.List;
 | 
				
			|||||||
 * @author Charles7c
 | 
					 * @author Charles7c
 | 
				
			||||||
 * @since 2023/8/20 10:55
 | 
					 * @since 2023/8/20 10:55
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public interface AnnouncementService extends BaseService<AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq>, IService<AnnouncementDO> {
 | 
					public interface NoticeService extends BaseService<NoticeResp, NoticeDetailResp, NoticeQuery, NoticeReq>, IService<NoticeDO> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 查询仪表盘公告列表
 | 
					     * 查询仪表盘公告列表
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @return 仪表盘公告列表
 | 
					     * @return 仪表盘公告列表
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<DashboardAnnouncementResp> listDashboard();
 | 
					    List<DashboardNoticeResp> listDashboard();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -20,7 +20,7 @@ import cn.hutool.core.convert.Convert;
 | 
				
			|||||||
import cn.hutool.core.util.NumberUtil;
 | 
					import cn.hutool.core.util.NumberUtil;
 | 
				
			||||||
import lombok.RequiredArgsConstructor;
 | 
					import lombok.RequiredArgsConstructor;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import top.continew.admin.system.service.AnnouncementService;
 | 
					import top.continew.admin.system.service.NoticeService;
 | 
				
			||||||
import top.continew.admin.system.service.DashboardService;
 | 
					import top.continew.admin.system.service.DashboardService;
 | 
				
			||||||
import top.continew.admin.system.service.LogService;
 | 
					import top.continew.admin.system.service.LogService;
 | 
				
			||||||
import top.continew.admin.system.model.resp.*;
 | 
					import top.continew.admin.system.model.resp.*;
 | 
				
			||||||
@@ -40,7 +40,7 @@ import java.util.Map;
 | 
				
			|||||||
public class DashboardServiceImpl implements DashboardService {
 | 
					public class DashboardServiceImpl implements DashboardService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final LogService logService;
 | 
					    private final LogService logService;
 | 
				
			||||||
    private final AnnouncementService announcementService;
 | 
					    private final NoticeService noticeService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public DashboardTotalResp getTotal() {
 | 
					    public DashboardTotalResp getTotal() {
 | 
				
			||||||
@@ -85,7 +85,7 @@ public class DashboardServiceImpl implements DashboardService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<DashboardAnnouncementResp> listAnnouncement() {
 | 
					    public List<DashboardNoticeResp> listNotice() {
 | 
				
			||||||
        return announcementService.listDashboard();
 | 
					        return noticeService.listDashboard();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,22 +16,20 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package top.continew.admin.system.service.impl;
 | 
					package top.continew.admin.system.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import lombok.RequiredArgsConstructor;
 | 
					import lombok.RequiredArgsConstructor;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					import top.continew.admin.system.mapper.NoticeMapper;
 | 
				
			||||||
import top.continew.admin.system.mapper.AnnouncementMapper;
 | 
					import top.continew.admin.system.model.entity.NoticeDO;
 | 
				
			||||||
import top.continew.admin.system.model.entity.AnnouncementDO;
 | 
					import top.continew.admin.system.model.query.NoticeQuery;
 | 
				
			||||||
import top.continew.admin.system.model.query.AnnouncementQuery;
 | 
					import top.continew.admin.system.model.req.NoticeReq;
 | 
				
			||||||
import top.continew.admin.system.model.req.AnnouncementReq;
 | 
					import top.continew.admin.system.model.resp.DashboardNoticeResp;
 | 
				
			||||||
import top.continew.admin.system.model.resp.AnnouncementDetailResp;
 | 
					import top.continew.admin.system.model.resp.NoticeDetailResp;
 | 
				
			||||||
import top.continew.admin.system.model.resp.AnnouncementResp;
 | 
					import top.continew.admin.system.model.resp.NoticeResp;
 | 
				
			||||||
import top.continew.admin.system.model.resp.DashboardAnnouncementResp;
 | 
					import top.continew.admin.system.service.NoticeService;
 | 
				
			||||||
import top.continew.admin.system.service.AnnouncementService;
 | 
					 | 
				
			||||||
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
 | 
					import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 公告业务实现
 | 
					 * 公告业务实现
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -40,10 +38,10 @@ import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Service
 | 
					@Service
 | 
				
			||||||
@RequiredArgsConstructor
 | 
					@RequiredArgsConstructor
 | 
				
			||||||
public class AnnouncementServiceImpl extends BaseServiceImpl<AnnouncementMapper, AnnouncementDO, AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> implements AnnouncementService {
 | 
					public class NoticeServiceImpl extends BaseServiceImpl<NoticeMapper, NoticeDO, NoticeResp, NoticeDetailResp, NoticeQuery, NoticeReq> implements NoticeService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<DashboardAnnouncementResp> listDashboard() {
 | 
					    public List<DashboardNoticeResp> listDashboard() {
 | 
				
			||||||
        return baseMapper.selectDashboardList();
 | 
					        return baseMapper.selectDashboardList();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1,12 +1,12 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" ?>
 | 
					<?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" >
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 | 
				
			||||||
<mapper namespace="top.continew.admin.system.mapper.AnnouncementMapper">
 | 
					<mapper namespace="top.continew.admin.system.mapper.NoticeMapper">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <select id="selectDashboardList"
 | 
					    <select id="selectDashboardList"
 | 
				
			||||||
            resultType="top.continew.admin.system.model.resp.DashboardAnnouncementResp">
 | 
					            resultType="top.continew.admin.system.model.resp.DashboardNoticeResp">
 | 
				
			||||||
        SELECT
 | 
					        SELECT
 | 
				
			||||||
            id, title, type
 | 
					            id, title, type
 | 
				
			||||||
        FROM sys_announcement
 | 
					        FROM sys_notice
 | 
				
			||||||
        WHERE (effective_time IS NULL OR NOW() > effective_time)
 | 
					        WHERE (effective_time IS NULL OR NOW() > effective_time)
 | 
				
			||||||
          AND (terminate_time IS NULL OR terminate_time > NOW())
 | 
					          AND (terminate_time IS NULL OR terminate_time > NOW())
 | 
				
			||||||
        ORDER BY sort ASC, effective_time DESC
 | 
					        ORDER BY sort ASC, effective_time DESC
 | 
				
			||||||
@@ -102,7 +102,7 @@ public class CommonController {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Operation(summary = "查询字典", description = "查询字典列表")
 | 
					    @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}")
 | 
					    @GetMapping("/dict/{code}")
 | 
				
			||||||
    public R<List<LabelValueResp<Serializable>>> listDict(@PathVariable String code) {
 | 
					    public R<List<LabelValueResp<Serializable>>> listDict(@PathVariable String code) {
 | 
				
			||||||
        Optional<Class<?>> enumClassOptional = this.getEnumClassByName(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.DashboardPopularModuleResp;
 | 
				
			||||||
import top.continew.admin.system.model.resp.DashboardTotalResp;
 | 
					import top.continew.admin.system.model.resp.DashboardTotalResp;
 | 
				
			||||||
import top.continew.admin.system.service.DashboardService;
 | 
					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.core.util.validate.ValidationUtils;
 | 
				
			||||||
import top.continew.starter.web.model.R;
 | 
					import top.continew.starter.web.model.R;
 | 
				
			||||||
import top.continew.starter.log.core.annotation.Log;
 | 
					import top.continew.starter.log.core.annotation.Log;
 | 
				
			||||||
@@ -89,8 +89,8 @@ public class DashboardController {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Operation(summary = "查询公告列表", description = "查询公告列表")
 | 
					    @Operation(summary = "查询公告列表", description = "查询公告列表")
 | 
				
			||||||
    @GetMapping("/announcement")
 | 
					    @GetMapping("/notice")
 | 
				
			||||||
    public R<List<DashboardAnnouncementResp>> listAnnouncement() {
 | 
					    public R<List<DashboardNoticeResp>> listNotice() {
 | 
				
			||||||
        return R.ok(dashboardService.listAnnouncement());
 | 
					        return R.ok(dashboardService.listNotice());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,26 +16,26 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package top.continew.admin.webapi.system;
 | 
					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 cn.dev33.satoken.annotation.SaCheckPermission;
 | 
				
			||||||
 | 
					import io.swagger.v3.oas.annotations.tags.Tag;
 | 
				
			||||||
import top.continew.admin.system.model.query.AnnouncementQuery;
 | 
					import org.springframework.validation.annotation.Validated;
 | 
				
			||||||
import top.continew.admin.system.model.req.AnnouncementReq;
 | 
					import org.springframework.web.bind.annotation.PathVariable;
 | 
				
			||||||
import top.continew.admin.system.model.resp.AnnouncementDetailResp;
 | 
					import org.springframework.web.bind.annotation.RequestBody;
 | 
				
			||||||
import top.continew.admin.system.model.resp.AnnouncementResp;
 | 
					import org.springframework.web.bind.annotation.RestController;
 | 
				
			||||||
import top.continew.admin.system.service.AnnouncementService;
 | 
					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.core.util.validate.ValidationUtils;
 | 
				
			||||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
 | 
					import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
 | 
				
			||||||
import top.continew.starter.extension.crud.controller.BaseController;
 | 
					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.extension.crud.util.ValidateGroup;
 | 
				
			||||||
import top.continew.starter.web.model.R;
 | 
					import top.continew.starter.web.model.R;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 公告管理 API
 | 
					 * 公告管理 API
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -44,19 +44,19 @@ import top.continew.starter.web.model.R;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Tag(name = "公告管理 API")
 | 
					@Tag(name = "公告管理 API")
 | 
				
			||||||
@RestController
 | 
					@RestController
 | 
				
			||||||
@CrudRequestMapping("/system/announcement")
 | 
					@CrudRequestMapping(value = "/system/notice", api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE})
 | 
				
			||||||
public class AnnouncementController extends BaseController<AnnouncementService, AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> {
 | 
					public class NoticeController extends BaseController<NoticeService, NoticeResp, NoticeDetailResp, NoticeQuery, NoticeReq> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @SaCheckPermission("system:announcement:add")
 | 
					    @SaCheckPermission("system:notice:add")
 | 
				
			||||||
    public R<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody AnnouncementReq req) {
 | 
					    public R<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody NoticeReq req) {
 | 
				
			||||||
        this.checkTime(req);
 | 
					        this.checkTime(req);
 | 
				
			||||||
        return super.add(req);
 | 
					        return super.add(req);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @SaCheckPermission("system:announcement:update")
 | 
					    @SaCheckPermission("system:notice:update")
 | 
				
			||||||
    public R<Void> update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody AnnouncementReq req,
 | 
					    public R<Void> update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody NoticeReq req,
 | 
				
			||||||
                          @PathVariable Long id) {
 | 
					                          @PathVariable Long id) {
 | 
				
			||||||
        this.checkTime(req);
 | 
					        this.checkTime(req);
 | 
				
			||||||
        return super.update(req, id);
 | 
					        return super.update(req, id);
 | 
				
			||||||
@@ -67,7 +67,7 @@ public class AnnouncementController extends BaseController<AnnouncementService,
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param req 创建或修改信息
 | 
					     * @param req 创建或修改信息
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void checkTime(AnnouncementReq req) {
 | 
					    private void checkTime(NoticeReq req) {
 | 
				
			||||||
        LocalDateTime effectiveTime = req.getEffectiveTime();
 | 
					        LocalDateTime effectiveTime = req.getEffectiveTime();
 | 
				
			||||||
        LocalDateTime terminateTime = req.getTerminateTime();
 | 
					        LocalDateTime terminateTime = req.getTerminateTime();
 | 
				
			||||||
        if (null != effectiveTime && null != terminateTime) {
 | 
					        if (null != effectiveTime && null != terminateTime) {
 | 
				
			||||||
@@ -120,7 +120,7 @@ VALUES
 | 
				
			|||||||
INSERT INTO `sys_dict`
 | 
					INSERT INTO `sys_dict`
 | 
				
			||||||
(`id`, `name`, `code`, `description`, `is_system`, `create_user`, `create_time`, `update_user`, `update_time`)
 | 
					(`id`, `name`, `code`, `description`, `is_system`, `create_user`, `create_time`, `update_user`, `update_time`)
 | 
				
			||||||
VALUES
 | 
					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`
 | 
					INSERT INTO `sys_dict_item`
 | 
				
			||||||
(`id`, `label`, `value`, `color`, `sort`, `description`, `status`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`)
 | 
					(`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
 | 
					    PRIMARY KEY (`message_id`, `user_id`) USING BTREE
 | 
				
			||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='消息和用户关联表';
 | 
					) 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',
 | 
					    `id`             bigint(20)   NOT NULL             COMMENT 'ID',
 | 
				
			||||||
    `title`          varchar(150) NOT NULL             COMMENT '标题',
 | 
					    `title`          varchar(150) NOT NULL             COMMENT '标题',
 | 
				
			||||||
    `content`        mediumtext   NOT NULL             COMMENT '内容',
 | 
					    `content`        mediumtext   NOT NULL             COMMENT '内容',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -120,7 +120,7 @@ VALUES
 | 
				
			|||||||
INSERT INTO "sys_dict"
 | 
					INSERT INTO "sys_dict"
 | 
				
			||||||
("id", "name", "code", "description", "is_system", "create_user", "create_time", "update_user", "update_time")
 | 
					("id", "name", "code", "description", "is_system", "create_user", "create_time", "update_user", "update_time")
 | 
				
			||||||
VALUES
 | 
					VALUES
 | 
				
			||||||
(547889614262632491, '公告类型', 'announcement_type', NULL, true, 1, NOW(), NULL, NULL);
 | 
					(547889614262632491, '公告类型', 'notice_type', NULL, true, 1, NOW(), NULL, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INSERT INTO "sys_dict_item"
 | 
					INSERT INTO "sys_dict_item"
 | 
				
			||||||
("id", "label", "value", "color", "sort", "description", "status", "dict_id", "create_user", "create_time", "update_user", "update_time")
 | 
					("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 COLUMN "sys_message_user"."read_time"  IS '读取时间';
 | 
				
			||||||
COMMENT ON TABLE  "sys_message_user"              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,
 | 
					    "id"             int8         NOT NULL,
 | 
				
			||||||
    "title"          varchar(150) NOT NULL,
 | 
					    "title"          varchar(150) NOT NULL,
 | 
				
			||||||
    "content"        text         NOT NULL,
 | 
					    "content"        text         NOT NULL,
 | 
				
			||||||
@@ -374,20 +374,20 @@ CREATE TABLE IF NOT EXISTS "sys_announcement" (
 | 
				
			|||||||
    "update_time"    timestamp    DEFAULT NULL,
 | 
					    "update_time"    timestamp    DEFAULT NULL,
 | 
				
			||||||
    PRIMARY KEY ("id")
 | 
					    PRIMARY KEY ("id")
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
CREATE INDEX "idx_announcement_create_user" ON "sys_announcement" ("create_user");
 | 
					CREATE INDEX "idx_notice_create_user" ON "sys_notice" ("create_user");
 | 
				
			||||||
CREATE INDEX "idx_announcement_update_user" ON "sys_announcement" ("update_user");
 | 
					CREATE INDEX "idx_notice_update_user" ON "sys_notice" ("update_user");
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."id"             IS 'ID';
 | 
					COMMENT ON COLUMN "sys_notice"."id"             IS 'ID';
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."title"          IS '标题';
 | 
					COMMENT ON COLUMN "sys_notice"."title"          IS '标题';
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."content"        IS '内容';
 | 
					COMMENT ON COLUMN "sys_notice"."content"        IS '内容';
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."type"           IS '类型';
 | 
					COMMENT ON COLUMN "sys_notice"."type"           IS '类型';
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."effective_time" IS '生效时间';
 | 
					COMMENT ON COLUMN "sys_notice"."effective_time" IS '生效时间';
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."terminate_time" IS '终止时间';
 | 
					COMMENT ON COLUMN "sys_notice"."terminate_time" IS '终止时间';
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."sort"           IS '排序';
 | 
					COMMENT ON COLUMN "sys_notice"."sort"           IS '排序';
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."create_user"    IS '创建人';
 | 
					COMMENT ON COLUMN "sys_notice"."create_user"    IS '创建人';
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."create_time"    IS '创建时间';
 | 
					COMMENT ON COLUMN "sys_notice"."create_time"    IS '创建时间';
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."update_user"    IS '修改人';
 | 
					COMMENT ON COLUMN "sys_notice"."update_user"    IS '修改人';
 | 
				
			||||||
COMMENT ON COLUMN "sys_announcement"."update_time"    IS '修改时间';
 | 
					COMMENT ON COLUMN "sys_notice"."update_time"    IS '修改时间';
 | 
				
			||||||
COMMENT ON TABLE  "sys_announcement"                  IS '公告表';
 | 
					COMMENT ON TABLE  "sys_notice"                  IS '公告表';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CREATE TABLE IF NOT EXISTS "sys_storage" (
 | 
					CREATE TABLE IF NOT EXISTS "sys_storage" (
 | 
				
			||||||
    "id"          int8         NOT NULL,
 | 
					    "id"          int8         NOT NULL,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user