[update] 学习资源新增/修改 Request VO 参数校验修改
This commit is contained in:
parent
fbdd3274ae
commit
3f7f62cd65
@ -32,6 +32,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode MODEL_ASSESS_STOPLIST_NOT_EXISTS = new ErrorCode(10014, "自动评估维度不存在");
|
||||
|
||||
ErrorCode LEARNING_RESOURCES_NOT_EXISTS = new ErrorCode(10015, "学习资源不存在");
|
||||
|
||||
ErrorCode LEARNING_RESOURCES_FILE_URL_NOT_NULL = new ErrorCode(10016, "文件地址不能为空");
|
||||
/*
|
||||
ErrorCode DATASET_FILES_NOT_EXISTS = new ErrorCode(10016, "数据集文件资源不存在");
|
||||
ErrorCode DATASET_QUESTION_NOT_EXISTS = new ErrorCode(10017, "数据集标准问题不存在");
|
||||
|
@ -25,7 +25,6 @@ public class LearningResourcesSaveReqVO {
|
||||
private Long fileId;
|
||||
|
||||
@Schema(description = "文件URL地址、视频封面图", example = "https://www.iocoder.cn")
|
||||
@NotNull(message = "文件内容不能为空")
|
||||
private String fileUrl;
|
||||
|
||||
@Schema(description = "文件名称,视频链接",example = "https://www.test.com")
|
||||
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -42,6 +43,9 @@ public class LearningResourcesServiceImpl implements LearningResourcesService {
|
||||
|
||||
@Override
|
||||
public Long createLearningResources(LearningResourcesSaveReqVO createReqVO) {
|
||||
if (StringUtils.isBlank(createReqVO.getFileUrl())){
|
||||
throw exception(LEARNING_RESOURCES_FILE_URL_NOT_NULL);
|
||||
}
|
||||
validateLearningResourcesNameExists(createReqVO);
|
||||
// 插入
|
||||
LearningResourcesDO learningResources = BeanUtils.toBean(createReqVO, LearningResourcesDO.class);
|
||||
@ -55,6 +59,9 @@ public class LearningResourcesServiceImpl implements LearningResourcesService {
|
||||
// 校验存在
|
||||
validateLearningResourcesExists(updateReqVO.getId());
|
||||
validateLearningResourcesNameExists(updateReqVO);
|
||||
if (StringUtils.isBlank(updateReqVO.getFileUrl())){
|
||||
throw exception(LEARNING_RESOURCES_FILE_URL_NOT_NULL);
|
||||
}
|
||||
// 更新
|
||||
LearningResourcesDO updateObj = BeanUtils.toBean(updateReqVO, LearningResourcesDO.class);
|
||||
learningResourcesMapper.updateById(updateObj);
|
||||
|
Loading…
x
Reference in New Issue
Block a user