class BackCategoryDAO extends MyBatisDAO<BackCategory> {

    public List<BackCategory> findByPid(Long pid) {
        return getSqlSession().selectList(sqlId("findByPid"), pid);
    }

}

class BackCategoryDAOTest extends MyBatisDAO<BackCategory> {

    private BackCategory bc;
    @Autowired
    private BackCategoryDAO backCategoryDao;

    @Test
    public void testFindByPid() {

        BackCategory bc2 = create("一级类目1", 1, 0L);
        backCategoryDao.create(bc2);

        List<BackCategory> children = backCategoryDao.findByPid(0L);
        assertThat(children).isNotEmpty().hasSize(2);
    }

}