ChecklisItemPointMapper.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.zhyc.xps.sys.mapper.ChecklistItemPointMapper">
  4. <resultMap id="ChecklistItemPointDtoResultMap" type="com.zhyc.xps.sys.dto.ChecklistItemPointDto">
  5. <result column="checklist_id" property="checklistId" jdbcType="BIGINT" />
  6. <result column="item_id" property="itemId" jdbcType="BIGINT" />
  7. <result column="item_title" property="itemTitle" jdbcType="VARCHAR" />
  8. <result column="point_id" property="pointId" jdbcType="BIGINT" />
  9. <result column="point_code" property="pointCode" jdbcType="VARCHAR" />
  10. <result column="point_content" property="pointContent" jdbcType="VARCHAR" />
  11. <result column="point_reference" property="pointReference" jdbcType="VARCHAR" />
  12. <result column="point_remark" property="pointRemark" jdbcType="VARCHAR" />
  13. <result column="sort_no" property="sortNo" jdbcType="BIGINT" />
  14. </resultMap>
  15. <sql id="ChecklistItemPointDto_Cols">
  16. A.checklist_id,
  17. A.item_id,
  18. B.item_title,
  19. A.point_id,
  20. A.point_code,
  21. A.point_content,
  22. A.point_reference,
  23. A.point_remark,
  24. A.sort_no
  25. </sql>
  26. <!--基于ID查询-->
  27. <select id="getById" resultMap="ChecklistItemPointDtoResultMap">
  28. SELECT
  29. <include refid="ChecklistItemPointDto_Cols"/>
  30. FROM checklist_item_point AS A
  31. LEFT JOIN checklist_item AS B ON (A.oc_id = B.oc_id AND A.checklist_id = B.checklist_id AND A.item_id = B.item_id)
  32. WHERE A.deleted_flag = 0
  33. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  34. AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
  35. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  36. AND A.point_id = #{pointId,jdbcType=BIGINT}
  37. </select>
  38. <!--分页查询-->
  39. <select id="getByPage" parameterType="java.util.Map" resultMap="ChecklistItemPointDtoResultMap">
  40. SELECT
  41. <include refid="ChecklistItemPointDto_Cols"/>
  42. FROM checklist_item_point AS A
  43. LEFT JOIN checklist_item AS B ON (A.oc_id = B.oc_id AND A.checklist_id = B.checklist_id AND A.item_id = B.item_id)
  44. WHERE A.deleted_flag = 0
  45. <if test="ocId != null">
  46. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  47. </if>
  48. <if test="checklistId != null">
  49. AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
  50. </if>
  51. <if test="itemId != null">
  52. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  53. </if>
  54. <if test="pointId != null">
  55. AND A.point_id = #{pointId,jdbcType=BIGINT}
  56. </if>
  57. <if test="keywords != null and keywords != ''">
  58. AND A.point_content like "%"#{keywords}"%"
  59. </if>
  60. ORDER BY A.item_id, A.sort_no
  61. </select>
  62. <!--列表查询-->
  63. <select id="getByList" parameterType="java.util.Map" resultMap="ChecklistItemPointDtoResultMap" >
  64. SELECT
  65. <include refid="ChecklistItemPointDto_Cols"/>
  66. FROM checklist_item_point AS A
  67. LEFT JOIN checklist_item AS B ON (A.oc_id = B.oc_id AND A.checklist_id = B.checklist_id AND A.item_id = B.item_id)
  68. WHERE A.deleted_flag = 0
  69. <if test="ocId != null">
  70. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  71. </if>
  72. <if test="checklistId != null">
  73. AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
  74. </if>
  75. <if test="itemId != null">
  76. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  77. </if>
  78. <if test="pointId != null">
  79. AND A.point_id = #{pointId,jdbcType=BIGINT}
  80. </if>
  81. <if test="keywords != null and keywords != ''">
  82. AND A.point_content like "%"#{keywords}"%"
  83. </if>
  84. ORDER BY A.item_id, A.sort_no
  85. </select>
  86. <insert id="create" parameterType="com.zhyc.xps.sys.entity.ChecklistItemPoint">
  87. INSERT INTO checklist_item_point
  88. <trim prefix="(" suffix=")" suffixOverrides=",">
  89. <if test="ocId != null">
  90. oc_id,
  91. </if>
  92. <if test="checklistId != null">
  93. checklist_id,
  94. </if>
  95. <if test="itemId != null">
  96. item_id,
  97. </if>
  98. <if test="pointId != null">
  99. point_id,
  100. </if>
  101. <if test="pointContent != null and pointContent != ''">
  102. point_content,
  103. </if>
  104. <if test="pointCode != null and pointCode != ''">
  105. point_code,
  106. </if>
  107. <if test="pointReference != null and pointReference != ''">
  108. point_reference,
  109. </if>
  110. <if test="pointRemark != null and pointRemark != ''">
  111. point_remark,
  112. </if>
  113. <if test="sortNo != null">
  114. sort_no,
  115. </if>
  116. <if test="createdBy != null">
  117. created_by,
  118. </if>
  119. <if test="createdAt != null">
  120. created_at,
  121. </if>
  122. </trim>
  123. <trim prefix="values (" suffix=")" suffixOverrides=",">
  124. <if test="ocId != null">
  125. #{ocId, jdbcType=BIGINT},
  126. </if>
  127. <if test="checklistId != null">
  128. #{checklistId, jdbcType=BIGINT},
  129. </if>
  130. <if test="itemId != null">
  131. #{itemId ,jdbcType=BIGINT},
  132. </if>
  133. <if test="pointId != null">
  134. #{pointId ,jdbcType=BIGINT},
  135. </if>
  136. <if test="pointContent != null and pointContent != ''">
  137. #{pointContent ,jdbcType=VARCHAR},
  138. </if>
  139. <if test="pointCode != null and pointCode != ''">
  140. #{pointCode ,jdbcType=VARCHAR},
  141. </if>
  142. <if test="pointReference != null and pointReference != ''">
  143. #{pointReference ,jdbcType=VARCHAR},
  144. </if>
  145. <if test="pointRemark != null and pointRemark != ''">
  146. #{pointRemark, jdbcType=VARCHAR},
  147. </if>
  148. <if test="sortNo != null">
  149. #{sortNo ,jdbcType=BIGINT},
  150. </if>
  151. <if test="createdBy != null">
  152. #{createdBy ,jdbcType=BIGINT},
  153. </if>
  154. <if test="createdAt != null">
  155. #{createdAt ,jdbcType=TIMESTAMP},
  156. </if>
  157. </trim>
  158. </insert>
  159. <!--更新-->
  160. <update id="update" parameterType="com.zhyc.xps.sys.entity.ChecklistItemPoint">
  161. UPDATE checklist_item_point
  162. <trim suffixOverrides=",">
  163. <set>
  164. <if test="pointContent != null and pointContent != ''">
  165. point_content = #{pointContent, jdbcType=VARCHAR},
  166. </if>
  167. <if test="pointCode != null and pointCode != ''">
  168. point_code = #{pointCode ,jdbcType=VARCHAR},
  169. </if>
  170. <if test="pointReference != null and pointReference != ''">
  171. point_reference = #{pointReference ,jdbcType=VARCHAR},
  172. </if>
  173. <if test="pointRemark != null and pointRemark != ''">
  174. point_remark = #{pointRemark, jdbcType=VARCHAR},
  175. </if>
  176. <if test="sortNo != null">
  177. sort_no = #{sortNo ,jdbcType=BIGINT},
  178. </if>
  179. <if test="updatedBy != null ">
  180. updated_by = #{updatedBy ,jdbcType=BIGINT},
  181. </if>
  182. <if test="updatedAt != null">
  183. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  184. </if>
  185. </set>
  186. </trim>
  187. WHERE oc_id = #{ocId ,jdbcType=BIGINT}
  188. AND checklist_id = #{checklistId ,jdbcType=BIGINT}
  189. AND item_id = #{itemId ,jdbcType=BIGINT}
  190. AND point_id = #{pointId ,jdbcType=BIGINT}
  191. </update>
  192. <!--删除-->
  193. <update id="delete" parameterType="java.util.Map">
  194. UPDATE checklist_item_point
  195. <trim suffixOverrides=",">
  196. <set>
  197. <if test="deletedFlag != null">
  198. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  199. </if>
  200. <if test="deletedTime != null">
  201. deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
  202. </if>
  203. <if test="deletedBy != null">
  204. deleted_by = #{deletedBy,jdbcType=BIGINT},
  205. </if>
  206. </set>
  207. </trim>
  208. WHERE oc_id = #{ocId ,jdbcType=BIGINT}
  209. <if test="checklistId != null">
  210. AND checklist_id = #{checklistId ,jdbcType=BIGINT}
  211. </if>
  212. <if test="itemId != null">
  213. AND item_id = #{itemId ,jdbcType=BIGINT}
  214. </if>
  215. <if test="pointId != null">
  216. AND point_id = #{pointId ,jdbcType=BIGINT}
  217. </if>
  218. </update>
  219. </mapper>