|
|
@ -37,6 +37,7 @@ import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
@ -172,13 +173,58 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public int countHours(String id) { |
|
|
|
public List<CoursesVO> getPagePageSize(int page, int pageSize) { |
|
|
|
return 0; |
|
|
|
int startIndex = (page-1) * pageSize; |
|
|
|
|
|
|
|
List<Courses> list = coursesMapper.getItemsByPage(startIndex, pageSize); |
|
|
|
|
|
|
|
// List<Courses> list = coursesMapper.selectList(null);
|
|
|
|
|
|
|
|
List<CoursesVO> coursesVo = BeanUtil.copyToList(list, CoursesVO.class); |
|
|
|
|
|
|
|
coursesVo = coursesVo.stream().map((item) -> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.setTotalHours(countHours(item.getId())); |
|
|
|
|
|
|
|
item.setTotalchapter(100); |
|
|
|
|
|
|
|
item.setTotalKnow(100); |
|
|
|
|
|
|
|
// if (StringUtils.isBlank(item.getName()) ||
|
|
|
|
|
|
|
|
// StringUtils.isBlank(item.getDescription()) ){
|
|
|
|
|
|
|
|
// throw new BusinessException(ErrorCode.OPERATION_ERROR,"数据格式有问题,请修改");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
return item; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return coursesVo; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<CoursesVO> getPagePageSize(int page, int pageSize) { |
|
|
|
public int countHours(String id) { |
|
|
|
return null; |
|
|
|
Courses courses = coursesMapper.selectById(id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer classhours = 0; |
|
|
|
|
|
|
|
Integer theoryhours = 0; |
|
|
|
|
|
|
|
Integer practicehours = 0; |
|
|
|
|
|
|
|
Integer experimenthours = 0; |
|
|
|
|
|
|
|
Integer otherhours = 0; |
|
|
|
|
|
|
|
if (courses.getClasshours() != null) { |
|
|
|
|
|
|
|
classhours = courses.getClasshours(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (courses.getTheoryhours() != null) { |
|
|
|
|
|
|
|
theoryhours = courses.getTheoryhours(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (courses.getPracticehours() != null) { |
|
|
|
|
|
|
|
practicehours = courses.getPracticehours(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (courses.getExperimenthours() != null) { |
|
|
|
|
|
|
|
experimenthours = courses.getExperimenthours(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (courses.getOtherhours() != null) { |
|
|
|
|
|
|
|
otherhours = courses.getOtherhours(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int total = classhours + theoryhours + practicehours + experimenthours + otherhours; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return total; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|