diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/IndexInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/IndexInfoController.java new file mode 100644 index 0000000..d8821f0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/controller/IndexInfoController.java @@ -0,0 +1,45 @@ +package com.ruoyi.cms.controller; + +import com.ruoyi.cms.domain.vo.ServerVo; +import com.ruoyi.cms.service.IndexInfoService; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 统计系统 + */ +@RequestMapping("/indexInfo") +@RestController +public class IndexInfoController extends BaseController { + + @Autowired + private IndexInfoService infoService; + + @Autowired + private RuoYiConfig ruoYiConfig; + + /** + * 统计栏目、内容、大赛、参数人数 + * @return + */ + @GetMapping() + public AjaxResult getIndexInfo(){ + return success(infoService.getSiteStat()); + } + + /** + * 系统信息 + */ + @GetMapping("/server") + public AjaxResult getServerInfo(){ + ServerVo serverVo = new ServerVo(); + serverVo.setName(ruoYiConfig.getName()); + serverVo.setVersion(ruoYiConfig.getVersion()); + return success(serverVo); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/vo/ServerVo.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/vo/ServerVo.java new file mode 100644 index 0000000..12ebbd3 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/vo/ServerVo.java @@ -0,0 +1,13 @@ +package com.ruoyi.cms.domain.vo; + +import lombok.Data; + +@Data +public class ServerVo { + + /** 项目名称 */ + private String name; + + /** 版本 */ + private String version; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/vo/SiteStatVo.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/vo/SiteStatVo.java new file mode 100644 index 0000000..a83f295 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/domain/vo/SiteStatVo.java @@ -0,0 +1,23 @@ +package com.ruoyi.cms.domain.vo; + +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; + +/** + * 统计类 + */ +@Data +public class SiteStatVo extends BaseEntity { + + /** 栏目数量 */ + private Long categoryCount; + + /** 文章数量 */ + private Long contentCount; + + /** 大赛数量 */ + private Long competitionCount; + + /** 参赛人员数量 */ + private Long studentCount; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IndexInfoService.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IndexInfoService.java new file mode 100644 index 0000000..c843730 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/IndexInfoService.java @@ -0,0 +1,12 @@ +package com.ruoyi.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.cms.domain.vo.SiteStatVo; + +/** + * 统计系统 + */ +public interface IndexInfoService { + + public SiteStatVo getSiteStat(); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/IndexInfoServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/IndexInfoServiceImpl.java new file mode 100644 index 0000000..daf4c5c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/cms/service/impl/IndexInfoServiceImpl.java @@ -0,0 +1,42 @@ +package com.ruoyi.cms.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.cms.domain.CmsCategory; +import com.ruoyi.cms.domain.CmsContent; +import com.ruoyi.cms.domain.HitCompetition; +import com.ruoyi.cms.domain.HitRegistrationStudentInfo; +import com.ruoyi.cms.domain.vo.SiteStatVo; +import com.ruoyi.cms.mapper.CmsCategoryMapper; +import com.ruoyi.cms.mapper.CmsContentMapper; +import com.ruoyi.cms.mapper.HitCompetitionMapper; +import com.ruoyi.cms.mapper.HitRegistrationStudentInfoMapper; +import com.ruoyi.cms.service.IndexInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class IndexInfoServiceImpl implements IndexInfoService { + + @Autowired + private CmsContentMapper contentMapper; + + @Autowired + private CmsCategoryMapper categoryMapper; + + @Autowired + private HitCompetitionMapper competitionMapper; + + @Autowired + private HitRegistrationStudentInfoMapper studentInfoMapper; + + @Override + public SiteStatVo getSiteStat() { + SiteStatVo siteStatVo = new SiteStatVo(); + siteStatVo.setCategoryCount(categoryMapper.selectCount(new QueryWrapper().eq("is_disable", 0))); + siteStatVo.setContentCount(contentMapper.selectCount(new QueryWrapper().eq("del_flag", 0))); + siteStatVo.setCompetitionCount(competitionMapper.selectCount(new QueryWrapper())); + siteStatVo.setStudentCount(studentInfoMapper.selectCount(new QueryWrapper())); + return siteStatVo; + } +} diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index f4ea182..7ba56c9 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -1,9 +1,9 @@ # 项目相关配置 ruoyi: # 名称 - name: RuoYi + name: 后台管理系统 # 版本 - version: 3.8.8 + version: 1.2.1 # 版权年份 copyrightYear: 2024 # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) diff --git a/ruoyi-admin/target/classes/application.yml b/ruoyi-admin/target/classes/application.yml index f4ea182..7ba56c9 100644 --- a/ruoyi-admin/target/classes/application.yml +++ b/ruoyi-admin/target/classes/application.yml @@ -1,9 +1,9 @@ # 项目相关配置 ruoyi: # 名称 - name: RuoYi + name: 后台管理系统 # 版本 - version: 3.8.8 + version: 1.2.1 # 版权年份 copyrightYear: 2024 # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) diff --git a/ruoyi-admin/target/classes/mapper/cms/CmsContentMapper.xml b/ruoyi-admin/target/classes/mapper/cms/CmsContentMapper.xml index 55da25c..67de817 100644 --- a/ruoyi-admin/target/classes/mapper/cms/CmsContentMapper.xml +++ b/ruoyi-admin/target/classes/mapper/cms/CmsContentMapper.xml @@ -5,57 +5,87 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - select id, category_id, content_type,image_url, video_url, content_title, content_img, content_detail, source, source_url, original, author, editor, summary, status, publish_date, offline_date, is_accessory, accessory_url, remark, del_flag, create_time, create_by, update_time, update_by from cms_content + select id, + category_id, + content_type, + image_url, + video_url, + content_title, + content_img, + content_detail, + source, + source_url, + original, + author, + editor, + summary, + status, + publish_date, + offline_date, + is_accessory, + accessory_url, + remark, + del_flag, + create_time, + create_by, + update_time, + update_by + from cms_content @@ -111,51 +141,59 @@ #{publishDate}, #{offlineDate}, #{isAccessory}, - #{accessoryUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, + + #{accessoryUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, + #{remark}, #{delFlag}, #{createTime}, #{createBy}, #{updateTime}, #{updateBy}, - #{imageUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, - #{videoUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, + + #{imageUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, + + + #{videoUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, + update cms_content - category_id = #{categoryId}, - content_type = #{contentType}, - content_title = #{contentTitle}, - content_img = #{contentImg}, - content_detail = #{contentDetail}, - source = #{source}, - source_url = #{sourceUrl}, - original = #{original}, - author = #{author}, - editor = #{editor}, - summary = #{summary}, - status = #{status}, - publish_date = #{publishDate}, - offline_date = #{offlineDate}, - is_accessory = #{isAccessory}, - accessory_url = #{accessoryUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, - remark = #{remark}, - del_flag = #{delFlag}, - create_time = #{createTime}, - create_by = #{createBy}, - update_time = #{updateTime}, - update_by = #{updateBy}, - image_url = #{imageUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, - video_url = #{videoUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, + category_id = #{categoryId}, + content_type = #{contentType}, + content_title = #{contentTitle}, + content_img = #{contentImg}, + content_detail = #{contentDetail}, + source = #{source}, + source_url = #{sourceUrl}, + original = #{original}, + author = #{author}, + editor = #{editor}, + summary = #{summary}, + status = #{status}, + publish_date = #{publishDate}, + offline_date = #{offlineDate}, + is_accessory = #{isAccessory}, + accessory_url = #{accessoryUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, + remark = #{remark}, + del_flag = #{delFlag}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + image_url = #{imageUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, + video_url = #{videoUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler}, where id = #{id} - delete from cms_content where id = #{id} + delete + from cms_content + where id = #{id} diff --git a/ruoyi-ui/src/api/cms/indexInfo.js b/ruoyi-ui/src/api/cms/indexInfo.js new file mode 100644 index 0000000..5cdfc3d --- /dev/null +++ b/ruoyi-ui/src/api/cms/indexInfo.js @@ -0,0 +1,16 @@ +import request from "@/utils/request"; + +export function getSiteStatData() { + return request({ + url: '/indexInfo', + method: 'get' + }) +} + +export function getCmsConfiguration() { + return request({ + url: '/indexInfo/server', + method: 'get' + }) +} + diff --git a/ruoyi-ui/src/assets/icons/svg/content.svg b/ruoyi-ui/src/assets/icons/svg/content.svg new file mode 100644 index 0000000..ea31478 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/content.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/treelog.svg b/ruoyi-ui/src/assets/icons/svg/treelog.svg new file mode 100644 index 0000000..7693acc --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/treelog.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/views/dashboard/cmsInfo/index.vue b/ruoyi-ui/src/views/dashboard/cmsInfo/index.vue new file mode 100644 index 0000000..3c1da8e --- /dev/null +++ b/ruoyi-ui/src/views/dashboard/cmsInfo/index.vue @@ -0,0 +1,216 @@ + + + + + diff --git a/ruoyi-ui/src/views/dashboard/serverInfo/index.vue b/ruoyi-ui/src/views/dashboard/serverInfo/index.vue index bdd5009..b752617 100644 --- a/ruoyi-ui/src/views/dashboard/serverInfo/index.vue +++ b/ruoyi-ui/src/views/dashboard/serverInfo/index.vue @@ -1,68 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +--> +export default { + name: "ServerInfoDashboard", + data () { + return { + config:{} + }; + }, + created() { + this.loadServerInfo(); + }, + methods: { + loadServerInfo() { + getCmsConfiguration().then(response => { + this.config = response.data; + }) + }, + } +}; + diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index d5152db..1502e46 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -4,9 +4,15 @@ + + + + + + @@ -14,12 +20,16 @@