SELECT uc.user_course_id AS userCourseId,uc.state ,uc.examination_time AS examinationTime,uc.train_state AS trainState,c.is_verifty_face AS isVeriftyFace,
uc.`examination_result` AS examinationResult,uc.`create_time` AS createTime,c.test_start_time as testStartTime,c.test_end_time as testEndTime,
c.`course_name` AS courseName, c.`topic_num` AS topicNum,c.`release_time` AS releaseTime,c.data_kind as dataKind,c.personnel_type as personnelType,
p.`plan_name` AS courseType,c.course_id as courseId,c.qualified_num as qualifiedNum,c.multiple_choice_score as multipleChoiceScore,
c.judgment_score as judgmentScore,c.single_choice_score as singleChoiceScore
FROM t_train_user_course uc
LEFT JOIN t_train_course c ON c.`course_id` = uc.`course_id`
LEFT JOIN t_train_plan p ON p.`plan_id` = c.`course_type`
WHERE uc.user_id = #{userId} and uc.personnel_type =#{personnelType}
SUM(case when user.state > 0 then 1 else 0 end)AS test,
SUM(case when user.state = 2 then 1 else 0 end)AS pass,
ROUND(SUM(case when user.state = 2 then 1 else 0 end)/COUNT(user.user_course_id)*100)AS rate
FROM
t_train_course course
INNER JOIN t_train_user_course user ON course.course_id = user.course_id
<where>
course.status = '1' AND course.is_del = '0' AND course.personnel_type = '1' AND course.topic_num>0
<iftest="courseName != null and courseName != ''"> and course.course_name like concat('%', #{courseName}, '%')</if>
<iftest="dataKind != null and dataKind != ''"> and course.data_kind = #{dataKind}</if>
<iftest="releaseTimeBegin != null and releaseTimeBegin != '' and releaseTimeEnd != null and releaseTimeEnd != ''"> and course.release_time BETWEEN #{releaseTimeBegin} AND #{releaseTimeEnd}</if>
SELECT uc.user_course_id AS userCourseId,uc.finish_duration AS finishDuration,uc.state ,uc.examination_time AS examinationTime,uc.train_state AS trainState,
uc.`examination_result` AS examinationResult,uc.`create_time` AS createTime,c.test_start_time as testStartTime,c.test_end_time as testEndTime,
c.`course_name` AS courseName, c.`topic_num` AS topicNum,c.`release_time` AS releaseTime,c.data_kind as dataKind,c.personnel_type as personnelType,
p.`plan_name` AS courseType,c.course_id as courseId,c.qualified_num as qualifiedNum,c.multiple_choice_score as multipleChoiceScore,
c.judgment_score as judgmentScore,c.single_choice_score as singleChoiceScore
FROM t_train_user_course uc
LEFT JOIN t_train_course c ON c.`course_id` = uc.`course_id`
LEFT JOIN t_train_plan p ON p.`plan_id` = c.`course_type`
WHERE uc.user_id = #{staffId} and uc.personnel_type ='1'
and data_kind=#{dataKind}
</select>
<!--消息添加-->
<insertid="insertNews">
insert into t_news (module_id,module,message_content,publisher_id,recipient_id,release_time)