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

本文介绍了一个订单详情列表的Java类实现及其接口文档。通过具体的代码示例,展示了如何使用类来存储和获取订单详情信息,包括单品名称、单价、总价等关键数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值