MsgCatMapper.xml 7.2 KB

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