AssessStoryMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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.AssessStoryMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="AssessStoryDtoResultMap" type="com.zhyc.xps.lylc.dto.AssessStoryDto">
  6. <result column="story_id" property="storyId" jdbcType="BIGINT" />
  7. <result column="story_title" property="storyTitle" jdbcType="VARCHAR" />
  8. <result column="story_code" property="storyCode" jdbcType="VARCHAR" />
  9. <result column="story_desc" property="storyDesc" jdbcType="VARCHAR" />
  10. </resultMap>
  11. <!-- 通用查询结果列 -->
  12. <sql id="AssessStoryDto_Cols">
  13. story_id,
  14. story_title,
  15. story_code,
  16. story_desc
  17. </sql>
  18. <!--基于ID查询-->
  19. <select id="getById" resultMap="AssessStoryDtoResultMap">
  20. SELECT
  21. <include refid="AssessStoryDto_Cols"/>
  22. FROM assess_story
  23. WHERE 1 = 1
  24. <if test="storyId != null">
  25. AND story_id = #{storyId ,jdbcType=BIGINT}
  26. </if>
  27. </select>
  28. <!--分页查询-->
  29. <select id="getByPage" resultMap="AssessStoryDtoResultMap" parameterType="java.util.Map" >
  30. SELECT
  31. <include refid="AssessStoryDto_Cols"/>
  32. FROM assess_story
  33. WHERE assess_story.deleted_flag = 0
  34. <if test="keywords != null and keywords != ''">
  35. and story_title like "%"#{keywords}"%"
  36. </if>
  37. ORDER BY story_id ASC
  38. </select>
  39. <!--列表查询-->
  40. <select id="getByList" resultMap="AssessStoryDtoResultMap" parameterType="java.util.Map">
  41. SELECT
  42. <include refid="AssessStoryDto_Cols"/>
  43. FROM assess_story
  44. WHERE deleted_flag = 0
  45. <if test="keywords != null and keywords != ''">
  46. and story_title like "%"#{keywords}"%"
  47. </if>
  48. </select>
  49. <insert id="create" parameterType="com.zhyc.xps.lylc.entity.AssessStory">
  50. INSERT INTO assess_story
  51. <trim prefix="(" suffix=")" suffixOverrides=",">
  52. <if test="ocId != null">
  53. oc_id,
  54. </if>
  55. <if test="storyId != null">
  56. story_id,
  57. </if>
  58. <if test="storyTitle != null and storyTitle != ''">
  59. story_title,
  60. </if>
  61. <if test="storyCode != null and storyCode != ''">
  62. story_code,
  63. </if>
  64. <if test="storyDesc != null and storyDesc != ''">
  65. story_desc,
  66. </if>
  67. <if test="createdBy != null">
  68. created_by,
  69. </if>
  70. <if test="createdAt != null">
  71. created_at,
  72. </if>
  73. </trim>
  74. <trim prefix="values (" suffix=")" suffixOverrides=",">
  75. <if test="ocId != null">
  76. #{ocId,jdbcType=BIGINT},
  77. </if>
  78. <if test="storyId != null">
  79. #{storyId ,jdbcType=BIGINT},
  80. </if>
  81. <if test="storyTitle != null and storyTitle != ''">
  82. #{storyTitle ,jdbcType=VARCHAR},
  83. </if>
  84. <if test="storyCode != null and storyCode != ''">
  85. #{storyCode ,jdbcType=VARCHAR},
  86. </if>
  87. <if test="storyDesc != null and storyDesc != ''">
  88. #{storyDesc ,jdbcType=VARCHAR},
  89. </if>
  90. <if test="createdBy != null">
  91. #{createdBy ,jdbcType=BIGINT},
  92. </if>
  93. <if test="createdAt != null">
  94. #{createdAt ,jdbcType=TIMESTAMP},
  95. </if>
  96. </trim>
  97. </insert>
  98. <!--更新-->
  99. <update id="update" parameterType="com.zhyc.xps.lylc.entity.AssessStory">
  100. UPDATE assess_story
  101. <trim suffixOverrides=",">
  102. <set>
  103. <if test="storyTitle != null and storyTitle != ''">
  104. story_title = #{storyTitle, jdbcType=VARCHAR},
  105. </if>
  106. <if test="storyCode != null and storyCode != ''">
  107. story_code = #{storyCode ,jdbcType=VARCHAR},
  108. </if>
  109. <if test="storyDesc != null and storyDesc != ''">
  110. story_desc = #{storyDesc, jdbcType=VARCHAR},
  111. </if>
  112. <if test="updatedBy != null ">
  113. updated_by = #{updatedBy ,jdbcType=BIGINT},
  114. </if>
  115. <if test="updatedAt != null">
  116. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  117. </if>
  118. </set>
  119. </trim>
  120. WHERE 1 = 1
  121. <if test="storyId != null">
  122. AND story_id = #{storyId ,jdbcType=BIGINT}
  123. </if>
  124. </update>
  125. <!--删除-->
  126. <update id="delete" parameterType="java.util.Map">
  127. UPDATE assess_story
  128. <trim suffixOverrides=",">
  129. <set>
  130. <if test="deletedFlag != null">
  131. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  132. </if>
  133. <if test="deletedTime != null">
  134. deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
  135. </if>
  136. <if test="deletedBy != null">
  137. deleted_by = #{deletedBy,jdbcType=BIGINT},
  138. </if>
  139. </set>
  140. </trim>
  141. WHERE 1 = 1
  142. <if test="storyId != null">
  143. AND story_id = #{storyId ,jdbcType=BIGINT}
  144. </if>
  145. </update>
  146. </mapper>