代码优化

This commit is contained in:
none 2023-07-28 16:00:46 +08:00
parent 46015593e9
commit 39519db020
2 changed files with 3 additions and 3 deletions

View File

@ -105,7 +105,7 @@ public class CourseController {
@PostMapping("/create") @PostMapping("/create")
@Transactional @Transactional
public JsonResponse store(@RequestBody @Validated CourseRequest req) throws ParseException { public JsonResponse store(@RequestBody @Validated CourseRequest req) throws ParseException {
if (req.getShortDesc() != null && req.getShortDesc().length() > 200) { if (req.getShortDesc().length() > 200) {
return JsonResponse.error("课程简短介绍不能超过200字"); return JsonResponse.error("课程简短介绍不能超过200字");
} }
Course course = Course course =
@ -144,7 +144,7 @@ public class CourseController {
classHourCount = insertHours.size(); classHourCount = insertHours.size();
} }
} else { } else {
if (req.getChapters() == null || req.getChapters().size() == 0) { if (req.getChapters().size() == 0) {
return JsonResponse.error("请配置课时"); return JsonResponse.error("请配置课时");
} }

View File

@ -112,7 +112,7 @@ public class ResourceController {
if(!type.equals(BackendConstant.RESOURCE_TYPE_VIDEO) && if(!type.equals(BackendConstant.RESOURCE_TYPE_VIDEO) &&
!type.equals(BackendConstant.RESOURCE_TYPE_IMAGE)){ !type.equals(BackendConstant.RESOURCE_TYPE_IMAGE)){
filter.setType(BackendConstant.RESOURCE_TYPE_ATTACHMENT); filter.setType(BackendConstant.RESOURCE_TYPE_ATTACHMENT);
data.put("existingType",resourceService.paginateType(filter)); data.put("existing_types",resourceService.paginateType(filter));
} }
return JsonResponse.data(data); return JsonResponse.data(data);
} }