all test accomplish

master
river 4 years ago
parent 1d4faeda52
commit b435e6390c
  1. 23
      src/main/java/com/yipin/liuwanr/entity/Staff.java
  2. 33
      src/main/java/com/yipin/liuwanr/entity/Student.java
  3. 2
      src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java
  4. 101
      src/test/java/com/yipin/liuwanr/service/SchoolServiceTest.java
  5. 194
      src/test/java/com/yipin/liuwanr/service/StaffServiceTest.java
  6. 258
      src/test/java/com/yipin/liuwanr/service/StuProfessionalArchitectureServiceTest.java

@ -139,4 +139,27 @@ public class Staff {
public void setStaffProfessionalArchitectureId(Integer staffProfessionalArchitectureId) {
this.staffProfessionalArchitectureId = staffProfessionalArchitectureId;
}
@Override
public String toString() {
return "Staff{" +
"staffId=" + staffId +
", staffName='" + staffName + '\'' +
", staffWorkNumber='" + staffWorkNumber + '\'' +
", phone='" + phone + '\'' +
", email='" + email + '\'' +
", logNumber=" + logNumber +
", lastTimeOfLanding='" + lastTimeOfLanding + '\'' +
", staffGradeId=" + staffGradeId +
", staffProfessionalArchitectureId=" + staffProfessionalArchitectureId +
", staffProfessionalArchitectureName='" + staffProfessionalArchitectureName + '\'' +
", nameAndNumber='" + nameAndNumber + '\'' +
", roleId=" + roleId +
", staffGradeName='" + staffGradeName + '\'' +
", uniqueIdentificationAccount='" + uniqueIdentificationAccount + '\'' +
", staffGradeIds='" + staffGradeIds + '\'' +
", staffProfessionalArchitectureIds='" + staffProfessionalArchitectureIds + '\'' +
", schoolId=" + schoolId +
'}';
}
}

@ -219,4 +219,37 @@ public class Student {
public void setIsAssess(Integer isAssess) {
this.isAssess = isAssess;
}
@Override
public String toString() {
return "Student{" +
"studentId=" + studentId +
", studentName='" + studentName + '\'' +
", studentNumber='" + studentNumber + '\'' +
", phone='" + phone + '\'' +
", email='" + email + '\'' +
", roleId=" + roleId +
", schoolId=" + schoolId +
", professionalId=" + professionalId +
", gradeId=" + gradeId +
", classId=" + classId +
", experimentalClassName='" + experimentalClassName + '\'' +
", experimentalClassId='" + experimentalClassId + '\'' +
", isAssess=" + isAssess +
", uniqueIdentificationAccount='" + uniqueIdentificationAccount + '\'' +
", searchContent='" + searchContent + '\'' +
", professionalIds='" + professionalIds + '\'' +
", gradeIds='" + gradeIds + '\'' +
", classIds='" + classIds + '\'' +
", professionalName='" + professionalName + '\'' +
", gradeName='" + gradeName + '\'' +
", studentNameNumber='" + studentNameNumber + '\'' +
", intExperimentalClassId=" + intExperimentalClassId +
", className='" + className + '\'' +
", loginNumber=" + loginNumber +
", lastLoginTime='" + lastLoginTime + '\'' +
", attendance='" + attendance + '\'' +
", stuProfessionalArchitectureName='" + stuProfessionalArchitectureName + '\'' +
'}';
}
}

@ -11,6 +11,8 @@ import com.yipin.liuwanr.entity.Customer;
import com.yipin.liuwanr.entity.Order;
import com.yipin.liuwanr.vo.OrderVo;
import java.util.List;
public interface OrderMapper {
//添加订单

@ -0,0 +1,101 @@
package com.yipin.liuwanr.service;
import com.yipin.liuwanr.entity.School;
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 org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
/**
* @auther River
* @date 2020/8/24 9:14
*/
@SpringBootTest
@RunWith(SpringRunner.class)
public class SchoolServiceTest {
@Autowired
private SchoolService schoolService;
/**
* 添加学校
*/
@Test
@Transactional
public void addSchoolTest(){
School school = new School();
school.setSchoolName("北京大学");
school.setProvinceId(1);
school.setCityId(1);
school.setLevel(1);
HashMap<String, Object> addSchool = schoolService.addSchool(school);
for (String s : addSchool.keySet()) {
System.out.println("key:" + s + "," + "value:" + addSchool.get(s));
}
}
/**
* 查询学校
*/
@Test
@Transactional
public void querySchoolTest(){
School school = new School();
school.setProvinceId(1);
school.setCityId(1);
school.setLevel(1);
HashMap<String, Object> querySchool = schoolService.querySchool(school);
for (String s : querySchool.keySet()) {
System.out.println("key:" + s + "," + "value:" + querySchool.get(s));
}
}
/**
* 查询学校详情
*/
@Test
@Transactional
public void querySchoolDetailsTest(){
Integer schoolId = 1;
HashMap<String, Object> schoolDetails = schoolService.querySchoolDetails(schoolId);
for (String s : schoolDetails.keySet()) {
System.out.println("key:" + s + "," + "value:" + schoolDetails.get(s));
}
}
/**
* 删除学校
*/
@Test
@Transactional
public void deleteSchoolTest(){
School school = new School();
school.setSchoolId(1);
HashMap<String, Object> deleteSchool = schoolService.deleteSchool(school);
for (String s : deleteSchool.keySet()) {
System.out.println("key:" + s + "," + "value:" + deleteSchool.get(s));
}
}
/**
* 更新学校
*/
@Test
@Transactional
public void updateSchoolTest(){
School school = new School();
school.setSchoolId(1);
school.setProvinceId(1);
school.setCityId(1);
school.setLevel(1);
school.setSchoolName("北京大学");
HashMap<String, Object> updateSchool = schoolService.updateSchool(school);
for (String s : updateSchool.keySet()) {
System.out.println("key:" + s + "," + "value:" + updateSchool.get(s));
}
}
}

@ -0,0 +1,194 @@
package com.yipin.liuwanr.service;
import com.yipin.liuwanr.entity.Staff;
import com.yipin.liuwanr.entity.UserM;
import com.yipin.liuwanr.vo.UserVO;
import org.apache.commons.io.IOUtils;
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.lang.Nullable;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.util.HashMap;
/**
* @auther River
* @date 2020/8/24 9:45
*/
@SpringBootTest
@RunWith(SpringRunner.class)
public class StaffServiceTest {
@Autowired
private StaffService staffService;
/**
* 读取员工表
*/
@Test
@Transactional
public void readStaffTest(){
MultipartFile file = new MultipartFile() {
@Override
public String getName() {
return null;
}
@Nullable
@Override
public String getOriginalFilename() {
return null;
}
@Nullable
@Override
public String getContentType() {
return null;
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public long getSize() {
return 0;
}
@Override
public byte[] getBytes() throws IOException {
return new byte[0];
}
@Override
public InputStream getInputStream() throws IOException {
return null;
}
@Override
public void transferTo(File dest) throws IOException, IllegalStateException {
}
};
Integer schoolId = 1;
File file1 = new File("C:\\Users\\Hello\\Desktop\\aaaa.xlsx");
try {
//将file类型文件转换为MultipartFile类型文件
FileInputStream input = new FileInputStream(file1);
file = new MockMultipartFile("file", file1.getName(), "text/plain", IOUtils.toByteArray(input));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
HashMap<String, Object> readStaff = staffService.readStaff(file, schoolId);
for (String s : readStaff.keySet()) {
System.out.println("key:" + s + "," + "value:" + readStaff.get(s));
}
}
/**
* 添加员工
*/
@Test
@Transactional
public void addStaffTest(){
Staff staff = new Staff();
staff.setSchoolId(2043);
staff.setEmail("4867687@qq.com");
staff.setPhone("18873465488");
staff.setRoleId(3);
staff.setStaffGradeId(2050);
staff.setStaffName("zha");
staff.setStaffProfessionalArchitectureId(2057);
staff.setStaffWorkNumber("1222");
staff.setUniqueIdentificationAccount("204312221598238094000");
HashMap<String, Object> addStaff = staffService.addStaff(staff);
for (String s : addStaff.keySet()) {
System.out.println("key:" + s + "," + "value:" + addStaff.get(s));
}
}
/**
* 查询员工
*/
@Test
@Transactional
public void queryStaffTest(){
Staff staff = new Staff();
Integer pageNo = 1;
Integer pageSize = 10;
staff.setSchoolId(2043);
HashMap<String, Object> queryStaff = staffService.queryStaff(staff, pageNo, pageSize);
for (String s : queryStaff.keySet()) {
System.out.println("key:" + s + "," + "value:" + queryStaff.get(s));
}
}
/**
* 删除员工
*/
@Test
@Transactional
public void deleteStaffTest(){
Integer staffId = 118;
String phone = "13137366427";
HashMap<String, Object> deleteStaff = staffService.deleteStaff(staffId, phone);
for (String s : deleteStaff.keySet()) {
System.out.println("key:" + s + "," + "value:" + deleteStaff.get(s));
}
}
/**
* 查询员工详情
*/
@Test
@Transactional
public void queryStaffDetailsTest(){
Integer staffId = 118;
HashMap<String, Object> staffDetails = staffService.queryStaffDetails(staffId);
for (String s : staffDetails.keySet()) {
System.out.println("key:" + s + "," + "value:" + staffDetails.get(s));
}
}
/**
* 更新员工
*/
@Test
@Transactional
public void updateStaffTest(){
UserVO userVO = new UserVO();
Staff staff = new Staff();
UserM user = new UserM();
staff.setEmail("123@qq.com");
staff.setPhone("13137366427");
staff.setRoleId(4);
staff.setSchoolId(2043);
staff.setStaffGradeId(2050);
staff.setStaffId(118);
staff.setStaffName("世杰-教师");
staff.setStaffProfessionalArchitectureId(2057);
staff.setStaffWorkNumber("123");
staff.setUniqueIdentificationAccount("20431231596424406000");
userVO.setStaff(staff);
user.setAccountRole(3);
user.setCityId(1);
user.setDisciplineId(1);
user.setEmail("123@qq.com");
user.setName("世杰-教师");
user.setPhone("13137366427");
user.setProfessionalClassId(1);
user.setProvinceId(4);
user.setProfessionalId(4);
user.setSchoolId(2043);
user.setUniqueIdentificationAccount("20431231596424406000");
user.setUserAccount("123");
user.setUserId(461);
user.setWorkNumber("123");
userVO.setUser(user);
HashMap<String, Object> updateStaff = staffService.updateStaff(userVO);
for (String s : updateStaff.keySet()) {
System.out.println("key:" + s + "," + "value:" + updateStaff.get(s));
}
}
}

@ -0,0 +1,258 @@
package com.yipin.liuwanr.service;
import com.yipin.liuwanr.entity.StuProfessionalArchitecture;
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 org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
/**
* @auther River
* @date 2020/8/25 9:46
*/
@SpringBootTest
@RunWith(SpringRunner.class)
public class StuProfessionalArchitectureServiceTest {
@Autowired
private StuProfessionalArchitectureService stuProfessionalArchitectureService;
/**
* 添加学生专业组织
*/
@Test
@Transactional
public void addStuProfessionalArchitectureTest(){
StuProfessionalArchitecture stuPA = new StuProfessionalArchitecture();
stuPA.setSchoolId(2043);
stuPA.setStuProfessionalArchitectureName("计算机学院");
HashMap<String, Object> stuProfessionalArchitecture = stuProfessionalArchitectureService.addStuProfessionalArchitecture(stuPA);
for (String s : stuProfessionalArchitecture.keySet()) {
System.out.println("key:" + s + "," + "value:" + stuProfessionalArchitecture.get(s));
}
}
/**
* 查询学生专业架构
*/
@Test
@Transactional
public void queryStuProfessionalArchitectureTest(){
Integer schoolId = 1;
HashMap<String, Object> professionalArchitecture = stuProfessionalArchitectureService.queryStuProfessionalArchitecture(schoolId);
for (String s : professionalArchitecture.keySet()) {
System.out.println("key:" + s + "," + "value:" + professionalArchitecture.get(s));
}
}
/**
* 查询学生专业架构详情
*/
@Test
@Transactional
public void queryStuPADTest(){
Integer stuProfessionalArchitectureId = 34;
HashMap<String, Object> stuPAD = stuProfessionalArchitectureService.queryStuPAD(stuProfessionalArchitectureId);
for (String s : stuPAD.keySet()) {
System.out.println("key:" + s + "," + "value:" + stuPAD.get(s));
}
}
/**
* 删除学生专业
*/
@Test
@Transactional
public void deleteStuProfessionalArchitectureTest(){
Integer stuProfessionalArchitectureId = 34;
HashMap<String, Object> professionalArchitecture = stuProfessionalArchitectureService.deleteStuProfessionalArchitecture(stuProfessionalArchitectureId);
for (String s : professionalArchitecture.keySet()) {
System.out.println("key:" + s + "," + "value:" + professionalArchitecture.get(s));
}
}
/**
* 删除学生转年级
*/
@Test
@Transactional
public void deleteStuGradeTest(){
Integer gradeId = 1;
HashMap<String, Object> stuGrade = stuProfessionalArchitectureService.deleteStuGrade(gradeId);
for (String s : stuGrade.keySet()) {
System.out.println("key:" + s + "," + "value:" + stuGrade.get(s));
}
}
/**
* 删除学生转班级
*/
@Test
@Transactional
public void deleteStuClassTest(){
Integer classId = 1;
HashMap<String, Object> stuClass = stuProfessionalArchitectureService.deleteStuClass(classId);
for (String s : stuClass.keySet()) {
System.out.println("key:" + s + "," + "value:" + stuClass.get(s));
}
}
/**
* 更新学生专业架构
*/
@Test
@Transactional
public void updateStuProfessionalArchitectureTest(){
StuProfessionalArchitecture stuPA = new StuProfessionalArchitecture();
stuPA.setSchoolId(2043);
stuPA.setStuProfessionalArchitectureId(34);
stuPA.setStuProfessionalArchitectureName("英语");
HashMap<String, Object> professionalArchitecture = stuProfessionalArchitectureService.updateStuProfessionalArchitecture(stuPA);
for (String s : professionalArchitecture.keySet()) {
System.out.println("key:" + s + "," + "value:" + professionalArchitecture.get(s));
}
}
/**
* 查询全部学生专业架构
*/
@Test
@Transactional
public void queryStudentProfessionalArchitectureTest(){
Integer schoolId = 1;
HashMap<String, Object> professionalArchitecture = stuProfessionalArchitectureService.queryStuProfessionalArchitecture(schoolId);
for (String s : professionalArchitecture.keySet()) {
System.out.println("key:" + s + "," + "value:" + professionalArchitecture.get(s));
}
}
/**
* 查询学生年级
*/
@Test
@Transactional
public void queryStuGradeTest(){
Integer stuProfessionalArchitectureId = 34;
HashMap<String, Object> queryStuGrade = stuProfessionalArchitectureService.queryStuGrade(stuProfessionalArchitectureId);
for (String s : queryStuGrade.keySet()) {
System.out.println("key:" + s + "," + "value:" + queryStuGrade.get(s));
}
}
/**
* 查询学生年级详情
*/
@Test
@Transactional
public void queryStuGradeDTest(){
Integer gradeId = 1;
HashMap<String, Object> stuGradeD = stuProfessionalArchitectureService.queryStuGradeD(gradeId);
for (String s : stuGradeD.keySet()) {
System.out.println("key:" + s + "," + "value:" + stuGradeD.get(s));
}
}
/**
* 查询学生班级
*/
@Test
@Transactional
public void queryStuClassTest(){
Integer gradeId = 1;
HashMap<String, Object> stuClass = stuProfessionalArchitectureService.queryStuClass(gradeId);
for (String s : stuClass.keySet()) {
System.out.println("key:" + s + "," + "value:" + stuClass.get(s));
}
}
/**
* 查询学生班级详情
*/
@Test
@Transactional
public void queryStuClassDTest(){
Integer classId = 1;
HashMap<String, Object> stuClassD = stuProfessionalArchitectureService.queryStuClassD(classId);
for (String s : stuClassD.keySet()) {
System.out.println("key:" + s + "," + "value:" + stuClassD.get(s));
}
}
/**
* 添加班级
*/
@Test
@Transactional
public void addStuClassTest(){
StuProfessionalArchitecture stuPA = new StuProfessionalArchitecture();
stuPA.setClassName("12");
stuPA.setGradeId(20);
HashMap<String, Object> addStuClass = stuProfessionalArchitectureService.addStuClass(stuPA);
for (String s : addStuClass.keySet()) {
System.out.println("key:" + s + "," + "value:" + addStuClass.get(s));
}
}
/**
* 修改班级
*/
@Test
@Transactional
public void updateStuClassTest(){
StuProfessionalArchitecture stuPA = new StuProfessionalArchitecture();
stuPA.setClassName("13");
stuPA.setClassId(76);
HashMap<String, Object> stuClass = stuProfessionalArchitectureService.updateStuClass(stuPA);
for (String s : stuClass.keySet()) {
System.out.println("key:" + s + "," + "value:" + stuClass.get(s));
}
}
/**
* 添加年级
*/
@Test
@Transactional
public void addStuGradeTest(){
StuProfessionalArchitecture stuPA = new StuProfessionalArchitecture();
stuPA.setGradeName("2020");
stuPA.setStuProfessionalArchitectureId(37);
HashMap<String, Object> stuGrade = stuProfessionalArchitectureService.addStuGrade(stuPA);
for (String s : stuGrade.keySet()) {
System.out.println("key:" + s + "," + "value:" + stuGrade.get(s));
}
}
/**
* 修改年级
*/
@Test
@Transactional
public void updateStuGradeTest(){
StuProfessionalArchitecture stuPA = new StuProfessionalArchitecture();
stuPA.setGradeId(50);
stuPA.setGradeName("2018");
stuPA.setStuProfessionalArchitectureId(37);
HashMap<String, Object> stuGrade = stuProfessionalArchitectureService.updateStuGrade(stuPA);
for (String s : stuGrade.keySet()) {
System.out.println("key:" + s + "," + "value:" + stuGrade.get(s));
}
}
/**
* 查询学生
*/
@Test
@Transactional
public void queryStudentTest(){
Integer classId = 1;
HashMap<String, Object> student = stuProfessionalArchitectureService.queryStudent(classId);
for (String s : student.keySet()) {
System.out.println("key:" + s + "," + "value:" + student.get(s));
}
}
}
Loading…
Cancel
Save