Map中存放数组

复制代码
       Map<String,Object> map = new HashMap<String, Object>();
        Map<String,String> agentMap = new HashMap<String, String>();
        String agentAmt = "123";
        agentMap.put("agentAmt",agentAmt);
        agentMap.put("agentId", "35110230000000393");
        Map [] agentInfo = {agentMap};//[{agentAmt=210.00, agentId=35110230000000393}]
        String b = JsonUtil.toJson(agentInfo);

        map.put("agentInfo", b);//agentInfo=[Ljava.lang.String;@429f81f1
复制代码

 map中放入数组,查询对应的条件

Map<String, Object> conditionMap = new HashMap<String, Object>();
        List<Integer> statusList = Arrays.asList(Borrow.STATUS_FULL,
                Borrow.STATUS_FULL_YES, Borrow.STATUS_REPLYING,
                Borrow.STATUS_REPLY_SUCCESS, Borrow.STATUS_OVERDUE);
        conditionMap.put("statusList", statusList);
        conditionMap.put("userId", userId);
        List borrowList = borrowQueryService.getborrowAccount(conditionMap);

 

复制代码
   <!-- 查询借款资金情况 -->
  <select id="getborrowAccount" parameterType="map" resultType="map">
     SELECT IFNULL(SUM(b.borrow_sum),0) borrowSum,IFNULL(count(b.id),0) as borrowCount ,ua.wait_repay_capital waitRepayCapital, ua.wait_repay_interest waitRepayInterest 
     FROM borrow b LEFT JOIN user_account ua ON b.user_id=ua.user_id 
     WHERE b.user_id=#{userId} AND b.borrow_status IN
     <foreach collection="statusList" item="item" open="(" separator="," close=")">
        #{item}         
     </foreach>
  </select>
复制代码

 

posted @   kangjie  阅读(27707)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示