排序完善

master
rong.liu 2 years ago
parent 1db80e42e9
commit 56e5644480
  1. 44
      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}
</if>
<if test="req.modifiedTimeSort ==0">
<choose>
<when test="req.modifiedTimeSort ==0">
ORDER BY c.update_time desc
</if>
</when>
<if test="req.modifiedTimeSort ==1">
<when test="req.modifiedTimeSort ==1">
ORDER BY c.update_time asc
</if>
</when>
<if test="req.publicationTimeSort ==0">
<when test="req.publicationTimeSort ==0">
ORDER BY c.release_time desc
</if>
</when>
<if test="req.publicationTimeSort ==1">
<when test="req.publicationTimeSort ==1">
ORDER BY c.release_time asc
</if>
</when>
<if test="req.topSort ==0">
<when test="req.topSort ==0">
ORDER BY is_top asc
</if>
</when>
<if test="req.topSort ==1">
<when test="req.topSort ==1">
ORDER BY is_top desc
</if>
</when>
<otherwise>
ORDER BY
release_time DESC,
create_time DESC
</otherwise>
</choose>
</select>
@ -167,11 +174,16 @@
sys_content c
WHERE
deleted = 1
AND site_id = 1
AND site_id = #{req.siteId}
<if test="req.title != null and req.title != ''">
AND title LIKE
CONCAT('%',#{req.title},'%')
</if>
ORDER BY
is_top = 1 DESC,
top_time DESC,
release_time DESC,
create_time DESC
</select>
<select id="columnConditionsFilterArticles" resultType="com.huoran.iasf.vo.resp.PageContentRespVO">
SELECT t.*,
@ -191,13 +203,11 @@
AND is_release = 1) t
WHERE FIND_IN_SET(t.column_id, #{columnId})
ORDER BY
is_top = 1 DESC,
ORDER BY is_top = 1 DESC,
top_time DESC,
release_time DESC,
create_time DESC
</select>
</mapper>

@ -44,6 +44,7 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
queryWrapper.eq("column_name", column.getColumnName());
queryWrapper.eq("level", column.getLevel());
queryWrapper.eq("site_id", column.getSiteId());
queryWrapper.eq("deleted", 1);
SysColumn sysColumn = mapper.selectOne(queryWrapper);
if (sysColumn != null) {
if (column.getId() != null) {
@ -93,9 +94,9 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
@Override
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");
}
//查询所有栏目
@ -147,14 +148,14 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
@Override
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));
}
@Override
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);
return R.success(buildTree);
}
@ -166,8 +167,8 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
}
@Override
public R getSubColumn(Integer parentId, String ids,Integer isSort) {
List<SysColumn> getsTheSubColumn = baseMapper.getsTheSubColumn(parentId, ids,isSort);
public R getSubColumn(Integer parentId, String ids, Integer isSort) {
List<SysColumn> getsTheSubColumn = baseMapper.getsTheSubColumn(parentId, ids, isSort);
return R.success(TreeStructureUtils.forMethod(getsTheSubColumn));
}

@ -64,17 +64,6 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
@Override
public R articlePaginationList(PageContentReqVO reqVO) {
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);
return R.success(pageList);
}

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

Loading…
Cancel
Save