Skip to content

Commit

Permalink
Merge pull request #190 from limingoo/dev
Browse files Browse the repository at this point in the history
fix:185
  • Loading branch information
dlimeng authored Sep 27, 2023
2 parents a60d71c + 472d1e0 commit 5e4f316
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,23 @@ public Result createProject(HttpServletRequest req,
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "project_id", dataTypeClass = int.class, example = "123456"),
@ApiImplicitParam(name = "projectName", value = "project_name", dataTypeClass = String.class),
@ApiImplicitParam(name = "backgroundImage", value = "backgroundImage", dataTypeClass = String.class),
@ApiImplicitParam(name = "description", value = "project_desc", dataTypeClass = String.class)
})
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_PROJECT_ERROR)
@RequestMapping(path = "/{id}", method = RequestMethod.PUT)
public Result updateProject(HttpServletRequest req,
@PathVariable("id") Integer projectId,
@RequestParam("projectName") String projectName,
@RequestParam(value = "projectName", required = false) String projectName,
@RequestParam(value = "backgroundImage", required = false) String backgroundImage,
@RequestParam(value = "description", required = false) String description) {

if(StringUtils.isBlank(projectName)) {
return error(Status.UPDATE_PROJECT_ERROR.getCode(),
Status.UPDATE_PROJECT_ERROR.getMsg());
}

if(projectId == null) {
return error(Status.UPDATE_PROJECT_ERROR.getCode(),
Status.UPDATE_PROJECT_ERROR.getMsg());
}
return projectService.updateProject(projectId, projectName, description);
return projectService.updateProject(projectId, projectName, backgroundImage, description);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public interface ProjectService {

Result createProject(String loginUser, String name, String desc);

Result updateProject(Integer projectId, String name, String desc);
Result updateProject(Integer projectId, String name, String image, String desc);

Result queryProjectListPaging(String searchName, Integer pageNo, Integer pageSize);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,22 @@ public Result createProject(String loginUser, String name, String desc) {
}

@Override
public Result updateProject(Integer projectId, String name, String desc) {
public Result updateProject(Integer projectId, String name, String image, String desc) {
Project newProject = projectMapper.selectById(projectId);
Result result = new Result();
if (newProject == null) {
putMsg(result, Status.PROJECT_NOT_EXISTS_ERROR);
return result;
}
newProject.setProjectName(name);
newProject.setDescription(desc);
if (name != null){
newProject.setProjectName(name);
}
if (image != null){
newProject.setImage(image);
}
if (desc != null){
newProject.setDescription(desc);
}
newProject.setUpdateTime(new Date());
newProject.setStatus(0);
if(projectMapper.updateById(newProject) > 0){
Expand Down

0 comments on commit 5e4f316

Please sign in to comment.