class ProjectService {

  public List<Project> queryPageList(String userName,
                                     String column,
                                     String order,
                                     int pageNo,
                                     int pageSize) throws Exception {
    LOG.info("queryPageList owner:{}, column:{}, order:{}, pageNo:{}, pageSize:{}",
        userName, column, order, pageNo, pageSize);

    List<Project> list = null;
    try (SqlSession sqlSession = MyBatisUtil.getSqlSession()) {
      ProjectMapper projectMapper = sqlSession.getMapper(ProjectMapper.class);
      Map<String, Object> where = new HashMap<>();
      where.put("userName", userName);
      where.put("column", column);
      where.put("order", order);
      list = projectMapper.selectAll(where, new RowBounds(pageNo, pageSize));

      ProjectFilesMapper projectFilesMapper = sqlSession.getMapper(ProjectFilesMapper.class);
      // Query from project_files table, And set to Project Object
      for (Project project : list) {
        Map<String, Object> whereMember = new HashMap<>();
        whereMember.put("projectId", project.getId());
        List<ProjectFiles> projectFilesList = projectFilesMapper.selectAll(whereMember);
        for (ProjectFiles projectFiles : projectFilesList) {
          project.addProjectFilesList(projectFiles);
        }
      }
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      throw new Exception(e);
    }
    return list;
  }

}