123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <?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.jeeplus.modules.exam.mapper.EduQuestionOptionMapper">
-
- <sql id="eduQuestionOptionColumns">
- a.id AS "id",
- a.question_id AS "questionId.id",
- a.title AS "title",
- a.is_answer AS "isAnswer"
- </sql>
-
- <sql id="eduQuestionOptionJoins">
-
- LEFT JOIN edu_question b ON b.id = a.question_id
- </sql>
-
-
- <select id="get" resultType="EduQuestionOption">
- SELECT
- <include refid="eduQuestionOptionColumns"/>
- FROM edu_question_option a
- <include refid="eduQuestionOptionJoins"/>
- WHERE a.id = #{id}
- </select>
-
- <select id="findList" resultType="EduQuestionOption" >
- SELECT
- <include refid="eduQuestionOptionColumns"/>
- FROM edu_question_option a
- <include refid="eduQuestionOptionJoins"/>
- <where>
- ${dataScope}
- <if test="questionId != null and questionId != ''">
- AND a.question_id = #{questionId.id}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="EduQuestionOption" >
- SELECT
- <include refid="eduQuestionOptionColumns"/>
- FROM edu_question_option a
- <include refid="eduQuestionOptionJoins"/>
- <where>
- ${dataScope}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findByTextId" resultType="EduQuestionOption" >
- SELECT o.*,o.question_id AS qId from edu_user_tests_detail d
- LEFT JOIN edu_question_option o on d.question_id = o.question_id
- LEFT JOIN edu_user_tests u ON u.id = d.tests_id
- <where>
- <if test="testsId != null and testsId != ''">
- AND d.tests_id =#{testsId}
- </if>
- <if test="userId != null and userId != ''">
- AND u.user_id=#{userId}
- </if>
- </where>
- </select>
- <select id="findByQuestionId" resultType="EduQuestionOption">
- SELECT
- a.id AS "id",
- a.title AS "title",
- a.is_answer AS "isAnswer"
- FROM edu_question_option a
- WHERE question_id = #{questionId}
- </select>
-
- <insert id="insert" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
- INSERT INTO edu_question_option(
- question_id,
- title,
- is_answer
- ) VALUES (
- #{questionId.id},
- #{title},
- #{isAnswer}
- )
- </insert>
-
- <update id="update">
- UPDATE edu_question_option SET
- question_id = #{questionId.id},
- title = #{title},
- is_answer = #{isAnswer}
- WHERE id = #{id}
- </update>
-
-
- <!--物理删除-->
- <update id="delete">
- DELETE FROM edu_question_option
- <choose>
- <when test="id !=null and id != ''">
- WHERE id = #{id}
- </when>
- <otherwise>
- WHERE question_id = #{questionId.id}
- </otherwise>
- </choose>
- </update>
-
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE edu_question_option SET
- del_flag = #{DEL_FLAG_DELETE}
- <choose>
- <when test="id !=null and id != ''">
- WHERE id = #{id}
- </when>
- <otherwise>
- WHERE question_id = #{questionId.id}
- </otherwise>
- </choose>
- </update>
-
-
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="EduQuestionOption" statementType="STATEMENT">
- select * FROM edu_question_option where ${propertyName} = '${value}'
- </select>
-
- </mapper>
|