parent
a3141cca39
commit
5585f78693
8 changed files with 594 additions and 181 deletions
@ -0,0 +1,91 @@ |
||||
package com.yipin.liuwanr.service; |
||||
|
||||
import com.yipin.liuwanr.entity.OrganizationRelationship; |
||||
import com.yipin.liuwanr.entity.UserInfo; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
import org.springframework.test.context.junit4.SpringRunner; |
||||
|
||||
import java.util.HashMap; |
||||
|
||||
@SpringBootTest |
||||
@RunWith(SpringRunner.class) |
||||
public class StudentServiceTest { |
||||
|
||||
@Autowired |
||||
private UserInfoService userInfoService; |
||||
|
||||
/** |
||||
* 新增学生 |
||||
*/ |
||||
@Test |
||||
public void addStudent(){ |
||||
UserInfo userInfo = new UserInfo(); |
||||
OrganizationRelationship ship = new OrganizationRelationship(); |
||||
userInfo.setAccount(""); |
||||
userInfo.setUniqueIdentificationAccount("huoran999"); |
||||
userInfo.setSchoolId(1); |
||||
userInfo.setUserName("michonne"); |
||||
userInfo.setRoleId(4); |
||||
userInfo.setPassword("123456"); |
||||
ship.setProfessionalId(1); |
||||
ship.setGradeId(1); |
||||
ship.setClassId(1); |
||||
ship.setWorkNumber("888"); |
||||
HashMap<String, Object> map = userInfoService.addUserInfo(userInfo); |
||||
userInfoService.addOrganizationRelationship(ship); |
||||
for (String s : map.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + map.get(s)); |
||||
} |
||||
HashMap<String, Object> map1 = userInfoService.addOrganizationRelationship(ship); |
||||
for (String ss : map1.keySet()) { |
||||
System.out.println("key:" + ss + "," + "value:" + map.get(ss)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 查询学生信息 |
||||
*/ |
||||
@Test |
||||
public void queryStudent(){ |
||||
UserInfo userInfo = new UserInfo(); |
||||
OrganizationRelationship organizationRelationship = new OrganizationRelationship(); |
||||
userInfo.setSchoolId(1); |
||||
userInfo.setSearchContent("1"); |
||||
Integer[] a = {1,2}; |
||||
Integer[] b = {1,2}; |
||||
Integer[] c = {1,2}; |
||||
|
||||
for (Integer aa: a){ |
||||
organizationRelationship.setProfessionalId(aa); |
||||
} |
||||
for (Integer bb:b){ |
||||
organizationRelationship.setGradeId(bb); |
||||
} |
||||
for (Integer cc:c){ |
||||
organizationRelationship.setClassId(cc); |
||||
} |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 3; |
||||
HashMap<String, Object> map = userInfoService.queryStudent(userInfo, organizationRelationship, pageNo, pageSize); |
||||
for (String s : map.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + map.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 测试删除学生信息 |
||||
*/ |
||||
@Test |
||||
public void deleteStudent(){ |
||||
Integer[] userInfo = new Integer[]{13,14,15}; |
||||
|
||||
HashMap<String, Object> map = userInfoService.deleteStudent(userInfo); |
||||
for (String s : map.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + map.get(s)); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue