TplPcMallDataReadMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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.system.TplPcMallDataReadMapper">
  4. <resultMap id="resultMap" type="com.slodon.b2b2c.system.pojo.TplPcMallData">
  5. <id column="data_id" property="dataId" />
  6. <result column="tpl_pc_id" property="tplPcId" />
  7. <result column="tpl_pc_name" property="tplPcName" />
  8. <result column="tpl_pc_type" property="tplPcType" />
  9. <result column="tpl_pc_type_name" property="tplPcTypeName" />
  10. <result column="site" property="site" />
  11. <result column="name" property="name" />
  12. <result column="create_time" property="createTime" />
  13. <result column="create_user_id" property="createUserId" />
  14. <result column="update_time" property="updateTime" />
  15. <result column="update_user_id" property="updateUserId" />
  16. <result column="sort" property="sort" />
  17. <result column="is_enable" property="isEnable" />
  18. <result column="store_id" property="storeId" />
  19. <result column="html" property="html" />
  20. <result column="json" property="json" />
  21. </resultMap>
  22. <!--按照主键值进行操作-->
  23. <sql id="pkWhere">
  24. WHERE `data_id` = #{primaryKey}
  25. </sql>
  26. <!--操作条件-->
  27. <sql id="whereCondition">
  28. <if test="example != null">
  29. <trim prefix="WHERE" prefixOverrides="AND|OR">
  30. <if test="example.dataIdNotEquals != null">
  31. AND `data_id` != #{example.dataIdNotEquals}
  32. </if>
  33. <if test="example.dataId != null">
  34. AND `data_id` = #{example.dataId}
  35. </if>
  36. <if test="example.dataIdIn != null">
  37. AND `data_id` in (${example.dataIdIn})
  38. </if>
  39. <if test="example.tplPcId != null">
  40. AND `tpl_pc_id` = #{example.tplPcId}
  41. </if>
  42. <if test="example.tplPcName != null">
  43. AND `tpl_pc_name` = #{example.tplPcName}
  44. </if>
  45. <if test="example.tplPcNameLike != null">
  46. AND `tpl_pc_name` like concat('%',#{example.tplPcNameLike},'%')
  47. </if>
  48. <if test="example.tplPcType != null">
  49. AND `tpl_pc_type` = #{example.tplPcType}
  50. </if>
  51. <if test="example.tplPcTypeNotEquals != null">
  52. AND `tpl_pc_type` != 'main_banner'
  53. </if>
  54. <if test="example.tplPcTypeName != null">
  55. AND `tpl_pc_type_name` = #{example.tplPcTypeName}
  56. </if>
  57. <if test="example.tplPcTypeNameLike != null">
  58. AND `tpl_pc_type_name` like concat('%',#{example.tplPcTypeNameLike},'%')
  59. </if>
  60. <if test="example.site != null">
  61. AND `site` = #{example.site}
  62. </if>
  63. <if test="example.name != null">
  64. AND `name` = #{example.name}
  65. </if>
  66. <if test="example.nameLike != null">
  67. AND `name` like concat('%',#{example.nameLike},'%')
  68. </if>
  69. <if test="example.createTimeAfter != null">
  70. AND `create_time` <![CDATA[ >= ]]> #{example.createTimeAfter}
  71. </if>
  72. <if test="example.createTimeBefore != null">
  73. AND `create_time` <![CDATA[ <= ]]> #{example.createTimeBefore}
  74. </if>
  75. <if test="example.createUserId != null">
  76. AND `create_user_id` = #{example.createUserId}
  77. </if>
  78. <if test="example.updateTimeAfter != null">
  79. AND `update_time` <![CDATA[ >= ]]> #{example.updateTimeAfter}
  80. </if>
  81. <if test="example.updateTimeBefore != null">
  82. AND `update_time` <![CDATA[ <= ]]> #{example.updateTimeBefore}
  83. </if>
  84. <if test="example.updateUserId != null">
  85. AND `update_user_id` = #{example.updateUserId}
  86. </if>
  87. <if test="example.sort != null">
  88. AND `sort` = #{example.sort}
  89. </if>
  90. <if test="example.isEnable != null">
  91. AND `is_enable` = #{example.isEnable}
  92. </if>
  93. <if test="example.storeId != null">
  94. AND `store_id` = #{example.storeId}
  95. </if>
  96. <if test="example.html != null">
  97. AND `html` = #{example.html}
  98. </if>
  99. <if test="example.json != null">
  100. AND `json` = #{example.json}
  101. </if>
  102. </trim>
  103. </if>
  104. </sql>
  105. <!--排序条件-->
  106. <sql id="orderBy">
  107. ORDER BY `data_id` DESC
  108. </sql>
  109. <sql id="orderByOther">
  110. order by ${example.orderBy}
  111. </sql>
  112. <!--分组条件-->
  113. <sql id="groupBy">
  114. group by ${example.groupBy}
  115. </sql>
  116. <!--分页条件-->
  117. <sql id="limit">
  118. <if test="size != null and size &gt; 0">
  119. limit #{startRow},#{size}
  120. </if>
  121. </sql>
  122. <!--查询符合条件的记录数-->
  123. <select id="countByExample" parameterType="com.slodon.b2b2c.system.example.TplPcMallDataExample" resultType="java.lang.Integer">
  124. SELECT
  125. COUNT(*)
  126. FROM `sys_tpl_pc_mall_data`
  127. <include refid="whereCondition" />
  128. </select>
  129. <!--根据主键查询记录-->
  130. <select id="getByPrimaryKey" resultMap="resultMap">
  131. SELECT
  132. *
  133. FROM `sys_tpl_pc_mall_data`
  134. <include refid="pkWhere" />
  135. </select>
  136. <!--查询符合条件的记录(所有字段)-->
  137. <select id="listByExample" resultMap="resultMap">
  138. SELECT
  139. *
  140. FROM `sys_tpl_pc_mall_data`
  141. <include refid="whereCondition" />
  142. <if test="example.groupBy != null">
  143. <include refid="groupBy" />
  144. </if>
  145. <choose>
  146. <when test="example.orderBy != null">
  147. <include refid="orderByOther" />
  148. </when>
  149. <otherwise>
  150. <include refid="orderBy" />
  151. </otherwise>
  152. </choose>
  153. </select>
  154. <!--分页查询符合条件的记录(所有字段)-->
  155. <select id="listPageByExample" resultMap="resultMap">
  156. SELECT
  157. *
  158. FROM `sys_tpl_pc_mall_data`
  159. <include refid="whereCondition" />
  160. <if test="example.groupBy != null">
  161. <include refid="groupBy" />
  162. </if>
  163. <choose>
  164. <when test="example.orderBy != null">
  165. <include refid="orderByOther" />
  166. </when>
  167. <otherwise>
  168. <include refid="orderBy" />
  169. </otherwise>
  170. </choose>
  171. <include refid="limit" />
  172. </select>
  173. <!--查询符合条件的记录(指定字段)-->
  174. <select id="listFieldsByExample" resultMap="resultMap">
  175. SELECT
  176. ${fields}
  177. FROM `sys_tpl_pc_mall_data`
  178. <include refid="whereCondition" />
  179. <if test="example.groupBy != null">
  180. <include refid="groupBy" />
  181. </if>
  182. <choose>
  183. <when test="example.orderBy != null">
  184. <include refid="orderByOther" />
  185. </when>
  186. <otherwise>
  187. <include refid="orderBy" />
  188. </otherwise>
  189. </choose>
  190. </select>
  191. <!--分页查询符合条件的记录(指定字段)-->
  192. <select id="listFieldsPageByExample" resultMap="resultMap">
  193. SELECT
  194. ${fields}
  195. FROM `sys_tpl_pc_mall_data`
  196. <include refid="whereCondition" />
  197. <if test="example.groupBy != null">
  198. <include refid="groupBy" />
  199. </if>
  200. <choose>
  201. <when test="example.orderBy != null">
  202. <include refid="orderByOther" />
  203. </when>
  204. <otherwise>
  205. <include refid="orderBy" />
  206. </otherwise>
  207. </choose>
  208. <include refid="limit" />
  209. </select>
  210. </mapper>