This commit is contained in:
GYJ
2025-01-02 20:45:51 +08:00
parent e3de8c009f
commit d56a5df40e
47 changed files with 221 additions and 382 deletions

View File

@@ -1,8 +1,8 @@
package com.sqx.modules.helpCenter.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sqx.common.utils.DateUtils;
import com.sqx.common.utils.PageUtils;
import com.sqx.common.utils.Result;
@@ -32,7 +32,7 @@ public class HelpWordController {
@PostMapping("/insertHelpClassify")
@ApiOperation("添加帮助分类")
public Result insertHelpClassify(@RequestBody HelpClassify helpClassify){
public Result insertHelpClassify(@RequestBody HelpClassify helpClassify) {
helpClassify.setCreateTime(DateUtils.format(new Date()));
helpClassifyService.save(helpClassify);
return Result.success();
@@ -40,14 +40,14 @@ public class HelpWordController {
@PostMapping("/updateHelpClassify")
@ApiOperation("修改帮助分类")
public Result updateHelpClassify(@RequestBody HelpClassify helpClassify){
public Result updateHelpClassify(@RequestBody HelpClassify helpClassify) {
helpClassifyService.updateById(helpClassify);
return Result.success();
}
@PostMapping("/deleteHelpClassify")
@ApiOperation("删除帮助分类")
public Result deleteHelpClassify(Long helpClassifyId){
public Result deleteHelpClassify(Long helpClassifyId) {
helpClassifyService.removeById(helpClassifyId);
return Result.success();
}
@@ -55,27 +55,28 @@ public class HelpWordController {
@GetMapping("/selectHelpClassifyList")
@ApiOperation("查询帮助分类")
public Result selectHelpClassifyList(Integer page,Integer limit,Long parentId,Integer types,String helpClassifyName){
if(page==null || limit==null){
List<HelpClassify> page1 = helpClassifyService.list(
new QueryWrapper<HelpClassify>()
.eq(types!=null,"types",types)
.eq(StringUtils.isNotBlank(helpClassifyName), "help_classify_name", helpClassifyName)
.eq(parentId != null, "parent_id", parentId).orderByAsc("sort"));
return Result.success().put("data",page1);
public Result selectHelpClassifyList(Integer page, Integer limit, Long parentId, Integer types, String helpClassifyName) {
if (page == null) {
page = 1;
}
IPage<HelpClassify> page1 = helpClassifyService.page(new Page<>(page, limit),
new QueryWrapper<HelpClassify>()
.eq(types!=null,"types",types)
.eq(StringUtils.isNotBlank(helpClassifyName), "help_classify_name", helpClassifyName)
.eq(parentId != null, "parent_id", parentId).orderByAsc("sort"));
return Result.success().put("data",new PageUtils(page1));
if (limit == null) {
limit = 10;
}
PageHelper.startPage(page, limit);
List<HelpClassify> list = helpClassifyService.list(new QueryWrapper<HelpClassify>()
.eq(types != null, "types", types)
.eq(StringUtils.isNotBlank(helpClassifyName), "help_classify_name", helpClassifyName)
.eq(parentId != null, "parent_id", parentId).orderByAsc("sort"));
PageInfo<HelpClassify> pageInfo = new PageInfo<>(list);
return Result.success().put("data", PageUtils.page(pageInfo));
}
@PostMapping("/insertHelpWord")
@ApiOperation("添加帮助文档")
public Result insertHelpWord(@RequestBody HelpWord helpWord){
public Result insertHelpWord(@RequestBody HelpWord helpWord) {
helpWord.setCreateTime(DateUtils.format(new Date()));
helpWordService.save(helpWord);
return Result.success();
@@ -83,14 +84,14 @@ public class HelpWordController {
@PostMapping("/updateHelpWord")
@ApiOperation("修改帮助文档")
public Result updateHelpWord(@RequestBody HelpWord helpWord){
public Result updateHelpWord(@RequestBody HelpWord helpWord) {
helpWordService.updateById(helpWord);
return Result.success();
}
@PostMapping("/deleteHelpWord")
@ApiOperation("删除帮助文档")
public Result deleteHelpWord(Long helpWordId){
public Result deleteHelpWord(Long helpWordId) {
helpWordService.removeById(helpWordId);
return Result.success();
}
@@ -98,15 +99,16 @@ public class HelpWordController {
@GetMapping("/selectHelpWordList")
@ApiOperation("查询帮助文档")
public Result selectHelpWordList(Integer page,Integer limit,Long helpClassifyId,String helpWordTitle){
IPage<HelpWord> page1 = helpWordService.page(new Page<>(page, limit), new QueryWrapper<HelpWord>()
public Result selectHelpWordList(Integer page, Integer limit, Long helpClassifyId, String helpWordTitle) {
PageHelper.startPage(page, limit);
List<HelpWord> page1 = helpWordService.list(new QueryWrapper<HelpWord>()
.eq(helpClassifyId != null, "help_classify_id", helpClassifyId)
.eq(StringUtils.isNotBlank(helpWordTitle), "help_word_title", helpWordTitle).orderByAsc("sort"));
return Result.success().put("data",new PageUtils(page1));
PageInfo<HelpWord> pageInfo = new PageInfo<>(page1);
return Result.success().put("data", PageUtils.page(pageInfo));
}
}