mybatis 之 parameterType="list"

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis 之 parameterType="list"相关的知识,希望对你有一定的参考价值。

    <!-- 根据货品编号查找货品图片地址,货品ID,商品ID,货品名称 -->
    <select id="getGoodsInfoByGoodsNo" parameterType="list" resultMap="goodsResultImg">
    select g.product_id,g.goods_id,g.goods_name,m.pro_image_url,g.goods_no,g.market_price
    from goods g
    inner join product t
    on t.product_id = g.product_id
    and g.is_delete = N
    inner join product_img m
    on m.product_id = t.product_id
    and m.image_type = list
    and m.image_order=1
    where g.goods_no in
    <foreach collection="list" item="listItem" index="index" open="("
            separator="," close=")">
            #{listItem,jdbcType=VARCHAR}
    </foreach>
    List<String> goodsNos = new ArrayList<String>();
                        for (int i = 0; i < templateGoodslist.size(); i++) {
                            goodsNos.add(templateGoodslist.get(i).getGoodsNo());
                        }
                        List<Goods> goodsImgAndPriceList =new ArrayList<Goods>();
                        if(!goodsNos.isEmpty()){
                            goodsImgAndPriceList = this.iGoodsMapper.getGoodsInfoByGoodsNo(goodsNos);
                        }

 

以上是关于mybatis 之 parameterType="list"的主要内容,如果未能解决你的问题,请参考以下文章

mybatis 之parameterType="Long"

MyBatis应用开发映射之参数绑定parameterType

mybati之parameterType传递多个参数

mybatis 之 parameterType="List" 2

mybatis 之 parameterType="list"

mybatis 之 parameterType="Map"