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");
        }
    });
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM