diff --git a/pom.xml b/pom.xml index 31dcb85..cf6ff2f 100644 --- a/pom.xml +++ b/pom.xml @@ -30,11 +30,11 @@ spring-boot-starter-tomcat provided - - org.mybatis.spring.boot - mybatis-spring-boot-starter - 2.1.2 - + + + + + org.springframework.boot spring-boot-starter-log4j @@ -95,6 +95,11 @@ junit test + + com.baomidou + mybatis-plus + 3.4.1 + diff --git a/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java b/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java index 0114511..7531ec8 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java @@ -53,7 +53,7 @@ public class ProjectManagementController { /** * 首页面查询 - *

+ *

updateProjectManagement * * @param projectPermissions:权限 * @param founder:创建人 diff --git a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java index 0e35535..9c10c61 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java @@ -26,7 +26,7 @@ public interface ProjectManagementMapper { * @param projectName * @return */ - @Select("select count(*) from hr_project_management where projectName=#{projectName}") + @Select("select count(*) from hr_project_management where projectName=#{projectName} and isdel = 0") Integer getByprojectName(String projectName); /** @@ -103,7 +103,7 @@ public interface ProjectManagementMapper { * @param projectId * @return */ - @Select("select projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0 and projectId=#{projectId}") + @Select("select knowledgePointsIsEnable,experimentIntroductionIsEnable,isstartexperimentSuggests,projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0 and projectId=#{projectId}") ProjectManagement getProjectId(Integer projectId); /** @@ -164,10 +164,14 @@ public interface ProjectManagementMapper { * @param ids * @param projectId */ - @Update("") +// @Update("") + @Update({""}) void updateRoleProjectId(@Param("ids") List ids, @Param("projectId") Integer projectId); @@ -277,8 +281,8 @@ public interface ProjectManagementMapper { * * @param management */ - @Insert("INSERT INTO hr_project_management(projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction,knowledgePointsIsEnable,experimentIntroductionIsEnable)" - + " VALUES (#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},#{founder},#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},#{knowledgePoints},#{experimentIntroduction},#{knowledgePointsIsEnable},#{experimentIntroductionIsEnable})") + @Insert("INSERT INTO hr_project_management(roleId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction,knowledgePointsIsEnable,experimentIntroductionIsEnable)" + + " VALUES (#{founder},#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},#{founder},#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},#{knowledgePoints},#{experimentIntroduction},#{knowledgePointsIsEnable},#{experimentIntroductionIsEnable})") @Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId") void insertProjectManagement(ProjectManagement management); diff --git a/src/test/java/com/yipin/liuwanr/Project_ManagementTest.java b/src/test/java/com/yipin/liuwanr/Project_ManagementTest.java index 1c61b82..6d09f88 100644 --- a/src/test/java/com/yipin/liuwanr/Project_ManagementTest.java +++ b/src/test/java/com/yipin/liuwanr/Project_ManagementTest.java @@ -223,40 +223,40 @@ public class Project_ManagementTest { map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); } - /** - * 添加项目管理信息 - */ - @Transactional //在单元测试中 Transaction注解会对数据库的更新(insert update delete)进行回滚 ,以保证数据不污染 - @Test - public void testInsertProjectManagement() { - /*ProjectManagement pro = new ProjectManagement(); - pro.setProjectName("简单加法计算"); - pro.setProjectPermissions(1); - pro.setExperimentalGoal("本项目将会帮助学生了解简单的加法计算"); - pro.setCaseDescription("声明两个变量,让其相加,得到其和"); - pro.setIsstartexperimental(0); - pro.setExperimentSuggests("使用加号,将声明的变量相加"); - pro.setIsstartexperimentSuggests(0); - pro.setState(1); - pro.setSystemId(6); - pro.setUserId(4); - pro.setFounder(0); - List points = new ArrayList<>(); - Judgment_Points judgmentPoints = new Judgment_Points(); - judgmentPoints.setJudgmentPointsId(205); - judgmentPoints.setExperimentalRequirements("按要求写出代码并正确运行显示小明考核结果"); - judgmentPoints.setScore(100); - points.add(judgmentPoints); - List roles = new ArrayList<>(); - roles.add(433);*/ - ProjectManagement pro = projectManagementMapper.getProjectId(302); - pro.setProjectId(null); - pro.setFounder(0); - List points = projectManagementMapper.queryProjectIds(302); - List roles = projectManagementMapper.getByRoleProjectId(302); - HashMap map = managementService.insertProjectManagement(pro, points, roles); - map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); - } +// /** +// * 添加项目管理信息 +// */ +// @Transactional //在单元测试中 Transaction注解会对数据库的更新(insert update delete)进行回滚 ,以保证数据不污染 +// @Test +// public void testInsertProjectManagement() { +// /*ProjectManagement pro = new ProjectManagement(); +// pro.setProjectName("简单加法计算"); +// pro.setProjectPermissions(1); +// pro.setExperimentalGoal("本项目将会帮助学生了解简单的加法计算"); +// pro.setCaseDescription("声明两个变量,让其相加,得到其和"); +// pro.setIsstartexperimental(0); +// pro.setExperimentSuggests("使用加号,将声明的变量相加"); +// pro.setIsstartexperimentSuggests(0); +// pro.setState(1); +// pro.setSystemId(6); +// pro.setUserId(4); +// pro.setFounder(0); +// List points = new ArrayList<>(); +// Judgment_Points judgmentPoints = new Judgment_Points(); +// judgmentPoints.setJudgmentPointsId(205); +// judgmentPoints.setExperimentalRequirements("按要求写出代码并正确运行显示小明考核结果"); +// judgmentPoints.setScore(100); +// points.add(judgmentPoints); +// List roles = new ArrayList<>(); +// roles.add(433);*/ +// ProjectManagement pro = projectManagementMapper.getProjectId(302); +// pro.setProjectId(null); +// pro.setFounder(0); +// List points = projectManagementMapper.queryProjectIds(302); +// List roles = projectManagementMapper.getByRoleProjectId(302); +// HashMap map = managementService.insertProjectManagement(pro, points, roles); +// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); +// } /**