AssessStoryTargetItemMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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.lylc.mapper.AssessStoryTargetItemMapper">
  4. <resultMap id="AssessStoryItemDtoResultMap" type="com.zhyc.xps.lylc.dto.AssessStoryTargetItemDto">
  5. <result column="story_id" property="storyId" jdbcType="BIGINT" />
  6. <result column="target_id" property="targetId" jdbcType="BIGINT" />
  7. <result column="item_id" property="itemId" jdbcType="BIGINT" />
  8. <result column="item_title" property="itemTitle" jdbcType="VARCHAR" />
  9. <result column="item_code" property="itemCode" jdbcType="VARCHAR" />
  10. <result column="item_desc" property="itemDesc" jdbcType="VARCHAR" />
  11. <result column="sort_no" property="sortNo" jdbcType="BIGINT" />
  12. </resultMap>
  13. <sql id="AssessStoryItemDto_Cols">
  14. A.story_id,
  15. A.target_id,
  16. A.item_id,
  17. A.item_title,
  18. A.item_code,
  19. A.item_desc,
  20. A.sort_no
  21. </sql>
  22. <!--基于ID查询-->
  23. <select id="getById" resultMap="AssessStoryItemDtoResultMap">
  24. SELECT
  25. <include refid="AssessStoryItemDto_Cols"/>
  26. FROM assess_story_target_item AS A
  27. <where>
  28. <if test="storyId != null">
  29. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  30. </if>
  31. <if test="targetId != null">
  32. AND A.target_id = #{targetId ,jdbcType=BIGINT}
  33. </if>
  34. <if test="itemId != null">
  35. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  36. </if>
  37. </where>
  38. </select>
  39. <!--分页查询-->
  40. <select id="getByPage" parameterType="java.util.Map" resultMap="AssessStoryItemDtoResultMap">
  41. SELECT
  42. <include refid="AssessStoryItemDto_Cols"/>
  43. FROM assess_story_target_item AS A
  44. WHERE A.deleted_flag = 0
  45. <if test="storyId != null">
  46. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  47. </if>
  48. <if test="targetId != null">
  49. AND A.target_id = #{targetId ,jdbcType=BIGINT}
  50. </if>
  51. <if test="itemId != null">
  52. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  53. </if>
  54. <if test="keywords != null and keywords != ''">
  55. and A.item_title like "%"#{keywords}"%"
  56. </if>
  57. ORDER BY A.story_id ASC
  58. </select>
  59. <!--列表查询-->
  60. <select id="getByList" parameterType="java.util.Map" resultMap="AssessStoryItemDtoResultMap">
  61. SELECT
  62. <include refid="AssessStoryItemDto_Cols"/>
  63. FROM assess_story_target_item AS A
  64. WHERE A.deleted_flag = 0
  65. <if test="storyId != null">
  66. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  67. </if>
  68. <if test="targetId != null">
  69. AND A.target_id = #{targetId ,jdbcType=BIGINT}
  70. </if>
  71. <if test="itemId != null">
  72. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  73. </if>
  74. <if test="keywords != null and keywords != ''">
  75. and A.item_title like "%"#{keywords}"%"
  76. </if>
  77. </select>
  78. <insert id="create" parameterType="com.zhyc.xps.lylc.entity.AssessStoryTargetItem">
  79. INSERT INTO assess_story_target_item
  80. <trim prefix="(" suffix=")" suffixOverrides=",">
  81. <if test="storyId != null">
  82. story_id,
  83. </if>
  84. <if test="targetId != null">
  85. target_id,
  86. </if>
  87. <if test="itemId != null">
  88. item_id,
  89. </if>
  90. <if test="itemTitle != null and itemTitle != ''">
  91. item_title,
  92. </if>
  93. <if test="itemCode != null and itemCode != ''">
  94. item_code,
  95. </if>
  96. <if test="itemDesc != null and itemDesc != ''">
  97. item_desc,
  98. </if>
  99. <if test="sortNo != null">
  100. sort_no,
  101. </if>
  102. <if test="createdBy != null">
  103. created_by,
  104. </if>
  105. <if test="createdAt != null">
  106. created_at,
  107. </if>
  108. </trim>
  109. <trim prefix="values (" suffix=")" suffixOverrides=",">
  110. <if test="storyId != null">
  111. #{storyId,jdbcType=BIGINT},
  112. </if>
  113. <if test="targetId != null">
  114. #{targetId,jdbcType=BIGINT},
  115. </if>
  116. <if test="itemId != null">
  117. #{itemId ,jdbcType=BIGINT},
  118. </if>
  119. <if test="itemTitle != null and itemTitle != ''">
  120. #{itemTitle ,jdbcType=VARCHAR},
  121. </if>
  122. <if test="itemCode != null and itemCode != ''">
  123. #{itemCode ,jdbcType=VARCHAR},
  124. </if>
  125. <if test="itemDesc != null and itemDesc != ''">
  126. #{itemDesc ,jdbcType=VARCHAR},
  127. </if>
  128. <if test="sortNo != null">
  129. #{sortNo ,jdbcType=BIGINT},
  130. </if>
  131. <if test="createdBy != null">
  132. #{createdBy ,jdbcType=BIGINT},
  133. </if>
  134. <if test="createdAt != null">
  135. #{createdAt ,jdbcType=TIMESTAMP},
  136. </if>
  137. </trim>
  138. </insert>
  139. <!--更新-->
  140. <update id="update" parameterType="com.zhyc.xps.lylc.entity.AssessStoryTargetItem">
  141. UPDATE assess_story_target_item
  142. <trim suffixOverrides=",">
  143. <set>
  144. <if test="itemTitle != null and itemTitle != ''">
  145. item_title = #{itemTitle, jdbcType=VARCHAR},
  146. </if>
  147. <if test="itemCode != null and itemCode != ''">
  148. item_code = #{itemCode ,jdbcType=VARCHAR},
  149. </if>
  150. <if test="itemDesc != null and itemDesc != ''">
  151. item_desc = #{itemDesc, jdbcType=VARCHAR},
  152. </if>
  153. <if test="sortNo != null">
  154. sort_no = #{sortNo ,jdbcType=BIGINT},
  155. </if>
  156. <if test="updatedBy != null ">
  157. updated_by = #{updatedBy ,jdbcType=BIGINT},
  158. </if>
  159. <if test="updatedAt != null">
  160. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  161. </if>
  162. </set>
  163. </trim>
  164. WHERE story_id = #{storyId ,jdbcType=BIGINT}
  165. AND target_id = #{targetId ,jdbcType=BIGINT}
  166. AND item_id = #{itemId ,jdbcType=BIGINT}
  167. </update>
  168. <!--删除-->
  169. <update id="delete" parameterType="java.util.Map">
  170. UPDATE assess_story_target_item
  171. <trim suffixOverrides=",">
  172. <set>
  173. <if test="deletedFlag != null">
  174. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  175. </if>
  176. <if test="deletedTime != null">
  177. deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
  178. </if>
  179. <if test="deletedBy != null">
  180. deleted_by = #{deletedBy,jdbcType=BIGINT},
  181. </if>
  182. </set>
  183. </trim>
  184. WHERE story_id = #{storyId ,jdbcType=BIGINT}
  185. <if test="targetId != null">
  186. AND target_id = #{targetId ,jdbcType=BIGINT}
  187. </if>
  188. <if test="itemId != null">
  189. AND item_id = #{itemId ,jdbcType=BIGINT}
  190. </if>
  191. </update>
  192. </mapper>