Files
pengchen-exam-java/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperPersonMapper.xml

64 lines
2.8 KiB
XML
Raw Normal View History

<?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="pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperPersonMapper">
<resultMap type="EducationPaperPerson" id="EducationPaperPersonResult">
<result property="taskId" column="task_id" />
<result property="personId" column="person_id" />
<result property="sessionId" column="session_id" />
</resultMap>
<sql id="selectEducationPaperPersonVo">
select task_id, person_id, session_id from education_paper_person
</sql>
<select id="selectEducationPaperPersonList" parameterType="EducationPaperPerson" resultMap="EducationPaperPersonResult">
<include refid="selectEducationPaperPersonVo"/>
<where>
<if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if>
<if test="personId != null and personId != ''"> and person_id = #{personId}</if>
<if test="sessionId != null and sessionId != ''"> and session_id = #{sessionId}</if>
</where>
</select>
<select id="selectEducationPaperPersonByTaskId" parameterType="String" resultMap="EducationPaperPersonResult">
<include refid="selectEducationPaperPersonVo"/>
where task_id = #{taskId}
</select>
<insert id="insertEducationPaperPerson" parameterType="EducationPaperPerson">
insert into education_paper_person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskId != null">task_id,</if>
<if test="personId != null">person_id,</if>
<if test="sessionId != null">session_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">#{taskId},</if>
<if test="personId != null">#{personId},</if>
<if test="sessionId != null">#{sessionId},</if>
</trim>
</insert>
<update id="updateEducationPaperPerson" parameterType="EducationPaperPerson">
update education_paper_person
<trim prefix="SET" suffixOverrides=",">
<if test="personId != null">person_id = #{personId},</if>
<if test="sessionId != null">session_id = #{sessionId},</if>
</trim>
where task_id = #{taskId}
</update>
<delete id="deleteEducationPaperPersonByTaskId" parameterType="String">
delete from education_paper_person where task_id = #{taskId}
</delete>
<delete id="deleteEducationPaperPersonByTaskIds" parameterType="String">
delete from education_paper_person where task_id in
<foreach item="taskId" collection="array" open="(" separator="," close=")">
#{taskId}
</foreach>
</delete>
</mapper>