• Java接收带List的实体类


    @PostMapping("/add")
        @ApiOperation(value = "新增价格联动补贴信息",notes = "param")
        public MessageTo<String> addPriceAllowance(@RequestBody PriceAllowanceParam param) throws InvalidSystemClockException {
            return priceAllowanceInfoService.addPriceAllowance(param);
        }
    
    
    //实体类
    package com.panchina.adjustment.domain.param;
    
    import com.panchina.adjustment.domain.entity.PriceAllowanceDetail;
    import lombok.Data;
    
    import java.math.BigDecimal;
    import java.util.List;
    
    @Data
    public class PriceAllowanceParam {
        private Long id;
    
        private Integer yearIndex;
    
        private Integer monthIndex;
    
        private String remark;
    
        private String areaCode;
    
        private BigDecimal cpi;
    
        private BigDecimal foodPriceIndex;
    
        private BigDecimal scpi;
    
        private BigDecimal paymentAmount;
    
        private Integer paymentTime;
        private Integer minimumStandard;
    
        private Integer highestStandard;
        private List<PriceAllowanceDetail> allowanceDetails;
    
    }

    前端调用

    form: {
            yearIndex: "",
            monthIndex: "",
            areaCode: "",
            cpi: "",
            foodPriceIndex: "",
            scpi: "",
            paymentAmount: "",
            paymentTime: "",
            minimumStandard: "",
            highestStandard: "",
            remark: "",
            allowanceDetails: [
              {
                issueObject: "城镇最低生活保障对象",
                paymentAmount: 0,
                paymentTime: "0",
                minimumStandard: "0",
                highestStandard: "0",
                remark: "",
                sort: 1
              },
              {
                issueObject: "农村最低生活保障对象",
                paymentAmount: 0,
                paymentTime: "0",
                minimumStandard: "0",
                highestStandard: "0",
                remark: "",
                sort: 2
              }
            ]
          }
    
    addPriceAllowance() {
        this.$refs.form.validate(valid => {
            if (valid) {
                let data = JSON.stringify(this.form);
                if (this.form.id == "" || this.form.id == undefined) {
                    axios({
                            method: "post", //请求方式
                            url: "/price-adjustment/api/priceAllowance/add", //请求地址
                            headers: {
                                "Content-Type": "application/json;charset=UTF-8"
                            },
                            data: data
                        })
                        .then(res => {
                            if (res.data.success) {
                                this.$router.push("/subsidy");
                            }
                        })
                        .catch(err => {});
                }
            } else {
                console.log("error");
            }
        });
    }
  • 相关阅读:
    CSS3 animation 属性
    关于shortcut icon和icon代码的区别介绍
    用js判断一个复选框是否被选中
    今天开始,走不一样的路
    JavaScript 中的对象
    (已转)Linux基础第七章 线程
    (已转)C++知识图谱
    Linux基础 文件和目录
    (已转)Linux基础第六章 信号
    Linux第四章 进程
  • 原文地址:https://www.cnblogs.com/yyjspace/p/12197280.html
Copyright © 2020-2023  润新知