From f10e4866fc469596d5bdde77fe0b086fb7b989d5 Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Wed, 31 Aug 2022 17:46:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iasf/controller/SysColumnController.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/huoran/iasf/controller/SysColumnController.java b/src/main/java/com/huoran/iasf/controller/SysColumnController.java index fcd11ff..b82cef8 100644 --- a/src/main/java/com/huoran/iasf/controller/SysColumnController.java +++ b/src/main/java/com/huoran/iasf/controller/SysColumnController.java @@ -89,7 +89,23 @@ public class SysColumnController { @PostMapping("/sortByColumn") @ApiOperation(value = "栏目排序(依据id更改)", response = SysColumn.class) public R sortByColumn(@RequestBody List sortColumnRespVOList) { - + for (SortColumnRespVO sort : sortColumnRespVOList) { + SysColumn sysColumn = new SysColumn(); + BeanUtils.copyProperties(sort, sysColumn); + service.updateById(sysColumn); + //依据当前循环获取的栏目id,查询到引用当前栏目的文章对其进行修改栏目id + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("column_id", sysColumn.getId()); + List contentList = contentService.list(queryWrapper); + if (contentList.size() > 0) { + for (SysContent content : contentList) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("column_id", sysColumn.getId()); + contentService.update(content, updateWrapper); + } + } + + } return R.success(); }