beetlsql3-dev
Mlxa0324 2 years ago
parent 8fb694df58
commit 260581b550

@ -1673,6 +1673,130 @@ queryStudentLoginLogByCondition
td.class_name td.class_name
) z ) z
order by z.login_time desc order by z.login_time desc
queryStudentUseLogByConditionGroupByUniversitiesCollegesId
===
* 使用日志:(院校分组)
* 院校管理员 只能查看他院校下面的学生、教师、院校管理跳转子应用的日志
* 超管 查看所有跳转子应用的日志
select
@pageTag() {
@// 子系统名称
platform,
@// 子系统应用ID
application_id,
@// 归属模块
@// 使用人数
count(1) as use_count,
universities_colleges_id,
universities_colleges_name,
@// 所属省份
universities_colleges_province,
@//指定时间内的,在线时长
sum(online_duration) as online_duration,
DATE_FORMAT(,'%Y-%m-%d') as create_time
@}
from (
SELECT
tc.`code`,
tc.`name`,
td.universities_colleges_id,
td.universities_colleges_name,
@// 所属省份
td.universities_colleges_province,
td.class_name,
@// 子系统名称
TRIM(
REPLACE ( tb.application_name, ' 子应用', '' )) AS platform,
tb.application_id,
@//指定时间内的,系统登入时间
min( ta.create_time ) AS login_time,
@//系统登出时间
( CASE WHEN count( 1 ) <= 1 THEN '-' ELSE adddate(min( ta.create_time ), interval (TIME_TO_SEC(max( ta.create_time )) - TIME_TO_SEC(min( ta.create_time ))) second) END ) AS logout_time,
@//指定时间内的,在线时长
(
CASE
WHEN count( 1 ) <= 1 THEN
TIMEDIFF(
now(),
min( ta.create_time )) ELSE TIMEDIFF(
max( ta.create_time ),
min( ta.create_time ))
END
) AS online_duration,
@// 是否在线规则: 登录次数 取余和1做对比
count( 1 ) % 2 = 1 AS is_on_line,
@// 登录次数
count( 1 ) AS login_count
FROM
sys_log ta
left join
@// 查询userId对应的院校信息
(
SELECT
c.universities_colleges_name,
b.universities_colleges_id,
c.universities_colleges_province,
a.class_id,
b.class_name,
a.user_id
FROM
student a
LEFT JOIN school_class b ON b.class_id = a.class_id
LEFT JOIN universities_colleges c ON b.universities_colleges_id = c.universities_colleges_id UNION ALL
SELECT
b.universities_colleges_name,
b.universities_colleges_id,
b.universities_colleges_province,
NULL AS class_id,
null as class_name,
a.user_id
FROM
teacher a
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
) td on td.user_id = ta.user_id
LEFT JOIN resources_application tb ON ta.request_url LIKE CONCAT( tb.application_link, '%' )
LEFT JOIN core_user tc ON ta.user_id = tc.id
WHERE
1
and ta.user_id is not null
AND tb.application_name IS NOT NULL
@if(!isEmpty(codeOrName)) {
and concat(tc.`name`, tc.`code`) like #'%'+codeOrName+'%'#
@}
@if(!isEmpty(classId)) {
and td.class_id = #classId#
@}
@if(!isEmpty(loginStartTime)) {
and ta.create_time >= #loginStartTime#
@}
@if(!isEmpty(loginEndTime)) {
and ta.create_time <= #loginEndTime#
@}
@// 用来过滤院校管理员所能查看的数据
@if(!isEmpty(universitiesCollegesId)) {
and td.universities_colleges_id = #universitiesCollegesId#
and tb.application_name is not null
@}
@if(!isEmpty(isOnLine)) {
and (count( 1 ) % 2 = 1) = #isOnLine#
@}
GROUP BY
tc.`code`,
tc.`name`,
td.universities_colleges_name,
td.universities_colleges_province,
tb.application_name,
td.class_name
) z
group by universities_colleges_id
order by z.login_time desc
queryStudentUseLogByCondition queryStudentUseLogByCondition
=== ===
@ -1688,6 +1812,7 @@ queryStudentUseLogByCondition
SELECT SELECT
tc.`code`, tc.`code`,
tc.`name`, tc.`name`,
td.universities_colleges_id,
td.universities_colleges_name, td.universities_colleges_name,
@// 所属省份 @// 所属省份
td.universities_colleges_province, td.universities_colleges_province,

@ -414,8 +414,8 @@ studentScoreList
ta.student_sn, ta.student_sn,
ta.student_name, ta.student_name,
t.teacher_open_course_question_setting_id t.teacher_open_course_question_setting_id
HAVING @//HAVING
sum( t.student_score ) IS NOT NULL @//sum( t.student_score ) IS NOT NULL
) a ) a
WHERE WHERE
NOT EXISTS ( NOT EXISTS (
@ -439,8 +439,8 @@ studentScoreList
ta.student_sn, ta.student_sn,
ta.student_name, ta.student_name,
t.teacher_open_course_question_setting_id t.teacher_open_course_question_setting_id
HAVING @//HAVING
sum( t.student_score ) IS NOT NULL @//sum( t.student_score ) IS NOT NULL
) b ) b
WHERE WHERE
a.student_id = b.student_id a.student_id = b.student_id

Loading…
Cancel
Save