From 82db8148f669060094416d291a753ba0062a190c Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 12 Apr 2023 14:36:47 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=94=BB=E5=83=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/resources/mapper/IcResiUserDao.xml | 44 ++++++++-----------
1 file changed, 19 insertions(+), 25 deletions(-)
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
index 3ca4f4c8cc..aa43c3eea9 100644
--- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
@@ -125,6 +125,8 @@
+ and ${subCondition.tableName}.${subCondition.columnName} is not null
+ and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
@@ -180,6 +182,8 @@
+ and ${subCondition.tableName}.${subCondition.columnName} is not null
+ and ${subCondition.tableName}.${subCondition.columnName} !=''
and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
@@ -1548,11 +1552,11 @@
u.ID,
YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) as age,
(
- case when YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) < 50 then '0'
- when YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=50 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) <=59 then '1'
- when YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=60 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) <=69 then '2'
- when YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=70 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) <=79 then '3'
- when YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=80 then '4'
+ case when u.BIRTHDAY > DATE_SUB(CURDATE(),INTERVAL 50 year) then '0'
+ when u.BIRTHDAY BETWEEN DATE_SUB(CURDATE(),INTERVAL 59 year) AND DATE_SUB(CURDATE(),INTERVAL 50 year) then '1'
+ when u.BIRTHDAY BETWEEN DATE_SUB(CURDATE(),INTERVAL 69 year) AND DATE_SUB(CURDATE(),INTERVAL 60 year) then '2'
+ when u.BIRTHDAY BETWEEN DATE_SUB(CURDATE(),INTERVAL 79 year) AND DATE_SUB(CURDATE(),INTERVAL 70 year) then '3'
+ when u.BIRTHDAY <= DATE_SUB(CURDATE(),INTERVAL 80 year) then '4'
end
) as `code`
FROM
@@ -1606,30 +1610,20 @@
-
- and u.BIRTHDAY is not null
- and u.BIRTHDAY !=''
- and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) < 50
+
+ and u.BIRTHDAY > DATE_SUB(CURDATE(),INTERVAL 50 year)
-
- and u.BIRTHDAY is not null
- and u.BIRTHDAY !=''
- and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=50 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) <=59
+
+ and u.BIRTHDAY BETWEEN DATE_SUB(CURDATE(),INTERVAL 59 year) AND DATE_SUB(CURDATE(),INTERVAL 50 year)
-
- and u.BIRTHDAY is not null
- and u.BIRTHDAY !=''
- and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=60 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) <=69
+
+ and u.BIRTHDAY BETWEEN DATE_SUB(CURDATE(),INTERVAL 69 year) AND DATE_SUB(CURDATE(),INTERVAL 60 year)
-
- and u.BIRTHDAY is not null
- and u.BIRTHDAY !=''
- and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=70 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) <=79
+
+ and u.BIRTHDAY BETWEEN DATE_SUB(CURDATE(),INTERVAL 79 year) AND DATE_SUB(CURDATE(),INTERVAL 70 year)
-
- and u.BIRTHDAY is not null
- and u.BIRTHDAY !=''
- and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) >=80
+
+ and u.BIRTHDAY <= DATE_SUB(CURDATE(),INTERVAL 80 year)
order by u.ID asc