From a61dd5d73aa782703be02990be78a160f3f271b9 Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Wed, 5 Aug 2020 14:32:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=E6=90=AD?= =?UTF-8?q?=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 10 + .../liuwanr/ProjectMaagementApplication.java | 2 + .../yipin/liuwanr/Project_ManagementTest.java | 198 ++++++++++++++++++ 3 files changed, 210 insertions(+) create mode 100644 src/test/java/com/yipin/liuwanr/Project_ManagementTest.java diff --git a/pom.xml b/pom.xml index c17f6fb..91d05ba 100644 --- a/pom.xml +++ b/pom.xml @@ -85,6 +85,16 @@ spring-boot-test 2.3.1.RELEASE + + junit + junit + test + + + junit + junit + test + diff --git a/src/main/java/com/yipin/liuwanr/ProjectMaagementApplication.java b/src/main/java/com/yipin/liuwanr/ProjectMaagementApplication.java index 654df11..c1113d6 100644 --- a/src/main/java/com/yipin/liuwanr/ProjectMaagementApplication.java +++ b/src/main/java/com/yipin/liuwanr/ProjectMaagementApplication.java @@ -3,7 +3,9 @@ package com.yipin.liuwanr; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import springfox.documentation.swagger2.annotations.EnableSwagger2; +@EnableSwagger2 @SpringBootApplication @MapperScan(basePackages = {"com.yipin.liuwanr.mapper"}) public class ProjectMaagementApplication { diff --git a/src/test/java/com/yipin/liuwanr/Project_ManagementTest.java b/src/test/java/com/yipin/liuwanr/Project_ManagementTest.java new file mode 100644 index 0000000..aa7d009 --- /dev/null +++ b/src/test/java/com/yipin/liuwanr/Project_ManagementTest.java @@ -0,0 +1,198 @@ +package com.yipin.liuwanr; + +import com.yipin.liuwanr.entity.*; +import com.yipin.liuwanr.service.Project_ManagementService; +import io.swagger.annotations.ApiParam; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +@SpringBootTest +public class Project_ManagementTest { + + @Autowired + private Project_ManagementService managementService; + + /** + * 查询用户角色信息 + */ + @Test + public void testQueryRole() { + int userid = 455; + + HashMap map = managementService.queryRole(userid); + + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + /** + * 分页查询+条件查询 + */ + @Test + public void testQueryAllManagements() { + + Integer projectPermissions = null; + Integer founder = null; + Integer state = null; + String projectName = null; + Integer systemId = 1; + Integer userId = 4; + + Project_Management vo = new Project_Management(); + if (null != projectPermissions) { + vo.setProjectPermissions(projectPermissions); + } + if (null != founder) { + vo.setFounder(founder); + } + if (null != state) { + vo.setState(state); + } + if (null != systemId) { + vo.setSystemId(systemId); + } + if (null != projectName && projectName != "") { + vo.setProjectName(projectName); + } + if (null != userId) { + vo.setUserId(userId); + } + + Integer pageNo = 1; + Integer pageSize = 10; + + HashMap map = managementService.queryAllManagements(vo, pageNo, pageSize); + map.forEach((key, value) -> { + + System.out.println("key = " + key + " ===> value = " + value); + }); + } + + + /** + * 批量删除 + */ + @Transactional + @Test + public void testDeleteProjectManagement() { + List point = new ArrayList<>(); + point.add(1); + HashMap map = managementService.deleteProjectManagement(point); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + /** + * 根据项目管理id查询对应信息 + */ + @Test + public void testGetProjectId() { + Integer projectId = null; + HashMap map = managementService.getProjectId(projectId); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + /** + * 添加判分点页面的判分点信息展示 + */ + @Test + public void testQueryAllJudgmentPoints() { + Judgment_Points points = null; + HashMap map = managementService.queryAllJudgmentPoints(points); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + + /** + * 创建项目管理页面的判分点信息展示 + */ + @Test + public void testGetByjudgmentPointsId() { + List judgmentPointsId = null; + Integer projectId = null; + Integer userId = null; + HashMap map = managementService.getByjudgmentPointsId(judgmentPointsId, projectId, userId); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + /** + * 平均分配分值 + */ + @Test + public void testAvgValues() { + Integer number = null; + HashMap map = managementService.avgValues(number); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + /** + * 添加完角色信息 角色信息展示 + */ + @Test + public void testGetByRoleId() { + List roleId = null; + HashMap map = managementService.getByRoleId(roleId); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + /** + * 修改角色信息 + */ + @Test + public void testUpdateRole() { + Role role = null; + HashMap map = managementService.updateRole(role); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + /** + * 添加角色信息 + */ + @Test + public void testInsertRole() { + Role role = null; + HashMap map = managementService.insertRole(role); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + /** + * 添加项目管理信息 + */ + @Transactional + @Test + public void testInsertProjectManagement() { + Project_Management pro = null; + List points = null; + List roles = null; + HashMap map = managementService.insertProjectManagement(pro, points, roles); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + + @Test + public void testGetByName() { + String projectName = null; + HashMap map = managementService.getByName(projectName); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } + + /** + * 修改项目管理信息 + */ + + @Transactional + @Test + public void testUpdateProjectManagement() { + Project_Management pro = null; + List points = null; + List roles = null; + HashMap map = managementService.updateProjectManagement(pro, points, roles); + map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); + } +}