|
|
@ -13,10 +13,7 @@ import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Description:
|
|
|
|
* StudentServiceImpl类实现了StudentService接口,提供学生信息的管理功能。
|
|
|
|
*
|
|
|
|
|
|
|
|
* @Date: 2020/2/17 14:22
|
|
|
|
|
|
|
|
* @Author: PeiChen
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Service("studentService")
|
|
|
|
@Service("studentService")
|
|
|
|
public class StudentServiceImpl implements StudentService {
|
|
|
|
public class StudentServiceImpl implements StudentService {
|
|
|
@ -29,9 +26,11 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询所有学生信息
|
|
|
|
* 查询所有学生信息,支持分页。
|
|
|
|
* @return
|
|
|
|
* @param page 当前页码
|
|
|
|
* @throws Exception
|
|
|
|
* @param size 每页显示的记录数
|
|
|
|
|
|
|
|
* @return 学生列表
|
|
|
|
|
|
|
|
* @throws Exception 异常处理
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Student> findAll(int page, int size) throws Exception {
|
|
|
|
public List<Student> findAll(int page, int size) throws Exception {
|
|
|
@ -40,9 +39,10 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 通过学号sno查询学生信息
|
|
|
|
* 根据学号查询学生信息。
|
|
|
|
* @return
|
|
|
|
* @param sno 学号
|
|
|
|
* @throws Exception
|
|
|
|
* @return 学生对象
|
|
|
|
|
|
|
|
* @throws Exception 异常处理
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Student findBySno(String sno) throws Exception {
|
|
|
|
public Student findBySno(String sno) throws Exception {
|
|
|
@ -50,9 +50,12 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 模糊查询学生信息
|
|
|
|
* 模糊查询学生信息,支持分页。
|
|
|
|
* @return
|
|
|
|
* @param page 当前页码
|
|
|
|
* @throws Exception
|
|
|
|
* @param size 每页显示的记录数
|
|
|
|
|
|
|
|
* @param keyword 查询关键字
|
|
|
|
|
|
|
|
* @return 学生列表
|
|
|
|
|
|
|
|
* @throws Exception 异常处理
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Student> search(int page, int size, String keyword) throws Exception {
|
|
|
|
public List<Student> search(int page, int size, String keyword) throws Exception {
|
|
|
@ -61,9 +64,10 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 添加学生信息
|
|
|
|
* 添加学生信息。
|
|
|
|
* @param student
|
|
|
|
* @param student 学生对象
|
|
|
|
* @throws Exception
|
|
|
|
* @return 是否添加成功
|
|
|
|
|
|
|
|
* @throws Exception 异常处理
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean add(Student student) throws Exception {
|
|
|
|
public boolean add(Student student) throws Exception {
|
|
|
@ -77,9 +81,9 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 根据学号删除学生
|
|
|
|
* 根据学号删除学生信息。
|
|
|
|
* @param sno
|
|
|
|
* @param sno 学号
|
|
|
|
* @throws Exception
|
|
|
|
* @throws Exception 异常处理
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void delete(String sno) throws Exception {
|
|
|
|
public void delete(String sno) throws Exception {
|
|
|
@ -87,9 +91,9 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 修改学生信息
|
|
|
|
* 修改学生信息。
|
|
|
|
* @param student
|
|
|
|
* @param student 学生对象
|
|
|
|
* @throws Exception
|
|
|
|
* @throws Exception 异常处理
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void update(Student student) throws Exception {
|
|
|
|
public void update(Student student) throws Exception {
|
|
|
@ -97,9 +101,9 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 导出学生信息
|
|
|
|
* 导出学生信息到Excel文件。
|
|
|
|
* @return
|
|
|
|
* @return 输入流,用于读取生成的Excel文件
|
|
|
|
* @throws Exception
|
|
|
|
* @throws Exception 异常处理
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public InputStream getInputStream() throws Exception {
|
|
|
|
public InputStream getInputStream() throws Exception {
|
|
|
@ -121,16 +125,15 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
datalist.add(obj);
|
|
|
|
datalist.add(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
WriteExcel excel = new WriteExcel(title, datalist);
|
|
|
|
WriteExcel excel = new WriteExcel(title, datalist);
|
|
|
|
|
|
|
|
|
|
|
|
return excel.export();
|
|
|
|
return excel.export();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 根据宿舍号查询状态为status的学生
|
|
|
|
* 根据宿舍号查询状态为status的学生。
|
|
|
|
* @param dorm_id
|
|
|
|
* @param dorm_id 宿舍号
|
|
|
|
* @param status
|
|
|
|
* @param status 状态值
|
|
|
|
* @return
|
|
|
|
* @return 学生列表
|
|
|
|
* @throws Exception
|
|
|
|
* @throws Exception 异常处理
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Student> findByDormId(String dorm_id, Integer status) throws Exception {
|
|
|
|
public List<Student> findByDormId(String dorm_id, Integer status) throws Exception {
|
|
|
@ -138,10 +141,12 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询育人导师为teacher的学生集合
|
|
|
|
* 查询育人导师为teacher的学生集合,支持分页。
|
|
|
|
* @param teacher
|
|
|
|
* @param page 当前页码
|
|
|
|
* @return
|
|
|
|
* @param size 每页显示的记录数
|
|
|
|
* @throws Exception
|
|
|
|
* @param teacher 育人导师名称
|
|
|
|
|
|
|
|
* @return 学生列表
|
|
|
|
|
|
|
|
* @throws Exception 异常处理
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Student> findByTeacher(int page, int size, String teacher) throws Exception {
|
|
|
|
public List<Student> findByTeacher(int page, int size, String teacher) throws Exception {
|
|
|
@ -149,6 +154,15 @@ public class StudentServiceImpl implements StudentService {
|
|
|
|
return studentDao.findByTeacher(teacher);
|
|
|
|
return studentDao.findByTeacher(teacher);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 根据育人导师和关键字模糊查询学生信息,支持分页。
|
|
|
|
|
|
|
|
* @param page 当前页码
|
|
|
|
|
|
|
|
* @param size 每页显示的记录数
|
|
|
|
|
|
|
|
* @param teacher 育人导师名称
|
|
|
|
|
|
|
|
* @param keyword 查询关键字
|
|
|
|
|
|
|
|
* @return 学生列表
|
|
|
|
|
|
|
|
* @throws Exception 异常处理
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Student> searchStudent(int page, int size, String teacher, String keyword) throws Exception {
|
|
|
|
public List<Student> searchStudent(int page, int size, String teacher, String keyword) throws Exception {
|
|
|
|
PageHelper.startPage(page, size);
|
|
|
|
PageHelper.startPage(page, size);
|
|
|
|