|
|
@ -1,14 +1,13 @@ |
|
|
|
package com.yipin.liuwanr; |
|
|
|
package com.yipin.liuwanr; |
|
|
|
|
|
|
|
|
|
|
|
import com.yipin.liuwanr.entity.*; |
|
|
|
import com.yipin.liuwanr.entity.*; |
|
|
|
|
|
|
|
import com.yipin.liuwanr.mapper.Project_ManagementMapper; |
|
|
|
import com.yipin.liuwanr.service.Project_ManagementService; |
|
|
|
import com.yipin.liuwanr.service.Project_ManagementService; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.boot.test.context.SpringBootTest; |
|
|
|
import org.springframework.boot.test.context.SpringBootTest; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
@ -20,16 +19,21 @@ public class Project_ManagementTest { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private Project_ManagementService managementService; |
|
|
|
private Project_ManagementService managementService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private Project_ManagementMapper projectManagementMapper; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询用户角色信息 |
|
|
|
* 查询用户角色信息 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testQueryRole() { |
|
|
|
public void testQueryRole() { |
|
|
|
int userid = 455; |
|
|
|
Integer userid = 455; |
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> map = managementService.queryRole(userid); |
|
|
|
HashMap<String, Object> map = managementService.queryRole(userid); |
|
|
|
|
|
|
|
|
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
map.forEach((key, value) -> { |
|
|
|
|
|
|
|
System.out.println("key = " + key + " ===> value = " + value.toString()); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -69,10 +73,28 @@ public class Project_ManagementTest { |
|
|
|
Integer pageSize = 10; |
|
|
|
Integer pageSize = 10; |
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> map = managementService.queryAllManagements(vo, pageNo, pageSize); |
|
|
|
HashMap<String, Object> map = managementService.queryAllManagements(vo, pageNo, pageSize); |
|
|
|
map.forEach((key, value) -> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("key = " + key + " ===> value = " + value); |
|
|
|
Integer retcode = (Integer) map.get("retcode"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println(retcode); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (retcode == 200) { |
|
|
|
|
|
|
|
PageResult pageResult = (PageResult) map.get("retvalue"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long total = pageResult.getTotal(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("total = " + total); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Project_Management> rows = (List<Project_Management>) pageResult.getRows(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rows.forEach(item -> { |
|
|
|
|
|
|
|
System.out.println(item.toString()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String msg = (String) map.get("retvalue"); |
|
|
|
|
|
|
|
System.out.println(msg); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -85,7 +107,7 @@ public class Project_ManagementTest { |
|
|
|
List<Integer> point = new ArrayList<>(); |
|
|
|
List<Integer> point = new ArrayList<>(); |
|
|
|
point.add(1); |
|
|
|
point.add(1); |
|
|
|
HashMap<String, Object> map = managementService.deleteProjectManagement(point); |
|
|
|
HashMap<String, Object> map = managementService.deleteProjectManagement(point); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -93,9 +115,9 @@ public class Project_ManagementTest { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testGetProjectId() { |
|
|
|
public void testGetProjectId() { |
|
|
|
Integer projectId = null; |
|
|
|
Integer projectId = 299; |
|
|
|
HashMap<String, Object> map = managementService.getProjectId(projectId); |
|
|
|
HashMap<String, Object> map = managementService.getProjectId(projectId); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -103,9 +125,21 @@ public class Project_ManagementTest { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testQueryAllJudgmentPoints() { |
|
|
|
public void testQueryAllJudgmentPoints() { |
|
|
|
Judgment_Points points = null; |
|
|
|
Judgment_Points points = new Judgment_Points(); |
|
|
|
|
|
|
|
points.setSystemId(1); |
|
|
|
|
|
|
|
points.setJudgmentPointsName(""); |
|
|
|
HashMap<String, Object> map = managementService.queryAllJudgmentPoints(points); |
|
|
|
HashMap<String, Object> map = managementService.queryAllJudgmentPoints(points); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
Integer retcode = (Integer) map.get("retcode"); |
|
|
|
|
|
|
|
System.out.println(retcode); |
|
|
|
|
|
|
|
if (retcode == 200) { |
|
|
|
|
|
|
|
List<Judgment_Points> list = (List<Judgment_Points>) map.get("retvalue"); |
|
|
|
|
|
|
|
list.forEach(item -> { |
|
|
|
|
|
|
|
System.out.println(item.toString()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String msg = (String) map.get("retvalue"); |
|
|
|
|
|
|
|
System.out.println(msg); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -114,11 +148,22 @@ public class Project_ManagementTest { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testGetByjudgmentPointsId() { |
|
|
|
public void testGetByjudgmentPointsId() { |
|
|
|
List<Integer> judgmentPointsId = null; |
|
|
|
List<Integer> judgmentPointsId = new ArrayList<>(); |
|
|
|
Integer projectId = null; |
|
|
|
judgmentPointsId.add(187); |
|
|
|
Integer userId = null; |
|
|
|
Integer projectId = 1; |
|
|
|
|
|
|
|
Integer userId = 4; |
|
|
|
HashMap<String, Object> map = managementService.getByjudgmentPointsId(judgmentPointsId, projectId, userId); |
|
|
|
HashMap<String, Object> map = managementService.getByjudgmentPointsId(judgmentPointsId, projectId, userId); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
Integer retcode = (Integer) map.get("retcode"); |
|
|
|
|
|
|
|
System.out.println(retcode); |
|
|
|
|
|
|
|
if (retcode == 200) { |
|
|
|
|
|
|
|
List<Judgment_Points> list = (List<Judgment_Points>) map.get("retvalue"); |
|
|
|
|
|
|
|
list.forEach(item -> { |
|
|
|
|
|
|
|
System.out.println(item.toString()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String msg = (String) map.get("retvalue"); |
|
|
|
|
|
|
|
System.out.println(msg); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -126,7 +171,7 @@ public class Project_ManagementTest { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testAvgValues() { |
|
|
|
public void testAvgValues() { |
|
|
|
Integer number = null; |
|
|
|
Integer number = 66; |
|
|
|
HashMap<String, Object> map = managementService.avgValues(number); |
|
|
|
HashMap<String, Object> map = managementService.avgValues(number); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
} |
|
|
|
} |
|
|
@ -136,9 +181,10 @@ public class Project_ManagementTest { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testGetByRoleId() { |
|
|
|
public void testGetByRoleId() { |
|
|
|
List<Integer> roleId = null; |
|
|
|
List<Integer> roleId = new ArrayList<>(); |
|
|
|
|
|
|
|
roleId.add(235); |
|
|
|
HashMap<String, Object> map = managementService.getByRoleId(roleId); |
|
|
|
HashMap<String, Object> map = managementService.getByRoleId(roleId); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -146,9 +192,17 @@ public class Project_ManagementTest { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testUpdateRole() { |
|
|
|
public void testUpdateRole() { |
|
|
|
Role role = null; |
|
|
|
|
|
|
|
|
|
|
|
List<Integer> list = new ArrayList<>(); |
|
|
|
|
|
|
|
list.add(235); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Role> roleList = projectManagementMapper.getByRoleId(list); |
|
|
|
|
|
|
|
Role role = roleList.get(0); |
|
|
|
|
|
|
|
role.setRoleName("hh"); |
|
|
|
|
|
|
|
//System.out.println(role.toString());//Role{roleId=235, roleName='null', roleNumber=1, roleType=1, roleAttribute=1}
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> map = managementService.updateRole(role); |
|
|
|
HashMap<String, Object> map = managementService.updateRole(role); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -156,9 +210,16 @@ public class Project_ManagementTest { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testInsertRole() { |
|
|
|
public void testInsertRole() { |
|
|
|
Role role = null; |
|
|
|
List<Integer> list = new ArrayList<>(); |
|
|
|
|
|
|
|
list.add(235); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Role> roleList = projectManagementMapper.getByRoleId(list); |
|
|
|
|
|
|
|
Role role = roleList.get(0); |
|
|
|
|
|
|
|
role.setRoleId(null); |
|
|
|
|
|
|
|
role.setRoleName("hh"); |
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> map = managementService.insertRole(role); |
|
|
|
HashMap<String, Object> map = managementService.insertRole(role); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -167,14 +228,34 @@ public class Project_ManagementTest { |
|
|
|
@Transactional |
|
|
|
@Transactional |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testInsertProjectManagement() { |
|
|
|
public void testInsertProjectManagement() { |
|
|
|
Project_Management pro = null; |
|
|
|
Project_Management pro = new Project_Management(); |
|
|
|
List<Judgment_Points> points = null; |
|
|
|
pro.setProjectName("简单加法计算"); |
|
|
|
List<Integer> roles = null; |
|
|
|
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<Judgment_Points> points = new ArrayList<>(); |
|
|
|
|
|
|
|
Judgment_Points judgmentPoints = new Judgment_Points(); |
|
|
|
|
|
|
|
judgmentPoints.setJudgmentPointsId(153); |
|
|
|
|
|
|
|
judgmentPoints.setExperimentalRequirements("声明两个变量,让其相加,得到其和....."); |
|
|
|
|
|
|
|
judgmentPoints.setScore(100); |
|
|
|
|
|
|
|
points.add(judgmentPoints); |
|
|
|
|
|
|
|
List<Integer> roles = new ArrayList<>(); |
|
|
|
|
|
|
|
roles.add(120); |
|
|
|
HashMap<String, Object> map = managementService.insertProjectManagement(pro, points, roles); |
|
|
|
HashMap<String, Object> map = managementService.insertProjectManagement(pro, points, roles); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 根据项目名称查询 |
|
|
|
|
|
|
|
*/ |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testGetByName() { |
|
|
|
public void testGetByName() { |
|
|
|
String projectName = null; |
|
|
|
String projectName = null; |
|
|
|