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());