Search in sources :

Example 1 with PageInfo

use of com.github.pagehelper.PageInfo in project TeachingInSimulation by ScOrPiOzzy.

the class ClassServiceImpl method findClasses.

@Override
public PageInfo<Class> findClasses(int pageIndex, int pageSize) {
    ClassMapper classMapper = (ClassMapper) mapper;
    PageHelper.startPage(pageIndex, pageSize);
    List<Class> result = classMapper.findClasses();
    PageInfo<Class> page = new PageInfo<>(result);
    LOG.info("成功查找到{}条资源,当前页码{},每页{}条资源,共{}页", page.getTotal(), pageIndex, pageSize, page.getPages());
    return page;
}
Also used : ClassMapper(com.cas.sim.tis.mapper.ClassMapper) PageInfo(com.github.pagehelper.PageInfo) Class(com.cas.sim.tis.entity.Class)

Example 2 with PageInfo

use of com.github.pagehelper.PageInfo in project TeachingInSimulation by ScOrPiOzzy.

the class LibraryPublishServiceImpl method findPublishForTeacher.

@Override
public PageInfo<LibraryPublishForTeacher> findPublishForTeacher(int pageIndex, int pageSize, int creator) {
    LibraryPublishMapper publishMapper = (LibraryPublishMapper) mapper;
    PageHelper.startPage(pageIndex, pageSize);
    List<LibraryPublishForTeacher> result = publishMapper.findPublishForTeacher(creator);
    PageInfo<LibraryPublishForTeacher> page = new PageInfo<>(result);
    LOG.info("成功查找到{}条资源,当前页码{},每页{}条资源,共{}页", result.size(), pageIndex, pageSize, page.getPages());
    return page;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) LibraryPublishMapper(com.cas.sim.tis.mapper.LibraryPublishMapper) LibraryPublishForTeacher(com.cas.sim.tis.vo.LibraryPublishForTeacher)

Example 3 with PageInfo

use of com.github.pagehelper.PageInfo in project TeachingInSimulation by ScOrPiOzzy.

the class LibraryServiceImpl method findLibraryByType.

@Override
public PageInfo<Library> findLibraryByType(int pageIndex, int pageSize, int type) {
    Condition condition = new Condition(Library.class);
    Criteria criteria = condition.createCriteria();
    criteria.andEqualTo("type", type);
    criteria.andEqualTo("del", 0);
    PageHelper.startPage(pageIndex, pageSize);
    List<Library> result = findByCondition(condition);
    PageInfo<Library> page = new PageInfo<Library>(result);
    LOG.info("成功查找到{}条资源,当前页码{},每页{}条资源,共{}页", result.size(), pageIndex, pageSize, page.getPages());
    return page;
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) PageInfo(com.github.pagehelper.PageInfo) Criteria(tk.mybatis.mapper.entity.Example.Criteria) Library(com.cas.sim.tis.entity.Library)

Example 4 with PageInfo

use of com.github.pagehelper.PageInfo in project TeachingInSimulation by ScOrPiOzzy.

the class QuestionServiceImpl method findQuestionsByLibrary.

@Override
public PageInfo<Question> findQuestionsByLibrary(int pageIndex, int pageSize, int rid) {
    Condition condition = new Condition(Question.class);
    Criteria criteria = condition.createCriteria();
    criteria.andEqualTo("relateId", rid);
    PageHelper.startPage(pageIndex, pageSize);
    List<Question> result = findByCondition(condition);
    PageInfo<Question> page = new PageInfo<>(result);
    LOG.info("成功查找到{}条资源,当前页码{},每页{}条资源,共{}页", result.size(), pageIndex, pageSize, page.getPages());
    return page;
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) PageInfo(com.github.pagehelper.PageInfo) Question(com.cas.sim.tis.entity.Question) Criteria(tk.mybatis.mapper.entity.Example.Criteria)

Example 5 with PageInfo

use of com.github.pagehelper.PageInfo in project TeachingInSimulation by ScOrPiOzzy.

the class ResourceServiceImpl method findResourcesByCreator.

@Override
public PageInfo<Resource> findResourcesByCreator(int pagination, int pageSize, List<Integer> resourceTypes, String keyword, String orderByClause, Integer creator) {
    // 获取当前登陆者身份信息
    Condition condition = new Condition(Resource.class);
    // 条件1、查找用户指定的几种资源类型
    if (resourceTypes.size() == 0) {
        return new PageInfo<Resource>(new ArrayList<Resource>());
    } else {
        Criteria criteria = condition.createCriteria();
        criteria.andIn("type", resourceTypes);
    }
    // 条件2、关键字搜索
    if (keyword != null && !"".equals(keyword)) {
        Criteria criteria = condition.createCriteria();
        List<String> words = StringUtil.split(keyword, ' ');
        for (String word : words) {
            criteria.orLike("keyword", "%" + word + "%");
        }
        condition.and(criteria);
    }
    Criteria criteria = condition.createCriteria();
    criteria.andEqualTo("creator", creator);
    condition.and(criteria);
    // 开始分页查询
    PageHelper.startPage(pagination, pageSize, orderByClause);
    List<Resource> result = findByCondition(condition);
    PageInfo<Resource> page = new PageInfo<Resource>(result);
    // 查到的总记录数
    // 解释一下:这个page.getTotal(),是所有符合条件的记录数。
    // result.size():是当前页中的数据量 <= pageSize
    LOG.info("成功查找到{}条资源,当前页码{},每页{}条资源,共{}页", result.size(), pagination, pageSize, page.getPages());
    return page;
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) PageInfo(com.github.pagehelper.PageInfo) Resource(com.cas.sim.tis.entity.Resource) Criteria(tk.mybatis.mapper.entity.Example.Criteria)

Aggregations

PageInfo (com.github.pagehelper.PageInfo)232 EUDataGridResult (com.megagao.production.ssm.domain.customize.EUDataGridResult)90 PostMapping (org.springframework.web.bind.annotation.PostMapping)62 Test (org.junit.Test)21 UserMapper (com.github.pagehelper.mapper.UserMapper)17 User (com.github.pagehelper.model.User)17 SqlSession (org.apache.ibatis.session.SqlSession)17 ApiOperation (io.swagger.annotations.ApiOperation)14 TaskRecordDetail (com.eservice.api.model.task_record.TaskRecordDetail)11 Condition (tk.mybatis.mapper.entity.Condition)8 DataTablesResult (cn.exrick.common.pojo.DataTablesResult)7 ArrayList (java.util.ArrayList)6 Criteria (tk.mybatis.mapper.entity.Example.Criteria)6 TaskRecord (com.eservice.api.model.task_record.TaskRecord)4 Product (com.megagao.production.ssm.domain.Product)4 Task (com.megagao.production.ssm.domain.Task)4 ManufactureVO (com.megagao.production.ssm.domain.vo.ManufactureVO)4 WorkVO (com.megagao.production.ssm.domain.vo.WorkVO)4 RowBounds (org.apache.ibatis.session.RowBounds)4 Device (com.megagao.production.ssm.domain.Device)3