QuestionTitleV1ServiceDaoImplMapper.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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="questionTitleV1ServiceDaoImpl">
  6. <!-- 保存问卷题目信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveQuestionTitleInfo" parameterType="Map">
  8. insert into question_title(
  9. title_type,title_id,community_id,qa_title
  10. ) values (
  11. #{titleType},#{titleId},#{communityId},#{qaTitle}
  12. )
  13. </insert>
  14. <!-- 查询问卷题目信息 add by wuxw 2018-07-03 -->
  15. <select id="getQuestionTitleInfo" parameterType="Map" resultType="Map">
  16. select t.title_type,t.title_type titleType,t.title_id,t.title_id titleId,t.status_cd,t.status_cd
  17. statusCd,t.community_id,t.community_id communityId,t.qa_title,t.qa_title qaTitle,t.create_time createTime
  18. from question_title t
  19. <if test="qaId !=null and qaId != ''">
  20. left join question_answer_title_rel qatr on t.title_id = qatr.title_id and qatr.status_cd = '0'
  21. </if>
  22. where 1 =1
  23. <if test="qaId !=null and qaId != ''">
  24. and qatr.qa_id = #{qaId}
  25. </if>
  26. <if test="titleType !=null and titleType != ''">
  27. and t.title_type= #{titleType}
  28. </if>
  29. <if test="titleId !=null and titleId != ''">
  30. and t.title_id= #{titleId}
  31. </if>
  32. <if test="statusCd !=null and statusCd != ''">
  33. and t.status_cd= #{statusCd}
  34. </if>
  35. <if test="communityId !=null and communityId != ''">
  36. and t.community_id= #{communityId}
  37. </if>
  38. <if test="qaTitle !=null and qaTitle != ''">
  39. and t.qa_title= #{qaTitle}
  40. </if>
  41. order by t.create_time desc
  42. <if test="page != -1 and page != null ">
  43. limit #{page}, #{row}
  44. </if>
  45. </select>
  46. <!-- 修改问卷题目信息 add by wuxw 2018-07-03 -->
  47. <update id="updateQuestionTitleInfo" parameterType="Map">
  48. update question_title t set t.status_cd = #{statusCd}
  49. <if test="newBId != null and newBId != ''">
  50. ,t.b_id = #{newBId}
  51. </if>
  52. <if test="titleType !=null and titleType != ''">
  53. , t.title_type= #{titleType}
  54. </if>
  55. <if test="communityId !=null and communityId != ''">
  56. , t.community_id= #{communityId}
  57. </if>
  58. <if test="qaTitle !=null and qaTitle != ''">
  59. , t.qa_title= #{qaTitle}
  60. </if>
  61. where 1=1
  62. <if test="titleId !=null and titleId != ''">
  63. and t.title_id= #{titleId}
  64. </if>
  65. </update>
  66. <!-- 查询问卷题目数量 add by wuxw 2018-07-03 -->
  67. <select id="queryQuestionTitlesCount" parameterType="Map" resultType="Map">
  68. select count(1) count
  69. from question_title t
  70. <if test="qaId !=null and qaId != ''">
  71. left join question_answer_title_rel qatr on t.title_id = qatr.title_id and qatr.status_cd = '0'
  72. </if>
  73. where 1 =1
  74. <if test="qaId !=null and qaId != ''">
  75. and qatr.qa_id = #{qaId}
  76. </if>
  77. <if test="titleType !=null and titleType != ''">
  78. and t.title_type= #{titleType}
  79. </if>
  80. <if test="titleId !=null and titleId != ''">
  81. and t.title_id= #{titleId}
  82. </if>
  83. <if test="statusCd !=null and statusCd != ''">
  84. and t.status_cd= #{statusCd}
  85. </if>
  86. <if test="communityId !=null and communityId != ''">
  87. and t.community_id= #{communityId}
  88. </if>
  89. <if test="qaTitle !=null and qaTitle != ''">
  90. and t.qa_title= #{qaTitle}
  91. </if>
  92. </select>
  93. </mapper>