From a8212f1a6605397327c36b6034feac0c0d11878d Mon Sep 17 00:00:00 2001 From: "jiakun.lin" Date: Fri, 2 Apr 2021 17:06:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=91=E5=A4=A7=E6=8E=A5=E5=8F=A3=E5=88=86?= =?UTF-8?q?=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectManagementController.java | 40 ++++++++++++++++++ .../mapper/ProjectManagementMapper.java | 13 ++++++ .../service/ProjectManagementService.java | 42 +++++++++++++++++++ 3 files changed, 95 insertions(+) diff --git a/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java b/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java index 193999a..c55c987 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java @@ -202,6 +202,46 @@ public class ProjectManagementController { } + /** + * 页面查询,排除练习 --- 科大分开接口 + *

+ * + * @param systemId + * @return + */ + @ApiOperation(value = "项目列表(排除练习)--科大分开接口", notes = "项目列表(用于创建实验,排除练习项目)") + @GetMapping("/KDqueryManagements") + Response KDqueryManagements( + @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 = "pageNo", value = "第几页,页码", required = true) @RequestParam Integer pageNo, + @ApiParam(name = "pageSize", value = "每页展示的数据条数", required = true) @RequestParam Integer pageSize, + @ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName) { + Response resp = new Response(); + ProjectManagement vo = new ProjectManagement(); + if (null != systemId) { + vo.setSystemId(systemId); + } + if (null != userId) { + vo.setUserId(userId); + } + if (org.apache.commons.lang3.StringUtils.equals("", projectName)) { + projectName = null; + } + HashMap ret = service.KDqueryManagements(vo, pageNo, pageSize); + 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/mapper/ProjectManagementMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java index 0e577ee..951d580 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java @@ -66,6 +66,7 @@ public interface ProjectManagementMapper { // ""}) // List queryManagements(ProjectManagement management); + //科大分开接口 @Select({""}) + List KDqueryManagementsExportTest(ProjectManagement management); + + + + @Select({""}) List queryManagementsExportTest(ProjectManagement management); diff --git a/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java b/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java index 446e775..93ae992 100644 --- a/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java +++ b/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java @@ -105,6 +105,48 @@ public class ProjectManagementService { } return resp; } + + + /** + * 条件查询 ---- 科大分开接口 + * + * @param vo + * @return + */ + public HashMap KDqueryManagements(ProjectManagement vo, Integer pageNo, Integer pageSize) { + HashMap resp = new HashMap(); + try { + //获取用户的角色信息 + String roleId = mapper.queryRoleId(vo.getUserId()); + if (null != roleId) { + //角色不对(学生没有权限) + if ("4".equals(roleId)) { + resp.put("retcode", 300); + resp.put("retvalue", "抱歉,您的权限不能访问该地址!"); + return resp; + } + //角色等于管理员或者超级管理员 + else if ("1".equals(roleId)) { + vo.setUserId(null); + } + } + PageHelper.startPage(pageNo, pageSize); + //条件查询 + List list = mapper.KDqueryManagementsExportTest(vo); + PageInfo info = new PageInfo(list); + resp.put("retvalue", new PageResult(info.getTotal(), list)); + resp.put("retcode", 200); + } catch (Exception e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } + + + /** * 分页查询+条件查询 *