Commit 6fe11361 by 段启岩

添加项目类别详细信息

parent 88678cec
......@@ -39,6 +39,9 @@ public class Project implements Serializable {
@ApiModelProperty(value = "项目类别ID")
private Integer categoryId;
@ApiModelProperty(value = "项目类别名称")
private String category;
@ApiModelProperty(value = "项目源码链接")
private String sourceLink;
......
......@@ -68,6 +68,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
}
// 2.保存项目
project.setCategory(projectCategory.getCategory());
save(project);
// 3.保存项目详情
......@@ -153,7 +154,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
throw new ProjectServiceException(ProjectErrorCode.PROJECT_NOT_FOUND);
}
// 检查项目类别是否存在
Integer categoryId = project.getCategoryId();
ProjectCategory projectCategory = projectCategoryMapper.selectById(categoryId);
// 若分类不存在,则抛出异常
if (null == projectCategory) {
throw new ProjectServiceException(ProjectErrorCode.INCORRECT_CATEGORY);
}
// 2.更新项目基本信息
project.setCategory(projectCategory.getCategory());
updateById(project);
// 3.更新项目详情
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment