freemark动态加载列表数据

1.ftl页面中
 <table  class="table table-striped table-hover table-bordered" name="record"  id="editable-sample">
 </table>

 function pay_details(game_id){
  
    $("[name='record']").html(""); //获取上面table的name,清空table
    $.post('${basePath}/agency/pay_details.shtml',{
        "game_id":game_id
    },function(result){
        var html_="";
        var html__="";
        html_=html_+
        "<thead >"+
        "<tr>"+
            "<th>游戏ID</th>"+
            "<th>充值人</th>"+
            "<th>游戏用户名</th>"+
            "<th>金额</th>"+
            "<th>兑换率</th>"+
            "<th>充值金币</th>"+
            "<th>订单号</th>"+
            "<th>充值时间</th>"+
            "<th>支付状态</th>"+
            "<th>充值状态</th>"+
            "<th>充值类型</th>"+
        "</tr>"+
    	"</thead>";
        $.each(result, function(idx, obj) {
            html__=html__+ 
            "<tr>"+
	        "<td>"+obj.GameID+"</td>"+
	        "<td>"+obj.TrueName+"</td>"+
	        "<td>"+obj.UserName+"</td>"+
	        "<td>"+obj.PayMoney+"</td>"+
	        "<td>"+obj.ExchangeRate+"</td>"+
	        "<td>"+obj.InMoney+"</td>"+
	        "<td>"+obj.OrderID+"</td>"+
	        "<td>"+obj.AddTime+"</td>"+
	        "<td>"+(obj.PaySuccess=='true'? '已支付' :'未支付')+"</td>"+
	        "<td>"+(obj.InSuccess=='true'? '已充值' : '未充值')+"</td>"+
	        "<td>"+obj.TypeInfo+"</td>"+
	    	"</tr>";
        });
        $("[name='record']").html(html_+html__);//把固定行和动态遍历的行加载到table中
    });
}
2.controller中提供List数据
 @RequestMapping(value = "pay_details", method = RequestMethod.POST)
    @ResponseBody
    public List<Map<String, String>> pay_details(HttpServletRequest request) {
        List<Map<String, String>> si = new ArrayList<Map<String, String>>();
        if (request.getParameter("game_id") != null && request.getParameter("game_id") != "") {
            // 发送 POST 请求
            String game_id = request.getParameter("game_id").toString();
            String sr = RequestService.sendPost(InterfaceAddressConfig.get("GetOrderList"),
                    "game_id="+ game_id
                    + "&pageSize=900000&pageIndex=1");// 请求充值成功的conditions=1为充值成功,每页90w条
            HashMap<String, String> stringToMap = StringToMap.StringToMap(sr);
            if (!"[]".equals(stringToMap.get("list").toString())) {
                String replace = stringToMap.get("list").toString().replace("[", "").replace("]", "");
                String[] arr = replace.split("\\},\\{");
                List<String> list = java.util.Arrays.asList(arr);
                for (String list_ : list) {
                    String lists = "{" + list_.replace("{", "").replace("}", "") + "}";
                    System.out.println(lists);
                    HashMap<String, String> itemMap = StringToMap.StringToMap(lists);
                    si.add(itemMap);
                }
            }

        }
        return si;

    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值