mybatis实用操作—— @MapKey

在mybatis中,可以将list集合转成map返回。用到注解:

 @MapKey("wiKey")
    Map summaryCurrentStore(@Param("storeId")Long storeId,
                                                               @Param("customerId") Long customerId,
                                                               @Param("skuIdSet") Set skuIdSet);




        
        
        
        
        
        
        
        
        
    

如果不加 @MapKey("wiKey"),就会报错;

java.lang.ClassCastException: com.runlion.sat.wms.vo.WarehouseInventoryLogMapVO cannot be cast to java.util.Map。

其实直接返回List也可以,然后实用jdk8流的map操作也可以。

你可能感兴趣的:(MyBatis,工作笔记)