You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.0 KiB
91 lines
2.0 KiB
|
1 week ago
|
package com.student.service;
|
||
|
|
|
||
|
|
import com.student.bean.Clazz;
|
||
|
|
import com.student.bean.Department;
|
||
|
|
import com.student.bean.Major;
|
||
|
|
import com.student.dao.OrgDao;
|
||
|
|
import com.student.dao.impl.OrgDaoImpl;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
public class OrgService {
|
||
|
|
|
||
|
|
private final OrgDao orgDao;
|
||
|
|
|
||
|
|
public OrgService() {
|
||
|
|
this(new OrgDaoImpl());
|
||
|
|
}
|
||
|
|
|
||
|
|
OrgService(OrgDao orgDao) {
|
||
|
|
this.orgDao = orgDao;
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<Department> listDepts() {
|
||
|
|
return orgDao.findAllDepts();
|
||
|
|
}
|
||
|
|
|
||
|
|
public Department findDept(int id) {
|
||
|
|
return orgDao.findDeptById(id);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean addDept(Department dept) {
|
||
|
|
return orgDao.insertDept(dept);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean updateDept(Department dept) {
|
||
|
|
return orgDao.updateDept(dept);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean deleteDept(int id) {
|
||
|
|
return orgDao.deleteDept(id);
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<Major> listMajorsByDept(int deptId) {
|
||
|
|
return orgDao.findMajorsByDept(deptId);
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<Major> listAllMajors() {
|
||
|
|
return orgDao.findAllMajors();
|
||
|
|
}
|
||
|
|
|
||
|
|
public Major findMajor(int id) {
|
||
|
|
return orgDao.findMajorById(id);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean addMajor(Major major) {
|
||
|
|
return orgDao.insertMajor(major);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean updateMajor(Major major) {
|
||
|
|
return orgDao.updateMajor(major);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean deleteMajor(int id) {
|
||
|
|
return orgDao.deleteMajor(id);
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<Clazz> listClazzByMajor(int majorId) {
|
||
|
|
return orgDao.findClazzByMajor(majorId);
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<Clazz> listAllClazz() {
|
||
|
|
return orgDao.findAllClazz();
|
||
|
|
}
|
||
|
|
|
||
|
|
public Clazz findClazz(int id) {
|
||
|
|
return orgDao.findClazzById(id);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean addClazz(Clazz clazz) {
|
||
|
|
return orgDao.insertClazz(clazz);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean updateClazz(Clazz clazz) {
|
||
|
|
return orgDao.updateClazz(clazz);
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean deleteClazz(int id) {
|
||
|
|
return orgDao.deleteClazz(id);
|
||
|
|
}
|
||
|
|
}
|