如題,在用swagger生成在線api檔案的時候,
@ApiModelProperty(value="https://bbs.csdn.net/topics/客戶編號",required=true)
private String customerNo;
@ApiModelProperty(value="https://bbs.csdn.net/topics/客戶姓名")
private String name;
@ApiModelProperty(value="https://bbs.csdn.net/topics/銀行卡資訊")
private CardInfo cardInfo ;
這個銀行卡資訊,怎么樣寫注解,才能在ui界面上展示出這樣的效果?
{
"customerNo":"",
"name":"",
"cardInfo ":{
"cardID":"",
"cardName":""
}
}而不是現在這樣的
{
"customerNo":"",
"name":"",
"cardID":"",
"cardName":""
}
uj5u.com熱心網友回復:
我搞了半天也搞不定這個,很煩uj5u.com熱心網友回復:
一個物件包住一個物件就可以了@Data
public class UserInfoForm {
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("性別{1:男,2:女}")
private Integer gender;
@ApiModelProperty("生日")
private Date birthday;
@ApiModelProperty("血型")
private String bloodType;
@ApiModelProperty("屬相(生肖)")
private String chineseZodiac;
@ApiModelProperty("星座")
private String constellation;
@ApiModelProperty("職業")
private String profession;
@ApiModelProperty("作業時長")
private String workTime;
@ApiModelProperty("婚姻狀態{1:保密,2:已婚,3:未婚}")
private Integer marriageStatus;
@ApiModelProperty("子女數量")
private Integer offspringCount;
@ApiModelProperty("身體資訊")
private UserBodyInfoForm userBodyInfoForm;
}
{
"birthday": "",
"bloodType": "",
"chineseZodiac": "",
"constellation": "",
"gender": 0,
"marriageStatus": 0,
"name": "",
"offspringCount": 0,
"profession": "",
"userBodyInfoForm": {
"chestCircumference": 0,
"createTime": "",
"highHip": 0,
"hipline": 0,
"id": 0,
"leftLeg": 0,
"rightLeg": 0,
"shank": 0,
"standardWeight": 0,
"stature": 0,
"targetWeight": 0,
"updateTime": "",
"userId": 0,
"waistline": 0,
"weight": 0
},
"workTime": ""
}
uj5u.com熱心網友回復:
一個物件包含一個物件提交引數,但是這些引數里面都只需要一部分屬性,另外的屬性不需要,該怎樣處理呢?同一個模型在不同請求里面的入參屬性可以不一樣轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/8263.html
標籤:Web 開發
上一篇:Jvm引數問題
