From b62d61d4689752747d1278f12f86a318bbcd2a98 Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Tue, 28 Jul 2020 18:00:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E5=90=8D=E5=AD=97=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/Project_ManagementMapper.java | 454 +++++++++--------- .../service/Project_ManagementService.java | 15 +- 2 files changed, 247 insertions(+), 222 deletions(-) diff --git a/src/main/java/com/yipin/liuwanr/mapper/Project_ManagementMapper.java b/src/main/java/com/yipin/liuwanr/mapper/Project_ManagementMapper.java index 211047a..e122807 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/Project_ManagementMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/Project_ManagementMapper.java @@ -15,226 +15,246 @@ import com.yipin.liuwanr.entity.Role; /** * 项目管理系统 项目管理表 - * - * @author 86151 * + * @author 86151 */ public interface Project_ManagementMapper { - /** - * 查询项目名称 - * @param projectName - * @return - */ - @Select("select count(*) from hr_project_management where projectName=#{projectName}") - Integer getByprojectName(String projectName); - - /** - * 分页查询+条件查询 - * - * @param management - * @return - */ - @Select({ "" }) - List queryManagements(Project_Management management); - - - /** - * 根据实验项目id查询信息 - * - * @param projectId - * @return - */ - @Select("select projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId from hr_project_management where isdel=0 and projectId=#{projectId}") - Project_Management getProjectId(Integer projectId); - - - /** - * 批量删除 - * @param projectId - */ - @Update("") - void deleteProjectManagement(@Param("point") List projectId); - - - /** - * 添加角色信息 - * - * @param role - * @return - */ - @Insert("insert into hr_role (roleNumber,roleType,roleAttribute) VALUES (#{roleNumber},#{roleType},#{roleAttribute})") - @Options(useGeneratedKeys = true, keyProperty = "roleId", keyColumn = "roleId") - void insertRole(Role role); - - /** - * 点击实验数据中单个角色后的编辑按钮,修改角色信息 - * - * @param role - */ - @Update("update hr_role set roleNumber=#{roleNumber},roleType=#{roleType},roleAttribute=#{roleAttribute} where roleId=#{roleId}") - void updateRole(Role role); - - - /** - * 点击编辑或者创建项目管理页面的保存按钮后, - * 修改角色表中的对应数据的项目id - * @param ids - * @param projectId - */ - @Update("") - void updateRoleProjectId(@Param("ids")List ids,@Param("projectId")Integer projectId); - - - @Delete("delete from hr_role where projectId=#{projectId}") - void deleteRole(Integer projectId); - - /** - * 添加角色信息后,在创建编辑页面的角色信息展示 - * - * @param role - * @return - */ - @Select({ "" }) - List getByRoleId(@Param("role") List role); - - - /** - * 点击具体某个项目信息的编辑按钮, - * 跳转到编辑项目管理页面的实验数据的信息展示 - * @param projectId - * @return - */ - @Select("select roleId,roleNumber,roleType,roleAttribute from hr_role where projectId=#{projectId}") - List queryProjectId(Integer projectId); - - - /** - * 添加判分点面板的判分信息展示 - * @return - */ - @Select({ "" }) - List queryAllJudgmentPoints(Judgment_Points points); - - - /** - * 从判分点添加面板,选择完数据后, - * 创建项目管理页面的实验任务信息展示 - * @param point - * @return - */ - @Select({ "" }) - List getByjudgmentPointsIds(@Param("point") List point); - - /** - * 点击具体某个项目信息的编辑按钮, - * 跳转到编辑项目管理页面的实验任务的信息展示 - * @param projectId - * @return - */ - @Select("select judgmentPointsId,judgmentPointsName,experimentalRequirements from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") - List getByProjectId(Integer projectId); - - - @Select("select judgmentPointsId,projectId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") - List queryProjectIds(Integer projectId); - - /** - * 取出判分点中的项目管理的id - * @param judgmentPointsId - * @return - */ - @Select("select projectId,experimentalRequirements from hr_judgment_points where judgmentPointsId=#{judgmentPointsId}") - Judgment_Points getByjudgmentPointsId(Integer judgmentPointsId); - - /** - * 点击保存按按,需要修改判分点表中对应的项目id,实验要求 - * @param projectId - * @param judgmentPointsId - */ - @Update({""}) - void updateProject(String projectId,String experimentalRequirements,Integer judgmentPointsId); - - - /** - * 添加项目管理信息 - * - * @param management - */ - @Insert("INSERT INTO hr_project_management(projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId,isExperiment,isAttendance,isdel)" - + " VALUES (#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},1,#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},0,0,0)") - @Options(useGeneratedKeys = true,keyProperty = "projectId",keyColumn = "projectId") - void insertProjectManagement(Project_Management management); - - /** - * 修改项目管理信息 - * - * @param management - */ - @Update("update hr_project_management set projectName=#{projectName},projectPermissions=#{projectPermissions},experimentalGoal=#{experimentalGoal},caseDescription=#{caseDescription},experimentSuggests=#{experimentSuggests},state=#{state}," - + "isstartexperimental=#{isstartexperimental},isstartexperimentSuggests=#{isstartexperimentSuggests} where projectId=#{projectId}") - void updateProjectManagement(Project_Management management); - - /** - * 根据项目id,查询出该项目所有的判分点id - * @param projectId - * @return - */ - @Select("select judgmentPointsId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") - List getByPointProjectId(Integer projectId); - - /** - * 根据项目id,查询出该项目所有的角色id - * @param projectId - * @return - */ - @Select("select roleId from hr_role where projectId=#{projectId}") - List getByRoleProjectId(Integer projectId); - - - /** - * 查询用户角色 - * @param userId - * @return - */ - @Select("SELECT ro.roleId FROM user us,role ro WHERE ro.roleId=us.accountRole AND us.userId=#{userId}") + /** + * 查询项目名称 + * + * @param projectName + * @return + */ + @Select("select count(*) from hr_project_management where projectName=#{projectName}") + Integer getByprojectName(String projectName); + + /** + * 分页查询+条件查询 + * + * @param management + * @return + */ + @Select({""}) + List queryManagements(Project_Management management); + + + /** + * 根据实验项目id查询信息 + * + * @param projectId + * @return + */ + @Select("select projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId from hr_project_management where isdel=0 and projectId=#{projectId}") + Project_Management getProjectId(Integer projectId); + + /** + * 根据实验项目id查询项目名称 + * + * @param projectId + * @return + */ + @Select("select projectName from hr_project_management where isdel=0 and projectId=#{projectId}") + String getNameByProjectId(Integer projectId); + + /** + * 批量删除 + * + * @param projectId + */ + @Update("") + void deleteProjectManagement(@Param("point") List projectId); + + + /** + * 添加角色信息 + * + * @param role + * @return + */ + @Insert("insert into hr_role (roleNumber,roleType,roleAttribute) VALUES (#{roleNumber},#{roleType},#{roleAttribute})") + @Options(useGeneratedKeys = true, keyProperty = "roleId", keyColumn = "roleId") + void insertRole(Role role); + + /** + * 点击实验数据中单个角色后的编辑按钮,修改角色信息 + * + * @param role + */ + @Update("update hr_role set roleNumber=#{roleNumber},roleType=#{roleType},roleAttribute=#{roleAttribute} where roleId=#{roleId}") + void updateRole(Role role); + + + /** + * 点击编辑或者创建项目管理页面的保存按钮后, + * 修改角色表中的对应数据的项目id + * + * @param ids + * @param projectId + */ + @Update("") + void updateRoleProjectId(@Param("ids") List ids, @Param("projectId") Integer projectId); + + + @Delete("delete from hr_role where projectId=#{projectId}") + void deleteRole(Integer projectId); + + /** + * 添加角色信息后,在创建编辑页面的角色信息展示 + * + * @param role + * @return + */ + @Select({""}) + List getByRoleId(@Param("role") List role); + + + /** + * 点击具体某个项目信息的编辑按钮, + * 跳转到编辑项目管理页面的实验数据的信息展示 + * + * @param projectId + * @return + */ + @Select("select roleId,roleNumber,roleType,roleAttribute from hr_role where projectId=#{projectId}") + List queryProjectId(Integer projectId); + + + /** + * 添加判分点面板的判分信息展示 + * + * @return + */ + @Select({""}) + List queryAllJudgmentPoints(Judgment_Points points); + + + /** + * 从判分点添加面板,选择完数据后, + * 创建项目管理页面的实验任务信息展示 + * + * @param point + * @return + */ + @Select({""}) + List getByjudgmentPointsIds(@Param("point") List point); + + /** + * 点击具体某个项目信息的编辑按钮, + * 跳转到编辑项目管理页面的实验任务的信息展示 + * + * @param projectId + * @return + */ + @Select("select judgmentPointsId,judgmentPointsName,experimentalRequirements from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") + List getByProjectId(Integer projectId); + + + @Select("select judgmentPointsId,projectId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") + List queryProjectIds(Integer projectId); + + /** + * 取出判分点中的项目管理的id + * + * @param judgmentPointsId + * @return + */ + @Select("select projectId,experimentalRequirements from hr_judgment_points where judgmentPointsId=#{judgmentPointsId}") + Judgment_Points getByjudgmentPointsId(Integer judgmentPointsId); + + /** + * 点击保存按按,需要修改判分点表中对应的项目id,实验要求 + * + * @param projectId + * @param judgmentPointsId + */ + @Update({""}) + void updateProject(String projectId, String experimentalRequirements, Integer judgmentPointsId); + + + /** + * 添加项目管理信息 + * + * @param management + */ + @Insert("INSERT INTO hr_project_management(projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId,isExperiment,isAttendance,isdel)" + + " VALUES (#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},#{founder},#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},0,0,0)") + @Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId") + void insertProjectManagement(Project_Management management); + + /** + * 修改项目管理信息 + * + * @param management + */ + @Update("update hr_project_management set projectName=#{projectName},projectPermissions=#{projectPermissions},experimentalGoal=#{experimentalGoal},caseDescription=#{caseDescription},experimentSuggests=#{experimentSuggests},state=#{state}," + + "isstartexperimental=#{isstartexperimental},isstartexperimentSuggests=#{isstartexperimentSuggests} where projectId=#{projectId}") + void updateProjectManagement(Project_Management management); + + /** + * 根据项目id,查询出该项目所有的判分点id + * + * @param projectId + * @return + */ + @Select("select judgmentPointsId from hr_judgment_points where isdel=0 and FIND_IN_SET(#{projectId},projectId)>0") + List getByPointProjectId(Integer projectId); + + /** + * 根据项目id,查询出该项目所有的角色id + * + * @param projectId + * @return + */ + @Select("select roleId from hr_role where projectId=#{projectId}") + List getByRoleProjectId(Integer projectId); + + + /** + * 查询用户角色 + * + * @param userId + * @return + */ + @Select("SELECT ro.roleId FROM user us,role ro WHERE ro.roleId=us.accountRole AND us.userId=#{userId}") Integer queryRole(Integer userId); - - - /** - * 查询用户角色 - * @param userId - * @return - */ - @Select("SELECT accountRole FROM user WHERE userId=#{userId}") - Integer queryRoleId(Integer userId); - - + + + /** + * 查询用户角色 + * + * @param userId + * @return + */ + @Select("SELECT accountRole FROM user WHERE userId=#{userId}") + Integer queryRoleId(Integer userId); + + } diff --git a/src/main/java/com/yipin/liuwanr/service/Project_ManagementService.java b/src/main/java/com/yipin/liuwanr/service/Project_ManagementService.java index e616231..a9e52fc 100644 --- a/src/main/java/com/yipin/liuwanr/service/Project_ManagementService.java +++ b/src/main/java/com/yipin/liuwanr/service/Project_ManagementService.java @@ -408,7 +408,7 @@ public class Project_ManagementService { String projectName = pro.getProjectName(); Integer count = mapper.getByprojectName(projectName); if (count != null) { - projectName += (count + 1); + projectName += (count + 1); pro.setProjectName(projectName); } // 添加项目信息 @@ -592,11 +592,16 @@ public class Project_ManagementService { } //项目名称去重 String projectName = pro.getProjectName(); - Integer count = mapper.getByprojectName(projectName); - if (count != null) { - projectName += (count + 1); - pro.setProjectName(projectName); + + String name = mapper.getNameByProjectId(pro.getProjectId()); + if (projectName != null && !projectName.equals(name)) { + Integer count = mapper.getByprojectName(projectName); + if (count != null && count > 1) { + projectName += (count + 1); + pro.setProjectName(projectName); + } } + //修改项目信息 mapper.updateProjectManagement(pro); resp.put("retcode", 200);