The front-end vue passes values to the back-end list collection object

I encountered some problems when writing the project today, but I don’t know how the front-end assigns values ​​to the back-end list
because all the previous queries are single queries,
as follows

package com.chx.disService.query;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@ApiModel(value = "数据查询对象", description = "数据查询对象封装")
@Data
public class DataQuery implements Serializable {

    //这个是api后面的解释
    @ApiModelProperty(value = "测点名称 1号监测点 2号监测点")
    private Integer point;

    @ApiModelProperty(value = "实时数据 1小时数据 2小时数据")
    private Integer data;

    @ApiModelProperty(value = "查询开始时间", example = "2018-12-20 11:17:12")
    private String begin;//注意,这里使用的是String类型,前端传过来的数据无需进行类型转换

    @ApiModelProperty(value = "查询结束时间", example = "2018-12-30 11:17:12")
    private String end;
}

The front end can assign a value to this point through DataQuery.point

There is a list collection in the object checked this time

as follows

package com.chx.disService.query;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@ApiModel(value = "数据查询对象", description = "数据查询对象封装")
@Data
public class ComplexQuery implements Serializable {

    //这个是api后面的解释
    @ApiModelProperty(value = "测点名称 1号监测点 2号监测点")
    private List points;

    @ApiModelProperty(value = "实时数据 1小时数据 2小时数据")
    private Integer data;

    @ApiModelProperty(value = "查询开始时间", example = "2018-12-20 11:17:12")
    private String begin;//注意,这里使用的是String类型,前端传过来的数据无需进行类型转换

    @ApiModelProperty(value = "查询结束时间", example = "2018-12-30 11:17:12")
    private String end;
}

This time the points is the List collection, and I have been entangled in how to pass the value.
Later, I found that ComplexQuery.points can also assign a value to this list.
This is the value in the list collection displayed by the back-end test, indicating that the assignment was successful.

=================
[1, 2]
=================

Guess you like

Origin blog.csdn.net/he1234555/article/details/115270806