更改角色id查询字段

master
rong.liu 4 years ago
parent 0816c9168b
commit 7d251fcfb3
  1. 70
      src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java
  2. 39
      src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java

@ -58,20 +58,20 @@ public class ProjectManagementController {
@ApiOperation(value = "项目管理列表", notes = "项目管理列表") @ApiOperation(value = "项目管理列表", notes = "项目管理列表")
@GetMapping("/queryAllManagements") @GetMapping("/queryAllManagements")
R queryAllManagements( R queryAllManagements(
@ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = false) @RequestParam(required = false) Integer projectPermissions, @ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = false) @RequestParam(required = false) Integer projectPermissions,
@ApiParam(name = "founder", value = "项目创建人(0、系统 1、老师)", required = false) @RequestParam(required = false) String founder, @ApiParam(name = "founder", value = "项目创建人(0、系统 1、老师)", required = false) @RequestParam(required = false) String founder,
@ApiParam(name = "state", value = "项目状态(0、草稿箱 1、已发布)", required = false) @RequestParam(required = false) Integer state, @ApiParam(name = "state", value = "项目状态(0、草稿箱 1、已发布)", required = false) @RequestParam(required = false) Integer state,
@ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName, @ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName,
@ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam Integer systemId, @ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam Integer systemId,
@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam Integer userId, @ApiParam(name = "userId", value = "用户id", required = true) @RequestParam Integer userId,
@ApiParam(name = "pageNo", value = "起始页数", required = true) @RequestParam Integer pageNo, @ApiParam(name = "pageNo", value = "起始页数", required = true) @RequestParam Integer pageNo,
@ApiParam(name = "pageSize", value = "页数", required = true) @RequestParam Integer pageSize) { @ApiParam(name = "pageSize", value = "页数", required = true) @RequestParam Integer pageSize) {
R r = new R(); R r = new R();
ProjectManagement vo = new ProjectManagement(); ProjectManagement vo = new ProjectManagement();
if (null != projectPermissions) { if (null != projectPermissions) {
vo.setProjectPermissions(projectPermissions); vo.setProjectPermissions(projectPermissions);
} }
if (null != founder && founder !="") { if (null != founder && founder != "") {
vo.setFounder(founder); vo.setFounder(founder);
} }
if (null != state) { if (null != state) {
@ -86,19 +86,19 @@ public class ProjectManagementController {
if (null != userId) { if (null != userId) {
vo.setUserId(userId); vo.setUserId(userId);
} }
if (null != pageNo){ if (null != pageNo) {
vo.setPageNo(pageNo); vo.setPageNo(pageNo);
} }
if (null != pageSize){ if (null != pageSize) {
vo.setPageSize(pageSize); vo.setPageSize(pageSize);
} }
HashMap<String, Object> ret = service.queryAllManagements(vo); HashMap<String, Object> ret = service.queryAllManagements(vo);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (status == 200) { if (status == 200) {
r.put("status", 200); r.put("status", 200);
r.put("pageInfo",ret.get("pageInfo")); r.put("pageInfo", ret.get("pageInfo"));
} else { } else {
R.error(500,ret.get("retvalue").toString()); R.error(500, ret.get("retvalue").toString());
} }
return r; return r;
} }
@ -155,6 +155,7 @@ public class ProjectManagementController {
// } // }
// return resp; // return resp;
// } // }
/** /**
* 页面查询,排除练习 * 页面查询,排除练习
* <p> * <p>
@ -165,11 +166,11 @@ public class ProjectManagementController {
@ApiOperation(value = "项目列表(排除练习)", notes = "项目列表(用于创建实验,排除练习项目)") @ApiOperation(value = "项目列表(排除练习)", notes = "项目列表(用于创建实验,排除练习项目)")
@GetMapping("/queryManagements") @GetMapping("/queryManagements")
Response queryManagements( Response queryManagements(
@ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam(required = false) Integer systemId, @ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam(required = false) Integer systemId,
@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam(required = false) Integer userId, @ApiParam(name = "userId", value = "用户id", required = true) @RequestParam(required = false) Integer userId,
@ApiParam(name = "pageNo", value = "第几页,页码", required = true) @RequestParam Integer pageNo, @ApiParam(name = "pageNo", value = "第几页,页码", required = true) @RequestParam Integer pageNo,
@ApiParam(name = "pageSize", value = "每页展示的数据条数", required = true) @RequestParam Integer pageSize, @ApiParam(name = "pageSize", value = "每页展示的数据条数", required = true) @RequestParam Integer pageSize,
@ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam String projectName) { @ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName) {
Response resp = new Response(); Response resp = new Response();
ProjectManagement vo = new ProjectManagement(); ProjectManagement vo = new ProjectManagement();
if (null != systemId) { if (null != systemId) {
@ -178,10 +179,17 @@ public class ProjectManagementController {
if (null != userId) { if (null != userId) {
vo.setUserId(userId); vo.setUserId(userId);
} }
if (null != projectName) {
/*if (null != projectName) {
vo.setQueryName(projectName); vo.setQueryName(projectName);
}*/
if (org.apache.commons.lang3.StringUtils.equals("", projectName)) {
projectName = null;
} }
HashMap<String, Object> ret = service.queryManagements(vo,pageNo,pageSize); HashMap<String, Object> ret = service.queryManagements(vo, pageNo, pageSize);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (status == 200) { if (status == 200) {
resp.setStatus(status); resp.setStatus(status);
@ -194,12 +202,6 @@ public class ProjectManagementController {
} }
/** /**
* 批量删除 * 批量删除
* *
@ -660,16 +662,17 @@ public class ProjectManagementController {
/** /**
* 判断项目名称是否存在 * 判断项目名称是否存在
*
* @param projectName * @param projectName
* @return * @return
*/ */
@GetMapping("/isNameExistis") @GetMapping("/isNameExistis")
Response isNameExistis(@RequestParam String projectName){ Response isNameExistis(@RequestParam String projectName) {
Response resp = new Response(); Response resp = new Response();
if (StringUtils.isEmpty(projectName)) { if (StringUtils.isEmpty(projectName)) {
resp.setStatus(300); resp.setStatus(300);
resp.setMessage("项目名称为空"); resp.setMessage("项目名称为空");
}else{ } else {
HashMap<String, Object> ret = service.getByName(projectName); HashMap<String, Object> ret = service.getByName(projectName);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (status == 200) { if (status == 200) {
@ -737,13 +740,13 @@ public class ProjectManagementController {
@ApiOperation(value = "川大查询项目管理列表", notes = "川大查询项目管理列表") @ApiOperation(value = "川大查询项目管理列表", notes = "川大查询项目管理列表")
@GetMapping("/getManagements") @GetMapping("/getManagements")
Response getManagements( Response getManagements(
@ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = true) @RequestParam(required = true) Integer projectPermissions){ @ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = true) @RequestParam(required = true) Integer projectPermissions) {
Response resp = new Response(); Response resp = new Response();
ProjectManagement vo = new ProjectManagement(); ProjectManagement vo = new ProjectManagement();
if (null == projectPermissions) { if (null == projectPermissions) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("项目权限不能为空!"); resp.setErrmessage("项目权限不能为空!");
}else { } else {
HashMap<String, Object> ret = service.getManagements(projectPermissions); HashMap<String, Object> ret = service.getManagements(projectPermissions);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (status == 200) { if (status == 200) {
@ -759,13 +762,14 @@ public class ProjectManagementController {
/** /**
* 是否启用 * 是否启用
*
* @param enable 0:启用,1:禁用 * @param enable 0:启用,1:禁用
* @param id 项目id * @param id 项目id
*/ */
@ApiOperation(value = "启用/禁用", notes = "启用/禁用") @ApiOperation(value = "启用/禁用", notes = "启用/禁用")
@GetMapping("/enable") @GetMapping("/enable")
public Response enable(@ApiParam(name = "enable", value = "0:启用,1:禁用")@RequestParam("enable") Integer enable, public Response enable(@ApiParam(name = "enable", value = "0:启用,1:禁用") @RequestParam("enable") Integer enable,
@ApiParam(name = "id", value = "项目id")@RequestParam("id") Integer id) { @ApiParam(name = "id", value = "项目id") @RequestParam("id") Integer id) {
Response resp = new Response(); Response resp = new Response();
if (enable == null || id == null || (enable != 0 && enable != 1)) { if (enable == null || id == null || (enable != 0 && enable != 1)) {
resp.setStatus(406); resp.setStatus(406);

@ -25,17 +25,16 @@ public interface ProjectManagementMapper {
* 分页查询+条件查询 * 分页查询+条件查询
* *
* @param management * @param management
* @return * @return "select projectId,projectName,projectPermissions,founder,creationTime,state from hr_project_management where isdel=0",
* "select projectId,projectName,projectPermissions,founder,creationTime,state from hr_project_management where isdel=0", * " <if test='projectPermissions!=null'> and projectPermissions=#{projectPermissions}</if>",
* " <if test='projectPermissions!=null'> and projectPermissions=#{projectPermissions}</if>", * " <if test='founder!=null and userId==null'> and founder=#{founder}</if>",//服务端跳项目管理
* " <if test='founder!=null and userId==null'> and founder=#{founder}</if>",//服务端跳项目管理 * " <if test='founder==null and userId!=null'> and (userId=#{userId} or founder = 0)</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的
* " <if test='founder==null and userId!=null'> and (userId=#{userId} or founder = 0)</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的 * " <if test='founder==0 and userId!=null'> and founder=#{founder}</if>",//教师选择创建人为系统
* " <if test='founder==0 and userId!=null'> and founder=#{founder}</if>",//教师选择创建人为系统 * " <if test='founder==1 and userId!=null'> and userId=#{userId}</if>",//教师选则创建人为老师
* " <if test='founder==1 and userId!=null'> and userId=#{userId}</if>",//教师选则创建人为老师 * " <if test='state!=null'> and state=#{state}</if>",
* " <if test='state!=null'> and state=#{state}</if>", * " <if test='systemId!=null'> and systemId=#{systemId}</if>",
* " <if test='systemId!=null'> and systemId=#{systemId}</if>", * " <if test='projectName!=null'> and projectName like concat('%',#{projectName},'%')</if>",
* " <if test='projectName!=null'> and projectName like concat('%',#{projectName},'%')</if>", * " ORDER BY creationTime desc",
* " ORDER BY creationTime desc",
*/ */
@Select({"<script>", @Select({"<script>",
// "select projectId,projectName,projectPermissions,founder,creationTime,state,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0", // "select projectId,projectName,projectPermissions,founder,creationTime,state,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0",
@ -44,9 +43,9 @@ public interface ProjectManagementMapper {
" <if test='userId!=null'>AND ((FIND_IN_SET(1,founder) AND isdel = 0) OR ( isdel = 0 AND userId = #{userId} ))</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的 " <if test='userId!=null'>AND ((FIND_IN_SET(1,founder) AND isdel = 0) OR ( isdel = 0 AND userId = #{userId} ))</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的
" <if test='projectPermissions!=null'> and projectPermissions=#{projectPermissions}</if>", " <if test='projectPermissions!=null'> and projectPermissions=#{projectPermissions}</if>",
" <if test='founder!=null'> and founder=#{founder}</if>",//教师选择创建人为系统 " <if test='founder!=null'> and founder=#{founder}</if>",//教师选择创建人为系统
" <if test='state!=null'> and state=#{state}</if>", " <if test='state!=null'> and state=#{state}</if>",
" <if test='systemId!=null'> and systemId=#{systemId}</if>", " <if test='systemId!=null'> and systemId=#{systemId}</if>",
" <if test='projectName!=null'> and projectName like concat('%',#{projectName},'%')</if>", " <if test='projectName!=null'> and projectName like concat('%',#{projectName},'%')</if>",
" ORDER BY creationTime desc", " ORDER BY creationTime desc",
"</script>"}) "</script>"})
List<ProjectManagement> queryManagements(ProjectManagement management); List<ProjectManagement> queryManagements(ProjectManagement management);
@ -69,10 +68,11 @@ public interface ProjectManagementMapper {
@Select({"<script>", @Select({"<script>",
"select * from hr_project_management where enable = 0",//(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 founder != 14 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 ((AND founder != 14 AND isdel = 0 AND projectPermissions != 0) " +
" <if test='systemId!=null'> and systemId=#{systemId}</if>", " OR ( isdel = 0 AND projectPermissions != 0 AND userId = #{userId} ))</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的
" <if test='queryName!=null'> and projectName LIKE '%' #{queryName} '%'</if>", " <if test='systemId!=null'> and systemId=#{systemId}</if>",
" <if test='queryName!=null'> and projectName LIKE '%' #{queryName} '%'</if>",
" ORDER BY creationTime desc", " ORDER BY creationTime desc",
"</script>"}) "</script>"})
List<ProjectManagement> queryManagementsExportTest(ProjectManagement management); List<ProjectManagement> queryManagementsExportTest(ProjectManagement management);
@ -211,7 +211,7 @@ public interface ProjectManagementMapper {
@Select({"<script>", @Select({"<script>",
"select score,judgmentPointsId from hr_score_index where judgmentPointsId=#{judgmentPointsId} and systemId = #{systemId} and projectId = #{projectId}", "select score,judgmentPointsId from hr_score_index where judgmentPointsId=#{judgmentPointsId} and systemId = #{systemId} and projectId = #{projectId}",
"</script>"}) "</script>"})
List<ScoreIndex> getScore(Integer judgmentPointsId,Integer systemId,Integer projectId); List<ScoreIndex> getScore(Integer judgmentPointsId, Integer systemId, Integer projectId);
/** /**
@ -310,6 +310,7 @@ public interface ProjectManagementMapper {
/** /**
* 修改判分点绑定的项目 * 修改判分点绑定的项目
*
* @param projectId * @param projectId
* @param judgmentPointsId * @param judgmentPointsId
*/ */

Loading…
Cancel
Save