写实体,list集合嵌套集合,所对应的名称必须一样

private List<OrderListModel> infos;
public List<OrderListModel> getInfos() {
        return infos;
    }
    public void setInfos(List<OrderListModel> infos) {
        this.infos = infos;
    }

接口文档

 "infos": [                                        //订单详情列表
            {
                "category": "其他",                       //单品名称1
                "goodsId": -1,
                "id": 877449196964196400,
                "orderNo": "877449195714293760",
                "preferentPrice": 0,
                "price": 3,                               //单价
                "reserve": "",
                "totalAmount": 0,
                "totalPrice": 1.5,                        //总价1
                "weight": 0.494                           //总重量1
            },
            {
                "category": "蟹子",
                "goodsId": 209,
                "id": 877449196997750800,
                "orderNo": "877449195714293760",
                "preferentPrice": 0,
                "price": 9.99,
                "reserve": "",
                "totalAmount": 0,
                "totalPrice": 4.9,
                "weight": 0.494
            }
        ],

所有

public class OrderDetail {
    //订单号
    private String orderNo;
    //下单时间
    private String placeTime;
    //消费者ID
    private String userId;
    //种类
    private int payType;
    //得分
    private int score;
    //总价
    private double totalPrice;




    private List<OrderListModel> infos;




    public List<OrderListModel> getInfos() {
        return infos;
    }
    public void setInfos(List<OrderListModel> infos) {
        this.infos = infos;
    }
    public static class OrderListModel {

           //种类
            private String category;
            //重量
            private double weight;
            //小计
            private double totalPrice;

            public String getCategory() {
                return category;
            }

            public void setCategory(String mCategory) {
                category = mCategory;
            }

            public double getWeight() {
                return weight;
            }

            public void setWeight(double mWeight) {
                weight = mWeight;
            }

            public double getTotalPrice() {
                return totalPrice;
            }

            public void setTotalPrice(double mTotalPrice) {
                totalPrice = mTotalPrice;
            }
       }

    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    public String getPlaceTime() {
        return placeTime;
    }
    public void setPlaceTime(String placeTime) {
        this.placeTime = placeTime;
    }
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    public int getPayType() {
        return payType;
    }
    public void setPayType(int payType) {
        this.payType = payType;
    }
    public int getScore() {
        return score;
    }
    public void setScore(int score) {
        this.score = score;
    }
    public double getTotalPrice() {
        return totalPrice;
    }
    public void setTotalPrice(double totalPrice) {
        this.totalPrice = totalPrice;
    }





}

接口文档

接口返回值:
{
    "appVersion": 0,
    "code": "1000",
    "info": {
        "boothNo": "370203010003",
        "cancelTime": "",
        "dealPrice": 0.01,
        "from": 1,
        "infos": [                                        //订单详情列表
            {
                "category": "其他",                       //单品名称1
                "goodsId": -1,
                "id": 877449196964196400,
                "orderNo": "877449195714293760",
                "preferentPrice": 0,
                "price": 3,                               //单价
                "reserve": "",
                "totalAmount": 0,
                "totalPrice": 1.5,                        //总价1
                "weight": 0.494                           //总重量1
            },
            {
                "category": "蟹子",
                "goodsId": 209,
                "id": 877449196997750800,
                "orderNo": "877449195714293760",
                "preferentPrice": 0,
                "price": 9.99,
                "reserve": "",
                "totalAmount": 0,
                "totalPrice": 4.9,
                "weight": 0.494
            }
        ],
        "orderNo": "877449195714293760",
        "payTime": "2017-06-21 16:52:45",
        "payType": 4,
        "placeTime": "2017-06-21 16:52:45",
        "preferentPrice": 0,
        "realPrice": 0.01,
        "regCode": "370200018085418",
        "score": 0,
        "status": 2,
        "thridNo": "",
        "thridPayNo": "",
        "totalPrice": 0.01,
        "userId": 877438524926783500,
        "userPhone": ""
    },
    "list": [],
    "message": "操作成功",
    "pks": "",
    "total": "",
    "updateUrl": "",
    "userInfo": null
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
仿某团list嵌套list\ package com.zl.listview; import java.util.ArrayList; import java.util.HashMap; import com.kjy.kjylistview.R; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.Toast; /** * @author zl * @time 2014年12月24日15:37:18 */ public class QianTaoListviewActivity extends Activity { private ListView listView; private ArrayList<HashMap<String, Object>> parentList, childList; private ParentAdapter parentAdapter; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_qiantao); init(); } private void init() { listView = (ListView) findViewById(R.id.qiantao_lv); getList(); } private void getList() { parentList = new ArrayList<HashMap<String, Object>>(); for (int i = 1; i < 10; i++) { childList = new ArrayList<HashMap<String, Object>>(); for (int j = i < 7 ? i : 7; j < 9; j++) { HashMap<String, Object> ParentMap = new HashMap<String, Object>(); ParentMap.put("parent_title", "三木铁板烧" + i); ParentMap.put("parent_address", "8." + i); ParentMap.put("parent_distance", "1" + i); ParentMap.put("parent_distance1", "已售123" + i); childList.add(ParentMap); } HashMap<String, Object> map = new HashMap<String, Object>(); map.put("child_item_title", "九州八拖二火锅" + i); map.put("child_item_price_old", "4." + i + "分"); map.put("child_item_price_score", "(100人)"); map.put("parent_lv", childList); parentList.add(map); } parentAdapter = new ParentAdapter(parentList, QianTaoListviewActivity.this); listView.setAdapter(parentAdapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Intent intent = new Intent(QianTaoListviewActivity.this, Activity_1.class); Toast.makeText(QianTaoListviewActivity.this, "第" + arg2 + "个条目", Toast.LENGTH_LONG).show(); startActivity(intent); } }); } }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值