import org.apache.ibatis.annotations.*;
import java.util.List;
@Mapper
public interface MenuMapper {
@Select("select * from menu where parentid=0")
@Results(id="tree",value = {
@Result(property = "id",column = "id"),
@Result(property = "name",column = "name"),
@Result(property = "parentId",column = "parentId"),
@Result(property = "children",column = "id",many = @Many(select = "getTreeByParentId")),
})
List<Menu> getTreeList();
@Select("select * from menu where parentId = #{parentId}")
@ResultMap("tree")
List<Menu> getTreeByParentId(int parentId);
}