This commit is contained in:
wangjinlei
2024-03-22 14:06:28 +08:00
parent c66a071de5
commit f9431e4c81
2 changed files with 2 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ import java.util.Map;
public class ObjectUtils { public class ObjectUtils {
public boolean isNotBlank(Map<String,Object> m, String key){ public static boolean isNotBlank(Map<String,Object> m, String key){
if(!m.containsKey(key)){ if(!m.containsKey(key)){
return false; return false;
} }

View File

@@ -31,8 +31,6 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
private CourseToSociologyDao courseToSociologyDao; private CourseToSociologyDao courseToSociologyDao;
@Autowired @Autowired
private CourseCatalogueDao courseCatalogueDao; private CourseCatalogueDao courseCatalogueDao;
@Autowired
private ObjectUtils objectUtils;
@Override @Override
public Page getCourseList(Map<String,Object> map) { public Page getCourseList(Map<String,Object> map) {
@@ -70,7 +68,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
return null; return null;
} }
} }
wrapper.like(objectUtils.isNotBlank(map,"keywords"),CourseEntity::getTitle,map.get("keywords").toString()); wrapper.like(ObjectUtils.isNotBlank(map,"keywords"),CourseEntity::getTitle,map.get("keywords").toString());
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectPage(new Page<>(page, limit), wrapper); Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
for (CourseEntity c:courseEntityPage.getRecords()){ for (CourseEntity c:courseEntityPage.getRecords()){
List<CourseCatalogueEntity> courseCatalogueEntities = courseCatalogueDao.selectList(new LambdaQueryWrapper<CourseCatalogueEntity>().eq(CourseCatalogueEntity::getCourseId, c.getId()).orderByAsc(CourseCatalogueEntity::getSort)); List<CourseCatalogueEntity> courseCatalogueEntities = courseCatalogueDao.selectList(new LambdaQueryWrapper<CourseCatalogueEntity>().eq(CourseCatalogueEntity::getCourseId, c.getId()).orderByAsc(CourseCatalogueEntity::getSort));