FriendLinkReadMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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.slodon.b2b2c.dao.read.cms.FriendLinkReadMapper">
  4. <resultMap id="resultMap" type="com.slodon.b2b2c.cms.pojo.FriendLink">
  5. <id column="link_id" property="linkId" />
  6. <result column="web_site" property="webSite" />
  7. <result column="link_name" property="linkName" />
  8. <result column="link_image" property="linkImage" />
  9. <result column="show_type" property="showType" />
  10. <result column="link_url" property="linkUrl" />
  11. <result column="sort" property="sort" />
  12. <result column="state" property="state" />
  13. <result column="create_admin_id" property="createAdminId" />
  14. <result column="create_admin_name" property="createAdminName" />
  15. <result column="create_time" property="createTime" />
  16. <result column="update_admin_id" property="updateAdminId" />
  17. <result column="update_admin_name" property="updateAdminName" />
  18. <result column="update_time" property="updateTime" />
  19. </resultMap>
  20. <!--按照主键值进行操作-->
  21. <sql id="pkWhere">
  22. WHERE `link_id` = #{primaryKey}
  23. </sql>
  24. <!--操作条件-->
  25. <sql id="whereCondition">
  26. <if test="example != null">
  27. <trim prefix="WHERE" prefixOverrides="AND|OR">
  28. <if test="example.linkIdNotEquals != null">
  29. AND `link_id` != #{example.linkIdNotEquals}
  30. </if>
  31. <if test="example.linkIdIn != null">
  32. AND `link_id` in (${example.linkIdIn})
  33. </if>
  34. <if test="example.webSite != null">
  35. AND `web_site` = #{example.webSite}
  36. </if>
  37. <if test="example.linkName != null">
  38. AND `link_name` = #{example.linkName}
  39. </if>
  40. <if test="example.linkNameLike != null">
  41. AND `link_name` like concat('%',#{example.linkNameLike},'%')
  42. </if>
  43. <if test="example.linkImage != null">
  44. AND `link_image` = #{example.linkImage}
  45. </if>
  46. <if test="example.showType != null">
  47. AND `show_type` = #{example.showType}
  48. </if>
  49. <if test="example.linkUrl != null">
  50. AND `link_url` = #{example.linkUrl}
  51. </if>
  52. <if test="example.sort != null">
  53. AND `sort` = #{example.sort}
  54. </if>
  55. <if test="example.state != null">
  56. AND `state` = #{example.state}
  57. </if>
  58. <if test="example.createAdminId != null">
  59. AND `create_admin_id` = #{example.createAdminId}
  60. </if>
  61. <if test="example.createAdminName != null">
  62. AND `create_admin_name` = #{example.createAdminName}
  63. </if>
  64. <if test="example.createAdminNameLike != null">
  65. AND `create_admin_name` like concat('%',#{example.createAdminNameLike},'%')
  66. </if>
  67. <if test="example.createTimeAfter != null">
  68. AND `create_time` <![CDATA[ >= ]]> #{example.createTimeAfter}
  69. </if>
  70. <if test="example.createTimeBefore != null">
  71. AND `create_time` <![CDATA[ <= ]]> #{example.createTimeBefore}
  72. </if>
  73. <if test="example.updateAdminId != null">
  74. AND `update_admin_id` = #{example.updateAdminId}
  75. </if>
  76. <if test="example.updateAdminName != null">
  77. AND `update_admin_name` = #{example.updateAdminName}
  78. </if>
  79. <if test="example.updateAdminNameLike != null">
  80. AND `update_admin_name` like concat('%',#{example.updateAdminNameLike},'%')
  81. </if>
  82. <if test="example.updateTimeAfter != null">
  83. AND `update_time` <![CDATA[ >= ]]> #{example.updateTimeAfter}
  84. </if>
  85. <if test="example.updateTimeBefore != null">
  86. AND `update_time` <![CDATA[ <= ]]> #{example.updateTimeBefore}
  87. </if>
  88. </trim>
  89. </if>
  90. </sql>
  91. <!--排序条件-->
  92. <sql id="orderBy">
  93. ORDER BY `link_id` DESC
  94. </sql>
  95. <sql id="orderByOther">
  96. order by ${example.orderBy}
  97. </sql>
  98. <!--分组条件-->
  99. <sql id="groupBy">
  100. group by ${example.groupBy}
  101. </sql>
  102. <!--分页条件-->
  103. <sql id="limit">
  104. <if test="size != null and size &gt; 0">
  105. limit #{startRow},#{size}
  106. </if>
  107. </sql>
  108. <!--查询符合条件的记录数-->
  109. <select id="countByExample" parameterType="com.slodon.b2b2c.cms.example.FriendLinkExample" resultType="java.lang.Integer">
  110. SELECT
  111. COUNT(*)
  112. FROM `cms_friend_link`
  113. <include refid="whereCondition" />
  114. </select>
  115. <!--根据主键查询记录-->
  116. <select id="getByPrimaryKey" resultMap="resultMap">
  117. SELECT
  118. *
  119. FROM `cms_friend_link`
  120. <include refid="pkWhere" />
  121. </select>
  122. <!--查询符合条件的记录(所有字段)-->
  123. <select id="listByExample" resultMap="resultMap">
  124. SELECT
  125. *
  126. FROM `cms_friend_link`
  127. <include refid="whereCondition" />
  128. <if test="example.groupBy != null">
  129. <include refid="groupBy" />
  130. </if>
  131. <choose>
  132. <when test="example.orderBy != null">
  133. <include refid="orderByOther" />
  134. </when>
  135. <otherwise>
  136. <include refid="orderBy" />
  137. </otherwise>
  138. </choose>
  139. </select>
  140. <!--分页查询符合条件的记录(所有字段)-->
  141. <select id="listPageByExample" resultMap="resultMap">
  142. SELECT
  143. *
  144. FROM `cms_friend_link`
  145. <include refid="whereCondition" />
  146. <if test="example.groupBy != null">
  147. <include refid="groupBy" />
  148. </if>
  149. <choose>
  150. <when test="example.orderBy != null">
  151. <include refid="orderByOther" />
  152. </when>
  153. <otherwise>
  154. <include refid="orderBy" />
  155. </otherwise>
  156. </choose>
  157. <include refid="limit" />
  158. </select>
  159. <!--查询符合条件的记录(指定字段)-->
  160. <select id="listFieldsByExample" resultMap="resultMap">
  161. SELECT
  162. ${fields}
  163. FROM `cms_friend_link`
  164. <include refid="whereCondition" />
  165. <if test="example.groupBy != null">
  166. <include refid="groupBy" />
  167. </if>
  168. <choose>
  169. <when test="example.orderBy != null">
  170. <include refid="orderByOther" />
  171. </when>
  172. <otherwise>
  173. <include refid="orderBy" />
  174. </otherwise>
  175. </choose>
  176. </select>
  177. <!--分页查询符合条件的记录(指定字段)-->
  178. <select id="listFieldsPageByExample" resultMap="resultMap">
  179. SELECT
  180. ${fields}
  181. FROM `cms_friend_link`
  182. <include refid="whereCondition" />
  183. <if test="example.groupBy != null">
  184. <include refid="groupBy" />
  185. </if>
  186. <choose>
  187. <when test="example.orderBy != null">
  188. <include refid="orderByOther" />
  189. </when>
  190. <otherwise>
  191. <include refid="orderBy" />
  192. </otherwise>
  193. </choose>
  194. <include refid="limit" />
  195. </select>
  196. </mapper>