<?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.ots.project.exam.mapper.TTextContentMapper">
|
|
<resultMap type="TTextContent" id="TTextContentResult">
|
<result property="id" column="id" />
|
<result property="content" column="content" />
|
<result property="questionId" column="questionId" />
|
<result property="createTime" column="create_time" />
|
</resultMap>
|
|
<resultMap type="TTextContentAndQuestion" id="TTextContentAndQuestionResult">
|
<result property="id" column="id" />
|
<result property="content" column="content" />
|
<result property="questionId" column="question_id" />
|
<result property="createTime" column="create_time" />
|
<result property="permanentId" column="permanent_id" />
|
</resultMap>
|
|
<sql id="selectTTextContentVo">
|
select id, content, create_time from t_text_content
|
</sql>
|
|
<select id="selectTTextContentList" parameterType="TTextContent" resultMap="TTextContentResult">
|
<include refid="selectTTextContentVo"/>
|
<where>
|
<if test="content != null and content != ''"> and content = #{content}</if>
|
</where>
|
</select>
|
|
<select id="selectTTextContentById" parameterType="Long" resultMap="TTextContentResult">
|
<include refid="selectTTextContentVo"/>
|
where id = #{id}
|
</select>
|
|
<select id="selectTTextContentByIds" parameterType="String" resultMap="TTextContentResult">
|
<include refid="selectTTextContentVo"/>
|
where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
|
<select id="selectTextContentAndQuestion" parameterType="String" resultMap="TTextContentAndQuestionResult">
|
SELECT ttc.id, ttc.content, ttc.create_time,q.id question_id, q.permanent_id from t_question q,t_text_content ttc
|
where q.info_text_content_id = ttc.id and q.id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
|
<insert id="insertTTextContent" parameterType="TTextContent" useGeneratedKeys="true" keyProperty="id">
|
insert into t_text_content
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="content != null and content != ''">content,</if>
|
<if test="createTime != null ">create_time,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="content != null and content != ''">#{content},</if>
|
<if test="createTime != null ">#{createTime},</if>
|
</trim>
|
</insert>
|
|
<update id="updateTTextContent" parameterType="TTextContent">
|
update t_text_content
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="content != null and content != ''">content = #{content},</if>
|
<if test="createTime != null ">create_time = #{createTime},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteTTextContentById" parameterType="Long">
|
delete from t_text_content where id = #{id}
|
</delete>
|
|
<delete id="deleteTTextContentByIds" parameterType="String">
|
delete from t_text_content where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
</mapper>
|