🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
##细颗粒缓存规范 mybatis无特殊情况,不应使用关联(join、left join、right join、out join、select * from A,B where a.b_id = b.id),在使用关联的地方一律使用嵌套查询代替 ####关联查询方式 ![](https://box.kancloud.cn/2016-01-26_56a6ccd7705ba.png) ####嵌套查询方式 ![](https://box.kancloud.cn/2016-01-26_56a6ccd783dce.png) ![](https://box.kancloud.cn/2016-01-26_56a6ccd795fb5.png) ![](https://box.kancloud.cn/2016-01-26_56a6ccd7a4a23.png) <resultMap type="com.mlgh.entity.ProductsReleased" id="productMap" extends="BaseResultMap"> <association property="baseMaterialTypes" javaType="com.mlgh.entity.BaseMaterialTypes" column="base_material_type_id" select="com.mlgh.dao.BaseMaterialTypesMapper.selectByPrimaryKey"/> <collection property="productAttrValues" javaType="ArrayList" ofType="com.mlgh.entity.ProductAttrValues" column="productId=latest_product_id" select="com.mlgh.dao.ProductAttrValuesMapper.getProductAttrValues"></collection> <collection property="pictures" javaType="ArrayList" ofType="com.mlgh.entity.Pictures" column="productId=latest_product_id" select="com.mlgh.dao.PicturesMapper.getPictures"></collection> <collection property="pricesReleaseds" javaType="ArrayList" ofType="com.mlgh.entity.PricesReleased" column="productId=latest_product_id" select="com.mlgh.dao.PricesReleasedMapper.getPrice"></collection> </resultMap>