问题遇到的现象和发生背景
Java Controller 传递对象函数,其中包含一个数组,COLUMN没有获取到值,请问怎么才能获取到COLUMN的值?
传参如下:
{
"jobName":"Datax",
"jobDes":"Test",
"spliteRK":"datasource_id",
"tableName":"sys_datasource",
"COLUMN":[
"datasource_id","datasource_name"
]
}
Controller 代码如下:
public AjaxResult add(@RequestBody SysReader sysReader) {
System.out.println(sysReader);
}
输出如下:
SysReader{jobname='Datax', jobDes='Test', spliteRK='datasource_id', readerMode='null', tablename='sys_datasource', COLUMN=null, where='null'}
COLUMN 没有获取到值,请问怎么才能获取到COLUMN的值?
SysReader定义如下:
public class SysReader {
private static final long serialVersionUID = 1L;
/** 任务名称*/
private String jobName;
/** 任务描述 */
private String jobDes;
/** 切分键 */
private String spliteRK;
/** 任务模式 */
private String readerMode;
/** 表名 */
private String tableName;
/** 表字段名称 */
private ArrayList<String> COLUMN;
/** 表字段名称 */
private String where;
private String querySql;
public String getQuerySql() {
return querySql;
}
public void setQuerySql(String querySql) {
this.querySql = querySql;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public String getJobDes() {
return jobDes;
}
public void setJobDes(String jobDes) {
this.jobDes = jobDes;
}
public String getSpliteRK() {
return spliteRK;
}
public void setSpliteRK(String spliteRK) {
this.spliteRK = spliteRK;
}
public String getReaderMode() {
return readerMode;
}
public void setReaderMode(String readerMode) {
this.readerMode = readerMode;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public ArrayList<String> getCOLUMN() {
return COLUMN;
}
public void setCOLUMN(ArrayList<String> COLUMN) {
this.COLUMN = COLUMN;
}
public String getWhere() {
return where;
}
public void setWhere(String where) {
this.where = where;
}
@Override
public String toString() {
return "SysReader{" +
"jobname='" + jobName + '\'' +
", jobDes='" + jobDes + '\'' +
", spliteRK='" + spliteRK + '\'' +
", readerMode='" + readerMode + '\'' +
", tablename='" + tableName + '\'' +
", COLUMN=" + COLUMN +
", where='" + where + '\'' +
'}';
}
}