mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-11-04 21:01:38 +08:00 
			
		
		
		
	feat: 完善仪表盘公告区块内容
This commit is contained in:
		@@ -16,8 +16,11 @@
 | 
			
		||||
 | 
			
		||||
package top.charles7c.cnadmin.system.mapper;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import top.charles7c.cnadmin.common.base.BaseMapper;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.entity.AnnouncementDO;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.vo.AnnouncementDashboardVO;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 公告 Mapper
 | 
			
		||||
@@ -25,4 +28,12 @@ import top.charles7c.cnadmin.system.model.entity.AnnouncementDO;
 | 
			
		||||
 * @author Charles7c
 | 
			
		||||
 * @since 2023/8/20 10:55
 | 
			
		||||
 */
 | 
			
		||||
public interface AnnouncementMapper extends BaseMapper<AnnouncementDO> {}
 | 
			
		||||
public interface AnnouncementMapper extends BaseMapper<AnnouncementDO> {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询仪表盘公告列表
 | 
			
		||||
     *
 | 
			
		||||
     * @return 公告列表
 | 
			
		||||
     */
 | 
			
		||||
    List<AnnouncementDashboardVO> selectDashboardList();
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,56 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package top.charles7c.cnadmin.system.model.vo;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
 | 
			
		||||
import top.charles7c.cnadmin.system.enums.AnnouncementTypeEnum;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 仪表盘公告信息
 | 
			
		||||
 *
 | 
			
		||||
 * @author Charles7c
 | 
			
		||||
 * @since 2023/8/20 10:55
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@Schema(description = "仪表盘公告信息")
 | 
			
		||||
public class AnnouncementDashboardVO implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * ID
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "ID", example = "1")
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 标题
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "标题", example = "这是标题")
 | 
			
		||||
    private String title;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 类型
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "类型")
 | 
			
		||||
    private AnnouncementTypeEnum type;
 | 
			
		||||
}
 | 
			
		||||
@@ -16,9 +16,12 @@
 | 
			
		||||
 | 
			
		||||
package top.charles7c.cnadmin.system.service;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import top.charles7c.cnadmin.common.base.BaseService;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.query.AnnouncementQuery;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.request.AnnouncementRequest;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.vo.AnnouncementDashboardVO;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.vo.AnnouncementDetailVO;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.vo.AnnouncementVO;
 | 
			
		||||
 | 
			
		||||
@@ -29,4 +32,12 @@ import top.charles7c.cnadmin.system.model.vo.AnnouncementVO;
 | 
			
		||||
 * @since 2023/8/20 10:55
 | 
			
		||||
 */
 | 
			
		||||
public interface AnnouncementService
 | 
			
		||||
    extends BaseService<AnnouncementVO, AnnouncementDetailVO, AnnouncementQuery, AnnouncementRequest> {}
 | 
			
		||||
    extends BaseService<AnnouncementVO, AnnouncementDetailVO, AnnouncementQuery, AnnouncementRequest> {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询仪表盘公告列表
 | 
			
		||||
     *
 | 
			
		||||
     * @return 公告列表
 | 
			
		||||
     */
 | 
			
		||||
    List<AnnouncementDashboardVO> listDashboard();
 | 
			
		||||
}
 | 
			
		||||
@@ -16,6 +16,8 @@
 | 
			
		||||
 | 
			
		||||
package top.charles7c.cnadmin.system.service.impl;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
@@ -25,6 +27,7 @@ import top.charles7c.cnadmin.system.mapper.AnnouncementMapper;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.entity.AnnouncementDO;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.query.AnnouncementQuery;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.request.AnnouncementRequest;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.vo.AnnouncementDashboardVO;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.vo.AnnouncementDetailVO;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.vo.AnnouncementVO;
 | 
			
		||||
import top.charles7c.cnadmin.system.service.AnnouncementService;
 | 
			
		||||
@@ -38,4 +41,10 @@ import top.charles7c.cnadmin.system.service.AnnouncementService;
 | 
			
		||||
@Service
 | 
			
		||||
@RequiredArgsConstructor
 | 
			
		||||
public class AnnouncementServiceImpl extends BaseServiceImpl<AnnouncementMapper, AnnouncementDO, AnnouncementVO,
 | 
			
		||||
    AnnouncementDetailVO, AnnouncementQuery, AnnouncementRequest> implements AnnouncementService {}
 | 
			
		||||
    AnnouncementDetailVO, AnnouncementQuery, AnnouncementRequest> implements AnnouncementService {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<AnnouncementDashboardVO> listDashboard() {
 | 
			
		||||
        return baseMapper.selectDashboardList();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8" ?>
 | 
			
		||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 | 
			
		||||
<mapper namespace="top.charles7c.cnadmin.system.mapper.AnnouncementMapper">
 | 
			
		||||
 | 
			
		||||
    <select id="selectDashboardList"
 | 
			
		||||
            resultType="top.charles7c.cnadmin.system.model.vo.AnnouncementDashboardVO">
 | 
			
		||||
        SELECT
 | 
			
		||||
            `id`, `title`, `type`
 | 
			
		||||
        FROM `sys_announcement`
 | 
			
		||||
        WHERE (`effective_time` IS NULL OR NOW() > `effective_time`)
 | 
			
		||||
          AND (`terminate_time` IS NULL OR `terminate_time` > NOW())
 | 
			
		||||
        ORDER BY `sort` ASC, `effective_time` DESC
 | 
			
		||||
        LIMIT 5
 | 
			
		||||
    </select>
 | 
			
		||||
</mapper>
 | 
			
		||||
		Reference in New Issue
	
	Block a user