HomeChannelMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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.juxiao.xchat.module.xbd.mapper.marketing.HomeChannelMapper" >
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.marketing.HomeChannel" >
  5. <id column="id" property="id" jdbcType="BIGINT" />
  6. <result column="channel" property="channel" jdbcType="VARCHAR" />
  7. <result column="home_default" property="homeDefault" jdbcType="INTEGER" />
  8. <result column="is_news" property="isNews" jdbcType="TINYINT" />
  9. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  10. <result column="type" property="type" jdbcType="TINYINT" />
  11. <result column="group_id" property="groupId" jdbcType="INTEGER" />
  12. <result column="channel_name" property="channelName" jdbcType="VARCHAR" />
  13. <result column="superior_channel" property="superiorChannel" jdbcType="VARCHAR" />
  14. </resultMap>
  15. <sql id="Base_Column_List" >
  16. id, channel, home_default, is_news, create_time, type, group_id, channel_name, superior_channel
  17. </sql>
  18. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  19. select
  20. <include refid="Base_Column_List" />
  21. from home_channel
  22. where id = #{id,jdbcType=BIGINT}
  23. </select>
  24. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
  25. delete from home_channel
  26. where id = #{id,jdbcType=BIGINT}
  27. </delete>
  28. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.marketing.HomeChannel" >
  29. <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER" >
  30. SELECT LAST_INSERT_ID()
  31. </selectKey>
  32. insert into home_channel (channel, home_default, is_news,
  33. create_time, type, group_id,
  34. channel_name, superior_channel)
  35. values (#{channel,jdbcType=VARCHAR}, #{homeDefault,jdbcType=INTEGER}, #{isNews,jdbcType=TINYINT},
  36. #{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=TINYINT}, #{groupId,jdbcType=INTEGER},
  37. #{channelName,jdbcType=VARCHAR}, #{superiorChannel,jdbcType=VARCHAR})
  38. </insert>
  39. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.marketing.HomeChannel" >
  40. <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER" >
  41. SELECT LAST_INSERT_ID()
  42. </selectKey>
  43. insert into home_channel
  44. <trim prefix="(" suffix=")" suffixOverrides="," >
  45. <if test="channel != null" >
  46. channel,
  47. </if>
  48. <if test="homeDefault != null" >
  49. home_default,
  50. </if>
  51. <if test="isNews != null" >
  52. is_news,
  53. </if>
  54. <if test="createTime != null" >
  55. create_time,
  56. </if>
  57. <if test="type != null" >
  58. type,
  59. </if>
  60. <if test="groupId != null" >
  61. group_id,
  62. </if>
  63. <if test="channelName != null" >
  64. channel_name,
  65. </if>
  66. <if test="superiorChannel != null" >
  67. superior_channel,
  68. </if>
  69. </trim>
  70. <trim prefix="values (" suffix=")" suffixOverrides="," >
  71. <if test="channel != null" >
  72. #{channel,jdbcType=VARCHAR},
  73. </if>
  74. <if test="homeDefault != null" >
  75. #{homeDefault,jdbcType=INTEGER},
  76. </if>
  77. <if test="isNews != null" >
  78. #{isNews,jdbcType=TINYINT},
  79. </if>
  80. <if test="createTime != null" >
  81. #{createTime,jdbcType=TIMESTAMP},
  82. </if>
  83. <if test="type != null" >
  84. #{type,jdbcType=TINYINT},
  85. </if>
  86. <if test="groupId != null" >
  87. #{groupId,jdbcType=INTEGER},
  88. </if>
  89. <if test="channelName != null" >
  90. #{channelName,jdbcType=VARCHAR},
  91. </if>
  92. <if test="superiorChannel != null" >
  93. #{superiorChannel,jdbcType=VARCHAR},
  94. </if>
  95. </trim>
  96. </insert>
  97. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.marketing.HomeChannel" >
  98. update home_channel
  99. <set >
  100. <if test="channel != null" >
  101. channel = #{channel,jdbcType=VARCHAR},
  102. </if>
  103. <if test="homeDefault != null" >
  104. home_default = #{homeDefault,jdbcType=INTEGER},
  105. </if>
  106. <if test="isNews != null" >
  107. is_news = #{isNews,jdbcType=TINYINT},
  108. </if>
  109. <if test="createTime != null" >
  110. create_time = #{createTime,jdbcType=TIMESTAMP},
  111. </if>
  112. <if test="type != null" >
  113. type = #{type,jdbcType=TINYINT},
  114. </if>
  115. <if test="groupId != null" >
  116. group_id = #{groupId,jdbcType=INTEGER},
  117. </if>
  118. <if test="channelName != null" >
  119. channel_name = #{channelName,jdbcType=VARCHAR},
  120. </if>
  121. <if test="superiorChannel != null" >
  122. superior_channel = #{superiorChannel,jdbcType=VARCHAR},
  123. </if>
  124. </set>
  125. where id = #{id,jdbcType=BIGINT}
  126. </update>
  127. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.marketing.HomeChannel" >
  128. update home_channel
  129. set channel = #{channel,jdbcType=VARCHAR},
  130. home_default = #{homeDefault,jdbcType=INTEGER},
  131. is_news = #{isNews,jdbcType=TINYINT},
  132. create_time = #{createTime,jdbcType=TIMESTAMP},
  133. type = #{type,jdbcType=TINYINT},
  134. group_id = #{groupId,jdbcType=INTEGER},
  135. channel_name = #{channelName,jdbcType=VARCHAR},
  136. superior_channel = #{superiorChannel,jdbcType=VARCHAR}
  137. where id = #{id,jdbcType=BIGINT}
  138. </update>
  139. <select id="selectChannelByList" resultType="com.juxiao.xchat.module.xbd.domain.marketing.HomeChannel">
  140. select id,channel,channel_name as channelName , is_news as isNews , type,group_id as groupId,home_default as homeDefault
  141. from home_channel
  142. where channel_name <![CDATA[ <> '' ]]>
  143. </select>
  144. <select id="selectHomeChannelByList" resultMap="BaseResultMap">
  145. select
  146. <include refid="Base_Column_List" />
  147. from home_channel
  148. where 1 = 1
  149. <if test="channel != null and channel != ''">
  150. and channel like "%"#{channel}"%"
  151. </if>
  152. <if test="superiorChannel != null and superiorChannel != ''">
  153. and superior_channel LIKE concat(concat('%',#{superiorChannel}),'%')
  154. </if>
  155. <if test="groupId != null">
  156. and group_id = #{groupId}
  157. </if>
  158. order by create_time desc
  159. </select>
  160. </mapper>