栏目更改排序判重

master
rong.liu 2 years ago
parent 1f9bbe96bc
commit 4dfe29f07d
  1. 13
      src/main/java/com/huoran/iasf/controller/SysColumnController.java
  2. 2
      src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml
  3. 9
      src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java

@ -159,6 +159,19 @@ public class SysColumnController {
@ApiOperation(value = "栏目排序(依据id更改)", response = SysColumn.class)
public R sortByColumn(@RequestBody List<SortColumnRespVO> 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();
BeanUtils.copyProperties(sort, sysColumn);
service.updateById(sysColumn);

@ -135,7 +135,7 @@
</when>
<otherwise>
ORDER BY
t.create_time DESC
t.sequence asc
</otherwise>
</choose>

@ -65,9 +65,10 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
public R articlePaginationList(PageContentReqVO reqVO) {
Page<PageContentRespVO> page = new Page<PageContentRespVO>(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<SysContentMapper, SysCont
@Override
public R newlyPublishedArticles(PageContentReqVO reqVO) {
if(reqVO.getRole()==null){
if (reqVO.getRole() == null) {
}else if (reqVO.getRole()!=null||reqVO.getRole().equals("admin") || ObjectUtil.isNotNull(reqVO.isIsadmin()) || reqVO.isIsadmin()){
} else if (reqVO.getRole() != null || reqVO.getRole().equals("admin") || ObjectUtil.isNotNull(reqVO.isIsadmin()) || reqVO.isIsadmin()) {
throw new IllegalArgumentException("参数名不能包含admin");
}
Page<PageContentRespVO> page = new Page<PageContentRespVO>(reqVO.getPageNum(), reqVO.getPageSize());

Loading…
Cancel
Save