You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1448 lines
58 KiB
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

queryByCondition
===
* 根据不为空的参数进行分页查询
select
@pageTag(){
t.student_id,
t.class_id,
t.student_name,
t.student_sn,
t.student_mobile,
t.student_email,
t.student_weixin_info,
t.student_status,
t.add_time,
t.org_id,
t.user_id,
a.class_name,b.universities_colleges_name,
@if(!isEmpty(log)){
d.resources_application_id,
TRIM(REPLACE(d.application_name,'子应用','')) platform,
@}
@if(!isEmpty(competitionId)){
c.team_name,
c.team_students_ids,
(SELECT GROUP_CONCAT(student_name ORDER BY FIND_IN_SET(student_id,c.team_students_ids)) FROM student WHERE FIND_IN_SET(student_id,c.team_students_ids) ) team_student_names,
@}
cu.`code`
@}
from student t
LEFT JOIN school_class a ON a.class_id = t.class_id
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
@if(!isEmpty(competitionId)){
LEFT JOIN (
@if(!isEmpty(studentTempList)){
SELECT
DISTINCT students_id,
team_name,
team_students_ids
from(
@for(item in studentTempList){
(
SELECT
#item.studentsId# students_id,
#item.teamName# team_name,
#item.studentsIds# team_students_ids
)
#text(itemLP.last?"":"UNION ALL" )#
@}
)c
@}else{
SELECT
cs.students_id,
cs.team_name,
(SELECT GROUP_CONCAT(students_id ORDER BY students_id) FROM competition_students WHERE team_flag = cs.team_flag AND is_captain = 2 ) team_students_ids -- 队员IDs
FROM competition_students cs
LEFT JOIN competition c ON c.competition_id = cs.competition_id
WHERE c.competition_id = #competitionId# AND cs.is_captain = 1
GROUP BY cs.competition_students_id
@}
)c ON c.students_id = t.student_id
@}
@if(!isEmpty(log)){
LEFT JOIN universities_colleges_jurisdiction_experimental_system c ON c.universities_colleges_id = b.universities_colleges_id AND c.type = 1 AND c.use_type != 0
LEFT JOIN resources_application d ON d.resources_application_id = c.type_id
@}
LEFT JOIN core_user cu ON cu.id = t.user_id
where 1=1
@//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
and #function("student.query")#
@if(!isEmpty(resourcesApplicationId)){
and d.resources_application_id =#resourcesApplicationId#
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(universitiesCollegesId)){
and b.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(classIds)){
and find_in_set(t.class_id,#classIds#)
@}
@if(!isEmpty(className)){
and a.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(universitiesCollegesName)){
and b.universities_colleges_name like #'%'+universitiesCollegesName+'%'#
@}
@if(!isEmpty(studentName)){
and t.student_name like #'%'+studentName+'%'#
@}
@if(!isEmpty(studentSn)){
and t.student_sn like #'%'+studentSn+'%'#
@}
@if(!isEmpty(studentMobile)){
and t.student_mobile =#studentMobile#
@}
@if(!isEmpty(studentEmail)){
and t.student_email =#studentEmail#
@}
@if(!isEmpty(studentStatus)){
and t.student_status =#studentStatus#
@}
@if(!isEmpty(studentStatuses)){
and find_in_set(t.student_status,#studentStatuses#)
@}
@if(!isEmpty(studentPassword)){
and t.student_password =#studentPassword#
@}
@if(!isEmpty(addTime)){
and t.add_time =#addTime#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(competitionId)){
-- 1只包含参赛学员 2不包含参赛学员
@if(beCompetitionStudent == 1){
@if(!isEmpty(tempStudentIds)){
AND find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND find_in_set(t.student_id,IFNULL((SELECT GROUP_CONCAT(students_id) FROM competition_students WHERE competition_id = #competitionId# and case when (select competition_type from competition where competition_id = #competitionId#) = 2 then is_captain = 1 else 1=1 end),"-1"))
@}
@}else if(beCompetitionStudent == 2){
@if(!isEmpty(tempStudentIds)){
AND NOT find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND t.student_id NOT IN (SELECT students_id FROM competition_students WHERE competition_id = #competitionId#)
@}
@}
@}
@if(!isEmpty(examId)){
-- 1只包含参赛学员 2不包含参赛学员
@if(beExamStudent == 1){
@if(!isEmpty(tempStudentIds)){
and find_in_set(t.student_id,#tempStudentIds#)
@}else{
and t.student_id IN (SELECT students_id FROM exam_students WHERE exam_id = #examId#)
@}
@}else if(beExamStudent == 2){
@if(!isEmpty(tempStudentIds)){
AND NOT find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND t.student_id NOT IN (SELECT students_id FROM exam_students WHERE exam_id = #examId#)
@}
@}
@}
ORDER BY t.add_time DESC
queryByConditionQuery
===
* 没有权限的查询
select
@pageTag(){
t.*
@}
from student t
LEFT JOIN school_class a ON a.class_id = t.class_id
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
where 1=1
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(universitiesCollegesId)){
and b.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(universitySystemId)){
and a.university_system_id =#universitySystemId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(classIds)){
and find_in_set(t.class_id ,#classIds#)
@}
@if(!isEmpty(className)){
and a.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(universitiesCollegesName)){
and b.universities_colleges_name like #'%'+universitiesCollegesName+'%'#
@}
@if(!isEmpty(studentName)){
and t.student_name like #'%'+studentName+'%'#
@}
@if(!isEmpty(studentSn)){
and t.student_sn =#studentSn#
@}
@if(!isEmpty(studentMobile)){
and t.student_mobile =#studentMobile#
@}
@if(!isEmpty(studentEmail)){
and t.student_email =#studentEmail#
@}
@if(!isEmpty(studentStatus)){
and t.student_status =#studentStatus#
@}
@if(!isEmpty(studentGender)){
and t.student_gender =#studentGender#
@}
@if(!isEmpty(studentStatuses)){
and find_in_set(t.student_status,#studentStatuses#)
@}
@if(!isEmpty(studentPassword)){
and t.student_password =#studentPassword#
@}
@if(!isEmpty(addTime)){
and t.add_time =#addTime#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(studentSnOrName)){
and (t.student_sn like #'%'+studentSnOrName+'%'# or t.student_name like #'%'+studentSnOrName+'%'#)
@}
@if(!isEmpty(orderByRand)){
ORDER BY RAND()
@}
queryByCondition2Student
===
* 根据不为空的参数进行分页查询
select
@pageTag(){
t.student_id,
t.class_id,
t.student_name,
t.student_sn,
t.student_mobile,
t.student_email,
t.student_status,
t.add_time,
t.org_id,
t.user_id,
a.class_name,b.universities_colleges_name,
@if(!isEmpty(competitionId)){
c.team_students_ids,
(SELECT GROUP_CONCAT(student_name ORDER BY FIND_IN_SET(student_id,c.team_students_ids)) FROM student WHERE FIND_IN_SET(student_id,c.team_students_ids) ) team_student_names,
@}
cu.code
@}
from student t
LEFT JOIN school_class a ON a.class_id = t.class_id
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
@if(!isEmpty(competitionId)){
LEFT JOIN (
@if(!isEmpty(studentTempList)){
SELECT
DISTINCT students_id,
team_name,
team_students_ids
from(
@for(item in studentTempList){
(
SELECT
#item.studentsId# students_id,
#item.teamName# team_name,
#item.studentsIds# team_students_ids
)
#text(itemLP.last?"":"UNION ALL" )#
@}
)c
@}else{
SELECT
cs.students_id,
cs.team_name,
(SELECT GROUP_CONCAT(students_id ORDER BY students_id) FROM competition_students WHERE team_flag = cs.team_flag AND is_captain = 2 ) team_students_ids -- 队员IDs
FROM competition_students cs
LEFT JOIN competition c ON c.competition_id = cs.competition_id
WHERE c.competition_id = #competitionId# AND cs.is_captain = 1
GROUP BY cs.competition_students_id
@}
)c ON c.students_id = t.student_id
@}
left join core_user cu ON cu.id = t.user_id
where 1=1
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(notStudentId)){
and t.student_id != #notStudentId#
@}
@if(!isEmpty(universitiesCollegesId)){
and b.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(className)){
and a.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(universitiesCollegesName)){
and b.universities_colleges_name like #'%'+universitiesCollegesName+'%'#
@}
@if(!isEmpty(studentName)){
and t.student_name like #'%'+studentName+'%'#
@}
@if(!isEmpty(studentSn)){
and t.student_sn =#studentSn#
@}
@if(!isEmpty(studentMobile)){
and t.student_mobile =#studentMobile#
@}
@if(!isEmpty(studentEmail)){
and t.student_email =#studentEmail#
@}
@if(!isEmpty(studentStatus)){
and t.student_status =#studentStatus#
@}
@if(!isEmpty(studentGender)){
and t.student_gender =#studentGender#
@}
@if(!isEmpty(studentStatuses)){
and find_in_set(t.student_status,#studentStatuses#)
@}
@if(!isEmpty(studentPassword)){
and t.student_password =#studentPassword#
@}
@if(!isEmpty(addTime)){
and t.add_time =#addTime#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(competitionId)){
-- 1只包含参赛学员 2不包含参赛学员
@if(beCompetitionStudent == 1){
@if(!isEmpty(tempStudentIds)){
AND find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND find_in_set(t.student_id,IFNULL((SELECT GROUP_CONCAT(students_id) FROM competition_students WHERE competition_id = #competitionId# and case when (select competition_type from competition where competition_id = #competitionId#) = 2 then is_captain = 1 else 1=1 end),"-1"))
@}
@}else if(beCompetitionStudent == 2){
@if(!isEmpty(tempStudentIds)){
AND NOT find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND t.student_id NOT IN (SELECT students_id FROM competition_students WHERE competition_id = #competitionId#)
@}
@}
@}
@if(!isEmpty(examId)){
-- 1只包含参赛学员 2不包含参赛学员
@if(beExamStudent == 1){
@if(!isEmpty(tempStudentIds)){
and find_in_set(t.student_id,#tempStudentIds#)
@}else{
and t.student_id IN (SELECT students_id FROM exam_students WHERE exam_id = #examId#)
@}
@}else if(beExamStudent == 2){
@if(!isEmpty(tempStudentIds)){
AND NOT find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND t.student_id NOT IN (SELECT students_id FROM exam_students WHERE exam_id = #examId#)
@}
@}
@}
ORDER BY t.add_time DESC
deleteStudentByIds
===
* 批量删除(假删除)
UPDATE `student`
SET
`student_status` = 2
WHERE FIND_IN_SET(student_id,#ids#)
deleteByIds
===
* 批量删除(真删除)
DELETE
FROM `student`
WHERE FIND_IN_SET(student_id,#ids#)
getByUserId
===
select t.* from `student` t where t.user_id = #userId#
getByAccount
===
select t.* from `student` t where t.user_id = (select id from core_user where code = #account#)
getByIds
===
select t.* from `student` t where find_in_set(t.student_id,#studentIds#)
getExcelValues
===
* 根据不为空的参数进行查询Excel所需数据
SELECT * FROM (
(
SELECT
MAX(LENGTH(a.class_name)) class_name,
MAX(LENGTH(t.student_name)) student_name,
MAX(LENGTH(t.student_sn)) student_sn,
MAX(LENGTH(t.student_mobile)) student_mobile,
MAX(LENGTH(t.student_email)) student_email
FROM
student AS t
LEFT JOIN school_class a ON a.class_id = t.class_id
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
where t.student_status = 1
@if(!isEmpty(universitiesCollegesId)){
and b.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(className)){
and a.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(universitiesCollegesName)){
and b.universities_colleges_name like #'%'+universitiesCollegesName+'%'#
@}
@if(!isEmpty(studentName)){
and t.student_name like #'%'+studentName+'%'#
@}
@if(!isEmpty(studentSn)){
and t.student_sn like #'%'+studentSn+'%'#
@}
)
UNION ALL
(
SELECT
a.class_name,
t.student_name,
t.student_sn,
t.student_mobile,
t.student_email
FROM
student AS t
LEFT JOIN school_class a ON a.class_id = t.class_id
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
where t.student_status = 1
@if(!isEmpty(universitiesCollegesId)){
and b.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(className)){
and a.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(universitiesCollegesName)){
and b.universities_colleges_name like #'%'+universitiesCollegesName+'%'#
@}
@if(!isEmpty(studentName)){
and t.student_name like #'%'+studentName+'%'#
@}
@if(!isEmpty(studentSn)){
and t.student_sn like #'%'+studentSn+'%'#
@}
)
)t
getExcelValues2Competition
===
SELECT * FROM (
(
select
MAX(LENGTH(t.student_name)) student_name,
MAX(LENGTH(t.student_sn)) student_sn,
MAX(LENGTH(a.class_name)) class_name,
MAX(LENGTH(b.universities_colleges_name)) universities_colleges_name,
@if(!isEmpty(competitionId)){
MAX(LENGTH(c.team_name)) team_name,
MAX(LENGTH(c.team_students_ids)) team_students_ids,
MAX(LENGTH((SELECT GROUP_CONCAT(student_name ORDER BY FIND_IN_SET(student_id,c.team_students_ids) SEPARATOR ' / ') FROM student WHERE FIND_IN_SET(student_id,c.team_students_ids)))) team_student_names,
@}
MAX(LENGTH(cu.`code`)) `code`
from student t
LEFT JOIN school_class a ON a.class_id = t.class_id
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
@if(!isEmpty(competitionId)){
LEFT JOIN (
@if(!isEmpty(studentTempList)){
SELECT
DISTINCT students_id,
team_name,
team_students_ids
from(
@for(item in studentTempList){
(
SELECT
#item.studentsId# students_id,
#item.teamName# team_name,
#item.studentsIds# team_students_ids
)
#text(itemLP.last?"":"UNION ALL" )#
@}
)c
@}else{
SELECT
cs.students_id,
cs.team_name,
(SELECT GROUP_CONCAT(students_id ORDER BY students_id) FROM competition_students WHERE team_flag = cs.team_flag AND is_captain = 2 ) team_students_ids -- 队员IDs
FROM competition_students cs
LEFT JOIN competition c ON c.competition_id = cs.competition_id
WHERE c.competition_id = #competitionId# AND cs.is_captain = 1
GROUP BY cs.competition_students_id
@}
)c ON c.students_id = t.student_id
@}
LEFT JOIN core_user cu ON cu.id = t.user_id
where 1=1
@if(!isEmpty(resourcesApplicationId)){
and d.resources_application_id =#resourcesApplicationId#
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(universitiesCollegesId)){
and b.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(className)){
and a.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(universitiesCollegesName)){
and b.universities_colleges_name like #'%'+universitiesCollegesName+'%'#
@}
@if(!isEmpty(studentName)){
and t.student_name like #'%'+studentName+'%'#
@}
@if(!isEmpty(studentSn)){
and t.student_sn like #'%'+studentSn+'%'#
@}
@if(!isEmpty(studentMobile)){
and t.student_mobile =#studentMobile#
@}
@if(!isEmpty(studentEmail)){
and t.student_email =#studentEmail#
@}
@if(!isEmpty(studentStatus)){
and t.student_status =#studentStatus#
@}
@if(!isEmpty(studentGender)){
and t.student_gender =#studentGender#
@}
@if(!isEmpty(studentPassword)){
and t.student_password =#studentPassword#
@}
@if(!isEmpty(addTime)){
and t.add_time =#addTime#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(competitionId)){
-- 1只包含参赛学员 2不包含参赛学员
@if(beCompetitionStudent == 1){
@if(!isEmpty(tempStudentIds)){
AND find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND find_in_set(t.student_id,IFNULL((SELECT GROUP_CONCAT(students_id) FROM competition_students WHERE competition_id = #competitionId# and case when (select competition_type from competition where competition_id = #competitionId#) = 2 then is_captain = 1 else 1=1 end),"-1"))
@}
@}else if(beCompetitionStudent == 2){
@if(!isEmpty(tempStudentIds)){
AND NOT find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND t.student_id NOT IN (SELECT students_id FROM competition_students WHERE competition_id = #competitionId#)
@}
@}
@}
@if(!isEmpty(examId)){
-- 1只包含参赛学员 2不包含参赛学员
@if(beExamStudent == 1){
@if(!isEmpty(tempStudentIds)){
and find_in_set(t.student_id,#tempStudentIds#)
@}else{
and t.student_id IN (SELECT students_id FROM exam_students WHERE exam_id = #examId#)
@}
@}else if(beExamStudent == 2){
@if(!isEmpty(tempStudentIds)){
AND NOT find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND t.student_id NOT IN (SELECT students_id FROM exam_students WHERE exam_id = #examId#)
@}
@}
@}
)
UNION ALL
(
select
t.student_name,
t.student_sn,
a.class_name,
b.universities_colleges_name,
@if(!isEmpty(competitionId)){
c.team_name,
c.team_students_ids,
(SELECT GROUP_CONCAT(student_name ORDER BY FIND_IN_SET(student_id,c.team_students_ids) SEPARATOR ' / ') FROM student WHERE FIND_IN_SET(student_id,c.team_students_ids) ) team_student_names,
@}
cu.`code`
from student t
LEFT JOIN school_class a ON a.class_id = t.class_id
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
@if(!isEmpty(competitionId)){
LEFT JOIN (
@if(!isEmpty(studentTempList)){
SELECT
DISTINCT students_id,
team_name,
team_students_ids
from(
@for(item in studentTempList){
(
SELECT
#item.studentsId# students_id,
#item.teamName# team_name,
#item.studentsIds# team_students_ids
)
#text(itemLP.last?"":"UNION ALL" )#
@}
)c
@}else{
SELECT
cs.students_id,
cs.team_name,
(SELECT GROUP_CONCAT(students_id ORDER BY students_id) FROM competition_students WHERE team_flag = cs.team_flag AND is_captain = 2 ) team_students_ids -- 队员IDs
FROM competition_students cs
LEFT JOIN competition c ON c.competition_id = cs.competition_id
WHERE c.competition_id = #competitionId# AND cs.is_captain = 1
GROUP BY cs.competition_students_id
@}
)c ON c.students_id = t.student_id
@}
LEFT JOIN core_user cu ON cu.id = t.user_id
where 1=1
@if(!isEmpty(resourcesApplicationId)){
and d.resources_application_id =#resourcesApplicationId#
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(universitiesCollegesId)){
and b.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(className)){
and a.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(universitiesCollegesName)){
and b.universities_colleges_name like #'%'+universitiesCollegesName+'%'#
@}
@if(!isEmpty(studentName)){
and t.student_name like #'%'+studentName+'%'#
@}
@if(!isEmpty(studentSn)){
and t.student_sn like #'%'+studentSn+'%'#
@}
@if(!isEmpty(studentMobile)){
and t.student_mobile =#studentMobile#
@}
@if(!isEmpty(studentEmail)){
and t.student_email =#studentEmail#
@}
@if(!isEmpty(studentStatus)){
and t.student_status =#studentStatus#
@}
@if(!isEmpty(studentGender)){
and t.student_gender =#studentGender#
@}
@if(!isEmpty(studentPassword)){
and t.student_password =#studentPassword#
@}
@if(!isEmpty(addTime)){
and t.add_time =#addTime#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(competitionId)){
-- 1只包含参赛学员 2不包含参赛学员
@if(beCompetitionStudent == 1){
@if(!isEmpty(tempStudentIds)){
AND find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND find_in_set(t.student_id,IFNULL((SELECT GROUP_CONCAT(students_id) FROM competition_students WHERE competition_id = #competitionId# and case when (select competition_type from competition where competition_id = #competitionId#) = 2 then is_captain = 1 else 1=1 end),"-1"))
@}
@}else if(beCompetitionStudent == 2){
@if(!isEmpty(tempStudentIds)){
AND NOT find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND t.student_id NOT IN (SELECT students_id FROM competition_students WHERE competition_id = #competitionId#)
@}
@}
@}
@if(!isEmpty(examId)){
-- 1只包含参赛学员 2不包含参赛学员
@if(beExamStudent == 1){
@if(!isEmpty(tempStudentIds)){
and find_in_set(t.student_id,#tempStudentIds#)
@}else{
and t.student_id IN (SELECT students_id FROM exam_students WHERE exam_id = #examId#)
@}
@}else if(beExamStudent == 2){
@if(!isEmpty(tempStudentIds)){
AND NOT find_in_set(t.student_id,#tempStudentIds#)
@}else{
AND t.student_id NOT IN (SELECT students_id FROM exam_students WHERE exam_id = #examId#)
@}
@}
@}
)
)t
getStudentValues
===
* 根据不为空的参数进行查询
select t.*,a.class_name,b.universities_colleges_id,b.universities_colleges_name
from student t
LEFT JOIN school_class a ON a.class_id = t.class_id
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
where 1=1
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(universitiesCollegesId)){
and b.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(className)){
and a.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(universitiesCollegesName)){
and b.universities_colleges_name like #'%'+universitiesCollegesName+'%'#
@}
@if(!isEmpty(studentName)){
and t.student_name like #'%'+studentName+'%'#
@}
@if(!isEmpty(studentSn)){
and t.student_sn =#studentSn#
@}
@if(!isEmpty(studentMobile)){
and t.student_mobile =#studentMobile#
@}
@if(!isEmpty(studentEmail)){
and t.student_email =#studentEmail#
@}
@if(!isEmpty(studentStatus)){
and t.student_status =#studentStatus#
@}
@if(!isEmpty(studentGender)){
and t.student_gender =#studentGender#
@}
@if(!isEmpty(studentPassword)){
and t.student_password =#studentPassword#
@}
@if(!isEmpty(addTime)){
and t.add_time =#addTime#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
getValuesByQuery
===
* 根据不为空的参数进行查询
select t.*,a.class_name,b.universities_colleges_id,b.universities_colleges_name,t.student_id value,t.student_name name
from student t
LEFT JOIN school_class a ON a.class_id = t.class_id
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
where 1=1
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(universitiesCollegesId)){
and b.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(universitySystemId)){
and a.university_system_id =#universitySystemId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(classIds)){
and find_in_set(t.class_id ,#classIds#)
@}
@if(!isEmpty(className)){
and a.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(universitiesCollegesName)){
and b.universities_colleges_name like #'%'+universitiesCollegesName+'%'#
@}
@if(!isEmpty(studentName)){
and t.student_name like #'%'+studentName+'%'#
@}
@if(!isEmpty(studentSn)){
and t.student_sn =#studentSn#
@}
@if(!isEmpty(studentMobile)){
and t.student_mobile =#studentMobile#
@}
@if(!isEmpty(studentEmail)){
and t.student_email =#studentEmail#
@}
@if(!isEmpty(studentStatus)){
and t.student_status =#studentStatus#
@}
@if(!isEmpty(studentGender)){
and t.student_gender =#studentGender#
@}
@if(!isEmpty(studentStatuses)){
and find_in_set(t.student_status,#studentStatuses#)
@}
@if(!isEmpty(studentPassword)){
and t.student_password =#studentPassword#
@}
@if(!isEmpty(addTime)){
and t.add_time =#addTime#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(orderByRand)){
ORDER BY RAND()
@}
getStudentLog
===
SELECT
t.student_id,
t.platform,
LEFT(SUBSTRING_INDEX(GROUP_CONCAT(t.last_login_time ORDER BY t.last_login_time DESC),',',1),19) last_login_time,
LEFT(SUBSTRING_INDEX(GROUP_CONCAT(t.last_operate_time ORDER BY t.last_operate_time DESC),',',1),19) last_operate_time,
SUBSTRING_INDEX(GROUP_CONCAT(t.IP ORDER BY t.last_login_time DESC),',',1) IP
FROM (
SELECT
t.student_id,
a.create_time last_login_time,
a1.create_time last_operate_time,
a.IP,
CASE WHEN a.params LIKE '%\\_ch%' THEN (SELECT TRIM(REPLACE(application_name,'子应用','')) FROM resources_application WHERE resources_application_id = 3) ELSE
CASE WHEN a.params LIKE '%\\_dsj%' THEN (SELECT TRIM(REPLACE(application_name,'子应用','')) FROM resources_application WHERE resources_application_id = 1) ELSE
CASE WHEN a.params LIKE '%\\_jr%' THEN (SELECT TRIM(REPLACE(application_name,'子应用','')) FROM resources_application WHERE resources_application_id = 2) ELSE
CASE WHEN a.params LIKE '%\\_sy%' THEN (SELECT TRIM(REPLACE(application_name,'子应用','')) FROM resources_application WHERE resources_application_id = 4) ELSE
CASE WHEN a.params LIKE '%\\_yx%' THEN (SELECT TRIM(REPLACE(application_name,'子应用','')) FROM resources_application WHERE resources_application_id = 5) END
END
END
END
END platform
FROM student t
LEFT JOIN (SELECT student_id,SUBSTRING_INDEX(GROUP_CONCAT(create_time ORDER BY create_time DESC),',',1) create_time,SUBSTRING_INDEX(GROUP_CONCAT(params ORDER BY create_time DESC),',',1) params,SUBSTRING_INDEX(GROUP_CONCAT(ip ORDER BY create_time DESC),',',1) ip FROM sys_log WHERE student_id > 0 AND request_url LIKE '%/api/student/indexInfo.do%' GROUP BY student_id) a ON a.student_id = t.student_id
LEFT JOIN (SELECT student_id,SUBSTRING_INDEX(GROUP_CONCAT(create_time ORDER BY create_time DESC),',',1) create_time FROM sys_log WHERE student_id > 0 GROUP BY student_id) a1 ON a1.student_id = t.student_id
WHERE a.params LIKE '%studentEnd\\_%'
@if(!isEmpty(studentIds)){
and find_in_set(t.student_id ,#studentIds#)
@}
)t
GROUP BY t.student_id,platform
getPracticePerformanceStatistic
===
* 练习成绩统计
SELECT
@pageTag(){
t.*,
t1.class_id,
t1.student_name,
t1.student_sn,
t1.student_mobile,
t1.student_email,
t1.student_status,
t1.add_time,
t1.org_id,
t1.user_id,
a.class_name,
b.universities_colleges_name
@}
FROM (
SELECT
t.student_id,
t.resources_question_num,
t.resources_competition_num,
t.resources_training_num,
CONCAT(FLOOR(ROUND(t.resources_question_right_num / t.resources_question_all_num,2)*100),'%') resources_question_proportion,
CONCAT(FLOOR(ROUND(t.resources_competition_step_right_num / t.resources_competition_step_all_num,2)*100),'%') resources_competition_proportion,
CONCAT(FLOOR(ROUND(t.resources_training_step_right_num / t.resources_training_step_all_num,2)*100),'%')resources_training_proportion
FROM (
SELECT
a.student_id,
COUNT(DISTINCT a.resources_question_id) resources_question_num,
COUNT(DISTINCT c.resources_competition_id) resources_competition_num,
COUNT(DISTINCT d.resources_training_id) resources_training_num,
SUM(CASE WHEN a.resources_question_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_question_right_num,
COUNT(CASE WHEN a.resources_question_id > 0 THEN b.student_question_log_id ELSE NULL END) resources_question_all_num,
SUM(CASE WHEN a.resources_competition_step_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_competition_step_right_num,
COUNT(CASE WHEN a.resources_competition_step_id > 0 THEN b.student_question_log_id ELSE NULL END)resources_competition_step_all_num,
SUM(CASE WHEN a.resources_training_step_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_training_step_right_num,
COUNT(CASE WHEN a.resources_training_step_id > 0 THEN b.student_question_log_id ELSE NULL END)resources_training_step_all_num
FROM student_question_log a
LEFT JOIN student_question_log_info b ON b.student_question_log_id = a.student_question_log_id
LEFT JOIN resources_competition_step c ON c.resources_competition_step_id = a.resources_competition_step_id
LEFT JOIN resources_training_step d ON d.resources_training_step_id = a.resources_training_step_id
LEFT JOIN student s ON s.student_id = a.student_id
WHERE 1=1
@if(!isEmpty(orgId)){
and s.org_id =#orgId#
@}
@if(!isEmpty(studentIds)){
and find_in_set(t.student_id ,#studentIds#)
@}
@if(!isEmpty(studentId)){
and t.student_id = #studentId#
@}
@if(!isEmpty(classId)){
and s.class_id = #classId#
@}
GROUP BY a.student_id
) t
) t
LEFT JOIN student t1 ON t1.student_id = t.student_id
LEFT JOIN school_class a ON a.class_id = t1.class_id
LEFT JOIN universities_colleges b ON b.universities_colleges_id = a.universities_colleges_id
@if(!isEmpty(orderByResourcesQuestionNum)){
@if(orderByResourcesQuestionNum == 1){
ORDER BY t.resources_question_num
@}else if(orderByResourcesQuestionNum == 2){
ORDER BY t.resources_question_num DESC
@}
@}
@if(!isEmpty(orderByResourcesCompetitionNum)){
@if(orderByResourcesCompetitionNum == 1){
ORDER BY t.resources_competition_num
@}else if(orderByResourcesCompetitionNum == 2){
ORDER BY t.resources_competition_num DESC
@}
@}
@if(!isEmpty(orderByResourcesTrainingNum)){
@if(orderByResourcesTrainingNum == 1){
ORDER BY t.resources_training_num
@}else if(orderByResourcesTrainingNum == 2){
ORDER BY t.resources_training_num DESC
@}
@}
@if(!isEmpty(orderByResourcesQuestionProportion)){
@if(orderByResourcesQuestionProportion == 1){
ORDER BY REPLACE(t.resources_question_proportion,'%','')+0
@}else if(orderByResourcesQuestionProportion == 2){
ORDER BY REPLACE(t.resources_question_proportion,'%','')+0 DESC
@}
@}
@if(!isEmpty(orderByResourcesCompetitionProportion)){
@if(orderByResourcesCompetitionProportion == 1){
ORDER BY REPLACE(t.resources_competition_proportion,'%','')+0
@}else if(orderByResourcesCompetitionProportion == 2){
ORDER BY REPLACE(t.resources_competition_proportion,'%','')+0 DESC
@}
@}
@if(!isEmpty(orderByResourcesTrainingProportion)){
@if(orderByResourcesTrainingProportion == 1){
ORDER BY REPLACE(t.resources_training_proportion,'%','')+0
@}else if(orderByResourcesTrainingProportion == 2){
ORDER BY REPLACE(t.resources_training_proportion,'%','')+0 DESC
@}
@}
getPracticePerformanceStatisticInfo
===
* 练习成绩统计详情
SELECT
t.course_info_id,
t.resources_question_num,
t.resources_competition_num,
t.resources_training_num,
CONCAT(t.resources_question_right_num ,'/', t.resources_question_all_num) resources_question_proportion,
CONCAT(t.resources_competition_step_right_num ,'/', t.resources_competition_step_all_num) resources_competition_proportion,
CONCAT(t.resources_training_step_right_num ,'/', t.resources_training_step_all_num)resources_training_proportion
FROM (
SELECT
a.course_info_id,
COUNT(DISTINCT a.resources_question_id) resources_question_num,
COUNT(DISTINCT c.resources_competition_id) resources_competition_num,
COUNT(DISTINCT d.resources_training_id) resources_training_num,
SUM(CASE WHEN a.resources_question_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_question_right_num,
COUNT(CASE WHEN a.resources_question_id > 0 THEN b.student_question_log_id ELSE NULL END) resources_question_all_num,
SUM(CASE WHEN a.resources_competition_step_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_competition_step_right_num,
COUNT(CASE WHEN a.resources_competition_step_id > 0 THEN b.student_question_log_id ELSE NULL END)resources_competition_step_all_num,
SUM(CASE WHEN a.resources_training_step_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_training_step_right_num,
COUNT(CASE WHEN a.resources_training_step_id > 0 THEN b.student_question_log_id ELSE NULL END)resources_training_step_all_num
FROM
(
SELECT
t.*,
CASE WHEN t.resources_question_id > 0
THEN
(
SELECT a.course_info_id FROM resources_question a
WHERE a.resources_question_id = t.resources_question_id
)
ELSE
CASE WHEN t.resources_competition_step_id > 0
THEN
(
SELECT DISTINCT b.course_info_id FROM resources_competition_step a
LEFT JOIN resources_competition b ON b.resources_competition_id = a.resources_competition_id
WHERE a.resources_competition_step_id = t.resources_competition_step_id
)
ELSE
CASE WHEN t.resources_training_step_id > 0
THEN
(
SELECT DISTINCT b.course_info_id FROM resources_training_step a
LEFT JOIN resources_training b ON b.resources_training_id = a.resources_training_id
WHERE a.resources_training_step_id = t.resources_training_step_id
)
ELSE NULL
END
END
END course_info_id
from student_question_log t
WHERE student_id = #studentId#
)a
LEFT JOIN student_question_log_info b ON b.student_question_log_id = a.student_question_log_id
LEFT JOIN resources_competition_step c ON c.resources_competition_step_id = a.resources_competition_step_id
LEFT JOIN resources_training_step d ON d.resources_training_step_id = a.resources_training_step_id
WHERE 1=1
@if(!isEmpty(courseInfoIds)){
and find_in_set(a.course_info_id ,#courseInfoIds#)
@}
GROUP BY a.course_info_id
) t
getPracticeProgress
===
* 练习进度
SELECT
t.course_info_id,
t.resources_question_num,
t.resources_competition_num,
t.resources_training_num,
CONCAT(t.resources_question_num ,'/', t.resources_question_all_num) resources_question_proportion,
CONCAT(t.resources_competition_num ,'/', t.resources_competition_all_num) resources_competition_proportion,
CONCAT(t.resources_training_num ,'/', t.resources_training_all_num)resources_training_proportion
FROM (
SELECT
a.course_info_id,
COUNT(DISTINCT a.resources_question_id) resources_question_num,
COUNT(DISTINCT c.resources_competition_id) resources_competition_num,
COUNT(DISTINCT d.resources_training_id) resources_training_num,
(SELECT COUNT(resources_question_id) FROM resources_question WHERE course_info_id = a.course_info_id) resources_question_all_num,
(SELECT COUNT(resources_competition_id) FROM resources_competition WHERE course_info_id = a.course_info_id) resources_competition_all_num,
(SELECT COUNT(resources_training_id) FROM resources_training WHERE course_info_id = a.course_info_id) resources_training_all_num
FROM
(
SELECT
t.*,
CASE WHEN t.resources_question_id > 0
THEN
(
SELECT a.course_info_id FROM resources_question a
WHERE a.resources_question_id = t.resources_question_id
)
ELSE
CASE WHEN t.resources_competition_step_id > 0
THEN
(
SELECT DISTINCT b.course_info_id FROM resources_competition_step a
LEFT JOIN resources_competition b ON b.resources_competition_id = a.resources_competition_id
WHERE a.resources_competition_step_id = t.resources_competition_step_id
)
ELSE
CASE WHEN t.resources_training_step_id > 0
THEN
(
SELECT DISTINCT b.course_info_id FROM resources_training_step a
LEFT JOIN resources_training b ON b.resources_training_id = a.resources_training_id
WHERE a.resources_training_step_id = t.resources_training_step_id
)
ELSE NULL
END
END
END course_info_id
FROM student_question_log t
LEFT JOIN student s ON s.student_id = t.student_id
WHERE 1=1
@if(!isEmpty(orgId)){
and s.org_id =#orgId#
@}
@if(!isEmpty(studentIds)){
and find_in_set(t.student_id ,#studentIds#)
@}
@if(!isEmpty(studentId)){
and t.student_id = #studentId#
@}
@if(!isEmpty(classId)){
and s.class_id = #classId#
@}
)a
LEFT JOIN student_question_log_info b ON b.student_question_log_id = a.student_question_log_id
LEFT JOIN resources_competition_step c ON c.resources_competition_step_id = a.resources_competition_step_id
LEFT JOIN resources_training_step d ON d.resources_training_step_id = a.resources_training_step_id
WHERE 1=1
@if(!isEmpty(courseInfoIds)){
and find_in_set(a.course_info_id ,#courseInfoIds#)
@}
GROUP BY a.course_info_id
) t
getErrorStatistics
===
* 错题统计
SELECT
@pageTag(){
@if(questionType == 1){
t.resources_question_id,
d.question_type,
d.question_stem,
@}else if(questionType == 2){
t.resources_competition_id,
e.resources_competition_name question_stem,
@}else if(questionType == 3){
t.resources_training_id,
e.resources_training_name question_stem,
@}
t.wrong_proportion,
t.course_info_id,
b.course_info_name,
c.course_info_name course_info_parent_name,
FIND_IN_SET(wrong_proportion,wrong_proportions) ranking
@}
FROM (
SELECT
t.course_info_id
@if(questionType == 1){
,t.resources_question_id,
CONCAT(FLOOR(ROUND((t.resources_question_all_num - t.resources_question_right_num) / t.resources_question_all_num,2)*100),'%') wrong_proportion
@}else if(questionType == 2){
,t.resources_competition_id,
CONCAT(FLOOR(ROUND((t.resources_competition_step_all_num - t.resources_competition_step_right_num) / t.resources_competition_step_all_num,2)*100),'%') wrong_proportion
@}else if(questionType == 3){
,t.resources_training_id,
CONCAT(FLOOR(ROUND((t.resources_training_step_all_num - t.resources_training_step_right_num) / t.resources_training_step_all_num,2)*100),'%')wrong_proportion
@}
FROM (
SELECT
GROUP_CONCAT(DISTINCT a.course_info_id) course_info_id,
resources_question_id,
resources_competition_id,
resources_training_id,
SUM(CASE WHEN a.resources_question_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_question_right_num,
COUNT(CASE WHEN a.resources_question_id > 0 THEN b.student_question_log_id ELSE NULL END) resources_question_all_num,
SUM(CASE WHEN a.resources_competition_step_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_competition_step_right_num,
COUNT(CASE WHEN a.resources_competition_step_id > 0 THEN b.student_question_log_id ELSE NULL END)resources_competition_step_all_num,
SUM(CASE WHEN a.resources_training_step_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_training_step_right_num,
COUNT(CASE WHEN a.resources_training_step_id > 0 THEN b.student_question_log_id ELSE NULL END)resources_training_step_all_num
FROM
(
SELECT
t.*,
CASE WHEN t.resources_question_id > 0
THEN
(
SELECT a.course_info_id FROM resources_question a
WHERE a.resources_question_id = t.resources_question_id
)
ELSE
CASE WHEN t.resources_competition_step_id > 0
THEN
(
SELECT DISTINCT b.course_info_id FROM resources_competition_step a
LEFT JOIN resources_competition b ON b.resources_competition_id = a.resources_competition_id
WHERE a.resources_competition_step_id = t.resources_competition_step_id
)
ELSE
CASE WHEN t.resources_training_step_id > 0
THEN
(
SELECT DISTINCT b.course_info_id FROM resources_training_step a
LEFT JOIN resources_training b ON b.resources_training_id = a.resources_training_id
WHERE a.resources_training_step_id = t.resources_training_step_id
)
ELSE NULL
END
END
END course_info_id
FROM student_question_log t
LEFT JOIN student s ON s.student_id = t.student_id
WHERE 1=1
)a
LEFT JOIN student_question_log_info b ON b.student_question_log_id = a.student_question_log_id
LEFT JOIN resources_competition_step c ON c.resources_competition_step_id = a.resources_competition_step_id
LEFT JOIN resources_training_step d ON d.resources_training_step_id = a.resources_training_step_id
LEFT JOIN student s ON s.student_id = a.student_id
WHERE 1=1
@if(!isEmpty(orgId)){
and s.org_id =#orgId#
@}
@if(questionType == 1){
and resources_question_id > 0
@}else if(questionType == 2){
and resources_competition_id > 0
@}else if(questionType == 3){
and resources_training_id > 0
@}
@if(!isEmpty(classId)){
and s.class_id = #classId#
@}
GROUP BY resources_question_id,resources_competition_id,resources_training_id
)t
)t
LEFT JOIN (
SELECT
@if(questionType == 1){
GROUP_CONCAT(DISTINCT CONCAT(FLOOR(ROUND((t.resources_question_all_num - t.resources_question_right_num) / t.resources_question_all_num,2)*100),'%') ORDER BY FLOOR(ROUND((t.resources_question_all_num - t.resources_question_right_num) / t.resources_question_all_num,2)*100)) wrong_proportions
@}else if(questionType == 2){
GROUP_CONCAT(DISTINCT CONCAT(FLOOR(ROUND((t.resources_competition_step_all_num - t.resources_competition_step_right_num) / t.resources_competition_step_all_num,2)*100),'%') ORDER BY FLOOR(ROUND((t.resources_competition_step_all_num - t.resources_competition_step_right_num) / t.resources_competition_step_all_num,2)*100)) wrong_proportions
@}else if(questionType == 3){
GROUP_CONCAT(DISTINCT CONCAT(FLOOR(ROUND((t.resources_training_step_all_num - t.resources_training_step_right_num) / t.resources_training_step_all_num,2)*100),'%') ORDER BY FLOOR(ROUND((t.resources_training_step_all_num - t.resources_training_step_right_num) / t.resources_training_step_all_num,2)*100)) wrong_proportions
@}
FROM (
SELECT
GROUP_CONCAT(DISTINCT a.course_info_id) course_info_id,
resources_question_id,
resources_competition_id,
resources_training_id,
SUM(CASE WHEN a.resources_question_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_question_right_num,
COUNT(CASE WHEN a.resources_question_id > 0 THEN b.student_question_log_id ELSE NULL END) resources_question_all_num,
SUM(CASE WHEN a.resources_competition_step_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_competition_step_right_num,
COUNT(CASE WHEN a.resources_competition_step_id > 0 THEN b.student_question_log_id ELSE NULL END)resources_competition_step_all_num,
SUM(CASE WHEN a.resources_training_step_id > 0 THEN CASE WHEN b.question_fraction = b.student_fraction THEN 1 ELSE 0 END ELSE 0 END) resources_training_step_right_num,
COUNT(CASE WHEN a.resources_training_step_id > 0 THEN b.student_question_log_id ELSE NULL END)resources_training_step_all_num
FROM
(
SELECT
t.*,
CASE WHEN t.resources_question_id > 0
THEN
(
SELECT a.course_info_id FROM resources_question a
WHERE a.resources_question_id = t.resources_question_id
)
ELSE
CASE WHEN t.resources_competition_step_id > 0
THEN
(
SELECT DISTINCT b.course_info_id FROM resources_competition_step a
LEFT JOIN resources_competition b ON b.resources_competition_id = a.resources_competition_id
WHERE a.resources_competition_step_id = t.resources_competition_step_id
)
ELSE
CASE WHEN t.resources_training_step_id > 0
THEN
(
SELECT DISTINCT b.course_info_id FROM resources_training_step a
LEFT JOIN resources_training b ON b.resources_training_id = a.resources_training_id
WHERE a.resources_training_step_id = t.resources_training_step_id
)
ELSE NULL
END
END
END course_info_id
FROM student_question_log t
LEFT JOIN student s ON s.student_id = t.student_id
WHERE 1=1
)a
LEFT JOIN student_question_log_info b ON b.student_question_log_id = a.student_question_log_id
LEFT JOIN resources_competition_step c ON c.resources_competition_step_id = a.resources_competition_step_id
LEFT JOIN resources_training_step d ON d.resources_training_step_id = a.resources_training_step_id
LEFT JOIN student s ON s.student_id = a.student_id
WHERE 1=1
@if(!isEmpty(orgId)){
and s.org_id =#orgId#
@}
@if(questionType == 1){
and resources_question_id > 0
@}else if(questionType == 2){
and resources_competition_id > 0
@}else if(questionType == 3){
and resources_training_id > 0
@}
@if(!isEmpty(classId)){
and s.class_id = #classId#
@}
GROUP BY resources_question_id,resources_competition_id,resources_training_id
)t
)a ON 1=1
LEFT JOIN course_info b ON b.course_info_id = t.course_info_id
LEFT JOIN course_info c ON c.course_info_id = b.course_info_parent_id
@if(questionType == 1){
LEFT JOIN resources_question d ON d.resources_question_id = t.resources_question_id
@}else if(questionType == 2){
LEFT JOIN resources_competition e ON e.resources_competition_id = t.resources_competition_id
@}else if(questionType == 3){
LEFT JOIN resources_training e ON e.resources_training_id = t.resources_training_id
@}
WHERE 1=1
@if(!isEmpty(courseInfoId)){
and c.course_info_id = #courseInfoId#
@}
ORDER BY IFNULL(FIND_IN_SET(wrong_proportion,wrong_proportions),LENGTH(wrong_proportions))
getStudentExtendSchoolInfo
===
* 获取学生的学校信息 班级-专业-院系-院校
SELECT
t.*,
ta.class_id,
ta.class_name,
tb.university_system_id,
tb.university_system_name,
tc.university_faculty_id,
tc.university_faculty_name,
td.universities_colleges_id,
td.universities_colleges_name
FROM
student t
LEFT JOIN school_class ta ON ta.class_id = t.class_id
AND ta.class_status = 1
LEFT JOIN university_system tb ON tb.university_system_id = ta.university_system_id
AND tb.university_system_status = 1
LEFT JOIN university_faculty tc ON tc.university_faculty_id = tb.university_faculty_id
AND tc.university_faculty_status = 1
LEFT JOIN universities_colleges td ON td.universities_colleges_id = tc.universities_colleges_id
AND td.universities_colleges_status = 1
WHERE
1 = 1
AND FIND_IN_SET(t.student_id,#studentIds#)
getStudentExtendSchoolInfoListByUserIds
===
* 通过用户ID 获取学生的学校信息 班级-专业-院系-院校
SELECT
t.*,
ta.class_id,
ta.class_name,
tb.university_system_id,
tb.university_system_name,
tc.university_faculty_id,
tc.university_faculty_name,
td.universities_colleges_id,
td.universities_colleges_name
FROM
student t
LEFT JOIN school_class ta ON ta.class_id = t.class_id
AND ta.class_status = 1
LEFT JOIN university_system tb ON tb.university_system_id = ta.university_system_id
AND tb.university_system_status = 1
LEFT JOIN university_faculty tc ON tc.university_faculty_id = tb.university_faculty_id
AND tc.university_faculty_status = 1
LEFT JOIN universities_colleges td ON td.universities_colleges_id = tc.universities_colleges_id
AND td.universities_colleges_status = 1
WHERE
1 = 1
AND FIND_IN_SET(t.user_id,#userIds#)
getStudentByStudentEditPasswordDTO
===
* 学生端-修改密码 验证信息
SELECT
t.*
FROM
student t
LEFT JOIN core_user ta ON ta.ID = t.user_id
WHERE
1 = 1
AND t.student_status = 1
AND ta.STATE = 'S1'
AND ta.DEL_FLAG = 0
AND t.student_name = #studentName#
AND t.student_sn = #studentSn#
AND ta.PASSWORD = #oldPwd#