1、class NewsLabel
package com.beans;
import java.io.Serializable;
import java.util.Set;
public class NewsLabel implements Serializable {
private Integer id;
private String name;
private Set<NewsLabel> childrens;
2、INewsLabelDao
package com.dao;
import java.util.List;
import com.beans.NewsLabel;
public interface INewsLabelDao {
List<NewsLabel> selectChildrenByParrentId(Integer pid);
}
3、mapper.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dao.INewsLabelDao">
<resultMap type="com.beans.NewsLabel" id="selectChildren">
<id column="id" property&#