MyBatis基础1-参数

本文介绍了MyBatis中两种特殊的参数类型:List<Map>及Map的value为List的情况,详细阐述了如何在映射文件中处理这两种类型的参数,提供了相关教程链接以供深入学习。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

myBatis类型分类:

http://www.cnblogs.com/mingyue1818/p/3714162.html

参数类型是List,List的泛型是Map:

##参数内容List<Map<Key,Value>>
//Dao中的接口
List<TbAdItemComment> getScan(@Param("mapList") List<Map<String, Object>> mapList,
            @Param("storeId") String storeId, @Param("customerId") String customerId);

<!-- xml中的List<Map<Key,Value>>的使用方式 -->
<foreach item="map" collection="mapList" index="index" open="("
    separator=" union all " close=") m">
    (select DISTINCT jan,ad_score
    from
    tb_item_bid_price
    where
    product_kind = #{map.kind}
    and delete_flg='0'
    order by ad_score desc
    limit #{map.numbers})
</foreach>

参数类型是Map,Map的value泛型是List,且需要便利map的key:

https://www.cnblogs.com/yg_zhang/p/4314602.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值