英文:
Hibernate: Is possible get missing numbers in a findAll query?
问题
如果我的查询返回以下数字(按顺序):10 8 1,是否可以补全缺失的数字,并且返回例如 10 9* 8 7* 6* 5* 4* 3* 2* 1,添加 * 或任何表示该值不在表中但已添加到查询中的字符。是否可以实现类似的操作?
在我的示例中,我只有 10 8 1,现在想象一下,如果数字在 5000 到 1 之间......或者在 10000 到 1 之间,我忘了提到,但问题是这个查询的结果在 HTML 表中显示出来,我可以在网页上显示 10 行,但用户很难看到 10000 行,这就是为什么我考虑使用分页,并将其处理为一个查询,而不是在服务或存储库层中编写一个算法。
注意:当前查询只是一个简单的 findAll(),如果需要的话可以更改,MySQL 版本为 5.2。
英文:
If I have a query that returns the following numbers (in order): 10 8 1, it is possible to complete the missing numbers and return for example 10 9* 8 7* 6* 5* 4* 3* 2* 1 , adding * or any char that indicates that this value was not in the table but was added into the query. is possible to do something like that?
In my example I only have 10 8 1 , now imagine that instead of that you have numbers between 5000 and 1 ... or between 10000 and 1, I forgot to mention but the problem is that the result of this query is being displayed in an html table, I can display 10 rows in a webpage, but will be hard for the user see 10k rows, that's why I was thinking to use pagination and handle as a query instead of have an algorithm in the service or repository layer.
Note: right now the query is a simple findAll(), this can change to whatever if I want, mysql version 5.2
专注分享java语言的经验与见解,让所有开发者获益!
评论