排序完善

master
rong.liu 2 years ago
parent 1db80e42e9
commit 56e5644480
  1. 60
      src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml
  2. 13
      src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java
  3. 11
      src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java
  4. 5
      src/main/java/com/huoran/iasf/vo/req/PageContentReqVO.java

@ -43,30 +43,37 @@
AND c.is_disable = #{req.isDisable} AND c.is_disable = #{req.isDisable}
</if> </if>
<choose>
<when test="req.modifiedTimeSort ==0">
ORDER BY c.update_time desc
</when>
<if test="req.modifiedTimeSort ==0"> <when test="req.modifiedTimeSort ==1">
ORDER BY c.update_time desc ORDER BY c.update_time asc
</if> </when>
<if test="req.modifiedTimeSort ==1"> <when test="req.publicationTimeSort ==0">
ORDER BY c.update_time asc ORDER BY c.release_time desc
</if> </when>
<if test="req.publicationTimeSort ==0"> <when test="req.publicationTimeSort ==1">
ORDER BY c.release_time desc ORDER BY c.release_time asc
</if> </when>
<if test="req.publicationTimeSort ==1"> <when test="req.topSort ==0">
ORDER BY c.release_time asc ORDER BY is_top asc
</if> </when>
<if test="req.topSort ==0"> <when test="req.topSort ==1">
ORDER BY is_top asc ORDER BY is_top desc
</if> </when>
<if test="req.topSort ==1"> <otherwise>
ORDER BY is_top desc ORDER BY
</if> release_time DESC,
create_time DESC
</otherwise>
</choose>
</select> </select>
@ -167,11 +174,16 @@
sys_content c sys_content c
WHERE WHERE
deleted = 1 deleted = 1
AND site_id = 1 AND site_id = #{req.siteId}
<if test="req.title != null and req.title != ''"> <if test="req.title != null and req.title != ''">
AND title LIKE AND title LIKE
CONCAT('%',#{req.title},'%') CONCAT('%',#{req.title},'%')
</if> </if>
ORDER BY
is_top = 1 DESC,
top_time DESC,
release_time DESC,
create_time DESC
</select> </select>
<select id="columnConditionsFilterArticles" resultType="com.huoran.iasf.vo.resp.PageContentRespVO"> <select id="columnConditionsFilterArticles" resultType="com.huoran.iasf.vo.resp.PageContentRespVO">
SELECT t.*, SELECT t.*,
@ -191,13 +203,11 @@
AND is_release = 1) t AND is_release = 1) t
WHERE FIND_IN_SET(t.column_id, #{columnId}) WHERE FIND_IN_SET(t.column_id, #{columnId})
ORDER BY ORDER BY is_top = 1 DESC,
is_top = 1 DESC, top_time DESC,
top_time DESC, release_time DESC,
release_time DESC, create_time DESC
create_time DESC
</select> </select>
</mapper> </mapper>

@ -44,6 +44,7 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
queryWrapper.eq("column_name", column.getColumnName()); queryWrapper.eq("column_name", column.getColumnName());
queryWrapper.eq("level", column.getLevel()); queryWrapper.eq("level", column.getLevel());
queryWrapper.eq("site_id", column.getSiteId()); queryWrapper.eq("site_id", column.getSiteId());
queryWrapper.eq("deleted", 1);
SysColumn sysColumn = mapper.selectOne(queryWrapper); SysColumn sysColumn = mapper.selectOne(queryWrapper);
if (sysColumn != null) { if (sysColumn != null) {
if (column.getId() != null) { if (column.getId() != null) {
@ -93,9 +94,9 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
@Override @Override
public List<SysColumn> listWithTreeMenuVisible(PaginationColumnReqVO column) { public List<SysColumn> listWithTreeMenuVisible(PaginationColumnReqVO column) {
if(column.getRole()==null){ if (column.getRole() == null) {
}else if (column.getRole()!=null||column.getRole().equals("admin") || ObjectUtil.isNotNull(column.isIsadmin()) || column.isIsadmin()){ } else if (column.getRole() != null || column.getRole().equals("admin") || ObjectUtil.isNotNull(column.isIsadmin()) || column.isIsadmin()) {
throw new IllegalArgumentException("参数名不能包含admin"); throw new IllegalArgumentException("参数名不能包含admin");
} }
//查询所有栏目 //查询所有栏目
@ -147,14 +148,14 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
@Override @Override
public R getsTheSubColumn(Integer pid, String ids) { public R getsTheSubColumn(Integer pid, String ids) {
List<SysColumn> getsTheSubColumn = baseMapper.getsTheSubColumn(pid, ids,null); List<SysColumn> getsTheSubColumn = baseMapper.getsTheSubColumn(pid, ids, null);
return R.success(TreeStructureUtils.buildTree(getsTheSubColumn, pid)); return R.success(TreeStructureUtils.buildTree(getsTheSubColumn, pid));
} }
@Override @Override
public R getsSublevelColumnsUnderALevel(Integer parentId, String ids) { public R getsSublevelColumnsUnderALevel(Integer parentId, String ids) {
List<SysColumn> getsTheSubColumn = baseMapper.getsTheSubColumn(parentId, ids,null); List<SysColumn> getsTheSubColumn = baseMapper.getsTheSubColumn(parentId, ids, null);
List<SysColumn> buildTree = TreeStructureUtils.buildTree(getsTheSubColumn, parentId); List<SysColumn> buildTree = TreeStructureUtils.buildTree(getsTheSubColumn, parentId);
return R.success(buildTree); return R.success(buildTree);
} }
@ -166,8 +167,8 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
} }
@Override @Override
public R getSubColumn(Integer parentId, String ids,Integer isSort) { public R getSubColumn(Integer parentId, String ids, Integer isSort) {
List<SysColumn> getsTheSubColumn = baseMapper.getsTheSubColumn(parentId, ids,isSort); List<SysColumn> getsTheSubColumn = baseMapper.getsTheSubColumn(parentId, ids, isSort);
return R.success(TreeStructureUtils.forMethod(getsTheSubColumn)); return R.success(TreeStructureUtils.forMethod(getsTheSubColumn));
} }

@ -64,17 +64,6 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
@Override @Override
public R articlePaginationList(PageContentReqVO reqVO) { public R articlePaginationList(PageContentReqVO reqVO) {
Page<PageContentRespVO> page = new Page<PageContentRespVO>(reqVO.getPageNum(), reqVO.getPageSize()); Page<PageContentRespVO> page = new Page<PageContentRespVO>(reqVO.getPageNum(), reqVO.getPageSize());
//没传任何排序参数时候 默认以发布时间排序
if (reqVO.getModifiedTimeSort() == null && reqVO.getPublicationTimeSort() == null && reqVO.getTopSort() == null) {
reqVO.setPublicationTimeSort(0);
}
/*if (reqVO.getIsDisable()!=null){
if (reqVO.getIsDisable() == 1) {
//是否禁用(0默认,0启用 1禁用)
reqVO.setIsDisable(1);
}
}*/
IPage<PageContentRespVO> pageList = baseMapper.articlePaginationList(page, reqVO); IPage<PageContentRespVO> pageList = baseMapper.articlePaginationList(page, reqVO);
return R.success(pageList); return R.success(pageList);
} }

@ -79,14 +79,9 @@ public class PageContentReqVO extends PageReqVO {
@ApiModelProperty(value = "发布时间排序(0默认倒序 1升序)") @ApiModelProperty(value = "发布时间排序(0默认倒序 1升序)")
private Integer publicationTimeSort; private Integer publicationTimeSort;
/* @ApiModelProperty(value = "序号排序(0默认升序 1倒序)")
private Integer ordinalSort;*/
@ApiModelProperty(value = "置顶排序(0默认升序 1倒序)") @ApiModelProperty(value = "置顶排序(0默认升序 1倒序)")
private Integer topSort; private Integer topSort;
/* @ApiModelProperty(value = "模板状态(0禁用;1启用)")
private Integer templateStatus;*/
@ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)") @ApiModelProperty(value = "是否禁用(0默认,0启用 1禁用)")
private Integer isDisable; private Integer isDisable;

Loading…
Cancel
Save