Search in sources :

Example 6 with ResourceMapper

use of com.cas.sim.tis.mapper.ResourceMapper in project TeachingInSimulation by ScOrPiOzzy.

the class ResourceServiceImpl method findResourcesByCollection.

@Override
public PageInfo<Resource> findResourcesByCollection(int pagination, int pageSize, List<Integer> resourceTypes, String keyword, String orderByClause, Integer creator) {
    ResourceMapper resourceMapper = (ResourceMapper) mapper;
    // 开始分页查询
    PageHelper.startPage(pagination, pageSize, orderByClause);
    List<Resource> result = resourceMapper.findResourcesByCollection(resourceTypes, keyword, creator);
    PageInfo<Resource> page = new PageInfo<Resource>(result);
    // 查到的总记录数
    // 解释一下:这个page.getTotal(),是所有符合条件的记录数。
    // result.size():是当前页中的数据量 <= pageSize
    LOG.info("成功查找到{}条资源,当前页码{},每页{}条资源,共{}页", result.size(), pagination, pageSize, page.getPages());
    return page;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) ResourceMapper(com.cas.sim.tis.mapper.ResourceMapper) Resource(com.cas.sim.tis.entity.Resource)

Aggregations

ResourceMapper (com.cas.sim.tis.mapper.ResourceMapper)6 DataSourceTransactionManager (org.springframework.jdbc.datasource.DataSourceTransactionManager)3 TransactionStatus (org.springframework.transaction.TransactionStatus)3 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)3 Collection (com.cas.sim.tis.entity.Collection)2 Resource (com.cas.sim.tis.entity.Resource)2 PageInfo (com.github.pagehelper.PageInfo)2 Condition (tk.mybatis.mapper.entity.Condition)2 Criteria (tk.mybatis.mapper.entity.Example.Criteria)2 BrowseHistory (com.cas.sim.tis.entity.BrowseHistory)1 ResourceInfo (com.cas.sim.tis.vo.ResourceInfo)1