Mybatis List Map

*java

 ServiceImpl.javaweb

@Override
    public List<ProdInfo> selectList2(List<ProdInfo> prodInfos){
        /*Map<String, Object> map = new HashMap<String, Object>();  
        map.put("prodInfos", prodInfos);
        return prodInfoMapper.selectList2(map);*/
        return prodInfoMapper.selectList3(prodInfos);
    }

Mapper.javaapi

public List<ProdInfo> selectList3(List<ProdInfo> prodInfos);
    
    public List<ProdInfo> selectList2(Map<String,Object> prodInfos);

Mapper.xmlapp

<select id="selectList2"         
        resultType="com.webapi.prod.entity.ProdInfo" >
                
        SELECT * FROM PROD_INFO P WHERE P.PROD_ID IN 
        <foreach collection="prodInfos" item="Prod" index="index"
            open="(" close=")" separator=",">
            #{Prod.prod_id}
        </foreach> 
    </select>
    
    <select id="selectList3"         
        resultType="com.webapi.prod.entity.ProdInfo" >
                
        SELECT * FROM PROD_INFO P WHERE P.PROD_ID IN 
        <foreach collection="list" item="Prod" index="index"
            open="(" close=")" separator=",">
            #{Prod.prod_id}
        </foreach> 
    </select>

 

*ide

相關文章
相關標籤/搜索