mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 19:36:50 +08:00
首页课程排行榜排序问题
This commit is contained in:
@@ -136,25 +136,31 @@ public class PortalIndexApi extends ApiBaseController{
|
|||||||
List<Course> courses = courseService.userHobbyList(aid,dto.getOrderField(),dto.getOrderAsc());
|
List<Course> courses = courseService.userHobbyList(aid,dto.getOrderField(),dto.getOrderAsc());
|
||||||
|
|
||||||
//计算下标,
|
//计算下标,
|
||||||
// int i=0;
|
int i=0;
|
||||||
// if(!courses.isEmpty()){
|
if(!courses.isEmpty()){
|
||||||
// for (Course c:courses) {
|
for (Course c:courses) {
|
||||||
// coursePageList.getList().add(i,c);
|
coursePageList.getList().set(i,c);
|
||||||
// i++;
|
i++;
|
||||||
// coursePageList.getList().remove(coursePageList.getList().size()-i);
|
// coursePageList.getList().remove(coursePageList.getList().size()-i);
|
||||||
// }
|
|
||||||
// }
|
|
||||||
PageList<Course> list = new PageList<>();
|
|
||||||
list.setList(new ArrayList<>(6));
|
|
||||||
if(!courses.isEmpty()) {
|
|
||||||
for (Course c:courses){
|
|
||||||
list.getList().add(c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i=0;i<coursePageList.getList().size();i++) {
|
|
||||||
list.getList().add(coursePageList.getList().get(i));
|
for (Course c:coursePageList.getList()) {
|
||||||
|
coursePageList.getList().set(i,c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// PageList<Course> list = new PageList<>();
|
||||||
|
// list.setList(new ArrayList<>(6));
|
||||||
|
// if(!courses.isEmpty()) {
|
||||||
|
// for (Course c:courses){
|
||||||
|
// list.getList().add(c);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// for (int i=0;i<coursePageList.getList().size();i++) {
|
||||||
|
// list.getList().add(coursePageList.getList().get(i));
|
||||||
|
// }
|
||||||
|
|
||||||
//如果有重复
|
//如果有重复
|
||||||
// List<Course> collect = list.getList().stream().distinct().collect(Collectors.toList());
|
// List<Course> collect = list.getList().stream().distinct().collect(Collectors.toList());
|
||||||
// if(collect.size()<list.getList().size()){
|
// if(collect.size()<list.getList().size()){
|
||||||
@@ -168,12 +174,12 @@ public class PortalIndexApi extends ApiBaseController{
|
|||||||
List<String> ids=new ArrayList<String>();
|
List<String> ids=new ArrayList<String>();
|
||||||
|
|
||||||
|
|
||||||
for(Course c :list.getList()) {
|
for(Course c :coursePageList.getList()) {
|
||||||
ids.add(c.getId());
|
ids.add(c.getId());
|
||||||
}
|
}
|
||||||
List<CourseTeacher> teachers = courseService.findTeachersByCourseIds(ids);
|
List<CourseTeacher> teachers = courseService.findTeachersByCourseIds(ids);
|
||||||
//注意对于多个教师的情况,这里只是设置第一个教师
|
//注意对于多个教师的情况,这里只是设置第一个教师
|
||||||
for(Course c :list.getList()) {
|
for(Course c :coursePageList.getList()) {
|
||||||
for(CourseTeacher ct : teachers) {
|
for(CourseTeacher ct : teachers) {
|
||||||
if(ct.getCourseId().equals(c.getId())) {
|
if(ct.getCourseId().equals(c.getId())) {
|
||||||
c.setSysCreateAid(ct.getTeacherId());
|
c.setSysCreateAid(ct.getTeacherId());
|
||||||
|
|||||||
Reference in New Issue
Block a user