Coder Social home page Coder Social logo

Comments (1)

zsy0216 avatar zsy0216 commented on August 12, 2024

对应P205
不改的话类型映射会出问题
这里会遇到一个问题,就是方法getAttrGroupWithAttrsBySpuId明明指定了返回类型为List(SpuItemAttrGroupVo)
漏写resultmap的话,返回类型为List(AttGroupEntity)居然不报错?

`

<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.zsy.product.entity.AttrGroupEntity" id="attrGroupMap">
    <result property="attrGroupId" column="attr_group_id"/>
    <result property="attrGroupName" column="attr_group_name"/>
    <result property="sort" column="sort"/>
    <result property="descript" column="descript"/>
    <result property="icon" column="icon"/>
    <result property="catelogId" column="catelog_id"/>
</resultMap>
<resultMap id="spuItemAttrGroupVo" type="com.zsy.product.vo.SpuItemAttrGroupVo">
    <result property="groupName" column="attr_group_name"></result>
    <collection property="attrs" ofType="com.zsy.product.vo.Attr">
        <result column="attr_name" property="attrName"></result>
        <result column="attr_value" property="attrValue"></result>
    </collection>
</resultMap>

<select id="getAttrGroupWithAttrsBySpuId" resultMap="spuItemAttrGroupVo">
    SELECT
        product.spu_id,
        pag.attr_group_id,
        pag.attr_group_name,
        product.attr_id,
        product.attr_name,
        product.attr_value
    FROM
        pms_product_attr_value product
            LEFT JOIN pms_attr_attrgroup_relation paar ON product.attr_id = paar.attr_id
            LEFT JOIN pms_attr_group pag ON paar.attr_group_id = pag.attr_group_id
    WHERE
        product.spu_id = #{spuId}
      AND pag.catelog_id = #{catalogId}

</select>

`

多谢,确实少写了,没注意到这个地方。

from guli-mall.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.