<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace= "com.msdw.tms.dao.AchievementManagementDao" >
<resultMap id= "achievementMap" type= "com.msdw.tms.entity.ExperimentalReportEntity" >
<result property= "experimentalClassName" column= "experimental_class_name" > </result>
</resultMap>
<insert id= "addReport" >
INSERT INTO tms_experimental_report ( projectId, content, principle, step, analysis, summarize, improvement, commentId, studentId, teacherName, period, laboratory,eventId )
VALUES
(#{projectId},#{content}, #{principle}, #{step}, #{analysis}, #{summarize}, #{improvement}, #{commentId}, #{studentId}, #{teacherName}, #{period}, #{laboratory},#{eventId})
</insert>
<update id= "deleteReport" >
UPDATE tms_project_record tpr,tms_experimental_report tcr SET tpr.isdel = 1 , tcr.isdel = 1 WHERE tpr.recordid = tcr.eventId AND tcr.reportId = #{reportId}
</update>
<update id= "updateComment" >
UPDATE tms_experimental_report SET `comment` = #{comment} WHERE reportId = #{reportId}
</update>
<update id= "updateSignatrue" >
UPDATE tms_experimental_report SET isSignature = #{isSignature} , signatureId = #{signatureId}, `comment` = #{comment} WHERE reportId = #{reportId}
</update>
<select id= "queryReport" resultType= "com.msdw.tms.entity.vo.AchievementManagementVo" >
SELECT
ter.reportId,
IFNULL( ter.`comment`, ( SELECT `comment` FROM tms_comment WHERE id = commentId ) ) AS comment,
ter.projectId,
ter.principle,
ter.content,
ter.step,
ter.`data`,
ter.analysis,
ter.conclusion,
ter.summarize,
ter.improvement,
ter.commentId,
ter.studentId,
ter.teacherName,
ter.period,
ter.laboratory,
ter.eventId,
ter.isSignature,
ter.signatureId,
ter.isdel ,
hpm.projectName,
hpm.systemId,
ts.signature_name AS signatureName,
ts.signature_url AS signatureUrl,
tc.`level`
FROM
tms_experimental_report ter
LEFT JOIN tms_signature ts ON signatureId = ts.id
LEFT JOIN tms_comment tc ON commentId = tc.id
LEFT JOIN tms_project_record AS tpr ON tpr.recordId = ter.eventId
LEFT JOIN hr_project_management AS hpm ON hpm.projectId = tpr.projectId
WHERE
reportId = #{reportId}
</select>
<select id= "queryEvaluationReport" resultType= "com.msdw.tms.entity.vo.AchievementManagementVo" >
SELECT
u.userName,
sch.schoolName,
s.workNumber,
tpr.score,
tpr.submitTime,
tpr.recordId,
tcr.reportId
FROM
hr_project_management hpm,
hr_user_info u,
student s,
tms_project_record tpr,
tms_experimental_report tcr,
school sch
WHERE
hpm.projectId = tpr.projectId
AND tpr.userId = u.userId
AND u.userId = s.userId
AND sch.schoolId = u.schoolId
AND tcr.eventId = tpr.recordId
AND tpr.isdel = 0
AND tcr.isdel = 0
AND u.isdel = 0
AND tpr.projectId = #{projectId}
<if test= "searchContant!=null and searchContant!=''" > AND (sch.schoolName LIKE CONCAT('%',#{searchContant},'%') OR u.userName LIKE CONCAT('%',#{searchContant},'%') )</if>
GROUP BY
tcr.reportId
ORDER BY tpr.submitTime DESC
</select>
<select id= "queryAchievement" resultType= "com.msdw.tms.entity.request.AchievementImportRequest" >
SELECT
u.userName,
sch.schoolName,
s.workNumber,
tpr.score,
tpr.submitTime,
tpr.recordId,
tcr.reportId
FROM
hr_project_management hpm,
hr_user_info u,
student s,
tms_project_record tpr,
tms_experimental_report tcr,
school sch
WHERE
hpm.projectId = tpr.projectId
AND tpr.userId = u.userId
AND u.userId = s.userId
AND sch.schoolId = u.schoolId
AND tcr.eventId = tpr.recordId
AND tpr.isdel = 0
AND tcr.isdel = 0
AND u.isdel = 0
<if test= "ids.size()>0" >
AND recordId IN (
<foreach collection= "ids" separator= "," item= "recordId" >
#{recordId}
</foreach>
)
</if>
GROUP BY
tcr.reportId
ORDER BY tpr.submitTime DESC
</select>
<select id= "queryFictitiousRecord" resultType= "com.msdw.tms.entity.vo.AchievementManagementVo" >
SELECT
hpm.projectName,
hpm.creationTime AS creationtime,
hpm.projectPermissions,
count( tcr.reportId ) AS reportNumber,
tcr.projectId,
tcr.reportId,
tpr.recordId
FROM
hr_project_management hpm
LEFT JOIN tms_project_record tpr ON hpm.projectId = tpr.projectId
LEFT JOIN tms_experimental_report tcr ON tpr.recordId = tcr.eventId
WHERE
tpr.isdel = 0
AND tcr.isdel = 0
AND hpm.projectPermissions = 0
<if test= "systemId!=null and systemId!=''" > AND hpm.systemId = #{systemId} </if>
<if test= "searchContant!=null and searchContant!=''" > and hpm.projectName like concat('%',#{searchContant},'%')</if>
<if test= "startingtime!=null and startingtime!='' and endtime!=null and endtime != ''" > and hpm.creationTime between #{endtime} and #{startingtime}</if>
<if test= "month!=null and month != ''" > and DATE_SUB(CURDATE(), INTERVAL #{month} month ) < = date(hpm.creationTime)</if>
<if test= "projectIds.size!=null" >
AND tpr.projectId IN (
<foreach collection= "projectIds" separator= "," item= "projectId" >
#{projectId}
</foreach>
) </if>
GROUP BY
tcr.reportId
ORDER BY
creationtime DESC,tcr.reportId DESC
</select>
<select id= "queryEducationRecord" resultType= "com.msdw.tms.entity.vo.AchievementManagementVo" >
SELECT
hpm.projectName,
hpm.creationTime AS creationtime,
tet.experimental_class_name,
hpm.projectPermissions,
tcr.projectId,
tcr.reportId,
tpr.recordId,
count( tcr.reportId ) AS reportNumber
FROM
hr_project_management hpm
LEFT JOIN tms_experimental_teaching tet ON tet.project_id = hpm.projectId
LEFT JOIN tms_project_record tpr ON tet.project_id = tpr.projectId
LEFT JOIN tms_experimental_report tcr ON tcr.projectId = tet.id
WHERE
tpr.isdel = 0
AND hpm.projectPermissions = 1
AND tcr.isdel = 0
<if test= "systemId!=null and systemId!=''" > AND hpm.systemId = #{systemId} </if>
<if test= "searchContant!=null and searchContant!=''" > and (hpm.projectName like concat('%',#{searchContant},'%') OR tet.experimental_class_name like concat('%',#{searchContant},'%') )</if>
<if test= "startingtime!=null and startingtime!='' and endtime!=null and endtime != ''" > and hpm.creationTime between #{endtime} and #{startingtime}</if>
<if test= "month!=null and month != ''" > and DATE_SUB(CURDATE(), INTERVAL #{month} month ) < = date(creation_time)</if>
<if test= "projectIds.size!=null" >
AND tet.id IN (
<foreach collection= "projectIds" separator= "," item= "projectId" >
#{projectId}
</foreach>
) </if>
GROUP BY
tcr.reportId
ORDER BY
creationtime DESC,tcr.reportId DESC
</select>
<select id= "queryFictitiousReport" resultType= "com.msdw.tms.entity.vo.AchievementManagementVo" >
SELECT
u.userName,
sch.schoolName,
s.workNumber,
tpr.score,
tpr.submitTime,
tpr.recordId,
tcr.reportId
FROM
hr_project_management hpm,
hr_user_info u,
student s,
tms_project_record tpr,
tms_experimental_report tcr,
school sch
WHERE
hpm.projectId = tpr.projectId
AND tpr.userId = u.userId
AND u.userId = s.userId
AND sch.schoolId = u.schoolId
AND tcr.eventId = tpr.recordId
AND tpr.isdel = 0
AND tcr.isdel = 0
AND u.isdel = 0
AND tpr.projectId = #{projectId}
<if test= "searchContant!=null and searchContant!=''" > AND (sch.schoolName LIKE CONCAT('%',#{searchContant},'%') OR u.userName LIKE CONCAT('%',#{searchContant},'%') )</if>
GROUP BY
tcr.reportId
ORDER BY tpr.submitTime DESC
</select>
<select id= "countEducationProjectId" resultType= "java.lang.Integer" >
SELECT
ter.projectId
FROM
tms_experimental_report ter
LEFT JOIN tms_experimental_teaching tet ON tet.id = ter.projectId
LEFT JOIN hr_project_management hpm ON tet.project_id = hpm.projectId
WHERE
ter.isdel = 0
AND hpm.projectPermissions = 1
AND ter.projectId IS NOT NULL
GROUP BY
ter.projectId
</select>
<select id= "countFictitiousProjectId" resultType= "java.lang.Integer" >
SELECT
tpr.projectId
FROM
tms_project_record tpr
LEFT JOIN hr_project_management hpm ON tpr.projectId = hpm.projectId
WHERE
tpr.isdel = 0
AND hpm.projectPermissions = 0
GROUP BY
tpr.projectId
</select>
<select id= "queryEvaluationName" resultType= "java.lang.String" >
SELECT project_name AS evaluationName FROM tms_experimental_teaching WHERE project_id = #{projectId}
</select>
<select id= "queryPythonTest" resultType= "com.msdw.tms.entity.vo.AchievementManagementVo" >
SELECT
hec.`code` AS userAnswer,
hec.codeId,
if(p.rightAndWrong=0,hsi.score,0) AS codeScore,
hjp.judgmentPointsName,
hjp.experimentcode AS answer
FROM
hr_experiment_code AS hec,
hr_score_index AS hsi,
hr_judgment_points AS hjp,
pointrecord p
WHERE
hjp.judgmentPointsId = hsi.judgmentPointsId
AND hjp.judgmentPointsId = hec.judgmentPointsId
AND p.codeId = hec.codeId
AND hsi.isdel = 0
AND hjp.isdel = 0
AND hec.recordId = #{recordId}
GROUP BY
hec.codeId
ORDER BY
hec.codeId ASC
</select>
</mapper>