|
|
@ -159,6 +159,19 @@ public class SysColumnController { |
|
|
|
@ApiOperation(value = "栏目排序(依据id更改)", response = SysColumn.class) |
|
|
|
@ApiOperation(value = "栏目排序(依据id更改)", response = SysColumn.class) |
|
|
|
public R sortByColumn(@RequestBody List<SortColumnRespVO> sortColumnRespVOList) { |
|
|
|
public R sortByColumn(@RequestBody List<SortColumnRespVO> sortColumnRespVOList) { |
|
|
|
for (SortColumnRespVO sort : sortColumnRespVOList) { |
|
|
|
for (SortColumnRespVO sort : sortColumnRespVOList) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysColumn column = service.getById(sort.getId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<SysColumn> 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<SysColumn> columnList = service.list(queryWrapper); |
|
|
|
|
|
|
|
if (columnList.size() > 0) { |
|
|
|
|
|
|
|
return R.fail("同级下已存在重复栏目:" + column.getColumnName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SysColumn sysColumn = new SysColumn(); |
|
|
|
SysColumn sysColumn = new SysColumn(); |
|
|
|
BeanUtils.copyProperties(sort, sysColumn); |
|
|
|
BeanUtils.copyProperties(sort, sysColumn); |
|
|
|
service.updateById(sysColumn); |
|
|
|
service.updateById(sysColumn); |
|
|
|