StoreInnerLabelWriteMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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.write.seller.StoreInnerLabelWriteMapper">
  4. <resultMap id="resultMap" type="com.slodon.b2b2c.seller.pojo.StoreInnerLabel">
  5. <id column="inner_label_id" property="innerLabelId" />
  6. <result column="web_site" property="webSite" />
  7. <result column="inner_label_name" property="innerLabelName" />
  8. <result column="inner_label_sort" property="innerLabelSort" />
  9. <result column="is_show" property="isShow" />
  10. <result column="parent_inner_label_id" property="parentInnerLabelId" />
  11. <result column="store_id" property="storeId" />
  12. <result column="create_time" property="createTime" />
  13. <result column="create_vendor_id" property="createVendorId" />
  14. <result column="create_vendor_name" property="createVendorName" />
  15. <result column="update_time" property="updateTime" />
  16. <result column="update_vendor_id" property="updateVendorId" />
  17. <result column="update_vendor_name" property="updateVendorName" />
  18. </resultMap>
  19. <!--除主键外的所有字段,用于插入操作-->
  20. <sql id="columns">
  21. <trim suffixOverrides=",">
  22. <if test="webSite != null">
  23. `web_site`,
  24. </if>
  25. <if test="innerLabelName != null">
  26. `inner_label_name`,
  27. </if>
  28. <if test="innerLabelSort != null">
  29. `inner_label_sort`,
  30. </if>
  31. <if test="isShow != null">
  32. `is_show`,
  33. </if>
  34. <if test="parentInnerLabelId != null">
  35. `parent_inner_label_id`,
  36. </if>
  37. <if test="storeId != null">
  38. `store_id`,
  39. </if>
  40. <if test="createTime != null">
  41. `create_time`,
  42. </if>
  43. <if test="createVendorId != null">
  44. `create_vendor_id`,
  45. </if>
  46. <if test="createVendorName != null">
  47. `create_vendor_name`,
  48. </if>
  49. <if test="updateTime != null">
  50. `update_time`,
  51. </if>
  52. <if test="updateVendorId != null">
  53. `update_vendor_id`,
  54. </if>
  55. <if test="updateVendorName != null">
  56. `update_vendor_name`,
  57. </if>
  58. </trim>
  59. </sql>
  60. <!--按照主键值进行操作-->
  61. <sql id="pkWhere">
  62. WHERE `inner_label_id` = #{primaryKey}
  63. </sql>
  64. <!--操作条件-->
  65. <sql id="whereCondition">
  66. <if test="example != null">
  67. <trim prefix="WHERE" prefixOverrides="AND|OR">
  68. <if test="example.innerLabelIdNotEquals != null">
  69. AND `inner_label_id` != #{example.innerLabelIdNotEquals}
  70. </if>
  71. <if test="example.innerLabelIdIn != null">
  72. AND `inner_label_id` in (${example.innerLabelIdIn})
  73. </if>
  74. <if test="example.webSite != null">
  75. AND `web_site` = #{example.webSite}
  76. </if>
  77. <if test="example.innerLabelName != null">
  78. AND `inner_label_name` = #{example.innerLabelName}
  79. </if>
  80. <if test="example.innerLabelNameLike != null">
  81. AND `inner_label_name` like concat('%',#{example.innerLabelNameLike},'%')
  82. </if>
  83. <if test="example.innerLabelSort != null">
  84. AND `inner_label_sort` = #{example.innerLabelSort}
  85. </if>
  86. <if test="example.isShow != null">
  87. AND `is_show` = #{example.isShow}
  88. </if>
  89. <if test="example.parentInnerLabelId != null">
  90. AND `parent_inner_label_id` = #{example.parentInnerLabelId}
  91. </if>
  92. <if test="example.storeId != null">
  93. AND `store_id` = #{example.storeId}
  94. </if>
  95. <if test="example.createTimeAfter != null">
  96. AND `create_time` <![CDATA[ >= ]]> #{example.createTimeAfter}
  97. </if>
  98. <if test="example.createTimeBefore != null">
  99. AND `create_time` <![CDATA[ <= ]]> #{example.createTimeBefore}
  100. </if>
  101. <if test="example.createVendorId != null">
  102. AND `create_vendor_id` = #{example.createVendorId}
  103. </if>
  104. <if test="example.createVendorName != null">
  105. AND `create_vendor_name` = #{example.createVendorName}
  106. </if>
  107. <if test="example.createVendorNameLike != null">
  108. AND `create_vendor_name` like concat('%',#{example.createVendorNameLike},'%')
  109. </if>
  110. <if test="example.updateTimeAfter != null">
  111. AND `update_time` <![CDATA[ >= ]]> #{example.updateTimeAfter}
  112. </if>
  113. <if test="example.updateTimeBefore != null">
  114. AND `update_time` <![CDATA[ <= ]]> #{example.updateTimeBefore}
  115. </if>
  116. <if test="example.updateVendorId != null">
  117. AND `update_vendor_id` = #{example.updateVendorId}
  118. </if>
  119. <if test="example.updateVendorName != null">
  120. AND `update_vendor_name` = #{example.updateVendorName}
  121. </if>
  122. <if test="example.updateVendorNameLike != null">
  123. AND `update_vendor_name` like concat('%',#{example.updateVendorNameLike},'%')
  124. </if>
  125. </trim>
  126. </if>
  127. </sql>
  128. <!--排序条件-->
  129. <sql id="orderBy">
  130. ORDER BY `inner_label_id` DESC
  131. </sql>
  132. <sql id="orderByOther">
  133. order by ${example.orderBy}
  134. </sql>
  135. <!--分组条件-->
  136. <sql id="groupBy">
  137. group by ${example.groupBy}
  138. </sql>
  139. <!--分页条件-->
  140. <sql id="limit">
  141. <if test="size != null and size &gt; 0">
  142. limit #{startRow},#{size}
  143. </if>
  144. </sql>
  145. <!--查询符合条件的记录数-->
  146. <select id="countByExample" parameterType="com.slodon.b2b2c.seller.example.StoreInnerLabelExample" resultType="java.lang.Integer">
  147. SELECT
  148. COUNT(*)
  149. FROM `store_inner_label`
  150. <include refid="whereCondition" />
  151. </select>
  152. <!--根据主键查询记录-->
  153. <select id="getByPrimaryKey" resultMap="resultMap">
  154. SELECT
  155. *
  156. FROM `store_inner_label`
  157. <include refid="pkWhere" />
  158. </select>
  159. <!--查询符合条件的记录(所有字段)-->
  160. <select id="listByExample" resultMap="resultMap">
  161. SELECT
  162. *
  163. FROM `store_inner_label`
  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="listPageByExample" resultMap="resultMap">
  179. SELECT
  180. *
  181. FROM `store_inner_label`
  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. <!--查询符合条件的记录(指定字段)-->
  197. <select id="listFieldsByExample" resultMap="resultMap">
  198. SELECT
  199. ${fields}
  200. FROM `store_inner_label`
  201. <include refid="whereCondition" />
  202. <if test="example.groupBy != null">
  203. <include refid="groupBy" />
  204. </if>
  205. <choose>
  206. <when test="example.orderBy != null">
  207. <include refid="orderByOther" />
  208. </when>
  209. <otherwise>
  210. <include refid="orderBy" />
  211. </otherwise>
  212. </choose>
  213. </select>
  214. <!--分页查询符合条件的记录(指定字段)-->
  215. <select id="listFieldsPageByExample" resultMap="resultMap">
  216. SELECT
  217. ${fields}
  218. FROM `store_inner_label`
  219. <include refid="whereCondition" />
  220. <if test="example.groupBy != null">
  221. <include refid="groupBy" />
  222. </if>
  223. <choose>
  224. <when test="example.orderBy != null">
  225. <include refid="orderByOther" />
  226. </when>
  227. <otherwise>
  228. <include refid="orderBy" />
  229. </otherwise>
  230. </choose>
  231. <include refid="limit" />
  232. </select>
  233. <!--根据条件删除记录,可多条删除-->
  234. <delete id="deleteByExample">
  235. DELETE FROM `store_inner_label`
  236. <include refid="whereCondition" />
  237. </delete>
  238. <!--根据主键删除记录-->
  239. <delete id="deleteByPrimaryKey">
  240. DELETE FROM `store_inner_label`
  241. <include refid="pkWhere" />
  242. </delete>
  243. <!--插入一条记录-->
  244. <insert id="insert" keyColumn="inner_label_id" keyProperty="innerLabelId" parameterType="com.slodon.b2b2c.seller.pojo.StoreInnerLabel" useGeneratedKeys="true">
  245. INSERT INTO `store_inner_label`(
  246. <include refid="columns" />
  247. )
  248. VALUES(
  249. <trim suffixOverrides=",">
  250. <if test="webSite != null">
  251. #{webSite},
  252. </if>
  253. <if test="innerLabelName != null">
  254. #{innerLabelName},
  255. </if>
  256. <if test="innerLabelSort != null">
  257. #{innerLabelSort},
  258. </if>
  259. <if test="isShow != null">
  260. #{isShow},
  261. </if>
  262. <if test="parentInnerLabelId != null">
  263. #{parentInnerLabelId},
  264. </if>
  265. <if test="storeId != null">
  266. #{storeId},
  267. </if>
  268. <if test="createTime != null">
  269. #{createTime},
  270. </if>
  271. <if test="createVendorId != null">
  272. #{createVendorId},
  273. </if>
  274. <if test="createVendorName != null">
  275. #{createVendorName},
  276. </if>
  277. <if test="updateTime != null">
  278. #{updateTime},
  279. </if>
  280. <if test="updateVendorId != null">
  281. #{updateVendorId},
  282. </if>
  283. <if test="updateVendorName != null">
  284. #{updateVendorName},
  285. </if>
  286. </trim>
  287. )
  288. </insert>
  289. <!--按条件更新记录中不为空的字段-->
  290. <update id="updateByExampleSelective">
  291. UPDATE `store_inner_label`
  292. <trim prefix="SET" suffixOverrides=",">
  293. <if test="webSite != null">
  294. `web_site` = #{webSite},
  295. </if>
  296. <if test="record.innerLabelName != null">
  297. `inner_label_name` = #{record.innerLabelName},
  298. </if>
  299. <if test="record.innerLabelSort != null">
  300. `inner_label_sort` = #{record.innerLabelSort},
  301. </if>
  302. <if test="record.isShow != null">
  303. `is_show` = #{record.isShow},
  304. </if>
  305. <if test="record.parentInnerLabelId != null">
  306. `parent_inner_label_id` = #{record.parentInnerLabelId},
  307. </if>
  308. <if test="record.storeId != null">
  309. `store_id` = #{record.storeId},
  310. </if>
  311. <if test="record.createTime != null">
  312. `create_time` = #{record.createTime},
  313. </if>
  314. <if test="record.createVendorId != null">
  315. `create_vendor_id` = #{record.createVendorId},
  316. </if>
  317. <if test="record.createVendorName != null">
  318. `create_vendor_name` = #{record.createVendorName},
  319. </if>
  320. <if test="record.updateTime != null">
  321. `update_time` = #{record.updateTime},
  322. </if>
  323. <if test="record.updateVendorId != null">
  324. `update_vendor_id` = #{record.updateVendorId},
  325. </if>
  326. <if test="record.updateVendorName != null">
  327. `update_vendor_name` = #{record.updateVendorName},
  328. </if>
  329. </trim>
  330. <include refid="whereCondition" />
  331. </update>
  332. <!--按照主键更新记录中不为空的字段-->
  333. <update id="updateByPrimaryKeySelective">
  334. UPDATE `store_inner_label`
  335. <trim prefix="SET" suffixOverrides=",">
  336. <if test="webSite != null">
  337. `web_site` = #{webSite},
  338. </if>
  339. <if test="innerLabelName != null">
  340. `inner_label_name` = #{innerLabelName},
  341. </if>
  342. <if test="innerLabelSort != null">
  343. `inner_label_sort` = #{innerLabelSort},
  344. </if>
  345. <if test="isShow != null">
  346. `is_show` = #{isShow},
  347. </if>
  348. <if test="parentInnerLabelId != null">
  349. `parent_inner_label_id` = #{parentInnerLabelId},
  350. </if>
  351. <if test="storeId != null">
  352. `store_id` = #{storeId},
  353. </if>
  354. <if test="createTime != null">
  355. `create_time` = #{createTime},
  356. </if>
  357. <if test="createVendorId != null">
  358. `create_vendor_id` = #{createVendorId},
  359. </if>
  360. <if test="createVendorName != null">
  361. `create_vendor_name` = #{createVendorName},
  362. </if>
  363. <if test="updateTime != null">
  364. `update_time` = #{updateTime},
  365. </if>
  366. <if test="updateVendorId != null">
  367. `update_vendor_id` = #{updateVendorId},
  368. </if>
  369. <if test="updateVendorName != null">
  370. `update_vendor_name` = #{updateVendorName},
  371. </if>
  372. </trim>
  373. WHERE `inner_label_id` = #{innerLabelId}
  374. </update>
  375. </mapper>