Search in sources :

Example 1 with TeacherVo

use of shu.java.csky.vo.TeacherVo in project CSKY by SHU-Silence.

the class TeacherServiceImpl method getTeacherInfoBySId.

@Override
public ResultVO getTeacherInfoBySId(Integer sid, long currentPage) {
    Page<Teachers> page = new Page<>(currentPage, 5, true);
    QueryWrapper<Teachers> wrapper = new QueryWrapper<Teachers>().eq("schoolId", sid);
    teachersMapper.selectPage(page, wrapper);
    TeacherPageVo teacherPageVo = new TeacherPageVo();
    BeanUtils.copyProperties(page, teacherPageVo);
    List<TeacherVo> teacherVos = new ArrayList<>();
    for (Teachers record : page.getRecords()) {
        TeacherVo teacherVo = new TeacherVo(record.getId(), record.getTname(), record.getStudydir());
        teacherVos.add(teacherVo);
    }
    teacherPageVo.setTeacherVoList(teacherVos);
    return new ResultVO(ResStatus.OK, "老师分页信息查询成功", teacherPageVo);
}
Also used : ResultVO(shu.java.csky.vo.ResultVO) Teachers(shu.java.csky.entity.Teachers) ArrayList(java.util.ArrayList) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage) TeacherVo(shu.java.csky.vo.TeacherVo) TeacherPageVo(shu.java.csky.vo.page.TeacherPageVo)

Example 2 with TeacherVo

use of shu.java.csky.vo.TeacherVo 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);
}
Also used : ResultVO(shu.java.csky.vo.ResultVO) TeacherPageParam(shu.java.csky.vo.param.TeacherPageParam) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) TeacherVo(shu.java.csky.vo.TeacherVo) SearchMapper(shu.java.csky.dao.SearchMapper) Resource(javax.annotation.Resource) ResultVO(shu.java.csky.vo.ResultVO) TeacherService(shu.java.csky.TeacherService) Search(shu.java.csky.entity.Search) TeachersMapper(shu.java.csky.dao.TeachersMapper) ArrayList(java.util.ArrayList) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) Teachers(shu.java.csky.entity.Teachers) ResStatus(shu.java.csky.vo.ResStatus) List(java.util.List) TeacherPageVo(shu.java.csky.vo.page.TeacherPageVo) Service(org.springframework.stereotype.Service) IPage(com.baomidou.mybatisplus.core.metadata.IPage) BeanUtils(org.springframework.beans.BeanUtils) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) ArrayList(java.util.ArrayList) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage) Teachers(shu.java.csky.entity.Teachers) Search(shu.java.csky.entity.Search) TeacherVo(shu.java.csky.vo.TeacherVo) TeacherPageVo(shu.java.csky.vo.page.TeacherPageVo)

Aggregations

IPage (com.baomidou.mybatisplus.core.metadata.IPage)2 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)2 ArrayList (java.util.ArrayList)2 Teachers (shu.java.csky.entity.Teachers)2 ResultVO (shu.java.csky.vo.ResultVO)2 TeacherVo (shu.java.csky.vo.TeacherVo)2 TeacherPageVo (shu.java.csky.vo.page.TeacherPageVo)2 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)1 List (java.util.List)1 Resource (javax.annotation.Resource)1 BeanUtils (org.springframework.beans.BeanUtils)1 Service (org.springframework.stereotype.Service)1 TeacherService (shu.java.csky.TeacherService)1 SearchMapper (shu.java.csky.dao.SearchMapper)1 TeachersMapper (shu.java.csky.dao.TeachersMapper)1 Search (shu.java.csky.entity.Search)1 ResStatus (shu.java.csky.vo.ResStatus)1 TeacherPageParam (shu.java.csky.vo.param.TeacherPageParam)1