From ac1f03862f139f79e79fb8cdb15596bcc86c2fcb Mon Sep 17 00:00:00 2001 From: zhc077 <565291854> Date: Fri, 27 Oct 2023 16:33:29 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8Ccms=E9=A6=96=E9=A1=B5=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/config/shiro/ShiroConfig.java | 6 +- .../cms/controller/CmsHomePageController.java | 70 +++++++++++++++++++ 2 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsHomePageController.java diff --git a/jeecg-boot-master/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java b/jeecg-boot-master/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java index 8b84f95f..03944151 100644 --- a/jeecg-boot-master/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java +++ b/jeecg-boot-master/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java @@ -99,6 +99,8 @@ public class ShiroConfig { filterChainDefinitionMap.put("/sys/getQrcodeToken/**", "anon"); //监听扫码 filterChainDefinitionMap.put("/sys/checkAuth", "anon"); //授权接口排除 + //CMS门户 + filterChainDefinitionMap.put("/cms/front/**","anon"); filterChainDefinitionMap.put("/", "anon"); filterChainDefinitionMap.put("/doc.html", "anon"); @@ -120,14 +122,14 @@ public class ShiroConfig { filterChainDefinitionMap.put("/swagger**/**", "anon"); filterChainDefinitionMap.put("/webjars/**", "anon"); filterChainDefinitionMap.put("/v2/**", "anon"); - + filterChainDefinitionMap.put("/sys/annountCement/show/**", "anon"); //积木报表排除 filterChainDefinitionMap.put("/jmreport/**", "anon"); filterChainDefinitionMap.put("/**/*.js.map", "anon"); filterChainDefinitionMap.put("/**/*.css.map", "anon"); - + //大屏模板例子 filterChainDefinitionMap.put("/test/bigScreen/**", "anon"); filterChainDefinitionMap.put("/bigscreen/template1/**", "anon"); diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsHomePageController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsHomePageController.java new file mode 100644 index 00000000..31160907 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsHomePageController.java @@ -0,0 +1,70 @@ +package org.jeecg.modules.demo.cms.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.demo.cms.entity.CmsArticle; +import org.jeecg.modules.demo.cms.entity.CmsColumn; +import org.jeecg.modules.demo.cms.service.ICmsArticleService; +import org.jeecg.modules.demo.cms.service.ICmsColumnService; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +@Api(tags = "cms首页") +@RestController +@RequestMapping("/cms/front") +@Slf4j +public class CmsHomePageController /*extends JeecgController*/ { + + @Autowired + private ICmsColumnService cmsColumnService; + + @Autowired + private ICmsArticleService cmsArticleService; + + @ApiOperation(value = "文章栏目-列表", notes = "文章栏目-列表") + @GetMapping(value = "/getColumnList") + public Result getColumnList(HttpServletRequest req) { + List list = cmsColumnService.list(new LambdaQueryWrapper() + .eq(CmsColumn::getIsShow, "1") + .orderByAsc(CmsColumn::getSort)); + return Result.OK(list); + } + + @ApiOperation(value = "通过栏目类型获取文章列表", notes = "通过栏目类型获取文章列表") + @GetMapping(value = "/getArticleListByColumn") + public Result getArticleListByColumn(CmsArticle cmsArticle, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(cmsArticle, req.getParameterMap()); + queryWrapper.eq("status", "1"); + queryWrapper.eq("column_id", cmsArticle.getColumnId()); + queryWrapper.last("order by publish_time desc"); + Page page = new Page(pageNo, pageSize); + IPage pageList = cmsArticleService.page(page, queryWrapper); + return Result.OK(pageList); + } + + @ApiOperation(value = "通过文单标题查询", notes = "通过文单标题查询") + @GetMapping(value = "/getByArticleTitle") + public Result getByArticleTitle(CmsArticle cmsArticle, HttpServletRequest req) { + List list = cmsArticleService.list(new LambdaQueryWrapper() + .eq(CmsArticle::getStatus, "1") + .eq(CmsArticle::getTitle, cmsArticle.getTitle()) + .orderByDesc(CmsArticle::getPublishTime)); + return Result.OK(list); + } +}