java - 最近在做jsr303的后端验证,对于怎样用Bean Validation判断订单号是否已存在不知所措?
黄舟
黄舟 2017-04-18 10:27:29
0
2
391

我想用类似@Email控制email格式,用怎样一种注解(自己写扩展也行)来实现判断订单号是否已存在?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
阿神

Whether the order number exists requires querying data
Generally, validate is not used to verify (it should not be possible)
You can write a public service or tool class

伊谢尔伦

jsr is used to verify javabeans. For example, when a user registers, they get a User object with an email attribute in it. You can add @email verification to it. You can use jsr implementation to verify whether the email attribute is in the mailbox format.
To determine the order number through annotations, you need to customize the annotations and then write the annotation parser. This is generally not done. Just check the database to see if the mailbox already exists.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!