查询标签修改

This commit is contained in:
670788339
2025-11-02 10:30:02 +08:00
parent fb29e2b95c
commit 99042619d2
2 changed files with 5 additions and 1 deletions

View File

@@ -158,7 +158,7 @@ public class CourseManageApi extends ApiBaseController{
List<CourseSection> sectionlist=sectionService.getByCourseId(id);
List<CourseTeacher> teachers=courseService.findTeachersByCourseId(id);
List<CourseCrowd> crowds=courseService.findCrowdByCourseId(id);
if (StringUtils.isNotBlank(course.getTags())){
if (StringUtils.isNotBlank(course.getTags()) && course.getTags().matches("[0-9,]+")){
List<CourseTag> tagList = tagService.getTagsByIds(course.getTags());
rs.put("tagList", tagList);
}

View File

@@ -26,6 +26,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
/**
* @ClassName:CourseTagApi
@@ -167,6 +168,9 @@ public class CourseTagApi extends ApiBaseController {
*/
@RequestMapping(value="/createTag",method= RequestMethod.POST)
public JsonResponse<CourseTag> createTag(CourseTagRelationDto courseTagRelationDto){
if (StringUtils.isNotBlank(courseTagRelationDto.getTagName()) && !Pattern.matches("^[\\u4e00-\\u9fa5a-zA-Z0-9_-]+$", courseTagRelationDto.getTagName())) {
return error("标签名称只能包含中文、英文、数字、下划线和中横线");
}
if (courseTagRelationDto!=null){
CourseTag courseTag = courseTagService.createTag(courseTagRelationDto);
return success(courseTag);