| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?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.takai.bigmodel.mapper.QuestionMapper">
-
- <resultMap type="Question" id="QuestionResult">
- <id property="id" column="id" />
- <result property="app_id" column="app_id" />
- <result property="question" column="question" />
- <result property="create_time" column="create_time" />
- </resultMap>
- <select id="getQuestionList" resultMap="QuestionResult">
- select
- q.id,
- q.app_id as appId,
- q.question,
- q.create_time
- from question q
- where q.app_id = #{appId}
- ORDER BY q.create_time desc
- </select>
-
- <insert id="insertQuestion" parameterType="Question">
- insert into question(
- id,
- <if test="appId != null">app_id,</if>
- <if test="question != null">question,</if>
- create_time
- )values(
- #{id},
- <if test="appId != null">#{appId},</if>
- <if test="question != null">#{question},</if>
- sysdate()
- )
- </insert>
- <select id="selectQuestionById" resultMap="QuestionResult">
- select
- q.id,
- q.app_id as appId,
- q.question,
- q.create_time
- from question q
- where q.id = #{id}
- </select>
- <delete id="delQuestion" parameterType="String">
- delete from question where id = #{id}
- </delete>
- <update id="updateQuestion" parameterType="Question">
- update question set question = #{question} where id = #{id}
- </update>
- <delete id="delQuestionByAppId" parameterType="String">
- delete from question where app_id = #{appId}
- </delete>
- </mapper>
|