赞
踩
原xml:
- <resultMap id="spuItemAttrGroupVo" type="com.atguigu.gulimall.product.vo.SpuItemAttrGroupVo">
- <result property="groupName" column="attr_group_name"></result>
- <collection property="attrs" ofType="com.atguigu.gulimall.product.vo.SpuBaseAttrVo">
- <result column="attr_name" property="attrName"></result>
- <result column="attr_value" property="attrValues"></result>
- </collection>
- </resultMap>
- <select id="getAttrGroupWithAttrsBySpuId"
- resultType="spuItemAttrGroupVo">
- SELECT attr_name ,attr_value ,pag.attr_group_name
- FROM pms_product_attr_value ppav
- LEFT JOIN pms_attr_attrgroup_relation paar ON paar.attr_id = ppav.attr_id
- LEFT JOIN pms_attr_group pag ON pag.attr_group_id= paar.attr_group_id and pag.catelog_id= #{catalogId}
- WHERE ppav.spu_id = #{spuId};
- </select>
后面发现 把 resultMap 写成了 resultType ,修改后:程序运行成功
- <resultMap id="spuItemAttrGroupVo" type="com.atguigu.gulimall.product.vo.SpuItemAttrGroupVo">
- <result property="groupName" column="attr_group_name"></result>
- <collection property="attrs" ofType="com.atguigu.gulimall.product.vo.SpuBaseAttrVo">
- <result column="attr_name" property="attrName"></result>
- <result column="attr_value" property="attrValues"></result>
- </collection>
- </resultMap>
- <select id="getAttrGroupWithAttrsBySpuId"
- resultMap="spuItemAttrGroupVo">
- SELECT attr_name ,attr_value ,pag.attr_group_name
- FROM pms_product_attr_value ppav
- LEFT JOIN pms_attr_attrgroup_relation paar ON paar.attr_id = ppav.attr_id
- LEFT JOIN pms_attr_group pag ON pag.attr_group_id= paar.attr_group_id and pag.catelog_id= #{catalogId}
- WHERE ppav.spu_id = #{spuId};
- </select>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。