diff --git a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java index dbe638c..bb322a0 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java @@ -46,17 +46,33 @@ public interface ProjectManagementMapper { * " ORDER BY creationTime desc", */ @Select({""}) List queryManagements(ProjectManagement management); + @Select({""}) + List queryUserManagements(ProjectManagement vo); // @Select({""}) List queryManagementsExportTest(ProjectManagement management); + @Select({""}) + List queryManagementsExport(ProjectManagement management); /** @@ -216,7 +240,7 @@ public interface ProjectManagementMapper { * @return */ @Select({""}) List getByjudgmentPointsIds(@Param("point") List point); @@ -228,7 +252,7 @@ public interface ProjectManagementMapper { * @param projectId * @return */ - @Select("select judgmentPointsId,judgmentPointsName,experimentalRequirements from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") + @Select("select judgmentPointsId,judgmentPointsName,experimentalRequirements ,userId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") List getByProjectId(Integer projectId); @@ -315,6 +339,16 @@ public interface ProjectManagementMapper { @Select("SELECT accountRole FROM user WHERE userId=#{userId}") Integer queryRoleId(Integer userId); + /** + * 查询用户角色 + * + * @param userId + * @return + */ + @Select("SELECT roleId FROM hr_user_info WHERE userId=#{userId}") + String queryRoleIds(Integer userId); + + @Select("SELECT id FROM tms_experimental_teaching WHERE project_id =#{projectId}") List queryproject(Integer projectId); @@ -325,4 +359,5 @@ public interface ProjectManagementMapper { "where projectId=#{projectId}" + "") void daleteManegement(Integer id); + } diff --git a/src/main/java/com/yipin/liuwanr/mapper/ScoreIndexMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ScoreIndexMapper.java index e61e8db..0b63d22 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ScoreIndexMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ScoreIndexMapper.java @@ -46,7 +46,7 @@ public interface ScoreIndexMapper { * 根据判分点id和项目id查询具体分数 * @return */ - @Select("select score from hr_score_index where isdel=0 and judgmentPointsId=#{judgmentPointsId} and projectId=#{projectId} and userId=#{userId}") + @Select("select score from hr_score_index where isdel=0 and judgmentPointsId=#{judgmentPointsId} and projectId=#{projectId} and userId=#{userId} ORDER BY score DESC LIMIT 1") Integer getbyJudgmentPointsIdScore(@Param("judgmentPointsId")Integer judgmentPointsId,@Param("projectId") Integer projectId,@Param("userId") Integer userId); /** @@ -57,7 +57,8 @@ public interface ScoreIndexMapper { */ @Select({""}) List queryScore(@Param("ids")List judgmentPointsId,@Param("projectId")Integer projectId,@Param("userId") Integer userId); } diff --git a/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java b/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java index 250420f..e346854 100644 --- a/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java +++ b/src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java @@ -77,23 +77,18 @@ public class ProjectManagementService { public HashMap queryManagements(ProjectManagement vo, Integer pageNo, Integer pageSize) { HashMap resp = new HashMap(); try { - //获取用户的角色信息 - Integer roleId = mapper.queryRoleId(vo.getUserId()); - if (null != roleId) { - //角色不对(学生没有权限) - if (roleId == 4) { - resp.put("retcode", 300); - resp.put("retvalue", "抱歉,您的权限不能访问该地址!"); - return resp; - } - //角色等于管理员或者超级管理员 - else if (roleId == 1 ) { - vo.setUserId(null); - } - } PageHelper.startPage(pageNo, pageSize); //条件查询 - List list = mapper.queryManagementsExportTest(vo); + List list = mapper.queryManagementsExport(vo); +// //获取用户的角色信息 +// String roleId = mapper.queryRoleIds(vo.getUserId()); +// if (null != roleId) { +// if (roleId.contains("3")) { +// vo.setUserId(null); +// List projectManagements = mapper.queryManagementsExport(vo); +// list.addAll(projectManagements); +// } +// } PageInfo info = new PageInfo(list); resp.put("retvalue", new PageResult(info.getTotal(), list)); resp.put("retcode", 200); @@ -115,21 +110,25 @@ public class ProjectManagementService { HashMap resp = new HashMap(); try { //获取用户的角色信息 - Integer roleId = mapper.queryRoleId(vo.getUserId()); - if (null != roleId) { - //角色不对(学生没有权限) - if (roleId == 4) { - resp.put("retcode", 300); - resp.put("retvalue", "抱歉,您的权限不能访问该地址!"); - return resp; - } - //角色等于管理员或者超级管理员 - else if (roleId == 1 ) { - vo.setUserId(null); - } - } +// String roleId = mapper.queryRoleIds(vo.getUserId()); +// if (null != roleId) { +// //角色不对(学生没有权限) +// if (roleId.contains("4")) { +// resp.put("retcode", 300); +// resp.put("retvalue", "抱歉,您的权限不能访问该地址!"); +// return resp; +// } +// //角色等于管理员或者超级管理员 +// else if (roleId.contains("1")) { +// vo.setUserId(null); +// } +// } //条件查询 List list = mapper.queryManagements(vo); +// if (vo.getFounder()==null||vo.getFounder()==3){ +// List list2 = mapper.queryUserManagements(vo); +// list.addAll(list2); +// } resp.put("retvalue",list); resp.put("retcode", 200); } catch (Exception e) { @@ -469,6 +468,14 @@ public class ProjectManagementService { public HashMap insertProjectManagement(ProjectManagement pro, List points, List roles) { HashMap resp = new HashMap(); try { + //只允许一个Founder +// if (pro.getFounder()==1){//超管 +// pro.setFounder(1); +// }else if (pro.getFounder()==2){//管理员 +// pro.setFounder(2); +// }else if (pro.getFounder()==3){//老师 +// pro.setFounder(3); +// } // 添加项目信息 mapper.insertProjectManagement(pro); // 取出添加的项目信息的id @@ -536,7 +543,7 @@ public class ProjectManagementService { try{ Integer count = mapper.getByprojectName(projectName); if(count>=1){ - resp.put("retcode", 300); + resp.put("retcode", 201); resp.put("retvalue", "该项目名称已存在"); }else{ resp.put("retcode", 200);