BannersMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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.goafanti.common.dao.BannersMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.Banners">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="sign" jdbcType="VARCHAR" property="sign" />
  7. <result column="text" jdbcType="VARCHAR" property="text" />
  8. <result column="imgUrl" jdbcType="VARCHAR" property="imgurl" />
  9. <result column="url" jdbcType="VARCHAR" property="url" />
  10. <result column="width" jdbcType="INTEGER" property="width" />
  11. <result column="height" jdbcType="INTEGER" property="height" />
  12. <result column="start_date" jdbcType="TIMESTAMP" property="startDate" />
  13. <result column="end_date" jdbcType="TIMESTAMP" property="endDate" />
  14. </resultMap>
  15. <sql id="Base_Column_List">
  16. id, sign, text, imgUrl, url, width, height, start_date, end_date
  17. </sql>
  18. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  19. select
  20. <include refid="Base_Column_List" />
  21. from banners
  22. where id = #{id,jdbcType=BIGINT}
  23. </select>
  24. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  25. delete from banners
  26. where id = #{id,jdbcType=BIGINT}
  27. </delete>
  28. <insert id="insert" parameterType="com.goafanti.common.model.Banners">
  29. insert into banners (id, sign, text,
  30. imgUrl, url, width,
  31. height, start_date, end_date
  32. )
  33. values (#{id,jdbcType=BIGINT}, #{sign,jdbcType=VARCHAR}, #{text,jdbcType=VARCHAR},
  34. #{imgurl,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{width,jdbcType=INTEGER},
  35. #{height,jdbcType=INTEGER}, #{startDate,jdbcType=TIMESTAMP}, #{endDate,jdbcType=TIMESTAMP}
  36. )
  37. </insert>
  38. <insert id="insertSelective" parameterType="com.goafanti.common.model.Banners">
  39. insert into banners
  40. <trim prefix="(" suffix=")" suffixOverrides=",">
  41. <if test="id != null">
  42. id,
  43. </if>
  44. <if test="sign != null">
  45. sign,
  46. </if>
  47. <if test="text != null">
  48. text,
  49. </if>
  50. <if test="imgurl != null">
  51. imgUrl,
  52. </if>
  53. <if test="url != null">
  54. url,
  55. </if>
  56. <if test="width != null">
  57. width,
  58. </if>
  59. <if test="height != null">
  60. height,
  61. </if>
  62. <if test="startDate != null">
  63. start_date,
  64. </if>
  65. <if test="endDate != null">
  66. end_date,
  67. </if>
  68. </trim>
  69. <trim prefix="values (" suffix=")" suffixOverrides=",">
  70. <if test="id != null">
  71. #{id,jdbcType=BIGINT},
  72. </if>
  73. <if test="sign != null">
  74. #{sign,jdbcType=VARCHAR},
  75. </if>
  76. <if test="text != null">
  77. #{text,jdbcType=VARCHAR},
  78. </if>
  79. <if test="imgurl != null">
  80. #{imgurl,jdbcType=VARCHAR},
  81. </if>
  82. <if test="url != null">
  83. #{url,jdbcType=VARCHAR},
  84. </if>
  85. <if test="width != null">
  86. #{width,jdbcType=INTEGER},
  87. </if>
  88. <if test="height != null">
  89. #{height,jdbcType=INTEGER},
  90. </if>
  91. <if test="startDate != null">
  92. #{startDate,jdbcType=TIMESTAMP},
  93. </if>
  94. <if test="endDate != null">
  95. #{endDate,jdbcType=TIMESTAMP},
  96. </if>
  97. </trim>
  98. </insert>
  99. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Banners">
  100. update banners
  101. <set>
  102. <if test="sign != null">
  103. sign = #{sign,jdbcType=VARCHAR},
  104. </if>
  105. <if test="text != null">
  106. text = #{text,jdbcType=VARCHAR},
  107. </if>
  108. <if test="imgurl != null">
  109. imgUrl = #{imgurl,jdbcType=VARCHAR},
  110. </if>
  111. <if test="url != null">
  112. url = #{url,jdbcType=VARCHAR},
  113. </if>
  114. <if test="width != null">
  115. width = #{width,jdbcType=INTEGER},
  116. </if>
  117. <if test="height != null">
  118. height = #{height,jdbcType=INTEGER},
  119. </if>
  120. <if test="startDate != null">
  121. start_date = #{startDate,jdbcType=TIMESTAMP},
  122. </if>
  123. <if test="endDate != null">
  124. end_date = #{endDate,jdbcType=TIMESTAMP},
  125. </if>
  126. </set>
  127. where id = #{id,jdbcType=BIGINT}
  128. </update>
  129. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Banners">
  130. update banners
  131. set sign = #{sign,jdbcType=VARCHAR},
  132. text = #{text,jdbcType=VARCHAR},
  133. imgUrl = #{imgurl,jdbcType=VARCHAR},
  134. url = #{url,jdbcType=VARCHAR},
  135. width = #{width,jdbcType=INTEGER},
  136. height = #{height,jdbcType=INTEGER},
  137. start_date = #{startDate,jdbcType=TIMESTAMP},
  138. end_date = #{endDate,jdbcType=TIMESTAMP}
  139. where id = #{id,jdbcType=BIGINT}
  140. </update>
  141. <select id="findBannerList" resultMap="BaseResultMap">
  142. select
  143. <include refid="Base_Column_List" />
  144. from banners where 1=1
  145. <if test="sign != null">
  146. and sign = #{sign,jdbcType=VARCHAR}
  147. </if>
  148. order by id desc
  149. <if test="pageNo != null and pageSize != null">
  150. limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
  151. </if>
  152. </select>
  153. <select id="findBannerListCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  154. select count(1)
  155. from banners where 1=1
  156. <if test="sign != null">
  157. and sign = #{sign,jdbcType=VARCHAR}
  158. </if>
  159. </select>
  160. </mapper>