61 lines
3.5 KiB
XML
61 lines
3.5 KiB
XML
<?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.ruoyi.train.mapper.TrainClassReportMapper">
|
|
<resultMap type="TrainClassReport" id="TrainClassReportResult">
|
|
<id property="reportId" column="report_id"/>
|
|
<result property="enrollmentId" column="enrollment_id"/>
|
|
<result property="planId" column="plan_id"/>
|
|
<result property="planName" column="plan_name"/>
|
|
<result property="studentId" column="student_id"/>
|
|
<result property="studentName" column="student_name"/>
|
|
<result property="reportWay" column="report_way"/>
|
|
<result property="reportDeviceSn" column="report_device_sn"/>
|
|
<result property="reportTime" column="report_time"/>
|
|
<result property="verifyResult" column="verify_result"/>
|
|
<result property="verifyNote" column="verify_note"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="remark" column="remark"/>
|
|
</resultMap>
|
|
<sql id="selectTrainClassReportVo">
|
|
select r.report_id, r.enrollment_id, e.plan_id, p.plan_name,
|
|
e.student_id, s.s_name as student_name, r.report_way,
|
|
r.report_device_sn, r.report_time, r.verify_result, r.verify_note,
|
|
r.create_by, r.create_time, r.remark
|
|
from train_class_report r
|
|
join train_enrollment e on e.enrollment_id = r.enrollment_id
|
|
left join train_class_plan p on p.plan_id = e.plan_id
|
|
left join train_student s on s.s_id = e.student_id
|
|
</sql>
|
|
<select id="selectTrainClassReportList" parameterType="TrainClassReport" resultMap="TrainClassReportResult">
|
|
<include refid="selectTrainClassReportVo"/>
|
|
<where>
|
|
<if test="enrollmentId != null">and r.enrollment_id = #{enrollmentId}</if>
|
|
<if test="planId != null and planId != ''">and e.plan_id = #{planId}</if>
|
|
<if test="planName != null and planName != ''">and p.plan_name like concat('%', #{planName}, '%')</if>
|
|
<if test="studentName != null and studentName != ''">and s.s_name like concat('%', #{studentName}, '%')</if>
|
|
<if test="reportWay != null">and r.report_way = #{reportWay}</if>
|
|
<if test="verifyResult != null">and r.verify_result = #{verifyResult}</if>
|
|
<if test="reportTime != null">and r.report_time = #{reportTime}</if>
|
|
</where>
|
|
order by r.report_time desc, r.report_id desc
|
|
</select>
|
|
<select id="selectTrainClassReportByReportId" parameterType="Long" resultMap="TrainClassReportResult">
|
|
<include refid="selectTrainClassReportVo"/>
|
|
where r.report_id = #{reportId}
|
|
</select>
|
|
<select id="selectTrainClassReportByEnrollmentId" parameterType="Long" resultMap="TrainClassReportResult">
|
|
<include refid="selectTrainClassReportVo"/>
|
|
where r.enrollment_id = #{enrollmentId}
|
|
</select>
|
|
<insert id="insertTrainClassReport" parameterType="com.ruoyi.train.domain.TrainClassReport" useGeneratedKeys="true" keyProperty="reportId">
|
|
insert into train_class_report (
|
|
enrollment_id, report_way, report_device_sn, report_time,
|
|
verify_result, verify_note, create_by, create_time, remark
|
|
) values (
|
|
#{enrollmentId}, #{reportWay}, #{reportDeviceSn}, #{reportTime},
|
|
#{verifyResult}, #{verifyNote}, #{createBy}, #{createTime}, #{remark}
|
|
)
|
|
</insert>
|
|
</mapper>
|