mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-19 15:56:53 +08:00
标签关联课程下面展示标签
This commit is contained in:
@@ -412,8 +412,24 @@ public class CourseFullTextApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 获取课程对应的标签
|
||||||
|
for (CourseFullText c : coursePageList.getList()){
|
||||||
|
String tags = c.getTags();
|
||||||
|
String[] split = tags.split(",",0);
|
||||||
|
List<String> courseTagIds = new ArrayList<>();
|
||||||
|
for (String tagId : split) {
|
||||||
|
courseTagIds.add(tagId);
|
||||||
|
}
|
||||||
|
List<CourseTag> courseTags = courseTagService.getTagsByTagIds(courseTagIds);
|
||||||
|
List<Map<String,Object>> tagList = new ArrayList<>();
|
||||||
|
for (CourseTag courseTag : courseTags) {
|
||||||
|
Map<String,Object> tag = new HashMap<>();
|
||||||
|
tag.put("tagName", courseTag.getTagName());
|
||||||
|
tag.put("id", courseTag.getId());
|
||||||
|
tagList.add(tag);
|
||||||
|
}
|
||||||
|
c.setTagList(tagList);
|
||||||
|
}
|
||||||
return success(coursePageList);
|
return success(coursePageList);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
log.error("课程全文检索错误",e);
|
log.error("课程全文检索错误",e);
|
||||||
|
|||||||
@@ -86,4 +86,6 @@ public interface ICourseTagService {
|
|||||||
CourseTag getTagByName(String tagName);
|
CourseTag getTagByName(String tagName);
|
||||||
|
|
||||||
void bindTag(String id, String tags);
|
void bindTag(String id, String tags);
|
||||||
|
|
||||||
|
List<CourseTag> getTagsByTagIds(List<String> courseTagIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -256,6 +256,12 @@ public class CourseTagServiceImpl implements ICourseTagService {
|
|||||||
return courseTag;
|
return courseTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CourseTag> getTagsByTagIds(List<String> courseTagIds) {
|
||||||
|
List<CourseTag> courseTagList = courseTagDao.findList(FieldFilters.in("id", courseTagIds));
|
||||||
|
return courseTagList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindTag(String id, String tags) {
|
public void bindTag(String id, String tags) {
|
||||||
// 将tags转换为数组
|
// 将tags转换为数组
|
||||||
|
|||||||
Reference in New Issue
Block a user