商城系统查询商品




    <resultMap id="blogResult" type="com.cryq.plus.entity.more.ProductVo">
        <id property="brandName" column="brand_name"/>
        <result property="spuTitle" column="spu_title"/>
        <result property="name" column="category_name"/>
        <result property="spuTitle" column="spu_title"/>
        <result property="categoryId" column="category_id"/>

        <result property="spuStatus" column="spu_status"/>
        <result property="spuActive" column="spu_active"/>

        <result property="spuInfo" column="spu_info"/>
        <collection property="imgSrc" ofType="com.cryq.plus.entity.ShopSpuImg">
            <id property="id" column="SpuImgId"/>
            <result property="mainImg" column="main_img"/>
            <result property="imgSrc" column="img_src"/>
            <result property="status" column="img_status"/>
        </collection>


        <collection property="lists" ofType="com.cryq.plus.entity.more.SkuAttrVo" column="id">
            <id property="id" column="attr_id"/>
            <result property="attrName" column="attr_name"/>
            <collection property="lists" ofType="com.cryq.plus.entity.more.SkuValVo" column="id" javaType="list">
               <id property="id" column="id"/>
                <result property="skuAttrValue" column="sku_attr_value"/>
                <result property="imgSrc" column="img_src"/>
                <result property="skuAttrId" column="skuAttrId"/>
            </collection>
        </collection>
    </resultMap>

    <select id="selectInfo" resultMap="blogResult" >
          SELECT
                b.brand_name AS brand_name,
                c.`name` AS category_name,
                c.id AS category_id,
                spu.spu_title AS spu_title,
                spu.spu_status AS spu_status,
                spu.spu_active AS spu_active,
                img.id AS SpuImgId,
                img.img_src AS img_src,
                img.status as img_status,
                img.main_img as main_img,
                info.spu_info AS spu_info,
                attr.id AS attr_id,
                attr.attr_name AS attr_name,
                val.id as id,
                val.sku_attr_value AS sku_attr_value,
                val.img_src AS img_src ,
                val.sku_attr_id AS skuAttrId
            FROM
                shop_brand b,
                shop_category c,
                shop_sku_attr attr,
                shop_sku_val2 val,
                shop_spu_img img,
                shop_spu_info info,
                shop_spu spu
            WHERE
                b.id = spu.brand_id
                AND c.id = spu.category_id
                AND spu.id = img.spu_id
                AND spu.store_id = img.store_id
                AND spu.id = info.spu_id
                AND spu.id = val.spu_id
                AND attr.id = val.sku_attr_id
                AND spu.store_id = #{storeId}
                AND spu.id = #{spuId}
                AND spu.spu_status = #{status}

            ORDER BY
                img.main_img DESC,val.is_main DESC,
                val.sort ASC

    </select>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

nier6088

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值