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>