GoafChecklistMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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="com.zhyc.xps.goaf.mapper.GoafChecklistMapper">
  5. <resultMap id="GoafChecklistDtoMapper" type="com.zhyc.xps.goaf.dto.GoafChecklistDto">
  6. <id column="checklist_id" property="checklistId" jdbcType="BIGINT"/>
  7. <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
  8. <result column="checklist_title" property="checklistTitle" jdbcType="VARCHAR"/>
  9. <result column="checklist_desc" property="checklistDesc" jdbcType="VARCHAR"/>
  10. <result column="checklist_item_id" property="checklistItemId" jdbcType="BIGINT"/>
  11. <result column="checklist_item_content" property="checklistItemContent" jdbcType="VARCHAR"/>
  12. </resultMap>
  13. <resultMap id="GoafChecklistMapper" type="com.zhyc.xps.goaf.entity.GoafChecklist">
  14. <id column="checklist_id" property="checklistId" jdbcType="BIGINT"/>
  15. <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
  16. <result column="checklist_title" property="checklistTitle" jdbcType="VARCHAR"/>
  17. <result column="checklist_desc" property="checklistDesc" jdbcType="VARCHAR"/>
  18. </resultMap>
  19. <select id="getChecklistByList" parameterType="java.util.Map" resultMap="GoafChecklistMapper">
  20. SELECT checklist_id,
  21. oc_id,
  22. checklist_title,
  23. checklist_desc
  24. FROM goaf_checklist
  25. WHERE oc_id = #{ocId, jdbcType=BIGINT}
  26. <if test="checklistId !=null">
  27. AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
  28. </if>
  29. <if test="checklistTitle !=null and checklistTitle != ''">
  30. AND A.checklist_title = #{checklistTitle ,jdbcType=VARCHAR}
  31. </if>
  32. </select>
  33. <!-- <select id="getByList" parameterType="java.util.Map" resultMap="GoafChecklistDtoMapper">-->
  34. <!-- SELECT A.checklist_id,-->
  35. <!-- A.oc_id,-->
  36. <!-- A.checklist_title,-->
  37. <!-- A.checklist_desc,-->
  38. <!-- B.checklist_item_id,-->
  39. <!-- B.checklist_item_content-->
  40. <!-- FROM goaf_checklist AS A-->
  41. <!-- left join goaf_checklist_item AS B ON B.checklist_id = A.checklist_id-->
  42. <!-- WHERE A.oc_id = #{ocId, jdbcType=BIGINT}-->
  43. <!-- <if test="checklistId !=null">-->
  44. <!-- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}-->
  45. <!-- </if>-->
  46. <!-- <if test="checklistTitle !=null and checklistTitle != ''">-->
  47. <!-- AND A.checklist_title = #{checklistTitle ,jdbcType=VARCHAR}-->
  48. <!-- </if>-->
  49. <!-- </select>-->
  50. <!--分页查询-->
  51. <select id="getChecklistByPage" parameterType="java.util.Map" resultMap="GoafChecklistMapper">
  52. SELECT checklist_id,
  53. oc_id,
  54. checklist_title,
  55. checklist_desc
  56. FROM goaf_checklist
  57. WHERE oc_id = #{ocId, jdbcType=BIGINT}
  58. <if test="checklistId !=null">
  59. AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
  60. </if>
  61. <if test="checklistTitle !=null and checklistTitle != ''">
  62. AND A.checklist_title = #{checklistTitle ,jdbcType=VARCHAR}
  63. </if>
  64. </select>
  65. <!-- &lt;!&ndash;分页查询&ndash;&gt;-->
  66. <!-- <select id="getByPage" parameterType="java.util.Map" resultMap="GoafChecklistDtoMapper">-->
  67. <!-- SELECT A.checklist_id,-->
  68. <!-- A.oc_id,-->
  69. <!-- A.checklist_title,-->
  70. <!-- A.checklist_desc,-->
  71. <!-- B.checklist_item_id,-->
  72. <!-- B.checklist_item_content-->
  73. <!-- FROM goaf_checklist AS A-->
  74. <!-- left join goaf_checklist_item AS B ON B.checklist_id = A.checklist_id-->
  75. <!-- WHERE A.oc_id = #{ocId, jdbcType=BIGINT}-->
  76. <!-- <if test="checklistId !=null">-->
  77. <!-- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}-->
  78. <!-- </if>-->
  79. <!-- <if test="checklistTitle !=null and checklistTitle != ''">-->
  80. <!-- AND A.checklist_title = #{checklistTitle ,jdbcType=VARCHAR}-->
  81. <!-- </if>-->
  82. <!-- </select>-->
  83. <!-- <select id="getById" resultMap="GoafChecklistDtoMapper">-->
  84. <!-- SELECT A.checklist_id,-->
  85. <!-- A.oc_id,-->
  86. <!-- A.checklist_title,-->
  87. <!-- A.checklist_desc,-->
  88. <!-- B.checklist_item_id,-->
  89. <!-- B.checklist_item_content-->
  90. <!-- FROM goaf_checklist AS A-->
  91. <!-- left join goaf_checklist_item AS B ON B.checklist_id = A.checklist_id-->
  92. <!-- WHERE A.checklist_id = #{checklistId ,jdbcType=BIGINT}-->
  93. <!-- </select>-->
  94. <insert id="create" parameterType="com.zhyc.xps.goaf.entity.GoafChecklist">
  95. insert into goaf_checklist
  96. <trim prefix="(" suffix=")" suffixOverrides=",">
  97. <if test="checklistId != null">
  98. checklist_id,
  99. </if>
  100. <if test="ocId != null">
  101. oc_id,
  102. </if>
  103. <if test="checklistTitle != null and checklistTitle != ''">
  104. checklist_title,
  105. </if>
  106. <if test="checklistDesc != null and checklistDesc != ''">
  107. checklist_desc,
  108. </if>
  109. </trim>
  110. <trim prefix="values (" suffix=")" suffixOverrides=",">
  111. <if test="checklistId != null">
  112. #{checklistId, jdbcType=BIGINT},
  113. </if>
  114. <if test="ocId != null">
  115. #{ocId, jdbcType=BIGINT},
  116. </if>
  117. <if test="checklistTitle != null and checklistTitle != ''">
  118. #{checklistTitle, jdbcType=VARCHAR},
  119. </if>
  120. <if test="checklistDesc != null and checklistDesc != ''">
  121. #{checklistDesc, jdbcType=VARCHAR},
  122. </if>
  123. </trim>
  124. </insert>
  125. <!--Update更新-->
  126. <update id="update" parameterType="com.zhyc.xps.goaf.entity.GoafChecklist">
  127. UPDATE goaf_checklist
  128. <trim suffixOverrides=",">
  129. <set>
  130. <if test="checklistTitle != null and checklistTitle != ''">
  131. checklist_title = #{checklistTitle, jdbcType=VARCHAR},
  132. </if>
  133. <if test="checklistDesc != null and checklistDesc != ''">
  134. checklist_desc = #{checklistDesc, jdbcType=VARCHAR},
  135. </if>
  136. </set>
  137. </trim>
  138. WHERE checklist_id = #{checklistId, jdbcType=BIGINT}
  139. </update>
  140. <delete id="delete" >
  141. DELETE FROM goaf_checklist
  142. WHERE checklist_id = #{checklistId, jdbcType=BIGINT}
  143. </delete>
  144. </mapper>