一对多数据拼接问题
-
直接使用 c o l l e c t i o n + s e l e c t collection + select collection+select 或者 a s s o c i a t i o n + s e l e c t association + select association+select 进行连接会出现数据重复的问题,子数据有多少条,重复多少次。
<collection property="foodKindMaterialList" ofType="com.jkr.canteen.provider.model.PubFoodKindMaterial" javaType="java.util.List" column="{foodKindId = id}" select="selectChildren"> </collection>
-
直接使用 $collection $ 会出现分页异常,每个页面的数据条数出现异常。
因为原来数据的数据结构是这样的id child 1 c1 1 c2 2 c3 当 p a g e s i z e = 2 pagesize=2 pagesize=2 时,第一页的数据为 id为1 的元素集合后的数据,当 p a g e s i z e = 1 pagesize=1 pagesize=1 的时候,会出现三页数据。