Home > Back-end > Mybatis sort for an integer types of data when ordering how do sorting according to ASCII code?
Mybatis sort for an integer types of data when ordering how do sorting according to ASCII code?
Time:02-01
Just doing a according to the problemId (stored in the database is bigint) sorting function Mybatis is wrote
The order by ${sort} ${order}
The order by ` problem_id ` asc
Then after I sort, found that was carried out in accordance with the ASCII ordering, this is obviously not, and then I went to the database and to see,
SELECT * FROM ` test_problem ` ORDER BY problem_id asc.
The results are normal, and not sorted according to ASCII code, then the problem will appear in the mybatis parsing,,
Then I according to the approach to baidu ${sort} a 0, after it worked, but it is clear that this will surely there is a big problem, efficiency, so how to solve this situation?
CodePudding user response:
The integer data type is: are you sure? You is that a character type, only is pure Numbers