dao层:
@Select("<script>" +
"select * from t_parent" +
"</script>")
@Results({
@Result(property="children",column="id",many=@Many(select="com.sample.demo.dao.getList"))
})
List<Type> getList(@Param("code") String code);
com.sample.demo.dao.getList是子查询的包路径,具体内容如下
子查询的dao:
@Select("<script>" +
"select * from t_child where parent_id=#{id}" +
"</script>")
List<ChildrenType> getList(@Param("id") String id);