1. Use sql to judge whether the incoming age is within the range
select
case when (age>=18 and age<65) then 1 else 0 end as age
from (select 15 as age from dual)a;
Return 0 means not in 1 means in
2. SQL determines whether the field is empty
select case when age is null then '年龄不能为空' else '' end age,
case when person_name is null then '姓名不能为空' else '' end person_name
from (
select '' age, '' person_name from dual
)
SQL can be configured into the database, and the value can be dynamically replaced
select case when age is null then 'age cannot be empty' else '' end age,
case when person_name is null then 'name cannot be empty' else '' end person_name
from (
select '${AGE}$' age, '${AGE}$' person_name from dual
)