@Override public Role get(long id) { SqlSession sqlSession = sqlSessionFactory.openSession(); Role role = null; try { role = roleMapper.select(id); } finally { sqlSession.close(); } return role; }
@Override public Role getByName(String name) { SqlSession sqlSession = sqlSessionFactory.openSession(); Role role = null; try { role = roleMapper.selectByName(name); } finally { sqlSession.close(); } return role; }
@Override public ListPage<Role> list(long start, long size) { SqlSession sqlSession = sqlSessionFactory.openSession(); ListPage<Role> page = null; try { page = new ListPage<>(start, size); page.setItems(roleMapper.list(page)); } finally { sqlSession.close(); } return page; }