QuestionAnswerServiceDaoImplMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="questionAnswerServiceDaoImpl">
  5. <!-- 保存答卷信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveQuestionAnswerInfo" parameterType="Map">
  7. insert into question_answer(qa_name, qa_type, start_time, end_time, remark, obj_id, qa_id, content)
  8. values (#{qaName}, #{qaType}, #{startTime}, #{endTime}, #{remark}, #{objType}, #{qaId}, #{content})
  9. </insert>
  10. <!-- 查询答卷信息 add by wuxw 2018-07-03 -->
  11. <select id="getQuestionAnswerInfo" parameterType="Map" resultType="Map">
  12. select t.qa_name,t.qa_name qaName,t.qa_type,t.qa_type qaType,t.status_cd,t.status_cd
  13. statusCd,t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.remark,
  14. t.obj_type,t.obj_type objType,t.obj_id,t.obj_id objId,t.qa_id,t.qa_id qaId,td.`name` qaTypeName,
  15. t.content
  16. <if test="userId !=null and userId != ''">
  17. ,uqa.person_id userId
  18. </if>
  19. from question_answer t
  20. LEFT JOIN t_dict td on td.status_cd = t.qa_type and td.table_name = 'question_answer' and td.table_columns =
  21. 'qa_type'
  22. <if test="userId !=null and userId != ''">
  23. LEFT JOIN user_question_answer uqa on t.qa_id = uqa.qa_id and uqa.status_cd = '0' and uqa.person_id =
  24. #{userId}
  25. </if>
  26. where 1 =1
  27. <if test="qaName !=null and qaName != ''">
  28. and t.qa_name like concat('%',#{qaName},'%')
  29. </if>
  30. <if test="qaType !=null and qaType != ''">
  31. and t.qa_type= #{qaType}
  32. </if>
  33. <if test="statusCd !=null and statusCd != ''">
  34. and t.status_cd= #{statusCd}
  35. </if>
  36. <if test="startTime !=null and startTime != ''">
  37. and t.start_time= #{startTime}
  38. </if>
  39. <if test="endTime !=null and endTime != ''">
  40. and t.end_time= #{endTime}
  41. </if>
  42. <if test="remark !=null and remark != ''">
  43. and t.remark= #{remark}
  44. </if>
  45. <if test="content != null and content != ''">
  46. and t.content= #{content}
  47. </if>
  48. <if test="objType !=null and objType != ''">
  49. and t.obj_type= #{objType}
  50. </if>
  51. <if test="objId !=null and objId != ''">
  52. and t.obj_id= #{objId}
  53. </if>
  54. <if test="objIds !=null">
  55. and t.obj_id in
  56. <foreach collection="objIds" item="item" open="(" close=")" separator=",">
  57. #{item}
  58. </foreach>
  59. </if>
  60. <if test="qaId !=null and qaId != ''">
  61. and t.qa_id= #{qaId}
  62. </if>
  63. order by t.create_time desc
  64. <if test="page != -1 and page != null ">
  65. limit #{page}, #{row}
  66. </if>
  67. </select>
  68. <!-- 修改答卷信息 add by wuxw 2018-07-03 -->
  69. <update id="updateQuestionAnswerInfo" parameterType="Map">
  70. update question_answer t set t.status_cd = #{statusCd}
  71. <if test="newBId != null and newBId != ''">
  72. ,t.b_id = #{newBId}
  73. </if>
  74. <if test="qaName !=null and qaName != ''">
  75. , t.qa_name= #{qaName}
  76. </if>
  77. <if test="qaType !=null and qaType != ''">
  78. , t.qa_type= #{qaType}
  79. </if>
  80. <if test="startTime !=null and startTime != ''">
  81. , t.start_time= #{startTime}
  82. </if>
  83. <if test="endTime !=null and endTime != ''">
  84. , t.end_time= #{endTime}
  85. </if>
  86. <if test="remark !=null and remark != ''">
  87. , t.remark= #{remark}
  88. </if>
  89. <if test="content != null and content != ''">
  90. , t.content= #{content}
  91. </if>
  92. <if test="objType !=null and objType != ''">
  93. , t.obj_type= #{objType}
  94. </if>
  95. <if test="objId !=null and objId != ''">
  96. , t.obj_id= #{objId}
  97. </if>
  98. where 1=1
  99. <if test="qaId !=null and qaId != ''">
  100. and t.qa_id= #{qaId}
  101. </if>
  102. </update>
  103. <!-- 查询答卷数量 add by wuxw 2018-07-03 -->
  104. <select id="queryQuestionAnswersCount" parameterType="Map" resultType="Map">
  105. select count(1) count
  106. from question_answer t
  107. where 1 =1
  108. <if test="qaName !=null and qaName != ''">
  109. and t.qa_name like concat('%',#{qaName},'%')
  110. </if>
  111. <if test="qaType !=null and qaType != ''">
  112. and t.qa_type= #{qaType}
  113. </if>
  114. <if test="statusCd !=null and statusCd != ''">
  115. and t.status_cd= #{statusCd}
  116. </if>
  117. <if test="startTime !=null and startTime != ''">
  118. and t.start_time= #{startTime}
  119. </if>
  120. <if test="endTime !=null and endTime != ''">
  121. and t.end_time= #{endTime}
  122. </if>
  123. <if test="remark !=null and remark != ''">
  124. and t.remark= #{remark}
  125. </if>
  126. <if test="content != null and content != ''">
  127. and t.content= #{content}
  128. </if>
  129. <if test="objType !=null and objType != ''">
  130. and t.obj_type= #{objType}
  131. </if>
  132. <if test="objId !=null and objId != ''">
  133. and t.obj_id= #{objId}
  134. </if>
  135. <if test="objIds !=null">
  136. and t.obj_id in
  137. <foreach collection="objIds" item="item" open="(" close=")" separator=",">
  138. #{item}
  139. </foreach>
  140. </if>
  141. <if test="qaId !=null and qaId != ''">
  142. and t.qa_id= #{qaId}
  143. </if>
  144. </select>
  145. </mapper>