From 4dfe29f07d53ece42d94476a49bba21d8fc9f588 Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Mon, 27 Mar 2023 14:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E6=9B=B4=E6=94=B9=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=88=A4=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../huoran/iasf/controller/SysColumnController.java | 13 +++++++++++++ .../com/huoran/iasf/mapper/xml/SysContentMapper.xml | 2 +- .../iasf/service/impl/SysContentServiceImpl.java | 9 +++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/huoran/iasf/controller/SysColumnController.java b/src/main/java/com/huoran/iasf/controller/SysColumnController.java index 2f3b692..49bf526 100644 --- a/src/main/java/com/huoran/iasf/controller/SysColumnController.java +++ b/src/main/java/com/huoran/iasf/controller/SysColumnController.java @@ -159,6 +159,19 @@ public class SysColumnController { @ApiOperation(value = "栏目排序(依据id更改)", response = SysColumn.class) public R sortByColumn(@RequestBody List sortColumnRespVOList) { for (SortColumnRespVO sort : sortColumnRespVOList) { + + SysColumn column = service.getById(sort.getId()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("column_name", column.getColumnName()); + queryWrapper.eq("site_id", column.getSiteId()); + queryWrapper.eq("father_id", sort.getFatherId()); + queryWrapper.last(" and id <> " + sort.getId()); + List columnList = service.list(queryWrapper); + if (columnList.size() > 0) { + return R.fail("同级下已存在重复栏目:" + column.getColumnName()); + } + SysColumn sysColumn = new SysColumn(); BeanUtils.copyProperties(sort, sysColumn); service.updateById(sysColumn); diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml index c29559e..baa6174 100644 --- a/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml +++ b/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml @@ -135,7 +135,7 @@ ORDER BY - t.create_time DESC + t.sequence asc diff --git a/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java b/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java index b7f4356..a6c2d11 100644 --- a/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java +++ b/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java @@ -65,9 +65,10 @@ public class SysContentServiceImpl extends ServiceImpl page = new Page(reqVO.getPageNum(), reqVO.getPageSize()); - /*if (reqVO.getModifiedTimeSort() == null && reqVO.getPublicationTimeSort() == null) { + //没传任何排序参数时候 默认以发布时间排序 + if (reqVO.getModifiedTimeSort() == null && reqVO.getPublicationTimeSort() == null && reqVO.getOrdinalSort() == null) { reqVO.setPublicationTimeSort(0); - }*/ + } /*if (reqVO.getIsDisable()!=null){ if (reqVO.getIsDisable() == 1) { //是否禁用(0默认,0启用 1禁用) @@ -80,9 +81,9 @@ public class SysContentServiceImpl extends ServiceImpl page = new Page(reqVO.getPageNum(), reqVO.getPageSize());