Stream流转换
//查询出list后转换成一对多
Map<Integer, List<SysUser>> maps = userService.list().stream().collect(Collectors.groupingBy(SysUser::getAge));
mybatis多表联查
(推荐多表联查使用)
代码
<resultMap id="deliveryAndMaterialMap" type="com.eybond.base.entity.StorageDelivery">
<result column="delivery_code" property="deliveryCode"/>
<result column="delivery_type" property="allSumPrice"/>
<collection property="materialList" ofType="com.eybond.base.entity.MaterialMaster">
<result column="material_code" property="materialCode"/>
<result column="material_name" property="materialName"/>
</collection>
</resultMap>
<select id="productOutPageToFts" resultMap="deliveryAndMaterialMap">
查询语句
</select>