入参是集合怎么传?(借用ArrayList)

应该是这么个形式

{"collectionDtoList":[{"collectionType":1,"typeId":3}]}

使用javabean进行解析对应

import java.util.List;

public class CancelCollectBean {

    private List<CollectionDtoListDTO> collectionDtoList;

    public List<CollectionDtoListDTO> getCollectionDtoList() {
        return collectionDtoList;
    }

    public void setCollectionDtoList(List<CollectionDtoListDTO> collectionDtoList) {
        this.collectionDtoList = collectionDtoList;
    }

    public static class CollectionDtoListDTO {
        private int collectionType;
        private int typeId;

        public int getCollectionType() {
            return collectionType;
        }

        public void setCollectionType(int collectionType) {
            this.collectionType = collectionType;
        }

        public int getTypeId() {
            return typeId;
        }

        public void setTypeId(int typeId) {
            this.typeId = typeId;
        }
    }
}

参数组装

  List<CancelCollectBean.CollectionDtoListDTO> collectionDtoList = new ArrayList<>();
                            CancelCollectBean.CollectionDtoListDTO collectionDtoListDTO = new CancelCollectBean.CollectionDtoListDTO();
                            collectionDtoListDTO.setCollectionType(1);
                            Log.e("wy", "156onItemClick: "+records.get(position).getTypeId() );
                            collectionDtoListDTO.setTypeId(records.get(position).getTypeId());
                            collectionDtoList.add(collectionDtoListDTO);
    RequestParams params = new RequestParams(Constant.delCollection);
                            params.addHeader("Authorization", Constant.authorization);
                            params.addHeader("language", Constant.system_language);
                            params.setAsJsonContent(true);
                收藏类型,1:商品,2:服务,3:SPU,4:专家,5,:品牌
//                            params.addBodyParameter("collectionType", 1);
//                            //                expertRemarkName  专家备注名
                params.addBodyParameter("expertRemarkName", "lbb");
//                            //                收藏对象ID。收藏商品时传商品ID,收藏服务时传服务ID,收藏SPU时传SpuId,收藏专家时传专家id
//                            params.addBodyParameter("typeId",records.get(position).getTypeId());

                            params.addBodyParameter("collectionDtoList", collectionDtoList);
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值