ExperimentalClassService单元测试

master
shijie 4 years ago
parent 9571b7c766
commit 6e8e98e27a
  1. 64
      src/main/java/com/yipin/liuwanr/entity/Industry.java
  2. 43
      src/main/java/com/yipin/liuwanr/entity/IndustryClass.java
  3. 520
      src/main/java/com/yipin/liuwanr/entity/Student.java
  4. 157
      src/test/java/com/yipin/liuwanr/ExperimentalClassServiceTest.java

@ -3,29 +3,43 @@ package com.yipin.liuwanr.entity;
//行业
public class Industry {
//行业主键ID
private Integer industryId;
//行业类绑定ID
private Integer industryClassId;
//行业名称
private String industryName;
public Integer getIndustryId() {
return industryId;
}
public void setIndustryId(Integer industryId) {
this.industryId = industryId;
}
public Integer getIndustryClassId() {
return industryClassId;
}
public void setIndustryClassId(Integer industryClassId) {
this.industryClassId = industryClassId;
}
public String getIndustryName() {
return industryName;
}
public void setIndustryName(String industryName) {
this.industryName = industryName;
}
//行业主键ID
private Integer industryId;
//行业类绑定ID
private Integer industryClassId;
//行业名称
private String industryName;
public Integer getIndustryId() {
return industryId;
}
public void setIndustryId(Integer industryId) {
this.industryId = industryId;
}
public Integer getIndustryClassId() {
return industryClassId;
}
public void setIndustryClassId(Integer industryClassId) {
this.industryClassId = industryClassId;
}
public String getIndustryName() {
return industryName;
}
public void setIndustryName(String industryName) {
this.industryName = industryName;
}
@Override
public String toString() {
return "Industry{" +
"industryId=" + industryId +
", industryClassId=" + industryClassId +
", industryName='" + industryName + '\'' +
'}';
}
}

@ -3,21 +3,32 @@ package com.yipin.liuwanr.entity;
//行业类
public class IndustryClass {
//行业类主键ID
private Integer industryClassId;
//行业类名称
private String industryClassName;
//行业类主键ID
private Integer industryClassId;
//行业类名称
private String industryClassName;
public Integer getIndustryClassId() {
return industryClassId;
}
public void setIndustryClassId(Integer industryClassId) {
this.industryClassId = industryClassId;
}
public String getIndustryClassName() {
return industryClassName;
}
public void setIndustryClassName(String industryClassName) {
this.industryClassName = industryClassName;
}
public Integer getIndustryClassId() {
return industryClassId;
}
public void setIndustryClassId(Integer industryClassId) {
this.industryClassId = industryClassId;
}
public String getIndustryClassName() {
return industryClassName;
}
public void setIndustryClassName(String industryClassName) {
this.industryClassName = industryClassName;
}
@Override
public String toString() {
return "IndustryClass{" +
"industryClassId=" + industryClassId +
", industryClassName='" + industryClassName + '\'' +
'}';
}
}

@ -2,221 +2,307 @@ package com.yipin.liuwanr.entity;
public class Student {
//学生主键ID
private Integer studentId;
//学生名称
private String studentName;
//学生学号
private String studentNumber;
//电话
private String phone;
//邮箱
private String email;
//学生绑定角色ID
private Integer roleId;
//绑定学校ID
private Integer schoolId;
//绑定专业ID
private Integer professionalId;
//绑定年级ID
private Integer gradeId;
//绑定班级ID
private Integer classId;
//外部实体实验班级名称
private String experimentalClassName;
//外部实体实验班级ID
private String experimentalClassId;
//是否考勤
private Integer isAssess;
//唯一标示性账号
private String uniqueIdentificationAccount;
//搜索内容
private String searchContent;
//多个专业ID
private String professionalIds;
//多个年级ID
private String gradeIds;
//多个班级ID
private String classIds;
//专业名称
private String professionalName;
//年级名称
private String gradeName;
//学生姓名和学号
private String studentNameNumber;
//int类型实验班级ID
private Integer intExperimentalClassId;
//绑定班级名称
private String className;
//登陆次数
private Integer loginNumber;
//最后一次登陆时间
private String lastLoginTime;
//考勤统计
private String attendance;
//学生专业组织架构名称
private String stuProfessionalArchitectureName;
public String getStuProfessionalArchitectureName() {
return stuProfessionalArchitectureName;
}
public void setStuProfessionalArchitectureName(String stuProfessionalArchitectureName) {
this.stuProfessionalArchitectureName = stuProfessionalArchitectureName;
}
public String getAttendance() {
return attendance;
}
public void setAttendance(String attendance) {
this.attendance = attendance;
}
public Integer getLoginNumber() {
return loginNumber;
}
public void setLoginNumber(Integer loginNumber) {
this.loginNumber = loginNumber;
}
public String getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(String lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public Integer getIntExperimentalClassId() {
return intExperimentalClassId;
}
public void setIntExperimentalClassId(Integer intExperimentalClassId) {
this.intExperimentalClassId = intExperimentalClassId;
}
public String getStudentNameNumber() {
return studentNameNumber;
}
public void setStudentNameNumber(String studentNameNumber) {
this.studentNameNumber = studentNameNumber;
}
public String getProfessionalName() {
return professionalName;
}
public void setProfessionalName(String professionalName) {
this.professionalName = professionalName;
}
public String getGradeName() {
return gradeName;
}
public void setGradeName(String gradeName) {
this.gradeName = gradeName;
}
public String getProfessionalIds() {
return professionalIds;
}
public void setProfessionalIds(String professionalIds) {
this.professionalIds = professionalIds;
}
public String getGradeIds() {
return gradeIds;
}
public void setGradeIds(String gradeIds) {
this.gradeIds = gradeIds;
}
public String getClassIds() {
return classIds;
}
public void setClassIds(String classIds) {
this.classIds = classIds;
}
public String getSearchContent() {
return searchContent;
}
public void setSearchContent(String searchContent) {
this.searchContent = searchContent;
}
public String getUniqueIdentificationAccount() {
return uniqueIdentificationAccount;
}
public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) {
this.uniqueIdentificationAccount = uniqueIdentificationAccount;
}
public Integer getStudentId() {
return studentId;
}
public void setStudentId(Integer studentId) {
this.studentId = studentId;
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
public String getStudentNumber() {
return studentNumber;
}
public void setStudentNumber(String studentNumber) {
this.studentNumber = studentNumber;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public Integer getSchoolId() {
return schoolId;
}
public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId;
}
public Integer getProfessionalId() {
return professionalId;
}
public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId;
}
public Integer getGradeId() {
return gradeId;
}
public void setGradeId(Integer gradeId) {
this.gradeId = gradeId;
}
public Integer getClassId() {
return classId;
}
public void setClassId(Integer classId) {
this.classId = classId;
}
public String getExperimentalClassName() {
return experimentalClassName;
}
public void setExperimentalClassName(String experimentalClassName) {
this.experimentalClassName = experimentalClassName;
}
public String getExperimentalClassId() {
return experimentalClassId;
}
public void setExperimentalClassId(String experimentalClassId) {
this.experimentalClassId = experimentalClassId;
}
public Integer getIsAssess() {
return isAssess;
}
public void setIsAssess(Integer isAssess) {
this.isAssess = isAssess;
}
//学生主键ID
private Integer studentId;
//学生名称
private String studentName;
//学生学号
private String studentNumber;
//电话
private String phone;
//邮箱
private String email;
//学生绑定角色ID
private Integer roleId;
//绑定学校ID
private Integer schoolId;
//绑定专业ID
private Integer professionalId;
//绑定年级ID
private Integer gradeId;
//绑定班级ID
private Integer classId;
//外部实体实验班级名称
private String experimentalClassName;
//外部实体实验班级ID
private String experimentalClassId;
//是否考勤
private Integer isAssess;
//唯一标示性账号
private String uniqueIdentificationAccount;
//搜索内容
private String searchContent;
//多个专业ID
private String professionalIds;
//多个年级ID
private String gradeIds;
//多个班级ID
private String classIds;
//专业名称
private String professionalName;
//年级名称
private String gradeName;
//学生姓名和学号
private String studentNameNumber;
//int类型实验班级ID
private Integer intExperimentalClassId;
//绑定班级名称
private String className;
//登陆次数
private Integer loginNumber;
//最后一次登陆时间
private String lastLoginTime;
//考勤统计
private String attendance;
//学生专业组织架构名称
private String stuProfessionalArchitectureName;
public String getStuProfessionalArchitectureName() {
return stuProfessionalArchitectureName;
}
public void setStuProfessionalArchitectureName(String stuProfessionalArchitectureName) {
this.stuProfessionalArchitectureName = stuProfessionalArchitectureName;
}
public String getAttendance() {
return attendance;
}
public void setAttendance(String attendance) {
this.attendance = attendance;
}
public Integer getLoginNumber() {
return loginNumber;
}
public void setLoginNumber(Integer loginNumber) {
this.loginNumber = loginNumber;
}
public String getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(String lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public Integer getIntExperimentalClassId() {
return intExperimentalClassId;
}
public void setIntExperimentalClassId(Integer intExperimentalClassId) {
this.intExperimentalClassId = intExperimentalClassId;
}
public String getStudentNameNumber() {
return studentNameNumber;
}
public void setStudentNameNumber(String studentNameNumber) {
this.studentNameNumber = studentNameNumber;
}
public String getProfessionalName() {
return professionalName;
}
public void setProfessionalName(String professionalName) {
this.professionalName = professionalName;
}
public String getGradeName() {
return gradeName;
}
public void setGradeName(String gradeName) {
this.gradeName = gradeName;
}
public String getProfessionalIds() {
return professionalIds;
}
public void setProfessionalIds(String professionalIds) {
this.professionalIds = professionalIds;
}
public String getGradeIds() {
return gradeIds;
}
public void setGradeIds(String gradeIds) {
this.gradeIds = gradeIds;
}
public String getClassIds() {
return classIds;
}
public void setClassIds(String classIds) {
this.classIds = classIds;
}
public String getSearchContent() {
return searchContent;
}
public void setSearchContent(String searchContent) {
this.searchContent = searchContent;
}
public String getUniqueIdentificationAccount() {
return uniqueIdentificationAccount;
}
public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) {
this.uniqueIdentificationAccount = uniqueIdentificationAccount;
}
public Integer getStudentId() {
return studentId;
}
public void setStudentId(Integer studentId) {
this.studentId = studentId;
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
public String getStudentNumber() {
return studentNumber;
}
public void setStudentNumber(String studentNumber) {
this.studentNumber = studentNumber;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public Integer getSchoolId() {
return schoolId;
}
public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId;
}
public Integer getProfessionalId() {
return professionalId;
}
public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId;
}
public Integer getGradeId() {
return gradeId;
}
public void setGradeId(Integer gradeId) {
this.gradeId = gradeId;
}
public Integer getClassId() {
return classId;
}
public void setClassId(Integer classId) {
this.classId = classId;
}
public String getExperimentalClassName() {
return experimentalClassName;
}
public void setExperimentalClassName(String experimentalClassName) {
this.experimentalClassName = experimentalClassName;
}
public String getExperimentalClassId() {
return experimentalClassId;
}
public void setExperimentalClassId(String experimentalClassId) {
this.experimentalClassId = experimentalClassId;
}
public Integer getIsAssess() {
return isAssess;
}
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 + '\'' +
'}';
}
}

@ -0,0 +1,157 @@
package com.yipin.liuwanr;
import com.yipin.liuwanr.entity.ExperimentalClass;
import com.yipin.liuwanr.entity.Student;
import com.yipin.liuwanr.service.ExperimentalClassService;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ExperimentalClassServiceTest {
@Autowired
private ExperimentalClassService experimentalClassService;
//添加客户
@Test
@Transactional
public void experimentClassAddStudent() {
List<Student> studentList = new ArrayList<>();
Student stu = new Student();
stu.setStudentId(1);
stu.setExperimentalClassId("123");
studentList.add(stu);
HashMap<String, Object> map = experimentalClassService.experimentClassAddStudent(studentList);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//实验班级删除学生
@Test
@Transactional
public void experimentClassDeleteStudent() {
List<Student> studentList = new ArrayList<>();
Student stu = new Student();
stu.setStudentId(1);
stu.setExperimentalClassId("123");
studentList.add(stu);
HashMap<String, Object> map = experimentalClassService.experimentClassDeleteStudent(studentList);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//创建实验班级
@Test
@Transactional
public void addExperimentalClass() {
ExperimentalClass experimentalClass = new ExperimentalClass();
experimentalClass.setExperimentalClassName("测试");
experimentalClass.setClassSize(12);
experimentalClass.setFounder("测试");
experimentalClass.setCourseId(2);
experimentalClass.setUserId(2);
experimentalClass.setSchoolId(2);
HashMap<String, Object> map = experimentalClassService.addExperimentalClass(experimentalClass);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
@Test
public void queryExperimentalClass() {
Integer schoolId = 1;
Integer courseId = 2;
HashMap<String, Object> map = experimentalClassService.queryExperimentalClass(schoolId, courseId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//查询实验班级专业
@Test
public void queryExperimentalClassSP() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.queryExperimentalClassSP(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//查询学生行政班级
@Test
public void queryStudentClass() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.queryStudentClass(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
/**
* 班级详情
*/
@Test
public void queryExperimentalClassDetails() {
Student student = new Student();
Integer courseId = 1;
HashMap<String, Object> map = experimentalClassService.queryExperimentalClassDetails(student, courseId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//新增学生显示数据
@Test
public void queryexperimentalClass() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.queryexperimentalClass(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//专业下拉框
@Test
public void getProfessionals() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.getProfessionals(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//班级下拉框
@Test
public void getStudentClass() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.getStudentClass(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
@Test
@Transactional
public void deleteExperimentalClass() {
Integer experimentalClassId = 1;
HashMap<String, Object> map = experimentalClassService.deleteExperimentalClass(experimentalClassId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
@Test
@Transactional
public void updateExperimentalClass() {
ExperimentalClass experimentalClass = new ExperimentalClass();
HashMap<String, Object> map = experimentalClassService.updateExperimentalClass(experimentalClass);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//修改实验班级名称
@Test
@Transactional
public void updateExperimentClassName() {
ExperimentalClass experimentalClass = new ExperimentalClass();
HashMap<String, Object> map = experimentalClassService.updateExperimentalClass(experimentalClass);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
//——————————————————————————————全承珠
@Test
public void queryGetByExperimentalClassName() {
String experimentalClassName = "";
HashMap<String, Object> map = experimentalClassService.queryGetByExperimentalClassName(experimentalClassName);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
}
Loading…
Cancel
Save