Home > Back-end >  Why springboot incoming data by the database, after the test check is wrong
Why springboot incoming data by the database, after the test check is wrong

Time:09-16

Discuss - mapper. The XML SQL
& lt; SQL id="selectFields" & gt;
Id, user_id, title, content, type, status, create_time, comment_count, score, kind_one, kind_two
& lt;/sql>

& lt; Select id="selectDiscussPosts" resultType="DiscussPost & gt;"
Select & lt; The include refid="selectFields" & gt; & lt;/include>
The from discuss_post
Where the status!=2
& lt; If test="userId!=0 "& gt;
And user_id=# {username}
& lt;/if>
And kind_one=# {kind_one}
And kind_two=# {kind_two}
& lt; If test="orderMode==0" & gt;
The order by type desc, create_time desc
& lt;/if>
& lt; If test="orderMode==1" & gt;
The order by type desc, score desc, create_time desc
& lt;/if>
Limit # {offset}, # {limit}
& lt;/select>

The entity of:
@ Id
Private int id;

@ Field (type=FieldType. Integer)
Private int userId.

//Internet school recruit
@ Field (type=FieldType. Text, analyzer="ik_max_word searchAnalyzer=" ik_smart ")
private String title;

@ Field (type=FieldType. Text, analyzer="ik_max_word searchAnalyzer=" ik_smart ")
private String content;

@ Field (type=FieldType. Integer)
private int type;

@ Field (type=FieldType. Integer)
private int status;

@ Field (type=FieldType. Date)
private Date createTime;

@ Field (type=FieldType. Integer)
Private int commentCount;

@ Field (type=FieldType. Double)
Private double score;

The test code: DiscussPost DiscussPost=discussPostService. FindDiscussPostById (289);
Int id=discussPost. GetKind_one ();
System. The out. Println (discussPost);


Output: DiscussPost {id=289, userId=150, title='222111', the content='222', type=7, the status=0, createTime=Wed Jul 08 22:27:01 GMT + 08:00 2020, commentCount=0, score=0.0, kind_one=0, kind_two=0}
But in the database kind_one is 1
Why such a question?









CodePudding user response:

Look at the field, or field to write wrong, and then look at other issues

CodePudding user response:

The entity class determine how kind_one field? It's not in your code
  • Related