首页 > 代码库 > mybatis 之 parameterType="list"

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"