From 06f349c833afef771ff4ec1bffee501a0ade3fe3 Mon Sep 17 00:00:00 2001 From: gxwebsoft Date: Thu, 7 Mar 2024 13:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ArticleCategoryController.java | 35 ++++- .../cms/controller/ArticleController.java | 16 +- .../cms/controller/DesignController.java | 2 +- .../cms/controller/WebsiteController.java | 142 ++++++++++++------ .../java/com/gxwebsoft/cms/entity/Ad.java | 6 + .../com/gxwebsoft/cms/entity/Article.java | 24 ++- .../gxwebsoft/cms/entity/ArticleCategory.java | 40 ++++- .../com/gxwebsoft/cms/entity/Website.java | 31 +++- .../cms/mapper/xml/ArticleCategoryMapper.xml | 15 +- .../cms/mapper/xml/ArticleMapper.xml | 3 +- .../cms/param/ArticleCategoryParam.java | 16 ++ .../impl/ArticleCategoryServiceImpl.java | 4 +- .../cms/service/impl/DesignServiceImpl.java | 2 +- 13 files changed, 249 insertions(+), 87 deletions(-) diff --git a/src/main/java/com/gxwebsoft/cms/controller/ArticleCategoryController.java b/src/main/java/com/gxwebsoft/cms/controller/ArticleCategoryController.java index c09e96c..24d9399 100644 --- a/src/main/java/com/gxwebsoft/cms/controller/ArticleCategoryController.java +++ b/src/main/java/com/gxwebsoft/cms/controller/ArticleCategoryController.java @@ -1,8 +1,11 @@ package com.gxwebsoft.cms.controller; +import com.gxwebsoft.cms.entity.Article; import com.gxwebsoft.cms.entity.ArticleCategory; import com.gxwebsoft.cms.param.ArticleCategoryParam; +import com.gxwebsoft.cms.param.ArticleParam; import com.gxwebsoft.cms.service.ArticleCategoryService; +import com.gxwebsoft.cms.service.ArticleService; import com.gxwebsoft.common.core.web.*; import com.gxwebsoft.common.system.entity.User; import io.swagger.annotations.Api; @@ -24,22 +27,34 @@ import java.util.List; public class ArticleCategoryController extends BaseController { @Resource private ArticleCategoryService articleCategoryService; + @Resource + private ArticleService articleService; @ApiOperation("分页查询文章分类表") @GetMapping("/page") public ApiResult> page(ArticleCategoryParam param) { PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc,create_time desc"); + page.setDefaultOrder("sort_number asc,create_time asc"); return success(articleCategoryService.page(page, page.getWrapper())); - // 使用关联查询 } @ApiOperation("查询全部文章分类表") @GetMapping() public ApiResult> list(ArticleCategoryParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc,create_time desc"); - return success(articleCategoryService.list(page.getOrderWrapper())); + // 使用关联查询 + List categoryList = articleCategoryService.listRel(param); + // 是否读取新闻列表 + if (param.getSceneType() != null && param.getSceneType().equals("showArticle")) { + categoryList.forEach(d->{ + final ArticleParam articleParam = new ArticleParam(); + articleParam.setCategoryId(d.getCategoryId()); + articleParam.setDeleted(0); + articleParam.setLimit(5L); + final PageResult
articlePageResult = articleService.pageRel(articleParam); + d.setArticleList(articlePageResult.getList()); + }); + } + return success(categoryList); // 使用关联查询 //return success(articleCategoryService.listRel(param)); } @@ -47,9 +62,13 @@ public class ArticleCategoryController extends BaseController { @ApiOperation("根据id查询文章分类表") @GetMapping("/{id}") public ApiResult get(@PathVariable("id") Integer id) { - return success(articleCategoryService.getById(id)); - // 使用关联查询 - //return success(articleCategoryService.getByIdRel(id)); + // 使用关联查询 + ArticleCategory category = articleCategoryService.getByIdRel(id); + if (!category.getParentId().equals(0)) { + final ArticleCategory parentCategory = articleCategoryService.getById(category.getParentId()); + category.setParentName(parentCategory.getTitle()); + } + return success(category); } @ApiOperation("添加文章分类表") diff --git a/src/main/java/com/gxwebsoft/cms/controller/ArticleController.java b/src/main/java/com/gxwebsoft/cms/controller/ArticleController.java index 783d104..e98f20f 100644 --- a/src/main/java/com/gxwebsoft/cms/controller/ArticleController.java +++ b/src/main/java/com/gxwebsoft/cms/controller/ArticleController.java @@ -1,18 +1,12 @@ package com.gxwebsoft.cms.controller; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.cms.service.ArticleService; import com.gxwebsoft.cms.entity.Article; import com.gxwebsoft.cms.param.ArticleParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.cms.service.ArticleService; +import com.gxwebsoft.common.core.web.*; import com.gxwebsoft.common.system.entity.User; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -54,9 +48,9 @@ public class ArticleController extends BaseController { @ApiOperation("根据id查询文章记录表") @GetMapping("/{id}") public ApiResult
get(@PathVariable("id") Integer id) { - return success(articleService.getById(id)); - // 使用关联查询 - //return success(articleService.getByIdRel(id)); + // 使用关联查询 + Article article = articleService.getByIdRel(id); + return success(article); } @ApiOperation("添加文章记录表") diff --git a/src/main/java/com/gxwebsoft/cms/controller/DesignController.java b/src/main/java/com/gxwebsoft/cms/controller/DesignController.java index f607bcf..9bedd08 100644 --- a/src/main/java/com/gxwebsoft/cms/controller/DesignController.java +++ b/src/main/java/com/gxwebsoft/cms/controller/DesignController.java @@ -36,7 +36,7 @@ public class DesignController extends BaseController { @GetMapping() public ApiResult> list(DesignParam param) { PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); + page.setDefaultOrder("sort_number asc,create_time desc"); return success(designService.list(page.getOrderWrapper())); // 使用关联查询 //return success(designService.listRel(param)); diff --git a/src/main/java/com/gxwebsoft/cms/controller/WebsiteController.java b/src/main/java/com/gxwebsoft/cms/controller/WebsiteController.java index 1f1cd20..79846ab 100644 --- a/src/main/java/com/gxwebsoft/cms/controller/WebsiteController.java +++ b/src/main/java/com/gxwebsoft/cms/controller/WebsiteController.java @@ -1,11 +1,16 @@ package com.gxwebsoft.cms.controller; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.cms.entity.Navigation; import com.gxwebsoft.cms.entity.Website; -import com.gxwebsoft.cms.entity.WebsiteField; +import com.gxwebsoft.cms.param.ArticleCategoryParam; import com.gxwebsoft.cms.param.WebsiteParam; +import com.gxwebsoft.cms.service.ArticleCategoryService; +import com.gxwebsoft.cms.service.NavigationService; import com.gxwebsoft.cms.service.WebsiteFieldService; import com.gxwebsoft.cms.service.WebsiteService; import com.gxwebsoft.common.core.security.JwtUtil; @@ -14,11 +19,11 @@ import com.gxwebsoft.common.system.entity.User; import com.gxwebsoft.oa.entity.Company; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; import java.util.List; /** @@ -35,6 +40,92 @@ public class WebsiteController extends BaseController { private WebsiteService websiteService; @Resource private WebsiteFieldService websiteFieldService; + @Resource + private NavigationService navigationService; + @Resource + private ArticleCategoryService articleCategoryService; + + @ApiOperation("获取网站信息") + @GetMapping("/getSiteInfo") + public ApiResult getSiteInfo(HttpServletRequest request) { + final Integer tenantId = getTenantId(); + final WebsiteParam websiteParam = new WebsiteParam(); + if (websiteService.count() == 0) { + // 请求主服务器获取租户信息 + String access_token = JwtUtil.getAccessToken(request); + // 链式构建请求 + String result = HttpRequest.get("https://server.gxwebsoft.com/api/auth/tenant") + .header("Authorization", access_token) + .header("Tenantid", tenantId.toString()) + .timeout(20000)//超时,毫秒 + .execute().body(); + + JSONObject jsonObject = JSONObject.parseObject(result); + final String data = jsonObject.getString("data"); + final Company company = JSONObject.parseObject(data, Company.class); + final Website website = new Website(); + website.setTenantId(company.getTenantId()); + website.setWebsiteName(company.getShortName()); + website.setWebsiteLogo(company.getCompanyLogo()); + website.setWebsiteIcon("/favicon.ico"); + website.setWebsiteType("企业官网"); + website.setDomain(company.getDomain()); + website.setExpirationTime(company.getExpirationTime()); + website.setIndustryParent(company.getIndustryParent()); + website.setIndustryChild(company.getIndustryChild()); + website.setCompanyId(company.getCompanyId()); + website.setAddress(company.getAddress()); + website.setComments(company.getComments()); + website.setKeywords(company.getCompanyName()); + website.setUserId(company.getUserId()); + websiteService.save(website); + } + + // 获取站点信息 + final List websites = websiteService.listRel(websiteParam); + final Website website = websites.get(0); + + // 附加自定义字段 + website.setFields(websiteFieldService.list()); + + // 附加自定义导航 + website.setNavigations(navigationService.list(new LambdaQueryWrapper().eq(Navigation::getStatus,0))); + + // 提取文章分类作为网站导航 + final ArticleCategoryParam param = new ArticleCategoryParam(); + param.setDeleted(0); + param.setStatus(0); + website.setCategoryList(articleCategoryService.listRel(param)); + + // 授权信息 + HashMap config = new HashMap<>(); + config.put("LICENSE_CODE", "dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNwl1NnhENahnIvl2cyVmdiwiIiATMuEjI6IibQf0NW=="); + config.put("MAP_KEY", "8191620da39a742c6f18f010c084c772"); + website.setConfig(config); + + // 服务器时间 + HashMap serverTime = new HashMap<>(); + // 今天日期 + DateTime date = DateUtil.date(); + String today= DateUtil.today(); + // 明天日期 + final DateTime dateTime = DateUtil.tomorrow(); + String tomorrow = DateUtil.format(dateTime, "yyyy-MM-dd"); + // 后天日期 + final DateTime dateTime2 = DateUtil.offsetDay(date, 2); + final String afterDay = DateUtil.format(dateTime2, "yyyy-MM-dd"); + // 今天星期几 + final int week = DateUtil.thisDayOfWeek(); + final DateTime nextWeek = DateUtil.nextWeek(); + serverTime.put("now",DateUtil.now()); + serverTime.put("today",today); + serverTime.put("tomorrow",tomorrow); + serverTime.put("afterDay",afterDay); + serverTime.put("week",week); + serverTime.put("nextWeek",nextWeek); + website.setServerTime(serverTime); + return success(website); + } @ApiOperation("分页查询网站信息记录表") @GetMapping("/page") @@ -55,49 +146,10 @@ public class WebsiteController extends BaseController { @ApiOperation("根据id查询网站信息记录表") @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id, HttpServletRequest request) { - final Integer tenantId = getTenantId(); - List list = websiteService.list(new LambdaQueryWrapper().eq(Website::getTenantId, tenantId)); - if (CollectionUtils.isEmpty(list)) { - // 请求主服务器获取租户信息 - String access_token = JwtUtil.getAccessToken(request); - // 链式构建请求 - String result = HttpRequest.get("https://server.gxwebsoft.com/api/auth/tenant") - .header("Authorization", access_token) - .header("Tenantid", tenantId.toString()) - .timeout(20000)//超时,毫秒 - .execute().body(); - - JSONObject jsonObject = JSONObject.parseObject(result); - System.out.println("jsonObject = " + jsonObject); - final String data = jsonObject.getString("data"); - System.out.println("data = " + data); - final Company company = JSONObject.parseObject(data, Company.class); - System.out.println("company = " + company); - final Website website = new Website(); - website.setTenantId(company.getTenantId()); - website.setWebsiteName(company.getShortName()); - website.setWebsiteLogo(company.getCompanyLogo()); - website.setWebsiteIcon("/favicon.ico"); - website.setWebsiteType("企业官网"); - website.setDomain(company.getDomain()); - website.setExpirationTime(company.getExpirationTime()); - website.setIndustryParent(company.getIndustryParent()); - website.setIndustryChild(company.getIndustryChild()); - website.setCompanyId(company.getCompanyId()); - website.setAddress(company.getAddress()); - website.setComments(company.getComments()); - website.setKeywords(company.getCompanyName()); - website.setUserId(company.getUserId()); - websiteService.save(website); - List websites = websiteService.list(new LambdaQueryWrapper().eq(Website::getTenantId, getTenantId())); - final Website website1 = websites.get(0); - website1.setFields(websiteFieldService.list(new LambdaQueryWrapper().eq(WebsiteField::getWebsiteId,website1.getWebsiteId()))); - return success(website1); - } - final Website website = list.get(0); - website.setFields(websiteFieldService.list(new LambdaQueryWrapper().eq(WebsiteField::getWebsiteId,website.getWebsiteId()))); - return success(website); + public ApiResult get(@PathVariable("id") Integer id) { + return success(websiteService.getById(id)); + // 使用关联查询 + //return success(websiteService.getByIdRel(id)); } @ApiOperation("添加网站信息记录表") diff --git a/src/main/java/com/gxwebsoft/cms/entity/Ad.java b/src/main/java/com/gxwebsoft/cms/entity/Ad.java index 74ab364..eefb09f 100644 --- a/src/main/java/com/gxwebsoft/cms/entity/Ad.java +++ b/src/main/java/com/gxwebsoft/cms/entity/Ad.java @@ -28,6 +28,9 @@ public class Ad implements Serializable { @TableId(value = "ad_id", type = IdType.AUTO) private Integer adId; + @ApiModelProperty(value = "广告位名称") + private String name; + @ApiModelProperty(value = "广告类型") private String adType; @@ -37,6 +40,9 @@ public class Ad implements Serializable { @ApiModelProperty(value = "高") private String height; + @ApiModelProperty(value = "路由/链接地址") + private String path; + @ApiModelProperty(value = "广告图片") private String images; diff --git a/src/main/java/com/gxwebsoft/cms/entity/Article.java b/src/main/java/com/gxwebsoft/cms/entity/Article.java index 95d34f8..e53e86b 100644 --- a/src/main/java/com/gxwebsoft/cms/entity/Article.java +++ b/src/main/java/com/gxwebsoft/cms/entity/Article.java @@ -1,18 +1,14 @@ package com.gxwebsoft.cms.entity; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import java.util.Date; - +import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import java.io.Serializable; +import java.util.Date; + /** * 文章记录表 * @@ -121,4 +117,16 @@ public class Article implements Serializable { @ApiModelProperty(value = "修改时间") private Date updateTime; + @ApiModelProperty(value = "栏目名称") + @TableField(exist = false) + private String categoryName; + + @ApiModelProperty(value = "父级栏目ID") + @TableField(exist = false) + private Integer parentId; + + @ApiModelProperty(value = "父级栏目名称") + @TableField(exist = false) + private String parentName; + } diff --git a/src/main/java/com/gxwebsoft/cms/entity/ArticleCategory.java b/src/main/java/com/gxwebsoft/cms/entity/ArticleCategory.java index 61b41bf..d5c8889 100644 --- a/src/main/java/com/gxwebsoft/cms/entity/ArticleCategory.java +++ b/src/main/java/com/gxwebsoft/cms/entity/ArticleCategory.java @@ -1,18 +1,15 @@ package com.gxwebsoft.cms.entity; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import java.util.Date; - +import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + /** * 文章分类表 * @@ -30,6 +27,9 @@ public class ArticleCategory implements Serializable { @TableId(value = "category_id", type = IdType.AUTO) private Integer categoryId; + @ApiModelProperty(value = "类型 0列表 1页面 2外链") + private Integer type; + @ApiModelProperty(value = "分类名称") private String title; @@ -39,6 +39,16 @@ public class ArticleCategory implements Serializable { @ApiModelProperty(value = "上级分类ID") private Integer parentId; + @ApiModelProperty(value = "路由/链接地址") + private String path; + + @ApiModelProperty(value = "绑定的页面ID") + private Integer pageId; + + @ApiModelProperty(value = "页面名称") + @TableField(exist = false) + private String pageName; + @ApiModelProperty(value = "用户ID") private Integer userId; @@ -51,6 +61,12 @@ public class ArticleCategory implements Serializable { @ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") private Integer hide; + @ApiModelProperty(value = "是否推荐") + private Integer recommend; + + @ApiModelProperty(value = "是否显示在首页") + private Integer showIndex; + @ApiModelProperty(value = "状态, 0正常, 1禁用") private Integer status; @@ -67,4 +83,12 @@ public class ArticleCategory implements Serializable { @ApiModelProperty(value = "修改时间") private Date updateTime; + @ApiModelProperty(value = "父级栏目名称") + @TableField(exist = false) + private String parentName; + + @ApiModelProperty(value = "文章列表") + @TableField(exist = false) + private List
articleList; + } diff --git a/src/main/java/com/gxwebsoft/cms/entity/Website.java b/src/main/java/com/gxwebsoft/cms/entity/Website.java index 47b76af..9cbcf6f 100644 --- a/src/main/java/com/gxwebsoft/cms/entity/Website.java +++ b/src/main/java/com/gxwebsoft/cms/entity/Website.java @@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; import java.io.Serializable; import java.util.Date; +import java.util.HashMap; import java.util.List; /** @@ -75,9 +76,15 @@ public class Website implements Serializable { @ApiModelProperty(value = "所在辖区") private String region; - @ApiModelProperty(value = "街道地址") + @ApiModelProperty(value = "办公地址") private String address; + @ApiModelProperty(value = "办公电话") + private String phone; + + @ApiModelProperty(value = "办公电话") + private String email; + @ApiModelProperty(value = "经度") private String longitude; @@ -87,6 +94,12 @@ public class Website implements Serializable { @ApiModelProperty(value = "备注") private String comments; + @ApiModelProperty(value = "ICP备案") + private String icpNo; + + @ApiModelProperty(value = "公安备案") + private String policeNo; + @ApiModelProperty(value = "是否推荐") private Integer recommend; @@ -116,4 +129,20 @@ public class Website implements Serializable { @TableField(exist = false) private List fields; + @ApiModelProperty(value = "网站导航栏") + @TableField(exist = false) + private List navigations; + + @ApiModelProperty(value = "文章分类") + @TableField(exist = false) + private List categoryList; + + @ApiModelProperty(value = "配置信息") + @TableField(exist = false) + private Object config; + + @ApiModelProperty(value = "服务器时间") + @TableField(exist = false) + private HashMap serverTime; + } diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/ArticleCategoryMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/ArticleCategoryMapper.xml index 3fc32f4..2cb0218 100644 --- a/src/main/java/com/gxwebsoft/cms/mapper/xml/ArticleCategoryMapper.xml +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/ArticleCategoryMapper.xml @@ -4,12 +4,16 @@ - SELECT a.* + SELECT a.*,b.title as pageName FROM cms_article_category a + LEFT JOIN cms_design b ON a.page_id = b.page_id AND a.category_id = #{param.categoryId} + + AND a.type = #{param.type} + AND a.title LIKE CONCAT('%', #{param.title}, '%') @@ -19,6 +23,9 @@ AND a.parent_id = #{param.parentId} + + AND a.page_id = #{param.pageId} + AND a.user_id = #{param.userId} @@ -31,6 +38,12 @@ AND a.hide = #{param.hide} + + AND a.show_index = #{param.showIndex} + + + AND a.recommend = #{param.recommend} + AND a.status = #{param.status} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/ArticleMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/ArticleMapper.xml index 54eea69..e6f2882 100644 --- a/src/main/java/com/gxwebsoft/cms/mapper/xml/ArticleMapper.xml +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/ArticleMapper.xml @@ -4,8 +4,9 @@ - SELECT a.* + SELECT a.*,b.title as categoryName FROM cms_article a + LEFT JOIN cms_article_category b ON a.category_id = b.category_id AND a.article_id = #{param.articleId} diff --git a/src/main/java/com/gxwebsoft/cms/param/ArticleCategoryParam.java b/src/main/java/com/gxwebsoft/cms/param/ArticleCategoryParam.java index 43b1ef6..a413130 100644 --- a/src/main/java/com/gxwebsoft/cms/param/ArticleCategoryParam.java +++ b/src/main/java/com/gxwebsoft/cms/param/ArticleCategoryParam.java @@ -26,6 +26,10 @@ public class ArticleCategoryParam extends BaseParam { @QueryField(type = QueryType.EQ) private Integer categoryId; + @ApiModelProperty(value = "类型 0列表 1页面 2外链") + @QueryField(type = QueryType.EQ) + private Integer type; + @ApiModelProperty(value = "分类名称") private String title; @@ -51,6 +55,18 @@ public class ArticleCategoryParam extends BaseParam { @QueryField(type = QueryType.EQ) private Integer hide; + @ApiModelProperty(value = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @ApiModelProperty(value = "是否显示在首页") + @QueryField(type = QueryType.EQ) + private Integer showIndex; + + @ApiModelProperty(value = "页面ID") + @QueryField(type = QueryType.EQ) + private Integer pageId; + @ApiModelProperty(value = "状态, 0正常, 1禁用") @QueryField(type = QueryType.EQ) private Integer status; diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/ArticleCategoryServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/ArticleCategoryServiceImpl.java index c67d2d0..13a35d8 100644 --- a/src/main/java/com/gxwebsoft/cms/service/impl/ArticleCategoryServiceImpl.java +++ b/src/main/java/com/gxwebsoft/cms/service/impl/ArticleCategoryServiceImpl.java @@ -23,7 +23,7 @@ public class ArticleCategoryServiceImpl extends ServiceImpl pageRel(ArticleCategoryParam param) { PageParam page = new PageParam<>(param); - //page.setDefaultOrder("create_time desc"); + page.setDefaultOrder("sort_number asc, create_time asc"); List list = baseMapper.selectPageRel(page, param); return new PageResult<>(list, page.getTotal()); } @@ -33,7 +33,7 @@ public class ArticleCategoryServiceImpl extends ServiceImpl list = baseMapper.selectListRel(param); // 排序 PageParam page = new PageParam<>(); - //page.setDefaultOrder("create_time desc"); + page.setDefaultOrder("sort_number asc, create_time asc"); return page.sortRecords(list); } diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/DesignServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/DesignServiceImpl.java index 5cdb492..e7a2ed0 100644 --- a/src/main/java/com/gxwebsoft/cms/service/impl/DesignServiceImpl.java +++ b/src/main/java/com/gxwebsoft/cms/service/impl/DesignServiceImpl.java @@ -23,7 +23,7 @@ public class DesignServiceImpl extends ServiceImpl impleme @Override public PageResult pageRel(DesignParam param) { PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); + page.setDefaultOrder("sort_number asc,create_time asc"); List list = baseMapper.selectPageRel(page, param); return new PageResult<>(list, page.getTotal()); }