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>
时间: 2024-11-06 16:50:16

mybatis 之 parameterType="Map"的相关文章

mybatis 之resultType=&quot;Map&quot;

Map map = new HashMap(); map.put("productTypeID", productTypeId); List<HashMap> productAttributeList = productsListService.getAttrByTypeID(map); public List<HashMap> getAttrByTypeID(Map map) { return commonDao.queryForList("Prod

mybatis的parameterType使用map实现真正的sql随意写

在dao层给map赋值 纠正一下应该把dd作为传入而不是sbiId; sqlMap中的parameterType="java.util.Map", 就 OK package com.ldrc.srm.jczx.web.results.module.screen; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.spr

mybatis返回List&lt;Map&gt;

mapperl.xml中: <select id="getAmount" parameterType="int" resultType="java.util.HashMap"> <![CDATA[ select count(*) as amount, estate_type as type, status from estate where status=#{status} group by estate_type ]]>

Mybatis学习——传递Map型参数

Spring整合Mybatis调用 1 public boolean editItemSales(int i_id, int i_sales) { 2 Map<String, Object> map = new HashMap<String, Object>(); 3 map.put("i_id", i_id); 4 map.put("i_sales", i_sales); 5 try{ 6 super.getSqlSession().upd

Mybatis中返回Map

在Mybatis中,我们通常会像下边这样用: 返回一个结果 User selectOne(User user); <select id="selectOne" parameterType="cn.lyn4ever.entity.User" resultType="cn.lyn4ever.entity.User"> select id,username,telphone from user where telphone=#{telpho

foreach属性-动态-mybatis中使用map类型参数,其中key为列名,value为列值

http://www.cnblogs.com/anruy/p/5942044.html Integer updateA(@Param("A") Map<String, Double> A); <update id="updateA" parameterType="java.util.Map"> <foreach collection="A.keys" item="key" in

mybatis 之 parameterType=&quot;List&quot; 2

<select id="queryGoodsByGoodsNoPcweb" parameterType="List" resultMap="simpleProductExtLucene"> select g.goods_no, wp.PRODUCT_ID, p.product_name, p.drug_treatment, p.drug_prescription_type, p.product_least_order || '' as

记录一次mybatis中parameterType中使用String和string的区别

今天修改一个问题. xml中使用的是#{xxxx  jdbcType=String} 但是这个sql  查询需要用到  in 如果这样查询 会变成 in  ( "1,2,3,4,5") 所以我把他改成 in <foreach collection="xxx.split(',')" item="item" open="(" close=")" separator=","> #{

mybatis中使用map,进行update或insert

当update一个对象时,可以用Map  在 xml 中 values 的值就是map的key,map的value是前端传来的,这样就不用parameterType=“********.user”  更新时就少些很多<if test=" pwd != null">去判断 原文地址:https://www.cnblogs.com/ukong/p/12244686.html