新增:网站后台管理功能模块

This commit is contained in:
gxwebsoft
2024-03-07 13:48:58 +08:00
parent baf175b2fa
commit 06f349c833
13 changed files with 249 additions and 87 deletions
@@ -1,8 +1,11 @@
package com.gxwebsoft.cms.controller; package com.gxwebsoft.cms.controller;
import com.gxwebsoft.cms.entity.Article;
import com.gxwebsoft.cms.entity.ArticleCategory; import com.gxwebsoft.cms.entity.ArticleCategory;
import com.gxwebsoft.cms.param.ArticleCategoryParam; import com.gxwebsoft.cms.param.ArticleCategoryParam;
import com.gxwebsoft.cms.param.ArticleParam;
import com.gxwebsoft.cms.service.ArticleCategoryService; import com.gxwebsoft.cms.service.ArticleCategoryService;
import com.gxwebsoft.cms.service.ArticleService;
import com.gxwebsoft.common.core.web.*; import com.gxwebsoft.common.core.web.*;
import com.gxwebsoft.common.system.entity.User; import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@@ -24,22 +27,34 @@ import java.util.List;
public class ArticleCategoryController extends BaseController { public class ArticleCategoryController extends BaseController {
@Resource @Resource
private ArticleCategoryService articleCategoryService; private ArticleCategoryService articleCategoryService;
@Resource
private ArticleService articleService;
@ApiOperation("分页查询文章分类表") @ApiOperation("分页查询文章分类表")
@GetMapping("/page") @GetMapping("/page")
public ApiResult<PageResult<ArticleCategory>> page(ArticleCategoryParam param) { public ApiResult<PageResult<ArticleCategory>> page(ArticleCategoryParam param) {
PageParam<ArticleCategory, ArticleCategoryParam> page = new PageParam<>(param); PageParam<ArticleCategory, ArticleCategoryParam> 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())); return success(articleCategoryService.page(page, page.getWrapper()));
// 使用关联查询
} }
@ApiOperation("查询全部文章分类表") @ApiOperation("查询全部文章分类表")
@GetMapping() @GetMapping()
public ApiResult<List<ArticleCategory>> list(ArticleCategoryParam param) { public ApiResult<List<ArticleCategory>> list(ArticleCategoryParam param) {
PageParam<ArticleCategory, ArticleCategoryParam> page = new PageParam<>(param); // 使用关联查询
page.setDefaultOrder("sort_number asc,create_time desc"); List<ArticleCategory> categoryList = articleCategoryService.listRel(param);
return success(articleCategoryService.list(page.getOrderWrapper())); // 是否读取新闻列表
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<Article> articlePageResult = articleService.pageRel(articleParam);
d.setArticleList(articlePageResult.getList());
});
}
return success(categoryList);
// 使用关联查询 // 使用关联查询
//return success(articleCategoryService.listRel(param)); //return success(articleCategoryService.listRel(param));
} }
@@ -47,9 +62,13 @@ public class ArticleCategoryController extends BaseController {
@ApiOperation("根据id查询文章分类表") @ApiOperation("根据id查询文章分类表")
@GetMapping("/{id}") @GetMapping("/{id}")
public ApiResult<ArticleCategory> get(@PathVariable("id") Integer id) { public ApiResult<ArticleCategory> get(@PathVariable("id") Integer id) {
return success(articleCategoryService.getById(id)); // 使用关联查询
// 使用关联查询 ArticleCategory category = articleCategoryService.getByIdRel(id);
//return success(articleCategoryService.getByIdRel(id)); if (!category.getParentId().equals(0)) {
final ArticleCategory parentCategory = articleCategoryService.getById(category.getParentId());
category.setParentName(parentCategory.getTitle());
}
return success(category);
} }
@ApiOperation("添加文章分类表") @ApiOperation("添加文章分类表")
@@ -1,18 +1,12 @@
package com.gxwebsoft.cms.controller; 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.entity.Article;
import com.gxwebsoft.cms.param.ArticleParam; import com.gxwebsoft.cms.param.ArticleParam;
import com.gxwebsoft.common.core.web.ApiResult; import com.gxwebsoft.cms.service.ArticleService;
import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.common.core.web.*;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User; import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@@ -54,9 +48,9 @@ public class ArticleController extends BaseController {
@ApiOperation("根据id查询文章记录表") @ApiOperation("根据id查询文章记录表")
@GetMapping("/{id}") @GetMapping("/{id}")
public ApiResult<Article> get(@PathVariable("id") Integer id) { public ApiResult<Article> get(@PathVariable("id") Integer id) {
return success(articleService.getById(id)); // 使用关联查询
// 使用关联查询 Article article = articleService.getByIdRel(id);
//return success(articleService.getByIdRel(id)); return success(article);
} }
@ApiOperation("添加文章记录表") @ApiOperation("添加文章记录表")
@@ -36,7 +36,7 @@ public class DesignController extends BaseController {
@GetMapping() @GetMapping()
public ApiResult<List<Design>> list(DesignParam param) { public ApiResult<List<Design>> list(DesignParam param) {
PageParam<Design, DesignParam> page = new PageParam<>(param); PageParam<Design, DesignParam> 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.list(page.getOrderWrapper()));
// 使用关联查询 // 使用关联查询
//return success(designService.listRel(param)); //return success(designService.listRel(param));
@@ -1,11 +1,16 @@
package com.gxwebsoft.cms.controller; package com.gxwebsoft.cms.controller;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.Website;
import com.gxwebsoft.cms.entity.WebsiteField; import com.gxwebsoft.cms.param.ArticleCategoryParam;
import com.gxwebsoft.cms.param.WebsiteParam; 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.WebsiteFieldService;
import com.gxwebsoft.cms.service.WebsiteService; import com.gxwebsoft.cms.service.WebsiteService;
import com.gxwebsoft.common.core.security.JwtUtil; 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 com.gxwebsoft.oa.entity.Company;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
@@ -35,6 +40,92 @@ public class WebsiteController extends BaseController {
private WebsiteService websiteService; private WebsiteService websiteService;
@Resource @Resource
private WebsiteFieldService websiteFieldService; private WebsiteFieldService websiteFieldService;
@Resource
private NavigationService navigationService;
@Resource
private ArticleCategoryService articleCategoryService;
@ApiOperation("获取网站信息")
@GetMapping("/getSiteInfo")
public ApiResult<Website> 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<Website> websites = websiteService.listRel(websiteParam);
final Website website = websites.get(0);
// 附加自定义字段
website.setFields(websiteFieldService.list());
// 附加自定义导航
website.setNavigations(navigationService.list(new LambdaQueryWrapper<Navigation>().eq(Navigation::getStatus,0)));
// 提取文章分类作为网站导航
final ArticleCategoryParam param = new ArticleCategoryParam();
param.setDeleted(0);
param.setStatus(0);
website.setCategoryList(articleCategoryService.listRel(param));
// 授权信息
HashMap<String, Object> config = new HashMap<>();
config.put("LICENSE_CODE", "dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNwl1NnhENahnIvl2cyVmdiwiIiATMuEjI6IibQf0NW==");
config.put("MAP_KEY", "8191620da39a742c6f18f010c084c772");
website.setConfig(config);
// 服务器时间
HashMap<String, Object> 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("分页查询网站信息记录表") @ApiOperation("分页查询网站信息记录表")
@GetMapping("/page") @GetMapping("/page")
@@ -55,49 +146,10 @@ public class WebsiteController extends BaseController {
@ApiOperation("根据id查询网站信息记录表") @ApiOperation("根据id查询网站信息记录表")
@GetMapping("/{id}") @GetMapping("/{id}")
public ApiResult<Website> get(@PathVariable("id") Integer id, HttpServletRequest request) { public ApiResult<Website> get(@PathVariable("id") Integer id) {
final Integer tenantId = getTenantId(); return success(websiteService.getById(id));
List<Website> list = websiteService.list(new LambdaQueryWrapper<Website>().eq(Website::getTenantId, tenantId)); // 使用关联查询
if (CollectionUtils.isEmpty(list)) { //return success(websiteService.getByIdRel(id));
// 请求主服务器获取租户信息
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<Website> websites = websiteService.list(new LambdaQueryWrapper<Website>().eq(Website::getTenantId, getTenantId()));
final Website website1 = websites.get(0);
website1.setFields(websiteFieldService.list(new LambdaQueryWrapper<WebsiteField>().eq(WebsiteField::getWebsiteId,website1.getWebsiteId())));
return success(website1);
}
final Website website = list.get(0);
website.setFields(websiteFieldService.list(new LambdaQueryWrapper<WebsiteField>().eq(WebsiteField::getWebsiteId,website.getWebsiteId())));
return success(website);
} }
@ApiOperation("添加网站信息记录表") @ApiOperation("添加网站信息记录表")
@@ -28,6 +28,9 @@ public class Ad implements Serializable {
@TableId(value = "ad_id", type = IdType.AUTO) @TableId(value = "ad_id", type = IdType.AUTO)
private Integer adId; private Integer adId;
@ApiModelProperty(value = "广告位名称")
private String name;
@ApiModelProperty(value = "广告类型") @ApiModelProperty(value = "广告类型")
private String adType; private String adType;
@@ -37,6 +40,9 @@ public class Ad implements Serializable {
@ApiModelProperty(value = "高") @ApiModelProperty(value = "高")
private String height; private String height;
@ApiModelProperty(value = "路由/链接地址")
private String path;
@ApiModelProperty(value = "广告图片") @ApiModelProperty(value = "广告图片")
private String images; private String images;
@@ -1,18 +1,14 @@
package com.gxwebsoft.cms.entity; package com.gxwebsoft.cms.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.*;
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 io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/** /**
* 文章记录表 * 文章记录表
* *
@@ -121,4 +117,16 @@ public class Article implements Serializable {
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updateTime; 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;
} }
@@ -1,18 +1,15 @@
package com.gxwebsoft.cms.entity; package com.gxwebsoft.cms.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.*;
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 io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; 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) @TableId(value = "category_id", type = IdType.AUTO)
private Integer categoryId; private Integer categoryId;
@ApiModelProperty(value = "类型 0列表 1页面 2外链")
private Integer type;
@ApiModelProperty(value = "分类名称") @ApiModelProperty(value = "分类名称")
private String title; private String title;
@@ -39,6 +39,16 @@ public class ArticleCategory implements Serializable {
@ApiModelProperty(value = "上级分类ID") @ApiModelProperty(value = "上级分类ID")
private Integer parentId; 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") @ApiModelProperty(value = "用户ID")
private Integer userId; private Integer userId;
@@ -51,6 +61,12 @@ public class ArticleCategory implements Serializable {
@ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") @ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)")
private Integer hide; private Integer hide;
@ApiModelProperty(value = "是否推荐")
private Integer recommend;
@ApiModelProperty(value = "是否显示在首页")
private Integer showIndex;
@ApiModelProperty(value = "状态, 0正常, 1禁用") @ApiModelProperty(value = "状态, 0正常, 1禁用")
private Integer status; private Integer status;
@@ -67,4 +83,12 @@ public class ArticleCategory implements Serializable {
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "父级栏目名称")
@TableField(exist = false)
private String parentName;
@ApiModelProperty(value = "文章列表")
@TableField(exist = false)
private List<Article> articleList;
} }
@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
@@ -75,9 +76,15 @@ public class Website implements Serializable {
@ApiModelProperty(value = "所在辖区") @ApiModelProperty(value = "所在辖区")
private String region; private String region;
@ApiModelProperty(value = "街道地址") @ApiModelProperty(value = "办公地址")
private String address; private String address;
@ApiModelProperty(value = "办公电话")
private String phone;
@ApiModelProperty(value = "办公电话")
private String email;
@ApiModelProperty(value = "经度") @ApiModelProperty(value = "经度")
private String longitude; private String longitude;
@@ -87,6 +94,12 @@ public class Website implements Serializable {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String comments; private String comments;
@ApiModelProperty(value = "ICP备案")
private String icpNo;
@ApiModelProperty(value = "公安备案")
private String policeNo;
@ApiModelProperty(value = "是否推荐") @ApiModelProperty(value = "是否推荐")
private Integer recommend; private Integer recommend;
@@ -116,4 +129,20 @@ public class Website implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private List<WebsiteField> fields; private List<WebsiteField> fields;
@ApiModelProperty(value = "网站导航栏")
@TableField(exist = false)
private List<Navigation> navigations;
@ApiModelProperty(value = "文章分类")
@TableField(exist = false)
private List<ArticleCategory> categoryList;
@ApiModelProperty(value = "配置信息")
@TableField(exist = false)
private Object config;
@ApiModelProperty(value = "服务器时间")
@TableField(exist = false)
private HashMap<String, Object> serverTime;
} }
@@ -4,12 +4,16 @@
<!-- 关联查询sql --> <!-- 关联查询sql -->
<sql id="selectSql"> <sql id="selectSql">
SELECT a.* SELECT a.*,b.title as pageName
FROM cms_article_category a FROM cms_article_category a
LEFT JOIN cms_design b ON a.page_id = b.page_id
<where> <where>
<if test="param.categoryId != null"> <if test="param.categoryId != null">
AND a.category_id = #{param.categoryId} AND a.category_id = #{param.categoryId}
</if> </if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
<if test="param.title != null"> <if test="param.title != null">
AND a.title LIKE CONCAT('%', #{param.title}, '%') AND a.title LIKE CONCAT('%', #{param.title}, '%')
</if> </if>
@@ -19,6 +23,9 @@
<if test="param.parentId != null"> <if test="param.parentId != null">
AND a.parent_id = #{param.parentId} AND a.parent_id = #{param.parentId}
</if> </if>
<if test="param.pageId != null">
AND a.page_id = #{param.pageId}
</if>
<if test="param.userId != null"> <if test="param.userId != null">
AND a.user_id = #{param.userId} AND a.user_id = #{param.userId}
</if> </if>
@@ -31,6 +38,12 @@
<if test="param.hide != null"> <if test="param.hide != null">
AND a.hide = #{param.hide} AND a.hide = #{param.hide}
</if> </if>
<if test="param.showIndex != null">
AND a.show_index = #{param.showIndex}
</if>
<if test="param.recommend != null">
AND a.recommend = #{param.recommend}
</if>
<if test="param.status != null"> <if test="param.status != null">
AND a.status = #{param.status} AND a.status = #{param.status}
</if> </if>
@@ -4,8 +4,9 @@
<!-- 关联查询sql --> <!-- 关联查询sql -->
<sql id="selectSql"> <sql id="selectSql">
SELECT a.* SELECT a.*,b.title as categoryName
FROM cms_article a FROM cms_article a
LEFT JOIN cms_article_category b ON a.category_id = b.category_id
<where> <where>
<if test="param.articleId != null"> <if test="param.articleId != null">
AND a.article_id = #{param.articleId} AND a.article_id = #{param.articleId}
@@ -26,6 +26,10 @@ public class ArticleCategoryParam extends BaseParam {
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer categoryId; private Integer categoryId;
@ApiModelProperty(value = "类型 0列表 1页面 2外链")
@QueryField(type = QueryType.EQ)
private Integer type;
@ApiModelProperty(value = "分类名称") @ApiModelProperty(value = "分类名称")
private String title; private String title;
@@ -51,6 +55,18 @@ public class ArticleCategoryParam extends BaseParam {
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer hide; 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禁用") @ApiModelProperty(value = "状态, 0正常, 1禁用")
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer status; private Integer status;
@@ -23,7 +23,7 @@ public class ArticleCategoryServiceImpl extends ServiceImpl<ArticleCategoryMappe
@Override @Override
public PageResult<ArticleCategory> pageRel(ArticleCategoryParam param) { public PageResult<ArticleCategory> pageRel(ArticleCategoryParam param) {
PageParam<ArticleCategory, ArticleCategoryParam> page = new PageParam<>(param); PageParam<ArticleCategory, ArticleCategoryParam> page = new PageParam<>(param);
//page.setDefaultOrder("create_time desc"); page.setDefaultOrder("sort_number asc, create_time asc");
List<ArticleCategory> list = baseMapper.selectPageRel(page, param); List<ArticleCategory> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal()); return new PageResult<>(list, page.getTotal());
} }
@@ -33,7 +33,7 @@ public class ArticleCategoryServiceImpl extends ServiceImpl<ArticleCategoryMappe
List<ArticleCategory> list = baseMapper.selectListRel(param); List<ArticleCategory> list = baseMapper.selectListRel(param);
// 排序 // 排序
PageParam<ArticleCategory, ArticleCategoryParam> page = new PageParam<>(); PageParam<ArticleCategory, ArticleCategoryParam> page = new PageParam<>();
//page.setDefaultOrder("create_time desc"); page.setDefaultOrder("sort_number asc, create_time asc");
return page.sortRecords(list); return page.sortRecords(list);
} }
@@ -23,7 +23,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
@Override @Override
public PageResult<Design> pageRel(DesignParam param) { public PageResult<Design> pageRel(DesignParam param) {
PageParam<Design, DesignParam> page = new PageParam<>(param); PageParam<Design, DesignParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc"); page.setDefaultOrder("sort_number asc,create_time asc");
List<Design> list = baseMapper.selectPageRel(page, param); List<Design> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal()); return new PageResult<>(list, page.getTotal());
} }