|
|
queryByCondition
|
|
|
===
|
|
|
* 根据不为空的参数进行分页查询
|
|
|
|
|
|
select
|
|
|
@pageTag(){
|
|
|
t.*,
|
|
|
ifnull((select count(1) from teacher_open_course_chat_log a
|
|
|
where a.teacher_open_course_chat_log_status = 1
|
|
|
and a.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
|
|
|
), 0) as comment_count
|
|
|
@}
|
|
|
from teacher_open_course_chat_log t
|
|
|
where 1=1
|
|
|
@//数据权限,该sql语句功能点,如果不考虑数据权限,可以删除此行
|
|
|
and #function("teacherOpenCourseChatLog.query")#
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogId)){
|
|
|
and t.teacher_open_course_chat_log_id =#teacherOpenCourseChatLogId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_id,#teacherOpenCourseChatLogIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogParentId)){
|
|
|
and t.teacher_open_course_chat_log_parent_id =#teacherOpenCourseChatLogParentId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogParentIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_parent_id,#teacherOpenCourseChatLogParentIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseId)){
|
|
|
and t.teacher_open_course_id =#teacherOpenCourseId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(schoolClassIds)){
|
|
|
and t.school_class_ids =#schoolClassIds#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherId)){
|
|
|
and t.teacher_id =#teacherId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherIdPlural)){
|
|
|
and find_in_set(t.teacher_id,#teacherIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(studentId)){
|
|
|
and t.student_id =#studentId#
|
|
|
@}
|
|
|
@if(!isEmpty(studentIdPlural)){
|
|
|
and find_in_set(t.student_id,#studentIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(chatContent)){
|
|
|
and t.chat_content =#chatContent#
|
|
|
@}
|
|
|
@if(!isEmpty(keywords)){
|
|
|
and t.keywords like #"%"+keywords+"%"#
|
|
|
@}
|
|
|
@if(!isEmpty(studentScore)){
|
|
|
and t.student_score =#studentScore#
|
|
|
@}
|
|
|
@if(!isEmpty(chatFiles)){
|
|
|
and t.chat_files =#chatFiles#
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogSendType)){
|
|
|
and find_in_set(t.chat_log_send_type, #chatLogSendType#)
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogSendTypePlural)){
|
|
|
and find_in_set(t.chat_log_send_type,#chatLogSendTypePlural#)
|
|
|
@}
|
|
|
@if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){
|
|
|
and t.teacher_open_course_chat_log_status != 2
|
|
|
@}else{
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogStatus)){
|
|
|
and t.teacher_open_course_chat_log_status =#teacherOpenCourseChatLogStatus#
|
|
|
@}else if(!isEmpty(teacherOpenCourseChatLogStatusPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_status,#teacherOpenCourseChatLogStatusPlural#)
|
|
|
@}
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogAddTime)){
|
|
|
and t.teacher_open_course_chat_log_add_time =#teacherOpenCourseChatLogAddTime#
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgIdPlural)){
|
|
|
and find_in_set(t.org_id,#orgIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogFullId)){
|
|
|
and t.chat_log_full_id like #"%"+chatLogFullId+"%"#
|
|
|
@}
|
|
|
@if(!isEmpty(userIdPlural)){
|
|
|
and find_in_set(t.user_id,#userIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(replyStatus)){
|
|
|
and
|
|
|
@// 待回复的消息
|
|
|
@if(replyStatus == 1) {
|
|
|
NOT
|
|
|
@}
|
|
|
@if(replyStatus == 1) {
|
|
|
@// 这里留空,代表查询已回复的消息
|
|
|
@}
|
|
|
EXISTS (
|
|
|
SELECT
|
|
|
1
|
|
|
FROM
|
|
|
teacher_open_course_chat_log ta
|
|
|
WHERE
|
|
|
ta.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
|
|
|
AND ta.teacher_open_course_chat_log_status = 1
|
|
|
)
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogParentId)){
|
|
|
@pageIgnoreTag(){
|
|
|
order by teacher_open_course_chat_log_add_time desc
|
|
|
@}
|
|
|
@}
|
|
|
|
|
|
queryByCondition2
|
|
|
===
|
|
|
* 根据不为空的参数进行分页查询
|
|
|
|
|
|
#use("queryByCondition")#
|
|
|
|
|
|
|
|
|
queryByConditionQuery
|
|
|
===
|
|
|
* 根据不为空的参数进行分页查询(无权限)
|
|
|
|
|
|
select
|
|
|
@pageTag(){
|
|
|
t.*,
|
|
|
tc.class_name,
|
|
|
ifnull((select count(1) from teacher_open_course_chat_log a
|
|
|
where a.teacher_open_course_chat_log_status = 1
|
|
|
and a.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
|
|
|
), 0) as comment_count,
|
|
|
@// 指定提问,随机提问类型,查询学生回答的数据。只查询一级
|
|
|
(case when find_in_set(t.chat_log_send_type, 'specify_ask,random_ask') then
|
|
|
(select chat_content
|
|
|
from teacher_open_course_chat_log za
|
|
|
where za.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
|
|
|
and za.teacher_open_course_chat_log_status = 1
|
|
|
order by teacher_open_course_chat_log_add_time desc limit 1
|
|
|
)
|
|
|
else
|
|
|
''
|
|
|
end ) as reply_content
|
|
|
@}
|
|
|
from teacher_open_course_chat_log t
|
|
|
left join student ta on ta.student_id = t.student_id
|
|
|
left join school_class tc on tc.class_id = ta.class_id
|
|
|
where 1=1
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogId)){
|
|
|
and t.teacher_open_course_chat_log_id =#teacherOpenCourseChatLogId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_id,#teacherOpenCourseChatLogIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogParentId)){
|
|
|
and t.teacher_open_course_chat_log_parent_id =#teacherOpenCourseChatLogParentId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogParentIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_parent_id,#teacherOpenCourseChatLogParentIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseId)){
|
|
|
and t.teacher_open_course_id =#teacherOpenCourseId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(schoolClassIds)){
|
|
|
and t.school_class_ids =#schoolClassIds#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherId)){
|
|
|
and t.teacher_id =#teacherId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherIdPlural)){
|
|
|
and find_in_set(t.teacher_id,#teacherIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(studentId)){
|
|
|
and t.student_id =#studentId#
|
|
|
@}
|
|
|
@if(!isEmpty(studentIdPlural)){
|
|
|
and find_in_set(t.student_id,#studentIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(chatContent)){
|
|
|
and t.chat_content =#chatContent#
|
|
|
@}
|
|
|
@if(!isEmpty(keywords)){
|
|
|
and t.keywords like #"%"+keywords+"%"#
|
|
|
@}
|
|
|
@if(!isEmpty(studentScore)){
|
|
|
and t.student_score =#studentScore#
|
|
|
@}
|
|
|
@if(!isEmpty(chatFiles)){
|
|
|
and t.chat_files =#chatFiles#
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogSendType)){
|
|
|
and find_in_set(t.chat_log_send_type, #chatLogSendType#)
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogSendTypePlural)){
|
|
|
and find_in_set(t.chat_log_send_type,#chatLogSendTypePlural#)
|
|
|
@}
|
|
|
@if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){
|
|
|
and t.teacher_open_course_chat_log_status != 2
|
|
|
@}else{
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogStatus)){
|
|
|
and t.teacher_open_course_chat_log_status =#teacherOpenCourseChatLogStatus#
|
|
|
@}else if(!isEmpty(teacherOpenCourseChatLogStatusPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_status,#teacherOpenCourseChatLogStatusPlural#)
|
|
|
@}
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogAddTime)){
|
|
|
and t.teacher_open_course_chat_log_add_time =#teacherOpenCourseChatLogAddTime#
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgIdPlural)){
|
|
|
and find_in_set(t.org_id,#orgIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogFullId)){
|
|
|
and t.chat_log_full_id like #"%"+chatLogFullId+"%"#
|
|
|
@}
|
|
|
@if(!isEmpty(userIdPlural)){
|
|
|
and find_in_set(t.user_id,#userIdPlural#)
|
|
|
@}
|
|
|
order by t.teacher_open_course_chat_log_add_time desc
|
|
|
|
|
|
|
|
|
|
|
|
deleteTeacherOpenCourseChatLogByIds
|
|
|
===
|
|
|
|
|
|
* 批量删除(假删除)
|
|
|
|
|
|
update teacher_open_course_chat_log set teacher_open_course_chat_log_status = 2 where find_in_set(teacher_open_course_chat_log_id,#ids#)
|
|
|
|
|
|
|
|
|
deleteByIds
|
|
|
===
|
|
|
|
|
|
* 批量删除(真删除)
|
|
|
|
|
|
delete from teacher_open_course_chat_log where find_in_set(teacher_open_course_chat_log_id,#ids#)
|
|
|
|
|
|
|
|
|
|
|
|
getByIds
|
|
|
===
|
|
|
|
|
|
select * from teacher_open_course_chat_log where find_in_set(teacher_open_course_chat_log_id,#ids#)
|
|
|
|
|
|
|
|
|
updateGivenByIds
|
|
|
===
|
|
|
|
|
|
* 批量更新指定字段,无论此字段是否有值
|
|
|
|
|
|
update teacher_open_course_chat_log
|
|
|
set
|
|
|
@if(contain("teacherOpenCourseChatLogParentId",_given)){
|
|
|
@if(isEmpty(teacherOpenCourseChatLogParentId)){
|
|
|
teacher_open_course_chat_log_parent_id = null ,
|
|
|
@}else{
|
|
|
teacher_open_course_chat_log_parent_id = #teacherOpenCourseChatLogParentId# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("teacherOpenCourseId",_given)){
|
|
|
@if(isEmpty(teacherOpenCourseId)){
|
|
|
teacher_open_course_id = null ,
|
|
|
@}else{
|
|
|
teacher_open_course_id = #teacherOpenCourseId# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("schoolClassIds",_given)){
|
|
|
@if(isEmpty(schoolClassIds)){
|
|
|
school_class_ids = null ,
|
|
|
@}else{
|
|
|
school_class_ids = #schoolClassIds# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("teacherId",_given)){
|
|
|
@if(isEmpty(teacherId)){
|
|
|
teacher_id = null ,
|
|
|
@}else{
|
|
|
teacher_id = #teacherId# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("studentId",_given)){
|
|
|
@if(isEmpty(studentId)){
|
|
|
student_id = null ,
|
|
|
@}else{
|
|
|
student_id = #studentId# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("chatContent",_given)){
|
|
|
@if(isEmpty(chatContent)){
|
|
|
chat_content = null ,
|
|
|
@}else{
|
|
|
chat_content = #chatContent# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("keywords",_given)){
|
|
|
@if(isEmpty(keywords)){
|
|
|
keywords = null ,
|
|
|
@}else{
|
|
|
keywords = #keywords# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("studentScore",_given)){
|
|
|
@if(isEmpty(studentScore)){
|
|
|
student_score = null ,
|
|
|
@}else{
|
|
|
student_score = #studentScore# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("chatFiles",_given)){
|
|
|
@if(isEmpty(chatFiles)){
|
|
|
chat_files = null ,
|
|
|
@}else{
|
|
|
chat_files = #chatFiles# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("chatLogSendType",_given)){
|
|
|
@if(isEmpty(chatLogSendType)){
|
|
|
chat_log_send_type = null ,
|
|
|
@}else{
|
|
|
chat_log_send_type = #chatLogSendType# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("teacherOpenCourseChatLogStatus",_given)){
|
|
|
@if(isEmpty(teacherOpenCourseChatLogStatus)){
|
|
|
teacher_open_course_chat_log_status = null ,
|
|
|
@}else{
|
|
|
teacher_open_course_chat_log_status = #teacherOpenCourseChatLogStatus# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("teacherOpenCourseChatLogAddTime",_given)){
|
|
|
@if(isEmpty(teacherOpenCourseChatLogAddTime)){
|
|
|
teacher_open_course_chat_log_add_time = null ,
|
|
|
@}else{
|
|
|
teacher_open_course_chat_log_add_time = #teacherOpenCourseChatLogAddTime# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("orgId",_given)){
|
|
|
@if(isEmpty(orgId)){
|
|
|
org_id = null ,
|
|
|
@}else{
|
|
|
org_id = #orgId# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("userId",_given)){
|
|
|
@if(isEmpty(userId)){
|
|
|
user_id = null ,
|
|
|
@}else{
|
|
|
user_id = #userId# ,
|
|
|
@}
|
|
|
@}
|
|
|
teacher_open_course_chat_log_id = teacher_open_course_chat_log_id
|
|
|
where find_in_set(teacher_open_course_chat_log_id,#teacherOpenCourseChatLogIdPlural#)
|
|
|
|
|
|
|
|
|
|
|
|
getTeacherOpenCourseChatLogValues
|
|
|
===
|
|
|
|
|
|
* 根据不为空的参数进行查询
|
|
|
|
|
|
select t.*
|
|
|
from teacher_open_course_chat_log t
|
|
|
where 1=1
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogId)){
|
|
|
and t.teacher_open_course_chat_log_id =#teacherOpenCourseChatLogId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogParentId)){
|
|
|
and t.teacher_open_course_chat_log_parent_id =#teacherOpenCourseChatLogParentId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseId)){
|
|
|
and t.teacher_open_course_id =#teacherOpenCourseId#
|
|
|
@}
|
|
|
@if(!isEmpty(schoolClassIds)){
|
|
|
and t.school_class_ids =#schoolClassIds#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherId)){
|
|
|
and t.teacher_id =#teacherId#
|
|
|
@}
|
|
|
@if(!isEmpty(studentId)){
|
|
|
and t.student_id =#studentId#
|
|
|
@}
|
|
|
@if(!isEmpty(chatContent)){
|
|
|
and t.chat_content =#chatContent#
|
|
|
@}
|
|
|
@if(!isEmpty(keywords)){
|
|
|
and t.keywords like #"%"+keywords+"%"#
|
|
|
@}
|
|
|
@if(!isEmpty(studentScore)){
|
|
|
and t.student_score =#studentScore#
|
|
|
@}
|
|
|
@if(!isEmpty(chatFiles)){
|
|
|
and t.chat_files =#chatFiles#
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogSendType)){
|
|
|
and find_in_set(t.chat_log_send_type, #chatLogSendType#)
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogStatus)){
|
|
|
and t.teacher_open_course_chat_log_status =#teacherOpenCourseChatLogStatus#
|
|
|
@}else{
|
|
|
and t.teacher_open_course_chat_log_status != 2
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogAddTime)){
|
|
|
and t.teacher_open_course_chat_log_add_time =#teacherOpenCourseChatLogAddTime#
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogFullId)){
|
|
|
and t.chat_log_full_id like #"%"+chatLogFullId+"%"#
|
|
|
@}
|
|
|
|
|
|
|
|
|
getValuesByQuery
|
|
|
===
|
|
|
|
|
|
* 根据不为空的参数进行查询
|
|
|
|
|
|
select t.*
|
|
|
from teacher_open_course_chat_log t
|
|
|
where 1=1 and #function("teacherOpenCourseChatLog.query")#
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogId)){
|
|
|
and t.teacher_open_course_chat_log_id =#teacherOpenCourseChatLogId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_id,#teacherOpenCourseChatLogIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogParentId)){
|
|
|
and t.teacher_open_course_chat_log_parent_id =#teacherOpenCourseChatLogParentId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogParentIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_parent_id,#teacherOpenCourseChatLogParentIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseId)){
|
|
|
and t.teacher_open_course_id =#teacherOpenCourseId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(schoolClassIds)){
|
|
|
and t.school_class_ids =#schoolClassIds#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherId)){
|
|
|
and t.teacher_id =#teacherId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherIdPlural)){
|
|
|
and find_in_set(t.teacher_id,#teacherIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(studentId)){
|
|
|
and t.student_id =#studentId#
|
|
|
@}
|
|
|
@if(!isEmpty(studentIdPlural)){
|
|
|
and find_in_set(t.student_id,#studentIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(chatContent)){
|
|
|
and t.chat_content =#chatContent#
|
|
|
@}
|
|
|
@if(!isEmpty(keywords)){
|
|
|
and t.keywords like #"%"+keywords+"%"#
|
|
|
@}
|
|
|
@if(!isEmpty(studentScore)){
|
|
|
and t.student_score =#studentScore#
|
|
|
@}
|
|
|
@if(!isEmpty(chatFiles)){
|
|
|
and t.chat_files =#chatFiles#
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogSendType)){
|
|
|
and find_in_set(t.chat_log_send_type, #chatLogSendType#)
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogSendTypePlural)){
|
|
|
and find_in_set(t.chat_log_send_type,#chatLogSendTypePlural#)
|
|
|
@}
|
|
|
@if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){
|
|
|
and t.teacher_open_course_chat_log_status != 2
|
|
|
@}else{
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogStatus)){
|
|
|
and t.teacher_open_course_chat_log_status =#teacherOpenCourseChatLogStatus#
|
|
|
@}else if(!isEmpty(teacherOpenCourseChatLogStatusPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_status,#teacherOpenCourseChatLogStatusPlural#)
|
|
|
@}
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogAddTime)){
|
|
|
and t.teacher_open_course_chat_log_add_time =#teacherOpenCourseChatLogAddTime#
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgIdPlural)){
|
|
|
and find_in_set(t.org_id,#orgIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(userIdPlural)){
|
|
|
and find_in_set(t.user_id,#userIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogFullId)){
|
|
|
and t.chat_log_full_id like #"%"+chatLogFullId+"%"#
|
|
|
@}
|
|
|
|
|
|
getValuesByQueryNotWithPermission
|
|
|
===
|
|
|
|
|
|
* 根据不为空的参数进行查询(不包含权限)
|
|
|
|
|
|
select t.*
|
|
|
from teacher_open_course_chat_log t
|
|
|
where 1=1
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogId)){
|
|
|
and t.teacher_open_course_chat_log_id =#teacherOpenCourseChatLogId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_id,#teacherOpenCourseChatLogIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogParentId)){
|
|
|
and t.teacher_open_course_chat_log_parent_id =#teacherOpenCourseChatLogParentId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogParentIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_parent_id,#teacherOpenCourseChatLogParentIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseId)){
|
|
|
and t.teacher_open_course_id =#teacherOpenCourseId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseIdPlural)){
|
|
|
and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(schoolClassIds)){
|
|
|
and t.school_class_ids =#schoolClassIds#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherId)){
|
|
|
and t.teacher_id =#teacherId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherIdPlural)){
|
|
|
and find_in_set(t.teacher_id,#teacherIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(studentId)){
|
|
|
and t.student_id =#studentId#
|
|
|
@}
|
|
|
@if(!isEmpty(studentIdPlural)){
|
|
|
and find_in_set(t.student_id,#studentIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(chatContent)){
|
|
|
and t.chat_content =#chatContent#
|
|
|
@}
|
|
|
@if(!isEmpty(keywords)){
|
|
|
and t.keywords like #"%"+keywords+"%"#
|
|
|
@}
|
|
|
@if(!isEmpty(studentScore)){
|
|
|
and t.student_score =#studentScore#
|
|
|
@}
|
|
|
@if(!isEmpty(chatFiles)){
|
|
|
and t.chat_files =#chatFiles#
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogSendType)){
|
|
|
and find_in_set(t.chat_log_send_type, #chatLogSendType#)
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogSendTypePlural)){
|
|
|
and find_in_set(t.chat_log_send_type,#chatLogSendTypePlural#)
|
|
|
@}
|
|
|
@if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){
|
|
|
and t.teacher_open_course_chat_log_status != 2
|
|
|
@}else{
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogStatus)){
|
|
|
and t.teacher_open_course_chat_log_status =#teacherOpenCourseChatLogStatus#
|
|
|
@}else if(!isEmpty(teacherOpenCourseChatLogStatusPlural)){
|
|
|
and find_in_set(t.teacher_open_course_chat_log_status,#teacherOpenCourseChatLogStatusPlural#)
|
|
|
@}
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseChatLogAddTime)){
|
|
|
and t.teacher_open_course_chat_log_add_time =#teacherOpenCourseChatLogAddTime#
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgIdPlural)){
|
|
|
and find_in_set(t.org_id,#orgIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(userIdPlural)){
|
|
|
and find_in_set(t.user_id,#userIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(chatLogFullId)){
|
|
|
and t.chat_log_full_id like #"%"+chatLogFullId+"%"#
|
|
|
@}
|
|
|
|
|
|
|
|
|
analysis
|
|
|
===
|
|
|
* 互动类型分析
|
|
|
|
|
|
SELECT
|
|
|
t.chat_log_send_type,
|
|
|
count( 1 ) AS type_count,
|
|
|
count( 1 ) AS people_count,
|
|
|
round(
|
|
|
avg(
|
|
|
ifnull( student_score, 0 ))) AS avg_score
|
|
|
FROM
|
|
|
teacher_open_course_chat_log t
|
|
|
where 1=1
|
|
|
and t.teacher_open_course_chat_log_status = 1
|
|
|
and t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
GROUP BY
|
|
|
t.chat_log_send_type
|
|
|
|
|
|
groupInfo
|
|
|
===
|
|
|
* 评论添加的类型,分组汇总
|
|
|
select
|
|
|
t.chat_log_send_type,
|
|
|
count(t.student_id is not null) as chat_count,
|
|
|
count(distinct(t.student_id)) as join_count,
|
|
|
round(avg(IFNULL(t.student_score, 0)), 1) as avg_score
|
|
|
from
|
|
|
teacher_open_course_chat_log t
|
|
|
where 1 = 1
|
|
|
and t.chat_log_send_type is not null
|
|
|
and t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
group by t.chat_log_send_type
|
|
|
|
|
|
getUnReadNum
|
|
|
===
|
|
|
* 根据登录身份,互动获取未读数
|
|
|
|
|
|
SELECT
|
|
|
count( 1 )
|
|
|
FROM
|
|
|
teacher_open_course_chat_log t
|
|
|
WHERE
|
|
|
1
|
|
|
@if(isNotEmpty(teacherOpenCourseId)) {
|
|
|
AND t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
@}
|
|
|
@if(isNotEmpty(studentId)) {
|
|
|
AND t.student_id = #studentId#
|
|
|
@}
|
|
|
@if(isNotEmpty(teacherId)) {
|
|
|
AND t.teacher_id = #teacherId#
|
|
|
@}
|
|
|
AND NOT EXISTS (
|
|
|
SELECT
|
|
|
1
|
|
|
FROM
|
|
|
teacher_open_course_chat_log ta
|
|
|
WHERE
|
|
|
1
|
|
|
@if(isNotEmpty(studentId)) {
|
|
|
AND t.student_id = #studentId#
|
|
|
@}
|
|
|
@if(isNotEmpty(teacherId)) {
|
|
|
AND t.teacher_id = #teacherId#
|
|
|
@}
|
|
|
@if(isNotEmpty(teacherOpenCourseId)) {
|
|
|
AND t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
@}
|
|
|
AND ta.teacher_open_course_chat_log_parent_id = teacher_open_course_chat_log_id
|
|
|
)
|
|
|
|
|
|
chatLogAnalysis
|
|
|
===
|
|
|
* 互动日志统计
|
|
|
|
|
|
SELECT
|
|
|
COUNT( 1 ) AS chat_log_count,
|
|
|
SUM( chat_log_send_type = 'student_ask' ) AS student_send_count,
|
|
|
SUM(
|
|
|
FIND_IN_SET( chat_log_send_type, 'specify_ask,random_ask' )) AS teacher_send_count
|
|
|
FROM
|
|
|
teacher_open_course_chat_log t
|
|
|
WHERE
|
|
|
1
|
|
|
@if(isNotEmpty(teacherOpenCourseId)) {
|
|
|
AND t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
@}
|
|
|
AND t.teacher_open_course_chat_log_status = 1
|
|
|
|
|
|
|
|
|
|
|
|
getTeacherAskUnReadCountByTeacher
|
|
|
===
|
|
|
* 获取老师提问模块未读数量,对于老师来说
|
|
|
SELECT IFNULL(sum(
|
|
|
(select count(*)
|
|
|
from teacher_open_course_chat_log t2
|
|
|
where t2.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
|
|
|
and t2.teacher_read_status = 0)
|
|
|
),0)
|
|
|
FROM teacher_open_course_chat_log t
|
|
|
WHERE 1
|
|
|
AND t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
AND t.teacher_id = #teacherId#
|
|
|
AND t.chat_log_send_type in ('specify_ask', 'random_ask')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getTeacherAskUnReadCountByStudent
|
|
|
===
|
|
|
* 获取老师提问模块未读数量,对于学生来说
|
|
|
|
|
|
SELECT count(*)
|
|
|
FROM teacher_open_course_chat_log t
|
|
|
WHERE 1
|
|
|
AND t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
AND t.student_id = #studentId#
|
|
|
AND t.chat_log_send_type in ('specify_ask','random_ask')
|
|
|
@//这里的未读我们可以认为就是不存在回复
|
|
|
AND NOT EXISTS(
|
|
|
SELECT 1
|
|
|
FROM teacher_open_course_chat_log ta
|
|
|
WHERE 1
|
|
|
and t.student_id = #studentId#
|
|
|
AND t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
AND ta.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
|
|
|
)
|
|
|
|
|
|
|
|
|
getStudentAskUnReadCountByTeacher
|
|
|
===
|
|
|
* 获取学生提问模块未读数量,对于老师来说
|
|
|
|
|
|
SELECT count(*)
|
|
|
FROM teacher_open_course_chat_log t
|
|
|
WHERE 1
|
|
|
AND t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
AND t.chat_log_send_type = 'student_ask'
|
|
|
AND NOT EXISTS(
|
|
|
SELECT 1
|
|
|
FROM teacher_open_course_chat_log ta
|
|
|
WHERE 1
|
|
|
and t.teacher_id = #teacherId#
|
|
|
AND t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
AND ta.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
|
|
|
)
|
|
|
|
|
|
|
|
|
getStudentAskUnReadCountByStudent
|
|
|
===
|
|
|
* 获取学生提问模块未读数量,对于学生来说
|
|
|
|
|
|
SELECT IFNULL(sum(
|
|
|
(select count(*)
|
|
|
from teacher_open_course_chat_log t2
|
|
|
where t2.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id
|
|
|
and t2.teacher_read_status = 0)
|
|
|
),0)
|
|
|
FROM teacher_open_course_chat_log t
|
|
|
WHERE 1
|
|
|
AND t.student_id = #studentId#
|
|
|
AND t.teacher_open_course_id = #teacherOpenCourseId#
|
|
|
AND t.chat_log_send_type = 'student_ask' |