hasTeam === * 判断是否已经有团队,用于是否可以创建团队 SELECT count(*) FROM `teams` WHERE `teams`.`examination_id` = #teamsQuery.examinationId# AND `teams`.`examination_id` IS NOT NULL AND `class_id` = #classId# AND `end_time` > now() AND EXISTS ( SELECT * FROM `users` INNER JOIN `user_teams` ON `users`.`id` = `user_teams`.`user_id` WHERE `teams`.`id` = `user_teams`.`team_id` AND `user_id` = #id# ) AND `teams`.`deleted_at` IS NULL getteamList === * 获取团队列表 SELECT @pageTag(){ * @} FROM `teams` WHERE `teams`.`examination_id` = #teamsQuery.examinationId# AND `class_id` = #users.classId# AND `end_time` > now() AND `teams`.`deleted_at` IS NULL ORDER BY `end_time` DESC ifAddTeamed === * 判断团队成员是否加入其它团队 SELECT count(*) FROM `teams` WHERE `teams`.`examination_id` = #examinationId# AND `teams`.`examination_id` IS NOT NULL AND `class_id` = #users.classId# AND `end_time` > #endTime# AND EXISTS ( SELECT * FROM `users` INNER JOIN `user_teams` ON `users`.`id` = `user_teams`.`user_id` WHERE `teams`.`id` = `user_teams`.`team_id` AND `user_id` IN ( #users.id# )) AND `teams`.`deleted_at` IS NULL isTeamExist === * 判断是否有团队存在 SELECT count(*) FROM teams t WHERE t.leader_id=#id# AND t.flow_id=#editTeamVO.flowId# AND t.examination_id=#editTeamVO.examinationId# AND t.end_time >= now() getTeamsOrNew === * 获取符合条件的第一条数据 SELECT * FROM teams ts WHERE ts.`name`=#name# and ts.flow_id = #flowId# LIMIT 0,1; getTeams === * 获取用户角色的组 SELECT * FROM `teams` WHERE `examination_id` = #examinations.id# AND `flow_id` = #examinations.flowId# AND EXISTS ( SELECT * FROM `users` INNER JOIN `user_teams` ON `users`.`id` = `user_teams`.`user_id` WHERE `teams`.`id` = `user_teams`.`team_id` AND `user_id` = #id# ) AND `teams`.`deleted_at` IS NULL LIMIT 0,1 getPracticeModeValue === * 获取个人练习模式下的数据 SELECT * FROM teams ts LEFT JOIN user_teams us ON ts.id = us.team_id WHERE ts.end_time > now() @if(teamId==1){ AND ts.id = #teamId# @} @if(teamId==0){ AND ts.examination_id = #examinations.id# @} AND us.user_id = #id# queryByCondition === * 根据不为空的参数进行分页查询 select @pageTag(){ t.* @} from teams t where 1=1 @//数据权限,该sql语句功能点,如果不考虑数据权限,可以删除此行 and #function("teams.query")# @if(!isEmpty(id)){ and t.id =#id# @} @if(!isEmpty(createdAt)){ and t.created_at =#createdAt# @} @if(!isEmpty(updatedAt)){ and t.updated_at =#updatedAt# @} @if(!isEmpty(deletedAt)){ and t.deleted_at =#deletedAt# @} @if(!isEmpty(data)){ and t.data =#data# @} @if(!isEmpty(name)){ and t.name =#name# @} @if(!isEmpty(creatorId)){ and t.creator_id =#creatorId# @} @if(!isEmpty(leaderId)){ and t.leader_id =#leaderId# @} @if(!isEmpty(endTime)){ and t.end_time =#endTime# @} @if(!isEmpty(classId)){ and t.class_id =#classId# @} @if(!isEmpty(flowId)){ and t.flow_id =#flowId# @} @if(!isEmpty(status)){ and t.status =#status# @} @if(!isEmpty(examinationId)){ and t.examination_id =#examinationId# @} deleteTeamsByIds === * 批量删除 delete from teams where find_in_set(id,#ids#) getTeamsValues === * 根据不为空的参数进行查询 select t.* from teams t where 1=1 @if(!isEmpty(id)){ and t.id =#id# @} @if(!isEmpty(createdAt)){ and t.created_at =#createdAt# @} @if(!isEmpty(updatedAt)){ and t.updated_at =#updatedAt# @} @if(!isEmpty(deletedAt)){ and t.deleted_at =#deletedAt# @} @if(!isEmpty(data)){ and t.data =#data# @} @if(!isEmpty(name)){ and t.name =#name# @} @if(!isEmpty(creatorId)){ and t.creator_id =#creatorId# @} @if(!isEmpty(leaderId)){ and t.leader_id =#leaderId# @} @if(!isEmpty(endTime)){ and t.end_time =#endTime# @} @if(!isEmpty(classId)){ and t.class_id =#classId# @} @if(!isEmpty(flowId)){ and t.flow_id =#flowId# @} @if(!isEmpty(status)){ and t.status =#status# @} @if(!isEmpty(examinationId)){ and t.examination_id =#examinationId# @} getValuesByQuery === * 根据不为空的参数进行查询 select t.* from teams t where 1=1 @if(!isEmpty(id)){ and t.id =#id# @} @if(!isEmpty(createdAt)){ and t.created_at =#createdAt# @} @if(!isEmpty(updatedAt)){ and t.updated_at =#updatedAt# @} @if(!isEmpty(deletedAt)){ and t.deleted_at =#deletedAt# @} @if(!isEmpty(data)){ and t.data =#data# @} @if(!isEmpty(name)){ and t.name =#name# @} @if(!isEmpty(creatorId)){ and t.creator_id =#creatorId# @} @if(!isEmpty(leaderId)){ and t.leader_id =#leaderId# @} @if(!isEmpty(endTime)){ and t.end_time =#endTime# @} @if(!isEmpty(classId)){ and t.class_id =#classId# @} @if(!isEmpty(flowId)){ and t.flow_id =#flowId# @} @if(!isEmpty(status)){ and t.status =#status# @} @if(!isEmpty(examinationId)){ and t.examination_id =#examinationId# @}