t.user_id_ as "userId"
, t.subject_id_ as "subjectId"
, t.current_grade_num_ as "currentGradeNum"
, t.member_rank_setting_id_ as "memberRankSettingId"
, t.membership_start_time_ as "membershipStartTime"
, t.membership_end_time_ as "membershipEndTime"
, t.cloud_study_sequence_days_ as "cloudStudySequenceDays"
, t.cloud_study_use_last_day_ as "cloudStudyUseLastDay"
, t.create_time_ as "createTime"
, t.update_time_ as "updateTime"
update student set subject_id_ = #{subjectIds},update_time_ = now() where user_id_ = #{id}
SELECT
,
u.avatar_ as avatar,
u.real_name_ as realName,
u.id_card_no_ as idCardNo,
u.username_ as username,
u.gender_ as gender,
u.birthdate_ as birthdate,
TIMESTAMPDIFF(YEAR, u.birthdate_, CURDATE()) as age,
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,
(
SELECT GROUP_CONCAT(name_) FROM subject WHERE FIND_IN_SET(id_,t.subject_id_)
) as subjectName
FROM student t
left join sys_user u on t.user_id_ = u.id_
where t.user_id_ = #{userId}
SELECT
,
u.username_ as username,
u.gender_ as gender,
u.birthdate_ as birthdate,
TIMESTAMPDIFF(YEAR, u.birthdate_, CURDATE()) as age,
u.phone_ as phone,
!isnull(birthdate_) as isReal,
(!isnull(membership_end_time_) and membership_end_time_ > now()) as isVip,
(
SELECT GROUP_CONCAT(name_) FROM subject WHERE FIND_IN_SET(id_,t.subject_id_)
) as subjectName
FROM student t
left join sys_user u on t.user_id_ = u.id_
AND (
t.user_id_ LIKE CONCAT('%', #{param.search}, '%') or
u.username_ LIKE CONCAT('%', #{param.search}, '%') or
u.phone_ LIKE CONCAT('%', #{param.search}, '%')
)
and u.gender_ = #{param.gender}
and INTE_ARRAY(t.subject_id_,#{param.subjectId})
and t.membership_end_time_ > now()
and (t.membership_end_time_ is null or t.membership_end_time_ <= now())
= #{param.startTime} ]]>
select * from subject t
where exists(
select 1 from student s where s.user_id_ = #{userId} and find_in_set(t.id_,s.subject_id_)
union all
select 1 from music_sheet a
left join music_sheet_purchase_record a1 on a.id_ = a1.music_sheet_id_
where a1.student_id_ = #{userId} and a1.order_status_ = 'PAID' and find_in_set(t.id_,a.music_subject_)
union all
select 1 from course_group b
left join course_schedule_student_payment b1 on b.id_ = b1.course_group_id_
where b1.user_id_ = #{userId} and find_in_set(t.id_,b.subject_id_)
union all
select 1 from video_lesson_group c
left join video_lesson_purchase_record c1 on c.id_ = c1.video_lesson_group_id_
where c1.student_id_ = #{userId} and find_in_set(t.id_,c.lesson_subject_)
)
SELECT
s.teacher_id_ AS userId,
u.avatar_ AS avatar,
u.username_ AS userName,
u.real_name_ AS realName,
u.gender_ AS gender,
t.star_grade_ AS starGrade,
t.fans_num_ AS fansNum,
t.live_flag_ AS liveFlag,
t.exp_time_ AS expTime,
tr.musician_flag_ AS musicianFlag,
tr.entry_flag_ AS entryFlag,
(SELECT group_concat(name_) FROM `subject` WHERE find_in_set(id_,tr.subject_id_)) AS subjectName
FROM student_star s
LEFT JOIN sys_user u ON s.teacher_id_ = u.id_
LEFT JOIN teacher_total t ON s.teacher_id_ = t.user_id_
LEFT JOIN teacher tr ON s.teacher_id_ = tr.user_id_
WHERE s.student_id_ = #{studentId}