SubquestionsMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.ie.mapper.SubquestionsMapper">
  6. <resultMap type="Subquestions" id="SubquestionsResult">
  7. <result property="id" column="id" />
  8. <result property="title" column="title" />
  9. <result property="optionA" column="option_a" />
  10. <result property="optionB" column="option_b" />
  11. <result property="optionC" column="option_c" />
  12. <result property="optionD" column="option_d" />
  13. <result property="pid" column="pid" />
  14. <result property="answer1" column="answer1" />
  15. <result property="answer2" column="answer2" />
  16. <result property="parse" column="parse" />
  17. <result property="qtpye" column="qtpye" />
  18. <result property="diff" column="diff" />
  19. <result property="subjectid" column="subjectId" />
  20. <result property="gradeid" column="gradeId" />
  21. <result property="knowledges" column="knowledges" />
  22. <result property="source" column="source" />
  23. <result property="tiid" column="tiid" />
  24. <result property="ptiid" column="ptiid" />
  25. <result property="fromsite" column="fromsite" />
  26. <result property="answerJson" column="answer_json" />
  27. </resultMap>
  28. <sql id="selectSubquestionsVo">
  29. select id, title, option_a, option_b, option_c, option_d, pid, answer1, answer2, parse, qtpye, diff, subjectId, gradeId, knowledges, source, tiid, ptiid, fromsite, answer_json from subquestions
  30. </sql>
  31. <select id="selectSubquestionsByQuestionIds" parameterType="Long" resultMap="SubquestionsResult">
  32. <include refid="selectSubquestionsVo"/>
  33. where pid in <foreach item="id" collection="array" open="(" separator="," close=")">#{id}</foreach>
  34. </select>
  35. <select id="selectSubquestionsByQuestionId" parameterType="Long" resultMap="SubquestionsResult">
  36. <include refid="selectSubquestionsVo"/>
  37. where pid =#{questionId}
  38. </select>
  39. <select id="selectSubquestionsList" parameterType="Subquestions" resultMap="SubquestionsResult">
  40. <include refid="selectSubquestionsVo"/>
  41. where 1=1
  42. <if test="title != null and title != ''"> and title = #{title}</if>
  43. <if test="optionA != null and optionA != ''"> and option_a = #{optionA}</if>
  44. <if test="optionB != null and optionB != ''"> and option_b = #{optionB}</if>
  45. <if test="optionC != null and optionC != ''"> and option_c = #{optionC}</if>
  46. <if test="optionD != null and optionD != ''"> and option_d = #{optionD}</if>
  47. <if test="pid != null "> and pid = #{pid}</if>
  48. <if test="answer1 != null and answer1 != ''"> and answer1 = #{answer1}</if>
  49. <if test="answer2 != null and answer2 != ''"> and answer2 = #{answer2}</if>
  50. <if test="parse != null and parse != ''"> and parse = #{parse}</if>
  51. <if test="qtpye != null and qtpye != ''"> and qtpye = #{qtpye}</if>
  52. <if test="diff != null "> and diff = #{diff}</if>
  53. <if test="subjectid != null "> and subjectId = #{subjectid}</if>
  54. <if test="gradeid != null "> and gradeId = #{gradeid}</if>
  55. <if test="knowledges != null and knowledges != ''"> and knowledges = #{knowledges}</if>
  56. <if test="source != null and source != ''"> and source = #{source}</if>
  57. <if test="tiid != null and tiid != ''"> and tiid = #{tiid}</if>
  58. <if test="ptiid != null and ptiid != ''"> and ptiid = #{ptiid}</if>
  59. <if test="fromsite != null "> and fromsite = #{fromsite}</if>
  60. <if test="answerJson != null and answerJson != ''"> and answer_json = #{answerJson}</if>
  61. </select>
  62. <!--分页慢 https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/Changelog.md 更新时间2017-08-01-->
  63. <select id="selectSubquestionsList_COUNT" resultType="Long">
  64. select count(*)
  65. from subquestions q
  66. where 1=1 and q.id &gt;=1 and q.id &lt;=999999999
  67. <if test="title != null and title != ''"> and title = #{title}</if>
  68. <if test="optionA != null and optionA != ''"> and option_a = #{optionA}</if>
  69. <if test="optionB != null and optionB != ''"> and option_b = #{optionB}</if>
  70. <if test="optionC != null and optionC != ''"> and option_c = #{optionC}</if>
  71. <if test="optionD != null and optionD != ''"> and option_d = #{optionD}</if>
  72. <if test="pid != null "> and pid = #{pid}</if>
  73. <if test="answer1 != null and answer1 != ''"> and answer1 = #{answer1}</if>
  74. <if test="answer2 != null and answer2 != ''"> and answer2 = #{answer2}</if>
  75. <if test="parse != null and parse != ''"> and parse = #{parse}</if>
  76. <if test="qtpye != null and qtpye != ''"> and qtpye = #{qtpye}</if>
  77. <if test="diff != null "> and diff = #{diff}</if>
  78. <if test="subjectid != null "> and subjectId = #{subjectid}</if>
  79. <if test="gradeid != null "> and gradeId = #{gradeid}</if>
  80. <if test="knowledges != null and knowledges != ''"> and knowledges = #{knowledges}</if>
  81. <if test="source != null and source != ''"> and source = #{source}</if>
  82. <if test="tiid != null and tiid != ''"> and tiid = #{tiid}</if>
  83. <if test="ptiid != null and ptiid != ''"> and ptiid = #{ptiid}</if>
  84. <if test="fromsite != null "> and fromsite = #{fromsite}</if>
  85. <if test="answerJson != null and answerJson != ''"> and answer_json = #{answerJson}</if>
  86. </select>
  87. <select id="selectSubquestionsById" parameterType="Integer" resultMap="SubquestionsResult">
  88. <include refid="selectSubquestionsVo"/>
  89. where id = #{id}
  90. </select>
  91. <insert id="insertSubquestions" parameterType="Subquestions" useGeneratedKeys="true" keyProperty="id">
  92. insert into subquestions
  93. <trim prefix="(" suffix=")" suffixOverrides=",">
  94. <if test="title != null">title,</if>
  95. <if test="optionA != null">option_a,</if>
  96. <if test="optionB != null">option_b,</if>
  97. <if test="optionC != null">option_c,</if>
  98. <if test="optionD != null">option_d,</if>
  99. <if test="pid != null">pid,</if>
  100. <if test="answer1 != null">answer1,</if>
  101. <if test="answer2 != null">answer2,</if>
  102. <if test="parse != null">parse,</if>
  103. <if test="qtpye != null">qtpye,</if>
  104. <if test="diff != null">diff,</if>
  105. <if test="subjectid != null">subjectId,</if>
  106. <if test="gradeid != null">gradeId,</if>
  107. <if test="knowledges != null">knowledges,</if>
  108. <if test="source != null">source,</if>
  109. <if test="tiid != null">tiid,</if>
  110. <if test="ptiid != null">ptiid,</if>
  111. <if test="fromsite != null">fromsite,</if>
  112. <if test="answerJson != null">answer_json,</if>
  113. </trim>
  114. <trim prefix="values (" suffix=")" suffixOverrides=",">
  115. <if test="title != null">#{title},</if>
  116. <if test="optionA != null">#{optionA},</if>
  117. <if test="optionB != null">#{optionB},</if>
  118. <if test="optionC != null">#{optionC},</if>
  119. <if test="optionD != null">#{optionD},</if>
  120. <if test="pid != null">#{pid},</if>
  121. <if test="answer1 != null">#{answer1},</if>
  122. <if test="answer2 != null">#{answer2},</if>
  123. <if test="parse != null">#{parse},</if>
  124. <if test="qtpye != null">#{qtpye},</if>
  125. <if test="diff != null">#{diff},</if>
  126. <if test="subjectid != null">#{subjectid},</if>
  127. <if test="gradeid != null">#{gradeid},</if>
  128. <if test="knowledges != null">#{knowledges},</if>
  129. <if test="source != null">#{source},</if>
  130. <if test="tiid != null">#{tiid},</if>
  131. <if test="ptiid != null">#{ptiid},</if>
  132. <if test="fromsite != null">#{fromsite},</if>
  133. <if test="answerJson != null">#{answerJson},</if>
  134. </trim>
  135. </insert>
  136. <update id="updateSubquestions" parameterType="Subquestions">
  137. update subquestions
  138. <trim prefix="SET" suffixOverrides=",">
  139. <if test="title != null">title = #{title},</if>
  140. <if test="optionA != null">option_a = #{optionA},</if>
  141. <if test="optionB != null">option_b = #{optionB},</if>
  142. <if test="optionC != null">option_c = #{optionC},</if>
  143. <if test="optionD != null">option_d = #{optionD},</if>
  144. <if test="pid != null">pid = #{pid},</if>
  145. <if test="answer1 != null">answer1 = #{answer1},</if>
  146. <if test="answer2 != null">answer2 = #{answer2},</if>
  147. <if test="parse != null">parse = #{parse},</if>
  148. <if test="qtpye != null">qtpye = #{qtpye},</if>
  149. <if test="diff != null">diff = #{diff},</if>
  150. <if test="subjectid != null">subjectId = #{subjectid},</if>
  151. <if test="gradeid != null">gradeId = #{gradeid},</if>
  152. <if test="knowledges != null">knowledges = #{knowledges},</if>
  153. <if test="source != null">source = #{source},</if>
  154. <if test="tiid != null">tiid = #{tiid},</if>
  155. <if test="ptiid != null">ptiid = #{ptiid},</if>
  156. <if test="fromsite != null">fromsite = #{fromsite},</if>
  157. <if test="answerJson != null">answer_json = #{answerJson},</if>
  158. </trim>
  159. where id = #{id}
  160. </update>
  161. <delete id="deleteSubquestionsByQuestionId" parameterType="Integer">
  162. delete from subquestions where pid = #{questionId}
  163. </delete>
  164. <delete id="deleteSubquestionsById" parameterType="Integer">
  165. delete from subquestions where id = #{id}
  166. </delete>
  167. <delete id="deleteSubquestionsByIds" parameterType="String">
  168. delete from subquestions where id in
  169. <foreach item="id" collection="array" open="(" separator="," close=")">
  170. #{id}
  171. </foreach>
  172. </delete>
  173. </mapper>