use of shu.java.csky.vo.param.TeacherPageParam in project CSKY by SHU-Silence.
the class TeacherServiceImpl method fuzzyQueryTeacher.
@Override
public ResultVO fuzzyQueryTeacher(TeacherPageParam teacherPageParam) {
String text = teacherPageParam.getText();
Integer uid = teacherPageParam.getUid();
if (text == null)
return new ResultVO(ResStatus.OK, "text为空", null);
QueryWrapper<Teachers> wrapper = new QueryWrapper<>();
wrapper.eq("schoolId", teacherPageParam.getSid()).and(wr -> {
wr.like("tname", text).or().like("studydir", text).or().like("eduresume", text).or().like("proresume", text).or().like("tURL", text);
}).orderByAsc("id");
IPage<Teachers> teachersPage = new Page<>();
BeanUtils.copyProperties(teacherPageParam, teachersPage);
teachersMapper.selectPage(teachersPage, wrapper);
TeacherPageVo teacherPageVo = new TeacherPageVo();
BeanUtils.copyProperties(teachersPage, teacherPageVo);
ArrayList<TeacherVo> teacherVos = new ArrayList<>();
for (Teachers record : teachersPage.getRecords()) {
TeacherVo teacherVo = new TeacherVo();
BeanUtils.copyProperties(record, teacherVo);
teacherVos.add(teacherVo);
}
// 若查到数据,插入search表
if (!teacherVos.isEmpty() && (uid != null))
searchMapper.insert(new Search(0, uid, text));
teacherPageVo.setTeacherVoList(teacherVos);
return new ResultVO(ResStatus.OK, "教师模糊查询分页信息返回成功", teacherPageVo);
}
Aggregations