QuestionInfoMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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.miaxis.qustion.mapper.QuestionInfoMapper">
  6. <resultMap type="QuestionInfo" id="QuestionInfoResult">
  7. <result property="id" column="id" />
  8. <result property="number" column="number" />
  9. <result property="answer" column="answer" />
  10. <result property="answerkeyword" column="answerkeyword" />
  11. <result property="explainGif" column="explain_gif" />
  12. <result property="explainJq" column="explain_jq" />
  13. <result property="explainJs" column="explain_js" />
  14. <result property="explainMp3" column="explain_mp3" />
  15. <result property="image" column="image" />
  16. <result property="imageYdt" column="image_ydt" />
  17. <result property="issue" column="issue" />
  18. <result property="opts" column="opts" />
  19. <result property="skillkeyword" column="skillkeyword" />
  20. <result property="titlekeyword" column="titlekeyword" />
  21. <result property="issuemp3" column="issuemp3" />
  22. <result property="answermp3" column="answermp3" />
  23. <result property="explainjsmp3" column="explainjsmp3" />
  24. <result property="subject1" column="subject_1" />
  25. <result property="subject2" column="subject_2" />
  26. <result property="subject3" column="subject_3" />
  27. <result property="subject4" column="subject_4" />
  28. <result property="liceCar" column="lice_car" />
  29. <result property="liceBus" column="lice_bus" />
  30. <result property="liceTruck" column="lice_truck" />
  31. <result property="liceMoto" column="lice_moto" />
  32. <result property="sequeIssue" column="seque_issue" />
  33. <result property="classIssue" column="class_issue" />
  34. <result property="placeIssue" column="place_issue" />
  35. <result property="excellIssue" column="excell_issue" />
  36. <result property="copyIssue" column="copy_issue" />
  37. <result property="mockIssue" column="mock_issue" />
  38. <result property="sequeIssueName" column="seque_issue_name" />
  39. <result property="placeIssueName" column="place_issue_name" />
  40. <result property="excellIssueName" column="excell_issue_name" />
  41. <result property="classIssueName" column="class_issue_name" />
  42. <result property="createTime" column="create_time" />
  43. <result property="updateTime" column="update_time" />
  44. </resultMap>
  45. <sql id="selectQuestionInfoVo">
  46. select * from question_info
  47. </sql>
  48. <select id="selectQuestionInfoList" parameterType="QuestionInfoDTO" resultMap="QuestionInfoResult">
  49. <include refid="selectQuestionInfoVo"/>
  50. <where>
  51. <if test="number != null "> and number = #{number}</if>
  52. <if test="answer != null and answer != ''"> and answer = #{answer}</if>
  53. <if test="answerkeyword != null and answerkeyword != ''"> and answerkeyword = #{answerkeyword}</if>
  54. <if test="explainGif != null and explainGif != ''"> and explain_gif = #{explainGif}</if>
  55. <if test="explainJq != null and explainJq != ''"> and explain_jq = #{explainJq}</if>
  56. <if test="explainJs != null and explainJs != ''"> and explain_js = #{explainJs}</if>
  57. <if test="explainMp3 != null and explainMp3 != ''"> and explain_mp3 = #{explainMp3}</if>
  58. <if test="image != null and image != ''"> and image = #{image}</if>
  59. <if test="imageYdt != null and imageYdt != ''"> and image_ydt = #{imageYdt}</if>
  60. <if test="issue != null and issue != ''"> and issue = #{issue}</if>
  61. <if test="opts != null and opts != ''"> and opts = #{opts}</if>
  62. <if test="skillkeyword != null and skillkeyword != ''"> and skillkeyword = #{skillkeyword}</if>
  63. <if test="titlekeyword != null and titlekeyword != ''"> and titlekeyword = #{titlekeyword}</if>
  64. <if test="issuemp3 != null and issuemp3 != ''"> and issuemp3 = #{issuemp3}</if>
  65. <if test="answermp3 != null and answermp3 != ''"> and answermp3 = #{answermp3}</if>
  66. <if test="explainjsmp3 != null and explainjsmp3 != ''"> and explainjsmp3 = #{explainjsmp3}</if>
  67. <if test="subject1 != null and subject1 != ''"> and subject_1 = #{subject1}</if>
  68. <if test="subject2 != null and subject2 != ''"> and subject_2 = #{subject2}</if>
  69. <if test="subject3 != null and subject3 != ''"> and subject_3 = #{subject3}</if>
  70. <if test="subject4 != null and subject4 != ''"> and subject_4 = #{subject4}</if>
  71. <if test="liceCar != null and liceCar != ''"> and lice_car = #{liceCar}</if>
  72. <if test="liceBus != null and liceBus != ''"> and lice_bus = #{liceBus}</if>
  73. <if test="liceTruck != null and liceTruck != ''"> and lice_truck = #{liceTruck}</if>
  74. <if test="liceMoto != null and liceMoto != ''"> and lice_moto = #{liceMoto}</if>
  75. <if test="sequeIssue != null and sequeIssue != ''"> and seque_issue = #{sequeIssue}</if>
  76. <if test="classIssue != null and classIssue != ''"> and class_issue = #{classIssue}</if>
  77. <if test="placeIssue != null and placeIssue != ''"> and place_issue = #{placeIssue}</if>
  78. <if test="excellIssue != null and excellIssue != ''"> and excell_issue = #{excellIssue}</if>
  79. <if test="copyIssue != null and copyIssue != ''"> and copy_issue = #{copyIssue}</if>
  80. <if test="mockIssue != null and mockIssue != ''"> and mock_issue = #{mockIssue}</if>
  81. <if test="sequeIssueName != null and sequeIssueName != ''"> and seque_issue_name like concat('%', #{sequeIssueName}, '%')</if>
  82. <if test="placeIssueName != null and placeIssueName != ''"> and place_issue_name like concat('%', #{placeIssueName}, '%')</if>
  83. <if test="excellIssueName != null and excellIssueName != ''"> and excell_issue_name like concat('%', #{excellIssueName}, '%')</if>
  84. <if test="classIssueName != null and classIssueName != ''"> and class_issue_name like concat('%', #{classIssueName}, '%')</if>
  85. </where>
  86. <if test="isRand!=null and isRand!=''"> order by rand() </if>
  87. </select>
  88. <select id="selectNormalQuestionInfoList" parameterType="QuestionInfoDTO" resultMap="QuestionInfoResult">
  89. <include refid="selectQuestionInfoVo"/>
  90. <where>
  91. <if test="number != null "> and number = #{number}</if>
  92. <if test="answer != null and answer != ''"> and answer = #{answer}</if>
  93. <if test="answerkeyword != null and answerkeyword != ''"> and answerkeyword = #{answerkeyword}</if>
  94. <if test="explainGif != null and explainGif != ''"> and explain_gif = #{explainGif}</if>
  95. <if test="explainJq != null and explainJq != ''"> and explain_jq = #{explainJq}</if>
  96. <if test="explainJs != null and explainJs != ''"> and explain_js = #{explainJs}</if>
  97. <if test="explainMp3 != null and explainMp3 != ''"> and explain_mp3 = #{explainMp3}</if>
  98. <if test="image != null and image != ''"> and image = #{image}</if>
  99. <if test="imageYdt != null and imageYdt != ''"> and image_ydt = #{imageYdt}</if>
  100. <if test="issue != null and issue != ''"> and issue = #{issue}</if>
  101. <if test="opts != null and opts != ''"> and opts = #{opts}</if>
  102. <if test="skillkeyword != null and skillkeyword != ''"> and skillkeyword = #{skillkeyword}</if>
  103. <if test="titlekeyword != null and titlekeyword != ''"> and titlekeyword = #{titlekeyword}</if>
  104. <if test="issuemp3 != null and issuemp3 != ''"> and issuemp3 = #{issuemp3}</if>
  105. <if test="answermp3 != null and answermp3 != ''"> and answermp3 = #{answermp3}</if>
  106. <if test="explainjsmp3 != null and explainjsmp3 != ''"> and explainjsmp3 = #{explainjsmp3}</if>
  107. <if test="subject1 != null and subject1 != ''"> and subject_1 = #{subject1}</if>
  108. <if test="subject2 != null and subject2 != ''"> and subject_2 = #{subject2}</if>
  109. <if test="subject3 != null and subject3 != ''"> and subject_3 = #{subject3}</if>
  110. <if test="subject4 != null and subject4 != ''"> and subject_4 = #{subject4}</if>
  111. <if test="liceCar != null and liceCar != ''"> and lice_car = #{liceCar}</if>
  112. <if test="liceBus != null and liceBus != ''"> and lice_bus = #{liceBus}</if>
  113. <if test="liceTruck != null and liceTruck != ''"> and lice_truck = #{liceTruck}</if>
  114. <if test="liceMoto != null and liceMoto != ''"> and lice_moto = #{liceMoto}</if>
  115. <if test="sequeIssue != null and sequeIssue != ''"> and seque_issue = #{sequeIssue}</if>
  116. <if test="classIssue != null and classIssue != ''"> and class_issue = #{classIssue}</if>
  117. <if test="placeIssue != null and placeIssue != ''"> and place_issue = #{placeIssue}</if>
  118. <if test="excellIssue != null and excellIssue != ''"> and excell_issue = #{excellIssue}</if>
  119. <if test="copyIssue != null and copyIssue != ''"> and copy_issue = #{copyIssue}</if>
  120. <if test="mockIssue != null and mockIssue != ''"> and mock_issue = #{mockIssue}</if>
  121. <if test="sequeIssueName != null and sequeIssueName != ''"> and seque_issue_name like concat('%', #{sequeIssueName}, '%')</if>
  122. <if test="placeIssueName != null and placeIssueName != ''"> and place_issue_name like concat('%', #{placeIssueName}, '%')</if>
  123. <if test="excellIssueName != null and excellIssueName != ''"> and excell_issue_name like concat('%', #{excellIssueName}, '%')</if>
  124. <if test="classIssueName != null and classIssueName != ''"> and class_issue_name like concat('%', #{classIssueName}, '%')</if>
  125. </where>
  126. limit 0,5
  127. </select>
  128. <select id="selectQuestionInfoListIds" parameterType="Long" resultMap="QuestionInfoResult">
  129. <include refid="selectQuestionInfoVo"/>
  130. <where>
  131. and id in
  132. <foreach collection="array" item="id" index="index" open="(" close=")" separator=",">
  133. #{id}
  134. </foreach>
  135. </where>
  136. </select>
  137. <select id="selectJxQuestionInfo" resultType="com.miaxis.qustion.vo.QuestionInfoJxVO">
  138. SELECT
  139. DISTINCT case WHEN excell_issue_name is null then '地方专题' else excell_issue_name end as "excell_issue_name",
  140. excell_issue
  141. FROM question_info
  142. <where>
  143. <if test="subject1 != null and subject1 != ''"> and subject_1 = #{subject1}</if>
  144. <if test="subject2 != null and subject2 != ''"> and subject_2 = #{subject2}</if>
  145. <if test="subject3 != null and subject3 != ''"> and subject_3 = #{subject3}</if>
  146. <if test="subject4 != null and subject4 != ''"> and subject_4 = #{subject4}</if>
  147. <if test="liceCar != null and liceCar != ''"> and lice_car = #{liceCar} </if>
  148. <if test="liceBus != null and liceBus != ''"> and lice_bus = #{liceBus}</if>
  149. <if test="liceTruck != null and liceTruck != ''"> and lice_truck = #{liceTruck}</if>
  150. <if test="liceMoto != null and liceMoto != ''"> and lice_moto = #{liceMoto}</if>
  151. </where>
  152. ORDER BY
  153. excell_issue + 0 ASC
  154. </select>
  155. <select id="selectDfQuestionInfo" resultType="com.miaxis.qustion.vo.QuestionInfoDfVO">
  156. SELECT
  157. DISTINCT
  158. case WHEN place_issue_name is null then '地方专题' else place_issue_name end as "place_issue_name",
  159. place_issue
  160. FROM question_info
  161. <where>
  162. <if test="subject1 != null and subject1 != ''"> and subject_1 = #{subject1}</if>
  163. <if test="subject2 != null and subject2 != ''"> and subject_2 = #{subject2}</if>
  164. <if test="subject3 != null and subject3 != ''"> and subject_3 = #{subject3}</if>
  165. <if test="subject4 != null and subject4 != ''"> and subject_4 = #{subject4}</if>
  166. <if test="liceCar != null and liceCar != ''"> and lice_car = #{liceCar} </if>
  167. <if test="liceBus != null and liceBus != ''"> and lice_bus = #{liceBus}</if>
  168. <if test="liceTruck != null and liceTruck != ''"> and lice_truck = #{liceTruck}</if>
  169. <if test="liceMoto != null and liceMoto != ''"> and lice_moto = #{liceMoto}</if>
  170. </where>
  171. ORDER BY
  172. place_issue + 0 ASC
  173. </select>
  174. <select id="selectFlQuestionInfo" resultType="com.miaxis.qustion.vo.QuestionInfoFlVO">
  175. SELECT
  176. DISTINCT
  177. case WHEN class_issue_name is null then '地方专题' else class_issue_name end as "class_issue_name",
  178. class_issue
  179. FROM question_info
  180. <where>
  181. <if test="subject1 != null and subject1 != ''"> and subject_1 = #{subject1}</if>
  182. <if test="subject2 != null and subject2 != ''"> and subject_2 = #{subject2}</if>
  183. <if test="subject3 != null and subject3 != ''"> and subject_3 = #{subject3}</if>
  184. <if test="subject4 != null and subject4 != ''"> and subject_4 = #{subject4}</if>
  185. <if test="liceCar != null and liceCar != ''"> and lice_car = #{liceCar} </if>
  186. <if test="liceBus != null and liceBus != ''"> and lice_bus = #{liceBus}</if>
  187. <if test="liceTruck != null and liceTruck != ''"> and lice_truck = #{liceTruck}</if>
  188. <if test="liceMoto != null and liceMoto != ''"> and lice_moto = #{liceMoto}</if>
  189. </where>
  190. ORDER BY
  191. class_issue + 0 ASC
  192. </select>
  193. </mapper>