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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM