254 lines
5.0 KiB
Markdown

searchStudents
===
* 分页查查询学生信息 团队搜索学生接口
SELECT
@pageTag(){
u.id,u.username,u.student_no,u.sex
@}
FROM users u
WHERE
u.type = 4
AND u.class_id = #users.classId#
AND u.id <> #users.id#
@if(!isEmpty(teamUsersids)){
AND u.id in (#join(teamUsersids)#)
@}
@if(!isEmpty(teamsQuery.username)){
AND (u.username LIKE #'%'+teamsQuery.username+'%'# OR u.student_no LIKE #'%'+teamsQuery.username+'%'#)
@}
queryByCondition
===
* 根据不为空的参数进行分页查询
select
@pageTag(){
t.*
@}
from users t
where 1=1
@//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
and #function("users.query")#
@if(!isEmpty(id)){
and t.id =#id#
@}
@if(!isEmpty(createdAt)){
and t.created_at =#createdAt#
@}
@if(!isEmpty(deletedAt)){
and t.deleted_at =#deletedAt#
@}
@if(!isEmpty(updatedAt)){
and t.updated_at =#updatedAt#
@}
@if(!isEmpty(data)){
and t.data =#data#
@}
@if(!isEmpty(exUserId)){
and t.ex_user_id =#exUserId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(type)){
and t.type =#type#
@}
@if(!isEmpty(sex)){
and t.sex =#sex#
@}
@if(!isEmpty(username)){
and t.username =#username#
@}
@if(!isEmpty(password)){
and t.password =#password#
@}
@if(!isEmpty(studentNo)){
and t.student_no =#studentNo#
@}
@if(!isEmpty(nickname)){
and t.nickname =#nickname#
@}
@if(!isEmpty(initBalance)){
and t.init_balance =#initBalance#
@}
@if(!isEmpty(balance)){
and t.balance =#balance#
@}
@if(!isEmpty(productAssets)){
and t.product_assets =#productAssets#
@}
@if(!isEmpty(totalAssets)){
and t.total_assets =#totalAssets#
@}
@if(!isEmpty(coreUserId)){
and t.core_user_id =#coreUserId#
@}
@if(!isEmpty(coreOrgId)){
and t.core_org_id =#coreOrgId#
@}
deleteUsersByIds
===
* 批量删除
delete from users where find_in_set(id,#ids#)
getUsersValues
===
* 根据不为空的参数进行查询
select t.*
from users t
where 1=1
@if(!isEmpty(id)){
and t.id =#id#
@}
@if(!isEmpty(createdAt)){
and t.created_at =#createdAt#
@}
@if(!isEmpty(deletedAt)){
and t.deleted_at =#deletedAt#
@}
@if(!isEmpty(updatedAt)){
and t.updated_at =#updatedAt#
@}
@if(!isEmpty(data)){
and t.data =#data#
@}
@if(!isEmpty(exUserId)){
and t.ex_user_id =#exUserId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(type)){
and t.type =#type#
@}
@if(!isEmpty(sex)){
and t.sex =#sex#
@}
@if(!isEmpty(username)){
and t.username =#username#
@}
@if(!isEmpty(password)){
and t.password =#password#
@}
@if(!isEmpty(studentNo)){
and t.student_no =#studentNo#
@}
@if(!isEmpty(nickname)){
and t.nickname =#nickname#
@}
@if(!isEmpty(initBalance)){
and t.init_balance =#initBalance#
@}
@if(!isEmpty(balance)){
and t.balance =#balance#
@}
@if(!isEmpty(productAssets)){
and t.product_assets =#productAssets#
@}
@if(!isEmpty(totalAssets)){
and t.total_assets =#totalAssets#
@}
@if(!isEmpty(coreUserId)){
and t.core_user_id =#coreUserId#
@}
@if(!isEmpty(coreOrgId)){
and t.core_org_id =#coreOrgId#
@}
getValuesByQuery
===
* 根据不为空的参数进行查询
select t.*
from users t
where 1=1
@if(!isEmpty(id)){
and t.id =#id#
@}
@if(!isEmpty(createdAt)){
and t.created_at =#createdAt#
@}
@if(!isEmpty(deletedAt)){
and t.deleted_at =#deletedAt#
@}
@if(!isEmpty(updatedAt)){
and t.updated_at =#updatedAt#
@}
@if(!isEmpty(data)){
and t.data =#data#
@}
@if(!isEmpty(exUserId)){
and t.ex_user_id =#exUserId#
@}
@if(!isEmpty(classId)){
and t.class_id =#classId#
@}
@if(!isEmpty(type)){
and t.type =#type#
@}
@if(!isEmpty(sex)){
and t.sex =#sex#
@}
@if(!isEmpty(username)){
and t.username =#username#
@}
@if(!isEmpty(password)){
and t.password =#password#
@}
@if(!isEmpty(studentNo)){
and t.student_no =#studentNo#
@}
@if(!isEmpty(nickname)){
and t.nickname =#nickname#
@}
@if(!isEmpty(initBalance)){
and t.init_balance =#initBalance#
@}
@if(!isEmpty(balance)){
and t.balance =#balance#
@}
@if(!isEmpty(productAssets)){
and t.product_assets =#productAssets#
@}
@if(!isEmpty(totalAssets)){
and t.total_assets =#totalAssets#
@}
@if(!isEmpty(coreUserId)){
and t.core_user_id =#coreUserId#
@}
@if(!isEmpty(coreOrgId)){
and t.core_org_id =#coreOrgId#
@}
getLoginInfo
===
select u.id as user_id,
u.nickname as name,
u.username as username,
cr.NAME as typeName,
s.name as school,
from users u
left join classes c on u.class_id = c.id
left join schools s on c.school_id = s.id
left join core_user cu on u.core_user_id = cu.ID
left join core_user_role cur on cu.ID = cur.USER_ID
left join core_role cr on cr.ID = cur.ROLE_ID
where u.username = #username# and u.password = #password#
getUsersById
===
select * from users where id = #id#