枚举类 get Set方法 在lombok中的坑
发表于|更新于
|阅读量:
lombok的类如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| package com.divx.service.model.task;
import com.divx.service.model.BaseTypeMedia; import lombok.Data;
/** * @author wuzhilang * @Title: QuestionResult * @ProjectName yxt-parent * @Description: QuestionResult * @date 2019/6/2015:59 */ @Data public class QuestionResult { private long questionId; private BaseTypeMedia.eQuestionType qType; private String userAnswer; private String standardAnswer; private long userId; private int instId; private Boolean result; private String word;
}
|
结果属性里面
private BaseTypeMedia.eQuestionType qType;的get方法是
导致我前端传过来的参数没有被接收到。
用idea生成的getsetter 方法如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| package com.divx.service.model.task;
import com.divx.service.model.BaseTypeMedia; import lombok.Data;
/** * @author wuzhilang * @Title: QuestionResult * @ProjectName yxt-parent * @Description: QuestionResult * @date 2019/6/2015:59 */ public class QuestionResult { private long questionId; private BaseTypeMedia.eQuestionType qType; private String userAnswer; private String standardAnswer; private long userId; private int instId; private Boolean result; private String word;
public long getQuestionId() { return questionId; }
public void setQuestionId(long questionId) { this.questionId = questionId; } //别找了就是这个方法 public BaseTypeMedia.eQuestionType getqType() { return qType; }
public void setqType(BaseTypeMedia.eQuestionType qType) { this.qType = qType; }
public String getUserAnswer() { return userAnswer; }
public void setUserAnswer(String userAnswer) { this.userAnswer = userAnswer; }
public String getStandardAnswer() { return standardAnswer; }
public void setStandardAnswer(String standardAnswer) { this.standardAnswer = standardAnswer; }
public long getUserId() { return userId; }
public void setUserId(long userId) { this.userId = userId; }
public int getInstId() { return instId; }
public void setInstId(int instId) { this.instId = instId; }
public Boolean getResult() { return result; }
public void setResult(Boolean result) { this.result = result; }
public String getWord() { return word; }
public void setWord(String word) { this.word = word; } }
|
对的你没看错
1 2 3 4 5 6 7
| public void setQuestionId(long questionId) { this.questionId = questionId; }
public BaseTypeMedia.eQuestionType getqType() { return qType; }
|
get set方法是这个样子的。
有没有大神来解释下,为什么