diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/HomeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/HomeController.java index bc34902..ff4f2f0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/HomeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/home/HomeController.java @@ -227,36 +227,20 @@ public class HomeController { @RequestParam(required = false ) String columnId) { //部门动态对应的栏目 - List deptColumns = null; - if(StringUtils.isNotBlank(columnId)){ - deptColumns = columnService.lambdaQuery() - .eq(SysColumn::getParentId,columnId) - .list(); - } else{ - deptColumns = columnService.lambdaQuery() - .eq(SysColumn::getColumnType, DEPT_COLUMN_TYPE) - .eq(SysColumn::getColumnGrade, COLUMN_GRADE) - .eq(SysColumn::getStatus,STATUS) - .list(); - } - if(CollUtil.isEmpty(deptColumns)){ - deptColumns = columnService.lambdaQuery() - .eq(SysColumn::getColumnId,columnId) - .eq(SysColumn::getStatus,STATUS) - .list(); - } + List deptColumns = columnService.lambdaQuery() + .eq(SysColumn::getColumnType, DEPT_COLUMN_TYPE) + .eq(SysColumn::getColumnGrade, COLUMN_GRADE) + .eq(SysColumn::getStatus,STATUS) + .orderByAsc(SysColumn::getOrderNum) + .list(); mmap.put("deptColumns", deptColumns); - List columnIdList = deptColumns.stream().map(SysColumn::getColumnId).collect(Collectors.toList()); - PageMethod.startPage(pageNum,pageSize); //部门动态 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(SysDeptTrends::getStatus,STATUS); - if(CollUtil.isNotEmpty(columnIdList)){ - queryWrapper.in(SysDeptTrends::getColumnId,columnIdList); - }else{ - queryWrapper.eq(SysDeptTrends::getColumnId, null); + if(StringUtils.isNotBlank(columnId)){ + queryWrapper.eq(SysDeptTrends::getColumnId, columnId); } List deptTrends = trendsService.list(queryWrapper); PageInfo page = new PageInfo<>(deptTrends, pageSize); @@ -313,6 +297,7 @@ public class HomeController { .eq(SysColumn::getColumnType, SPECIAL_COLUMN_TYPE) .eq(SysColumn::getColumnGrade, COLUMN_GRADE) .eq(SysColumn::getStatus,STATUS) + .orderByAsc(SysColumn::getOrderNum) .list(); mmap.put("specialColumns", specialColumns);