<?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.mindskip.xzs.repository.ExamTemplatesSubjectMapper">
|
<resultMap id="BaseResultMap" type="com.mindskip.xzs.domain.ExamTemplatesSubject">
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
<result column="subject_id" jdbcType="INTEGER" property="subjectId"/>
|
<result column="subjectName" property="subjectName"/>
|
<result column="templates_id" jdbcType="INTEGER" property="templatesId"/>
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
id, subject_id, templates_id
|
</sql>
|
|
<insert id="add" parameterType="com.mindskip.xzs.domain.ExamTemplatesSubject" useGeneratedKeys="true" keyProperty="id">
|
insert into t_department (subject_id, templates_id)
|
values (#{subjectId}, #{templatesId})
|
</insert>
|
|
<select id="getTemplatesId" resultMap="BaseResultMap">
|
select
|
ets.id, ets.subject_id, ets.templates_id, ts.name as subjectName
|
from t_exam_templates_subject ets
|
INNER JOIN t_subject ts ON ts.id = ets.subject_id
|
where ets.templates_id = #{templatesId}
|
</select>
|
|
<insert id="saves" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
insert into t_exam_templates_subject(id, subject_id, templates_id)
|
values
|
<foreach collection="list" item="item" index="index" separator=",">
|
(#{item.id},#{item.subjectId},#{item.templatesId})
|
</foreach>
|
</insert>
|
|
<delete id="removeByTemplatesId" parameterType="java.lang.Integer">
|
delete from t_exam_templates_question
|
where templates_id = #{templatesId}
|
</delete>
|
|
<select id="getByTemplatesId" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from t_exam_templates_subject where templates_id = #{templatesId}
|
</select>
|
|
</mapper>
|