- 请求URL:http://localhost:8081/basic_project/user/mapCode
- 入参出餐
{
"requestId": "1101",
"tenantId": "1102",
"pin": "1104",
"data": {
"id": "5010",
"name": "靳露露"
}
}
- Controller
@PostMapping("/mapCode")
public Object mapCode(@RequestBody BaseRequest<Student> baseRequest) {
System.out.println(JSON.toJSON(baseRequest));
return JSON.toJSON(baseRequest);
}
- 泛型
package com.hxh.basic.project.controller.pojo;
import lombok.Data;
import java.io.Serializable;
/**
* @program wdb-gateway
* @author: jy
* @create: 2021/02/26 13:45
*/
@Data
public class BaseRequest<T> implements Serializable {
private static final long serialVersionUID = -8380835582974221590L;
private String requestId;
private Long tenantId;
private String pin;
private T data;
}
- 实体类
package com.hxh.basic.project.controller.pojo;
import lombok.Data;
import java.io.Serializable;
@Data
public class Student implements Serializable {
private static final long serialVersionUID = -2674800810779287798L;
private Integer id;
private String name;
}