ExperimentalClassService单元测试

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