mybatis 之 parameterType="Map"

  // 获得品牌下的商品
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("brands", brandId);
            List<HashMap<String, Object>> productBrands = productBrandService.getBrandProductByBrandId(params);
public List<HashMap<String, Object>> getBrandProductByBrandId(Map<String, Object> params) {
        return commonDao.queryForList("ProductBrand.getBrandProductByBrandId",params);
    }
    <!-- 根据品牌id获取品牌下的商品列表 -->
    <select id="getBrandProductByBrandId" parameterType="Map" resultMap="simpleProductExtBrand">
        select
        pro.*,pi.pro_image_url
        from
        (
        select g.goods_no,
        p.product_id,p.product_name,p.drug_treatment,p.drug_prescription_type,g.goods_id,g.market_price,p.product_least_order,g.sale_amount as
        sale_amount,g.click_amount,g.available_stock,
        (case when
        g.discount_state='enable' and g.member_ranks='0' and
        to_char(sysdate,'yyyy-mm-dd hh24:mi:dd') between g.begin_time
        and
        g.end_time
        and g.discount_price is not null and g.discount_price!=0
        then g.discount_price
        else g.ec_price
        end
        ) as ec_price,
        (case when
        g.discount_state='enable' and to_char(sysdate,'yyyy-mm-dd
        hh24:mi:dd')
        between
        g.begin_time and g.end_time
        then g.promote_phrase
        else ''
        end
        ) as
        promote_phrase
        <!-- 商品评价 -->
        ,(select pe.evaluation_count from product_expand pe where pe.product_id=p.product_id and pe.is_delete='N') as
        commentSum,p.onsale_time,g.discount_state,g.promote_rule_ids
        from
        product p,goods g,product_brand_goods pbg
        where
        p.product_id=g.product_id
        and g.goods_id = pbg.goods_id
        and p.is_delete='N' and
        g.is_delete='N'
        and pbg.is_delete = 'N'
        and p.is_onsale='Y' and g.is_default='Y'
        and g.goods_no not like 'AJ%'
        and pbg.brand_id = #{brands}
        ) pro
        left join (select pig.product_id as product_id,
                                pig.image_order,
                                pig.pro_image_url as pro_image_url
                           from product_img pig
                          where pig.image_type = 'list'
                          and pig.image_order=1) pi on
        pro.product_id=pi.product_id
    </select>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值