From 856468809503b50b7c0cef532e387ac63e1b660c Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Thu, 13 Apr 2023 23:15:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/main/resources/sql/jlw/student.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/src/main/resources/sql/jlw/student.md b/web/src/main/resources/sql/jlw/student.md index 692b7803..216f31dc 100644 --- a/web/src/main/resources/sql/jlw/student.md +++ b/web/src/main/resources/sql/jlw/student.md @@ -1610,7 +1610,7 @@ queryStudentLoginLogByCondition END ) AS online_duration, @// 是否在线规则: 登录次数 取余和1做对比 - count( 1 ) % 2 = 1 AS is_on_line, + (count( 1 ) % 2 = 1 AND any_value(ta.create_time) >= CURDATE()) AS is_on_line, @// 会从多个地方登录,这里只是随机取一个IP,确保单条唯一 any_value(ta.ip) as ip, @// 登录次数 @@ -1662,15 +1662,15 @@ queryStudentLoginLogByCondition @if(!isEmpty(universitiesCollegesId)) { and td.universities_colleges_id = #universitiesCollegesId# @} - @if(!isEmpty(isOnLine)) { - and (count( 1 ) % 2 = 1) = #isOnLine# - @} GROUP BY tc.`code`, tc.`name`, td.universities_colleges_name, td.universities_colleges_province, td.class_name + @if(!isEmpty(isOnLine)) { + having (count( 1 ) % 2 = 1) = #isOnLine# + @} ) z order by z.login_time desc