AnswerService
package com.example.academicadministration.service;
import com.example.academicadministration.dao.AnswerDao;
import com.example.academicadministration.pojo.Answer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AnswerService {
@Autowired
private AnswerDao answerDao;
public Boolean addAnswer(Answer answer) {
return answerDao.addAnswer(answer)>0;
}
public Boolean updateAnswer(Answer answer) {
return answerDao.updateAnswer(answer)>0;
}
public Boolean updateScore(Answer answer) {
return answerDao.updateScore(answer)>0;
}
public Boolean deleteAnswer(String stuid,String homeworkid){
return answerDao.deleteAnswer(stuid,homeworkid)>0;
}
public Answer myAnswer(String stuid,String homeworkid) {
return answerDao.myAnswer(stuid,homeworkid);
}
}
CourseService
package com.example.academicadministration.service;
import com.example.academicadministration.dao.CourseDao;
import com.example.academicadministration.pojo.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CourseService {
@Autowired
private CourseDao courseDao;
public Boolean addCourse(Course course) {
return courseDao.addCourse(course)>0;
}
public Boolean deleteCourse(String courseid) {
return courseDao.deleteCourse(courseid)>0;
}
public List<Course> browseCourse(String condition) {
return courseDao.browseCourse(condition);
}
public List<Course> myCourse(String stuid){
return courseDao.myCourse(stuid);
}
public List<Course> TmyCourse(String teaid){
return courseDao.TmyCourse(teaid);
}
public Boolean checkTeacher(String courseid,String teaid){return !courseDao.checkTeacher(courseid,teaid).isEmpty();}
public Boolean addTeacherCourse(String teaid,String courseid){
return courseDao.addTeacherCourse(teaid,courseid)>0;
}
public Boolean deleteTeacherCourse(String teaid,String courseid){
return courseDao.deleteTeacherCourse(teaid,courseid)>0;
}
public Boolean addStudentCourse(String stuid,String courseid){
return courseDao.addStudentCourse(stuid,courseid)>0;
}
public Boolean deleteStudentCourse(String stuid,String courseid){
return courseDao.deleteStudentCourse(stuid,courseid)>0;
}
public Boolean addNum(String courseid){
return courseDao.addNum(courseid)>0;
}
public Boolean deleteNum(String courseid){
return courseDao.deleteNum(courseid)>0;
}
public String browseScore(String stuid,String courseid){
return courseDao.browseScore(stuid,courseid);
}
public Boolean updateScore(String coursescore,String stuid,String courseid){
return courseDao.updateScore(coursescore,stuid,courseid)>0;
}
}
HomeworkService
package com.example.academicadministration.service;
import com.example.academicadministration.dao.HomeworkDao;
import com.example.academicadministration.pojo.Homework;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class HomeworkService {
@Autowired
private HomeworkDao homeworkDao;
public Boolean addHomework(Homework homework) {
return homeworkDao.addHomework(homework)>0;
}
public Boolean deleteHomework(String homeworkid) {
return homeworkDao.deleteHomework(homeworkid)>0;
}
public List<Homework> browseHomeworkAll(String courseid) {
return homeworkDao.browseHomeworkAll(courseid);
}
public List<Homework> browseHomework1(String courseid) {
return homeworkDao.browseHomework1(courseid);
}
public List<Homework> browseHomework2(String courseid) {
return homeworkDao.browseHomework2(courseid);
}
}
MangerService
package com.example.academicadministration.service;
import com.example.academicadministration.dao.MangerDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MangerService {
@Autowired
private MangerDao mangerDao;
public String login(String id){
return mangerDao.login(id);
}
public boolean reset(String mangerid,String oldpwd, String newpwd1) {
return mangerDao.reset(mangerid,oldpwd,newpwd1)>0;
}
}
StudentService
package com.example.academicadministration.service;
import com.example.academicadministration.dao.StudentDao;
import com.example.academicadministration.pojo.Course;
import com.example.academicadministration.pojo.Homework;
import com.example.academicadministration.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class StudentService {
@Autowired
private StudentDao studentDao;
@Autowired
private CourseService courseService;
@Autowired
private HomeworkService homeworkService;
@Autowired
private AnswerService answerService;
public Boolean addStudent(Student student){
return studentDao.addStudent(student)>0;
}
public Boolean deleteStudent(String stuid){
List<Course> courses=courseService.myCourse(stuid);
for (Course i:courses){
courseService.deleteNum(String.valueOf(i.getCourseid()));
courseService.deleteStudentCourse(stuid, String.valueOf(i.getCourseid()));
List<Homework> homework=homeworkService.browseHomeworkAll(String.valueOf(i.getCourseid()));
for (Homework j:homework){
answerService.deleteAnswer(stuid, String.valueOf(j.getHomeworkid()));
}
}
return studentDao.deleteStudent(stuid)>0;
}
public Boolean auditStudent(String stuid){
return studentDao.auditStudent(stuid)>0;
}
public Boolean inauditStudent(String stuid){
return studentDao.inauditStudent(stuid)>0;
}
public Boolean reset(String stuid,String stupwd,String newpwd){
return studentDao.reset(stuid,stupwd,newpwd)>0;
}
public List<Student> browseStudent(String condition){
return studentDao.browseStudent(condition);
}
public List<Student> myStudent(String courseid){
return studentDao.myStudent(courseid);
}
}
TeacherService
package com.example.academicadministration.service;
import com.example.academicadministration.dao.TeacherDao;
import com.example.academicadministration.pojo.Course;
import com.example.academicadministration.pojo.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TeacherService {
@Autowired
private TeacherDao teacherDao;
@Autowired
private CourseService courseService;
public Boolean addTeacher(Teacher teacher){
return teacherDao.addTeacher(teacher)>0;
}
public Boolean deleteTeacher(String teaid){
List< Course> courses=courseService.TmyCourse(teaid);
for(Course i:courses){
courseService.deleteTeacherCourse(teaid, String.valueOf(i.getCourseid()));
}
return teacherDao.deleteTeacher(teaid)>0;
}
public Boolean auditTeacher(String teaid){
return teacherDao.auditTeacher(teaid)>0;
}
public Boolean inauditTeacher(String teaid){
return teacherDao.inauditTeacher(teaid)>0;
}
public Boolean reset(String teaid,String teapwd,String newpwd){
return teacherDao.reset(teaid,teapwd,newpwd)>0;
}
public List<Teacher> browseTeacher(String condition){
return teacherDao.browseTeacher(condition);
}
}
VideoService
package com.example.academicadministration.service;
import com.example.academicadministration.dao.VideoDao;
import com.example.academicadministration.pojo.Video;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.File;
import java.util.List;
@Service
public class VideoService {
@Autowired
private VideoDao videoDao;
public Boolean addVideo(Video video) {
return videoDao.addVideo(video)>0;
}
public Boolean deleteVideo(String videoid) {
List<Video> videoList=browseVideo("%%");
for(Video i:videoList){
if(videoid.equals(String.valueOf(i.getVideoid()))){
new File("D:\\JavaProject\\AcademicAdministration\\src\\main\\resources\\static\\video\\"+i.getVideofile()).delete();
}
}
return videoDao.deleteVideo(videoid)>0;
}
public List<Video> browseVideo(String condition) {
return videoDao.browseVideo(condition);
}
}
标签:return,String,service,courseid,Boolean,import,public From: https://www.cnblogs.com/liyiyang/p/17470983.html