|
|
|
|
getPracticeModeValue
|
|
|
|
|
===
|
|
|
|
|
* 获取练习模式下的userExaminations数据
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
user_examinations
|
|
|
|
|
WHERE
|
|
|
|
|
team_id = #teamId#
|
|
|
|
|
AND examination_id = #examinations.id#
|
|
|
|
|
AND flow_id = #examinations.flowId#
|
|
|
|
|
AND user_id = #users.id#
|
|
|
|
|
AND class_id = #users.classId#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scoresListOfStudent
|
|
|
|
|
===
|
|
|
|
|
* 查询我的成绩列表
|
|
|
|
|
SELECT
|
|
|
|
|
@pageTag(){
|
|
|
|
|
es.`name` as examinationsName,
|
|
|
|
|
us.report_name,
|
|
|
|
|
us.report_file,
|
|
|
|
|
fs.`name` as flowsName,
|
|
|
|
|
us.flow_scores,
|
|
|
|
|
us.report_scores,
|
|
|
|
|
us.raise_scores,
|
|
|
|
|
us.duration_scores,
|
|
|
|
|
us.total_scores,
|
|
|
|
|
us.class_orders,
|
|
|
|
|
efs.init_balance,
|
|
|
|
|
efs.balance,
|
|
|
|
|
efs.product_assets,
|
|
|
|
|
efs.raise_rate,
|
|
|
|
|
efs.raise_orders
|
|
|
|
|
@}
|
|
|
|
|
FROM
|
|
|
|
|
user_examinations us
|
|
|
|
|
LEFT JOIN flows fs ON us.flow_id = fs.id
|
|
|
|
|
LEFT JOIN examinations es ON us.examination_id = es.id
|
|
|
|
|
LEFT JOIN examination_financials efs ON us.financial_id = efs.id
|
|
|
|
|
WHERE
|
|
|
|
|
us.user_id = #users.id#
|
|
|
|
|
AND us.`status` = 2
|
|
|
|
|
AND es.`status`= 2
|
|
|
|
|
AND es.scores_status = 1
|
|
|
|
|
AND es.type =1
|
|
|
|
|
ORDER BY
|
|
|
|
|
us.id DESC
|
|
|
|
|
|
|
|
|
|
getMyScoresByValues
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 获取我的成绩
|
|
|
|
|
|
|
|
|
|
SELECT SUM(CASE WHEN total_scores < 60 THEN 1 ELSE 0 END) AS lt_60,
|
|
|
|
|
SUM(CASE WHEN total_scores >= 60 AND total_scores <= 80 THEN 1 ELSE 0 END) AS gt60_lte80,
|
|
|
|
|
SUM(CASE WHEN total_scores > 80 THEN 1 ELSE 0 END) AS gt_80
|
|
|
|
|
FROM user_examinations WHERE examination_id = #examinationId# AND class_id = #classId#
|
|
|
|
|
|
|
|
|
|
getUserAndExaminations
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 获取我的成绩的用户信息
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
e.*
|
|
|
|
|
FROM
|
|
|
|
|
user_examinations e,
|
|
|
|
|
examinations es
|
|
|
|
|
WHERE
|
|
|
|
|
e.examination_id = es.id
|
|
|
|
|
AND e.user_id = #id#
|
|
|
|
|
AND e.`status` = 2
|
|
|
|
|
AND es.`status` = 2
|
|
|
|
|
AND es.scores_status = 1
|
|
|
|
|
AND es.type = 1
|
|
|
|
|
ORDER BY e.id DESC
|
|
|
|
|
limit 0,1;
|
|
|
|
|
|
|
|
|
|
queryByCondition
|
|
|
|
|
===
|
|
|
|
|
* 根据不为空的参数进行分页查询
|
|
|
|
|
|
|
|
|
|
select
|
|
|
|
|
@pageTag(){
|
|
|
|
|
t.*
|
|
|
|
|
@}
|
|
|
|
|
from user_examinations t
|
|
|
|
|
where 1=1
|
|
|
|
|
@//数据权限,该sql语句功能点,如果不考虑数据权限,可以删除此行
|
|
|
|
|
and #function("userExaminations.query")#
|
|
|
|
|
@if(!isEmpty(id)){
|
|
|
|
|
and t.id =#id#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(flowId)){
|
|
|
|
|
and t.flow_id =#flowId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(examinationId)){
|
|
|
|
|
and t.examination_id =#examinationId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(userId)){
|
|
|
|
|
and t.user_id =#userId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(teamId)){
|
|
|
|
|
and t.team_id =#teamId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(financialId)){
|
|
|
|
|
and t.financial_id =#financialId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(instanceId)){
|
|
|
|
|
and t.instance_id =#instanceId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(status)){
|
|
|
|
|
and t.status =#status#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(finishTime)){
|
|
|
|
|
and t.finish_time =#finishTime#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(reportFile)){
|
|
|
|
|
and t.report_file =#reportFile#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(reportName)){
|
|
|
|
|
and t.report_name =#reportName#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(flowScores)){
|
|
|
|
|
and t.flow_scores =#flowScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(reportScores)){
|
|
|
|
|
and t.report_scores =#reportScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(raiseScores)){
|
|
|
|
|
and t.raise_scores =#raiseScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(durationScores)){
|
|
|
|
|
and t.duration_scores =#durationScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(totalScores)){
|
|
|
|
|
and t.total_scores =#totalScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(classId)){
|
|
|
|
|
and t.class_id =#classId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(classOrders)){
|
|
|
|
|
and t.class_orders =#classOrders#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(teamOrders)){
|
|
|
|
|
and t.team_orders =#teamOrders#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(data)){
|
|
|
|
|
and t.data =#data#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(createdAt)){
|
|
|
|
|
and t.created_at =#createdAt#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(updatedAt)){
|
|
|
|
|
and t.updated_at =#updatedAt#
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deleteUserExaminationsByIds
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 批量删除
|
|
|
|
|
|
|
|
|
|
delete from user_examinations where find_in_set(id,#ids#)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getUserExaminationsValues
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据不为空的参数进行查询
|
|
|
|
|
|
|
|
|
|
select t.*
|
|
|
|
|
from user_examinations t
|
|
|
|
|
where 1=1
|
|
|
|
|
@if(!isEmpty(id)){
|
|
|
|
|
and t.id =#id#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(flowId)){
|
|
|
|
|
and t.flow_id =#flowId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(examinationId)){
|
|
|
|
|
and t.examination_id =#examinationId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(userId)){
|
|
|
|
|
and t.user_id =#userId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(teamId)){
|
|
|
|
|
and t.team_id =#teamId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(financialId)){
|
|
|
|
|
and t.financial_id =#financialId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(instanceId)){
|
|
|
|
|
and t.instance_id =#instanceId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(status)){
|
|
|
|
|
and t.status =#status#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(finishTime)){
|
|
|
|
|
and t.finish_time =#finishTime#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(reportFile)){
|
|
|
|
|
and t.report_file =#reportFile#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(reportName)){
|
|
|
|
|
and t.report_name =#reportName#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(flowScores)){
|
|
|
|
|
and t.flow_scores =#flowScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(reportScores)){
|
|
|
|
|
and t.report_scores =#reportScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(raiseScores)){
|
|
|
|
|
and t.raise_scores =#raiseScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(durationScores)){
|
|
|
|
|
and t.duration_scores =#durationScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(totalScores)){
|
|
|
|
|
and t.total_scores =#totalScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(classId)){
|
|
|
|
|
and t.class_id =#classId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(classOrders)){
|
|
|
|
|
and t.class_orders =#classOrders#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(teamOrders)){
|
|
|
|
|
and t.team_orders =#teamOrders#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(data)){
|
|
|
|
|
and t.data =#data#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(createdAt)){
|
|
|
|
|
and t.created_at =#createdAt#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(updatedAt)){
|
|
|
|
|
and t.updated_at =#updatedAt#
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getValuesByQuery
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据不为空的参数进行查询
|
|
|
|
|
|
|
|
|
|
select t.*
|
|
|
|
|
from user_examinations t
|
|
|
|
|
where 1=1
|
|
|
|
|
@if(!isEmpty(id)){
|
|
|
|
|
and t.id =#id#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(flowId)){
|
|
|
|
|
and t.flow_id =#flowId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(examinationId)){
|
|
|
|
|
and t.examination_id =#examinationId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(userId)){
|
|
|
|
|
and t.user_id =#userId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(teamId)){
|
|
|
|
|
and t.team_id =#teamId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(financialId)){
|
|
|
|
|
and t.financial_id =#financialId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(instanceId)){
|
|
|
|
|
and t.instance_id =#instanceId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(status)){
|
|
|
|
|
and t.status =#status#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(finishTime)){
|
|
|
|
|
and t.finish_time =#finishTime#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(reportFile)){
|
|
|
|
|
and t.report_file =#reportFile#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(reportName)){
|
|
|
|
|
and t.report_name =#reportName#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(flowScores)){
|
|
|
|
|
and t.flow_scores =#flowScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(reportScores)){
|
|
|
|
|
and t.report_scores =#reportScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(raiseScores)){
|
|
|
|
|
and t.raise_scores =#raiseScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(durationScores)){
|
|
|
|
|
and t.duration_scores =#durationScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(totalScores)){
|
|
|
|
|
and t.total_scores =#totalScores#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(classId)){
|
|
|
|
|
and t.class_id =#classId#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(classOrders)){
|
|
|
|
|
and t.class_orders =#classOrders#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(teamOrders)){
|
|
|
|
|
and t.team_orders =#teamOrders#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(data)){
|
|
|
|
|
and t.data =#data#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(createdAt)){
|
|
|
|
|
and t.created_at =#createdAt#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(updatedAt)){
|
|
|
|
|
and t.updated_at =#updatedAt#
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getByExaminationIdAndUserId
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 通过ExaminationId和用户id查询用户实训,并通过id进行排序,一对一通过instance_id映射examination_instances表
|
|
|
|
|
|
|
|
|
|
select * from user_examinations u where
|
|
|
|
|
examination_id = #examinationId#
|
|
|
|
|
and
|
|
|
|
|
user_id = #userId#
|
|
|
|
|
order by u.id desc
|
|
|
|
|
@orm.single({"instanceId":"id"},"ExaminationInstances");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getStudentExaminationScoreList
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 查询学生实训评分列表 可选条件:classId、username
|
|
|
|
|
````
|
|
|
|
|
select
|
|
|
|
|
@pageTag(){
|
|
|
|
|
t1.username,
|
|
|
|
|
t1.student_id,
|
|
|
|
|
t1.class_id,
|
|
|
|
|
t3.name class_name,
|
|
|
|
|
t2.*
|
|
|
|
|
@}
|
|
|
|
|
from users t1
|
|
|
|
|
join user_examinations t2 on t1.id = t2.user_id
|
|
|
|
|
join classes t3 on t1.class_id = t3.classes_id
|
|
|
|
|
where
|
|
|
|
|
t2.examination_id = #examinationId#
|
|
|
|
|
and t2.status > 0
|
|
|
|
|
and t1.type = 4
|
|
|
|
|
@if(!isEmpty(classId)){
|
|
|
|
|
and t1.class_id = #classId#
|
|
|
|
|
@}
|
|
|
|
|
@ if(!isEmpty(username)){
|
|
|
|
|
and ( t1.username like #'%'+username+'%'# or t1.student_id like #'%'+username+'%'# )
|
|
|
|
|
@}
|
|
|
|
|
order by t2.report_scores, t2.id
|
|
|
|
|
````
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getStudentExaminationScoreExcelList
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 查询学生实训评分列表 可选条件:classId、username
|
|
|
|
|
````
|
|
|
|
|
select
|
|
|
|
|
t1.username,
|
|
|
|
|
t1.student_id,
|
|
|
|
|
t3.name class_name,
|
|
|
|
|
t2.report_name,
|
|
|
|
|
t2.flow_scores,
|
|
|
|
|
t2.operator_scores,
|
|
|
|
|
t2.report_scores,
|
|
|
|
|
t2.raise_scores,
|
|
|
|
|
t2.duration_scores,
|
|
|
|
|
t2.total_scores
|
|
|
|
|
from users t1
|
|
|
|
|
join user_examinations t2 on t1.id = t2.user_id
|
|
|
|
|
join classes t3 on t1.class_id = t3.classes_id
|
|
|
|
|
where
|
|
|
|
|
t2.examination_id = #examinationId#
|
|
|
|
|
and t2.status > 0
|
|
|
|
|
and t1.type = 4
|
|
|
|
|
@if(!isEmpty(classId)){
|
|
|
|
|
and t1.class_id = #classId#
|
|
|
|
|
@}
|
|
|
|
|
@ if(!isEmpty(username)){
|
|
|
|
|
and ( t1.username like #'%'+username+'%'# or t1.student_id like #'%'+username+'%'# )
|
|
|
|
|
@}
|
|
|
|
|
order by t2.report_scores, t2.id
|
|
|
|
|
````
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getStudentExaminationScoreChart
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 查询学生实训评分统计 可选条件:classId
|
|
|
|
|
````
|
|
|
|
|
select
|
|
|
|
|
count(0) as num,
|
|
|
|
|
MIN(total_scores) as mins,
|
|
|
|
|
MAX(total_scores) as maxs,
|
|
|
|
|
sum(total_scores) as total_scores,
|
|
|
|
|
SUM(CASE WHEN total_scores >= 90 THEN 1 ELSE 0 END) as well,
|
|
|
|
|
SUM(CASE WHEN total_scores >= 80 AND total_scores <= 89 THEN 1 ELSE 0 END) as good,
|
|
|
|
|
SUM(CASE WHEN total_scores >= 60 AND total_scores <= 79 THEN 1 ELSE 0 END) as normal,
|
|
|
|
|
SUM(CASE WHEN total_scores < 60 THEN 1 ELSE 0 END) as bad
|
|
|
|
|
from user_examinations t1
|
|
|
|
|
join users t2 on t1.user_id = t2.id
|
|
|
|
|
where
|
|
|
|
|
t1.examination_id = #examinationId#
|
|
|
|
|
and t1.status > 0
|
|
|
|
|
and t2.type = 4
|
|
|
|
|
@if(!isEmpty(classId)){
|
|
|
|
|
and t2.class_id = #classId#
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
````
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getTeacherClassExaminationScoreChart
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 查询老师班级实训评分统计
|
|
|
|
|
````
|
|
|
|
|
select
|
|
|
|
|
t2.id examination_id,
|
|
|
|
|
t2.name examination_name,
|
|
|
|
|
t3.class_id,
|
|
|
|
|
t4.name class_name,
|
|
|
|
|
avg(t1.total_scores) total_scores
|
|
|
|
|
from user_examinations t1
|
|
|
|
|
join examinations t2 on t1.examination_id = t2.id
|
|
|
|
|
join users t3 on t1.user_id = t3.id
|
|
|
|
|
join classes t4 on t3.class_id = t4.classes_id
|
|
|
|
|
where
|
|
|
|
|
t4.teacher_id = #teacherId#
|
|
|
|
|
and t1.status = 2
|
|
|
|
|
and t2.type = 1
|
|
|
|
|
group by t2.id, t3.class_id
|
|
|
|
|
|
|
|
|
|
````
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getExaminationStudentCount
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 查询实训学生数量
|
|
|
|
|
|
|
|
|
|
select count(*)
|
|
|
|
|
from users t1
|
|
|
|
|
join user_examinations t2 on t1.id = t2.user_id
|
|
|
|
|
where t1.type = 4
|
|
|
|
|
and t2.examination_id = #examinationId#
|
|
|
|
|
@if(!isEmpty(classId)){
|
|
|
|
|
and t1.class_id = #classId#
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hasZeroScores
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 查询未评分的记录数量
|
|
|
|
|
|
|
|
|
|
select count(*)
|
|
|
|
|
from user_examinations t
|
|
|
|
|
where t.examination_id = #examinationId#
|
|
|
|
|
and t.status < 2
|
|
|
|
|
and (t.report_scores = 0 or t.report_scores is null)
|