diff --git a/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java b/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java index 9e45ded..72d38aa 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java @@ -748,4 +748,31 @@ public class ProjectManagementController { } return resp; } + + /** + * 是否启用 + * @param enable 0:启用,1:禁用 + * @param id 项目id + */ + @ApiOperation(value = "启用/禁用", notes = "启用/禁用") + @GetMapping("/enable") + public Response enable(@ApiParam(name = "enable", value = "0:启用,1:禁用")@RequestParam("enable") Integer enable, + @ApiParam(name = "id", value = "项目id")@RequestParam("id") Integer id) { + Response resp = new Response(); + if (enable == null || id == null || (enable != 0 && enable != 1)) { + resp.setStatus(406); + resp.setErrmessage("参数错误!"); + } else { + HashMap ret = service.enable(id, enable); + int status = (int) ret.get("retcode"); + if (status == 200) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } } diff --git a/src/main/java/com/yipin/liuwanr/entity/ProjectManagement.java b/src/main/java/com/yipin/liuwanr/entity/ProjectManagement.java index 038f452..f9b8fbf 100644 --- a/src/main/java/com/yipin/liuwanr/entity/ProjectManagement.java +++ b/src/main/java/com/yipin/liuwanr/entity/ProjectManagement.java @@ -104,6 +104,17 @@ public class ProjectManagement { @ApiModelProperty(value = "实验介绍是否启用(0、启用 1、不展示)", name = "userId", example = "0", required = true) private Integer experimentIntroductionIsEnable; + @ApiModelProperty(value = "是否启用(0:启用,1:禁用)") + private Integer enable; + + public Integer getEnable() { + return enable; + } + + public void setEnable(Integer enable) { + this.enable = enable; + } + public Integer getKnowledgePointsIsEnable() { return knowledgePointsIsEnable; } @@ -276,10 +287,13 @@ public class ProjectManagement { @Override public String toString() { return "ProjectManagement{" + - "projectId=" + projectId + + "pageNo=" + pageNo + + ", pageSize=" + pageSize + + ", queryName='" + queryName + '\'' + + ", projectId=" + projectId + ", projectName='" + projectName + '\'' + ", projectPermissions=" + projectPermissions + - ", founder=" + founder + + ", founder='" + founder + '\'' + ", creationTime='" + creationTime + '\'' + ", state=" + state + ", experimentalGoal='" + experimentalGoal + '\'' + @@ -288,11 +302,16 @@ public class ProjectManagement { ", experimentalDataId='" + experimentalDataId + '\'' + ", experimentSuggests='" + experimentSuggests + '\'' + ", systemId=" + systemId + + ", knowledgePoints='" + knowledgePoints + '\'' + + ", experimentIntroduction='" + experimentIntroduction + '\'' + ", isdel=" + isdel + ", isShow=" + isShow + ", isstartexperimental=" + isstartexperimental + ", isstartexperimentSuggests=" + isstartexperimentSuggests + ", userId=" + userId + + ", knowledgePointsIsEnable=" + knowledgePointsIsEnable + + ", experimentIntroductionIsEnable=" + experimentIntroductionIsEnable + + ", enable=" + enable + '}'; } } diff --git a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java index 35e54e7..58b64f0 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java @@ -68,7 +68,7 @@ public interface ProjectManagementMapper { // List queryManagements(ProjectManagement management); @Select({"") void daleteManegement(Integer id); + + @Update("update hr_project_management set enable = #{enable} where projectId = #{id}") + void enable(@Param("id") Integer id, @Param("enable") Integer enable); } diff --git a/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java b/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java index d386226..83cefe0 100644 --- a/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java +++ b/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java @@ -1029,4 +1029,22 @@ public class ProjectManagementService { return resp; } + /** + * 项目启用/禁用 + */ + public HashMap enable(Integer id, Integer enable) { + HashMap resp = new HashMap(); + try { + mapper.enable(id, enable); + resp.put("retcode", 200); + resp.put("retvalue","SUCCESS"); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "SERVER ERROR"); + throw new RuntimeException(); + } + return resp; + } + }