新增项目管理启用禁用功能

master
river 4 years ago
parent 84acd5838d
commit 8c2de60511
  1. 27
      src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java
  2. 23
      src/main/java/com/yipin/liuwanr/entity/ProjectManagement.java
  3. 5
      src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java
  4. 18
      src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java

@ -748,4 +748,31 @@ public class ProjectManagementController {
} }
return resp; 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<String, Object> 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;
}
} }

@ -104,6 +104,17 @@ public class ProjectManagement {
@ApiModelProperty(value = "实验介绍是否启用(0、启用 1、不展示)", name = "userId", example = "0", required = true) @ApiModelProperty(value = "实验介绍是否启用(0、启用 1、不展示)", name = "userId", example = "0", required = true)
private Integer experimentIntroductionIsEnable; 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() { public Integer getKnowledgePointsIsEnable() {
return knowledgePointsIsEnable; return knowledgePointsIsEnable;
} }
@ -276,10 +287,13 @@ public class ProjectManagement {
@Override @Override
public String toString() { public String toString() {
return "ProjectManagement{" + return "ProjectManagement{" +
"projectId=" + projectId + "pageNo=" + pageNo +
", pageSize=" + pageSize +
", queryName='" + queryName + '\'' +
", projectId=" + projectId +
", projectName='" + projectName + '\'' + ", projectName='" + projectName + '\'' +
", projectPermissions=" + projectPermissions + ", projectPermissions=" + projectPermissions +
", founder=" + founder + ", founder='" + founder + '\'' +
", creationTime='" + creationTime + '\'' + ", creationTime='" + creationTime + '\'' +
", state=" + state + ", state=" + state +
", experimentalGoal='" + experimentalGoal + '\'' + ", experimentalGoal='" + experimentalGoal + '\'' +
@ -288,11 +302,16 @@ public class ProjectManagement {
", experimentalDataId='" + experimentalDataId + '\'' + ", experimentalDataId='" + experimentalDataId + '\'' +
", experimentSuggests='" + experimentSuggests + '\'' + ", experimentSuggests='" + experimentSuggests + '\'' +
", systemId=" + systemId + ", systemId=" + systemId +
", knowledgePoints='" + knowledgePoints + '\'' +
", experimentIntroduction='" + experimentIntroduction + '\'' +
", isdel=" + isdel + ", isdel=" + isdel +
", isShow=" + isShow + ", isShow=" + isShow +
", isstartexperimental=" + isstartexperimental + ", isstartexperimental=" + isstartexperimental +
", isstartexperimentSuggests=" + isstartexperimentSuggests + ", isstartexperimentSuggests=" + isstartexperimentSuggests +
", userId=" + userId + ", userId=" + userId +
", knowledgePointsIsEnable=" + knowledgePointsIsEnable +
", experimentIntroductionIsEnable=" + experimentIntroductionIsEnable +
", enable=" + enable +
'}'; '}';
} }
} }

@ -68,7 +68,7 @@ public interface ProjectManagementMapper {
// List<ProjectManagement> queryManagements(ProjectManagement management); // List<ProjectManagement> queryManagements(ProjectManagement management);
@Select({"<script>", @Select({"<script>",
"select * from hr_project_management where 1 = 1",//(roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0)", "select * from hr_project_management where enable = 0",//(roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0)",
"<if test='userId==null'>AND roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0</if>", "<if test='userId==null'>AND roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0</if>",
" <if test='userId!=null'>AND ((roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0) OR ( isdel = 0 AND projectPermissions != 0 AND userId = #{userId} ))</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的 " <if test='userId!=null'>AND ((roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0) OR ( isdel = 0 AND projectPermissions != 0 AND userId = #{userId} ))</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的
" <if test='systemId!=null'> and systemId=#{systemId}</if>", " <if test='systemId!=null'> and systemId=#{systemId}</if>",
@ -394,4 +394,7 @@ public interface ProjectManagementMapper {
"where projectId=#{projectId}" "where projectId=#{projectId}"
+ "</script>") + "</script>")
void daleteManegement(Integer id); 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);
} }

@ -1029,4 +1029,22 @@ public class ProjectManagementService {
return resp; return resp;
} }
/**
* 项目启用/禁用
*/
public HashMap<String, Object> enable(Integer id, Integer enable) {
HashMap<String, Object> resp = new HashMap<String, Object>();
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;
}
} }

Loading…
Cancel
Save