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.

252 lines
7.2 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.*,
b.university_faculty_name
@}
from school_class t
LEFT join university_system a on t.university_system_id = a.university_system_id
LEFT join university_faculty b on a.university_faculty_id = b.university_faculty_id
INNER JOIN universities_colleges ta ON ta.universities_colleges_id = b.universities_colleges_id and ta.universities_colleges_status = 1
where 1=1
and a.university_system_status = 1
and b.university_faculty_status = 1
@//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
and #function("schoolClass.query")#
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(universitiesCollegesId)){
and t.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(universitySystemId)){
and t.university_system_id =#universitySystemId#
@}
@if(!isEmpty(className)){
and t.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(classSn)){
and t.class_sn like #'%'+classSn+'%'#
@}
@if(!isEmpty(classStatus)){
and t.class_status =#classStatus#
@}
@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(universityFacultyId)){
and b.university_faculty_id =#universityFacultyId#
@}
ORDER BY t.add_time DESC
deleteSchoolClassByIds
===
* 批量删除
delete from school_class where find_in_set(class_id,#ids#)
getSchoolClassValues
===
* 根据不为空的参数进行查询
select t.*
from school_class t
where 1=1
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(universitiesCollegesId)){
and t.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(universitySystemId)){
and t.university_system_id =#universitySystemId#
@}
@if(!isEmpty(universityFacultyId)){
and t.university_faculty_id =#universityFacultyId#
@}
@if(!isEmpty(className)){
and t.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(classSn)){
and t.class_sn =#classSn#
@}
@if(!isEmpty(classStatus)){
and t.class_status =#classStatus#
@}
@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(teacherId)){
and t.university_system_id =
(select university_system_id from teacher where teacher_id = #teacherId# and teacher_status = 1 order by add_time desc limit 1)
@}
getValuesByQuery
===
* 根据不为空的参数进行查询
select t.*,t.class_name name,t.class_id value
from school_class t
where 1=1
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(universitiesCollegesId)){
and t.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(universitySystemId)){
and t.university_system_id =#universitySystemId#
@}
@if(!isEmpty(className)){
and t.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(classSn)){
and t.class_sn =#classSn#
@}
@if(!isEmpty(classStatus)){
and t.class_status =#classStatus#
@}
@if(!isEmpty(addTime)){
and t.add_time =#addTime#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
getValuesByQueryNotWithPermission
===
* 根据不为空的参数进行查询
select t.*,t.class_name name,t.class_id value
from school_class t
where 1=1
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(universitiesCollegesId)){
and t.universities_colleges_id =#universitiesCollegesId#
@}
@if(!isEmpty(universitySystemId)){
and t.university_system_id =#universitySystemId#
@}
@if(!isEmpty(className)){
and t.class_name like #'%'+className+'%'#
@}
@if(!isEmpty(classSn)){
and t.class_sn =#classSn#
@}
@if(!isEmpty(classStatus)){
and t.class_status =#classStatus#
@}
@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(oldClassId)){
and t.old_class_id =#oldClassId#
@}
getAllSchoolClass
===
* 查询所有的班级
select
CONCAT_WS( '___ID', t.class_name, t.class_id ) AS `key`
from school_class t
where class_status = 1
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
order by class_id desc
getClassesByOrgId
===
select school_class.class_id as classId,school_class.class_name as className from school_class join universities_colleges on
school_class.universities_colleges_id = universities_colleges.universities_colleges_id where universities_colleges.universities_colleges_id = #orgId# ORDER BY class_id
getClassListByMajorId
===
select class_id as id,class_name as name from school_class where university_system_id = #majorId#
getClassesBySchoolId
===
select old_class_id as id,class_name as name from school_class join universities_colleges on school_class.universities_colleges_id=universities_colleges.universities_colleges_id where universities_colleges.old_school_id = #schoolId#
getClassesByOldSchoolId
===
select* from school_class where universities_colleges_id = #oldSchoolId#
getClassIdsByZhiyun
===
SELECT
teacher.teacher_id as userId,
GROUP_CONCAT(DISTINCT school_class.old_class_id ORDER BY school_class.old_class_id SEPARATOR ',') AS class_ids,
3 as roleId
FROM
universities_colleges
JOIN
school_class ON universities_colleges.universities_colleges_id = school_class.universities_colleges_id
JOIN
teacher ON teacher.universities_colleges_id = universities_colleges.universities_colleges_id
WHERE teacher_id = #userId# AND school_class.class_status = 1
GROUP BY
teacher.teacher_id, universities_colleges.universities_colleges_id, universities_colleges.universities_colleges_name
ORDER BY
teacher.teacher_id;
findAllClass
===
select old_class_id as id,class_name as name from school_class where class_status = 1
getClassIdsByZhiyunAndUserIdIsNull
===
SELECT
teacher.teacher_id as userId,
GROUP_CONCAT(DISTINCT school_class.old_class_id ORDER BY school_class.old_class_id SEPARATOR ',') AS class_ids,
3 as roleId
FROM
universities_colleges
JOIN
school_class ON universities_colleges.universities_colleges_id = school_class.universities_colleges_id
JOIN
teacher ON teacher.universities_colleges_id = universities_colleges.universities_colleges_id
WHERE school_class.class_status = 1
GROUP BY
teacher.teacher_id, universities_colleges.universities_colleges_id, universities_colleges.universities_colleges_name
ORDER BY
teacher.teacher_id;
findClassNameByClassId
===
SELECT class_name as name FROM school_class WHERE old_class_id = #classId#