|
|
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
import com.ruoyi.common.utils.ServletUtils;
|
|
|
|
|
import com.ruoyi.course.common.R;
|
|
|
|
|
import com.ruoyi.course.domain.Student;
|
|
|
|
|
import com.ruoyi.course.domain.vo.StudentQueryVO;
|
|
|
|
|
@ -16,10 +15,7 @@ import io.swagger.annotations.ApiParam;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@ -92,39 +88,36 @@ public class StudentController extends BaseController {
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public TableDataInfo listStudents(Student student) {
|
|
|
|
|
|
|
|
|
|
// 1. 从请求获取分页参数
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes)
|
|
|
|
|
RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
Integer pageNum = ServletUtils.getParameterToInt("pageNum", 1);
|
|
|
|
|
Integer pageSize = ServletUtils.getParameterToInt("pageSize", 10);
|
|
|
|
|
startPage();
|
|
|
|
|
// 创建查询条件
|
|
|
|
|
LambdaQueryWrapper<Student> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
|
|
|
|
|
// 添加查询条件(非空判断)
|
|
|
|
|
if (StringUtils.hasText(student.getStudentNo())) {
|
|
|
|
|
wrapper.like(Student::getStudentNo, student.getStudentNo());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.hasText(student.getName())) {
|
|
|
|
|
wrapper.like(Student::getName, student.getName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (student.getClassId() != null) {
|
|
|
|
|
wrapper.eq(Student::getClassId, student.getClassId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.hasText(String.valueOf(student.getGrade()))) {
|
|
|
|
|
wrapper.eq(Student::getGrade, student.getGrade());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (student.getStatus() != null) {
|
|
|
|
|
wrapper.eq(Student::getStatus, student.getStatus());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 按创建时间倒序
|
|
|
|
|
wrapper.orderByDesc(Student::getCreateTime);
|
|
|
|
|
List<Student> list = studentService.list(wrapper);
|
|
|
|
|
startPage();
|
|
|
|
|
// // 创建查询条件
|
|
|
|
|
// LambdaQueryWrapper<Student> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
//
|
|
|
|
|
// // 添加查询条件(非空判断)
|
|
|
|
|
// if (StringUtils.hasText(student.getStudentNo())) {
|
|
|
|
|
// wrapper.like(Student::getStudentNo, student.getStudentNo());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (StringUtils.hasText(student.getName())) {
|
|
|
|
|
// wrapper.like(Student::getName, student.getName());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (student.getClassId() != null) {
|
|
|
|
|
// wrapper.eq(Student::getClassId, student.getClassId());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (StringUtils.hasText(String.valueOf(student.getGrade()))) {
|
|
|
|
|
// wrapper.eq(Student::getGrade, student.getGrade());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (student.getStatus() != null) {
|
|
|
|
|
// wrapper.eq(Student::getStatus, student.getStatus());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// // 按创建时间倒序
|
|
|
|
|
// wrapper.orderByDesc(Student::getCreateTime);
|
|
|
|
|
// List<Student> list = studentService.list(wrapper);
|
|
|
|
|
List<Student> list = studentService.list();
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
}
|
|
|
|
|
|