QuestionTitleValueV1ServiceDaoImplMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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="questionTitleValueV1ServiceDaoImpl">
  6. <!-- 保存问卷题目选项信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveQuestionTitleValueInfo" parameterType="Map">
  8. insert into question_title_value(
  9. score,value_id,title_id,community_id,qa_value,seq
  10. ) values (
  11. #{score},#{valueId},#{titleId},#{communityId},#{qaValue},#{seq}
  12. )
  13. </insert>
  14. <!-- 查询问卷题目选项信息 add by wuxw 2018-07-03 -->
  15. <select id="getQuestionTitleValueInfo" parameterType="Map" resultType="Map">
  16. select t.score,t.value_id,t.value_id valueId,t.title_id,t.title_id titleId,t.status_cd,t.status_cd
  17. statusCd,t.community_id,t.community_id communityId,t.qa_value,t.qa_value qaValue,t.seq
  18. from question_title_value t
  19. where 1 =1
  20. <if test="score !=null and score != ''">
  21. and t.score= #{score}
  22. </if>
  23. <if test="valueId !=null and valueId != ''">
  24. and t.value_id= #{valueId}
  25. </if>
  26. <if test="titleId !=null and titleId != ''">
  27. and t.title_id= #{titleId}
  28. </if>
  29. <if test="titleIds !=null">
  30. and t.title_id in
  31. <foreach collection="titleIds" item="item" index="index" open="(" close=")" separator=",">
  32. #{item}
  33. </foreach>
  34. </if>
  35. <if test="statusCd !=null and statusCd != ''">
  36. and t.status_cd= #{statusCd}
  37. </if>
  38. <if test="communityId !=null and communityId != ''">
  39. and t.community_id= #{communityId}
  40. </if>
  41. <if test="qaValue !=null and qaValue != ''">
  42. and t.qa_value= #{qaValue}
  43. </if>
  44. <if test="seq !=null and seq != ''">
  45. and t.seq= #{seq}
  46. </if>
  47. order by t.seq
  48. <if test="page != -1 and page != null ">
  49. limit #{page}, #{row}
  50. </if>
  51. </select>
  52. <!-- 修改问卷题目选项信息 add by wuxw 2018-07-03 -->
  53. <update id="updateQuestionTitleValueInfo" parameterType="Map">
  54. update question_title_value t set t.status_cd = #{statusCd}
  55. <if test="newBId != null and newBId != ''">
  56. ,t.b_id = #{newBId}
  57. </if>
  58. <if test="score !=null and score != ''">
  59. , t.score= #{score}
  60. </if>
  61. <if test="qaValue !=null and qaValue != ''">
  62. , t.qa_value= #{qaValue}
  63. </if>
  64. <if test="seq !=null and seq != ''">
  65. , t.seq= #{seq}
  66. </if>
  67. where 1=1
  68. <if test="valueId !=null and valueId != ''">
  69. and t.value_id= #{valueId}
  70. </if>
  71. <if test="titleId !=null and titleId != ''">
  72. and t.title_id= #{titleId}
  73. </if>
  74. <if test="communityId !=null and communityId != ''">
  75. and t.community_id= #{communityId}
  76. </if>
  77. </update>
  78. <!-- 查询问卷题目选项数量 add by wuxw 2018-07-03 -->
  79. <select id="queryQuestionTitleValuesCount" parameterType="Map" resultType="Map">
  80. select count(1) count
  81. from question_title_value t
  82. where 1 =1
  83. <if test="score !=null and score != ''">
  84. and t.score= #{score}
  85. </if>
  86. <if test="valueId !=null and valueId != ''">
  87. and t.value_id= #{valueId}
  88. </if>
  89. <if test="titleId !=null and titleId != ''">
  90. and t.title_id= #{titleId}
  91. </if>
  92. <if test="statusCd !=null and statusCd != ''">
  93. and t.status_cd= #{statusCd}
  94. </if>
  95. <if test="communityId !=null and communityId != ''">
  96. and t.community_id= #{communityId}
  97. </if>
  98. <if test="qaValue !=null and qaValue != ''">
  99. and t.qa_value= #{qaValue}
  100. </if>
  101. <if test="seq !=null and seq != ''">
  102. and t.seq= #{seq}
  103. </if>
  104. </select>
  105. <select id="queryQuestionOwnerTitleValues" parameterType="Map" resultType="Map">
  106. select qa.qa_id qaId,t.qa_value qaValue,t.seq,count(1) personCount
  107. from question_title_value t
  108. inner join question_answer_title_rel qatr on t.title_id = qatr.title_id and qatr.status_cd = '0'
  109. inner join question_answer qa on qatr.qa_id = qa.qa_id and qa.status_cd = '0'
  110. left join user_question_answer_value uqav on qa.qa_id = uqav.qa_id and t.value_id = uqav.value_id and t.title_id = uqav.title_id and uqav.status_cd = '0'
  111. where 1=1
  112. and t.community_id = #{communityId}
  113. <if test="titleId !=null and titleId != ''">
  114. and t.title_id= #{titleId}
  115. </if>
  116. <if test="statusCd !=null and statusCd != ''">
  117. and t.status_cd= #{statusCd}
  118. </if>
  119. <if test="qaIds !=null">
  120. and qa.qa_id in
  121. <foreach collection="qaIds" item="item" index="index" open="(" close=")" separator=",">
  122. #{item}
  123. </foreach>
  124. </if>
  125. group by qa.qa_id,t.qa_value,t.seq
  126. order by t.seq
  127. </select>
  128. </mapper>