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.

141 lines
2.4 KiB
Markdown

queryByCondition
===
* 根据不为空的参数进行分页查询
* @//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
* and #function("classes.query")#
select
@pageTag(){
t.*
@}
from classes t
where 1=1
@if(!isEmpty(id)){
and t.id =#id#
@}
@if(!isEmpty(name)){
and t.name =#name#
@}
@if(!isEmpty(createdAt)){
and t.created_at =#createdAt#
@}
@if(!isEmpty(updatedAt)){
and t.updated_at =#updatedAt#
@}
@if(!isEmpty(data)){
and t.data =#data#
@}
@if(!isEmpty(schoolId)){
and t.school_id =#schoolId#
@}
@if(!isEmpty(teacherId)){
and t.teacher_id =#teacherId#
@}
deleteClassesByIds
===
* 批量删除
delete from classes where find_in_set(id,#ids#)
getClassesValues
===
* 根据不为空的参数进行查询
select t.*
from classes t
where 1=1
@if(!isEmpty(id)){
and t.id =#id#
@}
@if(!isEmpty(name)){
and t.name =#name#
@}
@if(!isEmpty(createdAt)){
and t.created_at =#createdAt#
@}
@if(!isEmpty(updatedAt)){
and t.updated_at =#updatedAt#
@}
@if(!isEmpty(data)){
and t.data =#data#
@}
@if(!isEmpty(schoolId)){
and t.school_id =#schoolId#
@}
@if(!isEmpty(teacherId)){
and t.teacher_id =#teacherId#
@}
getValuesByQuery
===
* 根据不为空的参数进行查询
select t.*
from classes t
where 1=1
@if(!isEmpty(id)){
and t.id =#id#
@}
@if(!isEmpty(name)){
and t.name =#name#
@}
@if(!isEmpty(createdAt)){
and t.created_at =#createdAt#
@}
@if(!isEmpty(updatedAt)){
and t.updated_at =#updatedAt#
@}
@if(!isEmpty(data)){
and t.data =#data#
@}
@if(!isEmpty(schoolId)){
and t.school_id =#schoolId#
@}
@if(!isEmpty(teacherId)){
and t.teacher_id =#teacherId#
@}
getClassesById
===
* 根据id获取classes
select * from classes where id = #id#
getClassesByExaminationIdList
===
* 根据一组examinationId获取实训关联班名列表
select t3.examination_id, t3.class_id as id, t4.name
from
(SELECT t1.id, t1.name
from examinations t1
WHERE find_in_set(t1.id, #examinationIdList# ) ) t2
join examination_classes t3 on t2.id = t3.examination_id
join classes t4 on t3.class_id = t4.id