完善排序功能

master
rong.liu 2 years ago
parent 5e48be6055
commit dabe5e677e
  1. 3
      src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml
  2. 10
      src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java

@ -185,7 +185,8 @@
AND is_release = 1) t
WHERE FIND_IN_SET(t.column_id, #{columnId})
ORDER BY t.release_time DESC
ORDER BY
t.sequence ASC
</select>
<!-- &lt;!&ndash;根据 sequence 查询下一条记录主键&ndash;&gt;

@ -159,6 +159,16 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
//获取当前文章所属栏目id
Integer columnId = content.getColumnId();
//获取栏目下全部文章的数量与当前输入的序号判断 如果要更改的序号大于当前有的数量,直接替换
QueryWrapper<SysContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("column_id", columnId);
queryWrapper.eq("deleted", 1);
List<SysContent> contentList = baseMapper.selectList(queryWrapper);
if (sequenceNumber >= contentList.size()) {
sequenceNumber = contentList.size();
}
if (currentSerialNumber.equals(sequenceNumber)) {
return R.success();
}

Loading…
Cancel
Save