t.user_id_ as "userId"
, t.education_background_ as "educationBackground"
, t.graduate_school_ as "graduateSchool"
, t.technical_titles_ as "technicalTitles"
, t.work_unit_ as "workUnit"
, t.subject_id_ as "subjectId"
, t.default_subject_ as defaultSubject
, t.introduction_ as "introduction"
, t.subject_ as "subject"
, t.grad_certificate_ as "gradCertificate"
, t.degree_certificate_ as "degreeCertificate"
, t.teacher_certificate_ as "teacherCertificate"
, t.entry_flag_ as "entryFlag"
, t.entry_auth_date_ as "entryAuthDate"
, t.musician_flag_ as "musicianFlag"
, t.musician_date_ as "musicianDate"
, t.live_flag_ as "liveFlag"
, t.music_date_ as "musicDate"
, t.video_date_ as "videoDate"
, t.style_date_ as "styleDate"
, t.degree_date_ as "degreeDate"
, t.teacher_date_ as "teacherDate"
, t.degree_flag_ as "degreeFlag"
, t.teacher_flag_ as "teacherFlag"
, t.member_rank_setting_id_ as "memberRankSettingId"
, t.browse_ as "browse"
, t.memo_ as "memo"
, t.tag_ as "tag"
, t.is_settlement_ as "isSettlement"
, t.is_test_user_ as "isTestUser"
, t.create_time_ as "createTime"
, t.update_time_ as "updateTime"
, t.train_time_ as trainTime
, t.evaluate_time_ as evaluateTime
, t.tenant_id_ as tenantId
, t.settlement_from_ as settlementFrom
, t.im_device_id_ as imDeviceId
SELECT
,
if(u.lock_flag_ = 0 and t.lock_flag_ = 0,0,1) as lockFlag,
u.username_ as username,
u.phone_ as phone,
u.real_name_ as realName,
u.avatar_ as avatar,
u.birthdate_ as birthdate,
u.gender_ as gender,
u.del_flag_ as delFlag,
ifnull(vcr2.vip_type_,'NORMAL') as vipType,
max(if(vcr.vip_type_ = 'VIP', vcr.end_time_, null)) vipEndTime,
max(if(vcr.vip_type_ = 'SVIP' and vcr.type_ = 'PERPETUAL', vcr.end_time_ , null)) perSvipEndTime,
max(if(vcr.vip_type_ = 'SVIP', vcr.end_time_, null)) svipEndTime,
max(vcr.end_time_) currentVipEndTime,
(case when isnull(u.id_card_no_) then 0 else 1 end) as isReal,
(case when isnull(b.user_id_) then 0 else 1 end) as isBank,
(case when t.tenant_id_ = -1 then '平台' else ti.name_ end) as tenantName
FROM teacher t
left join sys_user u on t.user_id_ = u.id_
left join (
select distinct user_id_ from user_bank_card where del_flag_ = 0
) b on t.user_id_ = b.user_id_
left join tenant_info ti on t.tenant_id_ = ti.id_
left join vip_card_record vcr on t.user_id_ = vcr.user_id_ and vcr.efficient_flag_ = 1 and vcr.client_type_='STUDENT'
left join vip_card_record vcr2 on t.user_id_ = vcr2.user_id_ and vcr2.efficient_flag_ = 1 and vcr2.end_time_ > now() and now() >= vcr2.start_time_ and vcr2.client_type_='STUDENT'
AND (
t.user_id_ LIKE CONCAT('%', #{param.search}, '%') or
u.username_ LIKE CONCAT('%', #{param.search}, '%') or
u.real_name_ LIKE CONCAT('%', #{param.search}, '%') or
u.phone_ LIKE CONCAT('%', #{param.search}, '%')
)
and (
1=0
or (t.entry_flag_ = 0 and t.musician_flag_ = 0)
or t.entry_flag_ = 1
or t.musician_flag_ = 1
)
and vcr2.id_ is null
and vcr2.vip_type_ = #{param.vipType}
and find_in_set(#{param.tag},t.tag_)
and t.lock_flag_ = #{param.lockFlag}
and u.del_flag_ = #{param.delFlag}
and find_in_set(#{param.subjectId},t.subject_id_)
and t.is_settlement_ = #{param.isSettlement}
and t.is_test_user_ = #{param.isTestUser}
and vcr.end_time_ <= #{param.vipEndTime}
and vcr.end_time_ >= #{param.vipStartTime}
AND t.train_time_ > 0
AND t.evaluate_time_ > 0
AND t.tenant_id_ = #{param.tenantId}
and t.tenant_id_ = -1
and t.tenant_id_ != -1
AND t.settlement_from_ = #{param.settlementFrom}
and ti.name_ like concat('%',#{param.tenantName},'%')
group by t.user_id_
having currentVipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> currentVipEndTime
order by ${param.orderBy}
order by t.create_time_ desc
SELECT id_ user_id_, username_, real_name_, avatar_, phone_
FROM sys_user
WHERE del_flag_ = 0
and id_ = #{userId}
LIMIT 1
SELECT id_ user_id_,username_,real_name_,avatar_, phone_ FROM sys_user
WHERE del_flag_ = 0 and id_ IN
#{userId}
SELECT
,
if(u.lock_flag_ = 0 and t.lock_flag_ = 0,0,1) as lockFlag,
u.avatar_ as avatar,
u.username_ as username,
u.gender_ as `gender`,
u.birthdate_ as birthdate,
u.phone_ as phone,
(case when isnull(u.id_card_no_) then 0 else 1 end) as isReal,
(!isnull(membership_end_time_) and membership_end_time_ > now()) as isVip,
u.real_name_ as realName,
u.id_card_no_ as idCardNo,
if(vcr.type_ = 'PERMANENT',null,vcr.end_time_) as membershipEndTime,
(case when isnull(b.user_id_) then 0 else 1 end) as isBank,
(
SELECT GROUP_CONCAT(name_ ORDER by locate(id_,t.subject_id_)) FROM subject WHERE FIND_IN_SET(id_,t.subject_id_)
) as subjectName,
u.user_type_ as userType
FROM teacher t
left join sys_user u on t.user_id_ = u.id_
left join (
select distinct user_id_ from user_bank_card where del_flag_ = 0 and user_id_ = #{userId}
) b on t.user_id_ = b.user_id_
left join vip_card_record vcr on t.user_id_ = vcr.user_id_ and vcr.client_type_ = 'TEACHER'
and vcr.efficient_flag_ = 1 and vcr.end_time_ >= now() and now() > vcr.start_time_ and (vcr.vip_type_ = 'VIP' or vcr.vip_type_ = 'SVIP') and vcr.client_type_ = 'TEACHER'
where u.del_flag_ = 0 and t.user_id_ = #{userId}
SELECT s.*
FROM `subject` s
LEFT JOIN teacher t ON FIND_IN_SET(s.id_, t.subject_id_)
WHERE t.user_id_ = #{userId}
update teacher
set subject_id_ = #{subjectIds},
update_time_ = now()
where user_id_ = #{id}
update teacher
set browse_ = browse_ + 1
where user_id_ = #{userId}
select t.* from subject t
join (
select a.subject_id_ from (
union all
(select music_subject_ as subject_id_ from music_sheet where user_id_ = #{userId} GROUP BY
music_subject_)
union all
(select lesson_subject_ as subject_id_ from video_lesson_group where teacher_id_ = #{userId} GROUP BY
lesson_subject_)
union all
(select subject_id_ as subject_id_ from course_group where type_ = 'PIANO_ROOM_CLASS' and teacher_id_ =
#{userId} GROUP BY subject_id_)
union all
(select subject_id_ as subject_id_ from course_group where type_ = 'PRACTICE' and teacher_id_ =
#{userId} GROUP BY subject_id_)
union all
(select subject_id_ as subject_id_ from course_group where type_ = 'LIVE' and teacher_id_ = #{userId}
GROUP BY subject_id_)
) a group by a.subject_id_
) a on t.id_ = a.subject_id_
where t.parent_subject_id_ != 0
and not exists(
select 1 from teacher s where s.user_id_ = #{userId} and find_in_set(t.id_,s.subject_id_)
)
SELECT
s.student_id_ AS userId,
s.create_time_ AS starTime,
u.avatar_ AS avatar,
u.username_ AS userName,
u.real_name_ AS realName,
u.gender_ AS gender,
u.phone_ AS phone,
u.birthdate_ AS birthdate,
(SELECT group_concat(name_) FROM `subject` WHERE find_in_set(id_,sr.subject_id_)) AS subjectName
FROM student_star s
LEFT JOIN sys_user u ON s.student_id_ = u.id_
LEFT JOIN student sr ON s.student_id_ = sr.user_id_
u.del_flag_ = 0
AND s.teacher_id_ =#{record.teacherId}
AND u.username_ LIKE '%${record.nickname}%'
AND u.id_ = #{record.userId}
AND u.phone_ = #{record.phone}
AND ( #{record.startTime} <= s.create_time_ AND s.create_time_ <= #{record.endTime})
select t.user_id_, t.graduate_school_, u.username_, u.avatar_, ifnull(a.speaker_id_, 0) isLiving_
from teacher t
left join sys_user u on t.user_id_ = u.id_
left join teacher_total tt on tt.user_id_ = t.user_id_
left join (SELECT lr.speaker_id_
from live_room lr
WHERE live_state_ = 1 and type_ = 'temp'
group by lr.speaker_id_) a on a.speaker_id_ = t.user_id_
where t.entry_flag_ = 1
and t.is_test_user_ = 0
and find_in_set(#{subjectId}, t.subject_id_)
order by tt.fans_num_ desc
limit 10
SELECT t1.teacher_id_ AS id, COUNT(DISTINCT t1.id_) AS total FROM user_binding_teacher t1
AND t1.teacher_id_ IN (
#{item}
)
GROUP BY t1.teacher_id_
select tenant_id_ tenantId, count(tenant_id_) count
from teacher
lock_flag_ = 0
AND tenant_id_ in
#{item}
group by tenant_id_
select count(tenant_id_)
from teacher
lock_flag_ = 0
and tenant_id_ = #{id}