VendorWriteMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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.VendorWriteMapper">
  4. <resultMap id="resultMap" type="com.slodon.b2b2c.seller.pojo.Vendor">
  5. <id column="vendor_id" property="vendorId" />
  6. <result column="vendor_name" property="vendorName" />
  7. <result column="vendor_password" property="vendorPassword" />
  8. <result column="vendor_mobile" property="vendorMobile" />
  9. <result column="vendor_email" property="vendorEmail" />
  10. <result column="store_id" property="storeId" />
  11. <result column="is_store_admin" property="isStoreAdmin" />
  12. <result column="register_time" property="registerTime" />
  13. <result column="latest_login_time" property="latestLoginTime" />
  14. <result column="latest_login_ip" property="latestLoginIp" />
  15. <result column="avatar_url" property="avatarUrl" />
  16. <result column="is_allow_login" property="isAllowLogin" />
  17. <result column="roles_id" property="rolesId" />
  18. <result column="gp_uid" property="gpUid" />
  19. <result column="gp_token" property="gpToken" />
  20. <result column="store_url_by9710" property="storeUrlBy9710" />
  21. <result column="store_url_by9810" property="storeUrlBy9810" />
  22. </resultMap>
  23. <!--除主键外的所有字段,用于插入操作-->
  24. <sql id="columns">
  25. <trim suffixOverrides=",">
  26. <if test="vendorId != null">
  27. `vendor_id`,
  28. </if>
  29. <if test="vendorName != null">
  30. `vendor_name`,
  31. </if>
  32. <if test="vendorPassword != null">
  33. `vendor_password`,
  34. </if>
  35. <if test="vendorMobile != null">
  36. `vendor_mobile`,
  37. </if>
  38. <if test="vendorEmail != null">
  39. `vendor_email`,
  40. </if>
  41. <if test="storeId != null">
  42. `store_id`,
  43. </if>
  44. <if test="isStoreAdmin != null">
  45. `is_store_admin`,
  46. </if>
  47. <if test="registerTime != null">
  48. `register_time`,
  49. </if>
  50. <if test="latestLoginTime != null">
  51. `latest_login_time`,
  52. </if>
  53. <if test="latestLoginIp != null">
  54. `latest_login_ip`,
  55. </if>
  56. <if test="avatarUrl != null">
  57. `avatar_url`,
  58. </if>
  59. <if test="isAllowLogin != null">
  60. `is_allow_login`,
  61. </if>
  62. <if test="rolesId != null">
  63. `roles_id`,
  64. </if>
  65. <if test="gpUid != null">
  66. `gp_uid`,
  67. </if>
  68. <if test="gpToken != null">
  69. `gp_token`,
  70. </if>
  71. <if test="storeUrlBy9710 != null">
  72. `store_url_by9710`,
  73. </if>
  74. <if test="storeUrlBy9810 != null">
  75. `store_url_by9810`,
  76. </if>
  77. </trim>
  78. </sql>
  79. <!--按照主键值进行操作-->
  80. <sql id="pkWhere">
  81. WHERE `vendor_id` = #{primaryKey}
  82. </sql>
  83. <!--操作条件-->
  84. <sql id="whereCondition">
  85. <if test="example != null">
  86. <trim prefix="WHERE" prefixOverrides="AND|OR">
  87. <if test="example.vendorIdNotEquals != null">
  88. AND `vendor_id` != #{example.vendorIdNotEquals}
  89. </if>
  90. <if test="example.vendorIdIn != null">
  91. AND `vendor_id` in (${example.vendorIdIn})
  92. </if>
  93. <if test="example.vendorName != null">
  94. AND `vendor_name` = #{example.vendorName}
  95. </if>
  96. <if test="example.vendorNameLike != null">
  97. AND `vendor_name` like concat('%',#{example.vendorNameLike},'%')
  98. </if>
  99. <if test="example.vendorPassword != null">
  100. AND `vendor_password` = #{example.vendorPassword}
  101. </if>
  102. <if test="example.vendorMobile != null">
  103. AND `vendor_mobile` = #{example.vendorMobile}
  104. </if>
  105. <if test="example.vendorEmail != null">
  106. AND `vendor_email` = #{example.vendorEmail}
  107. </if>
  108. <if test="example.storeId != null">
  109. AND `store_id` = #{example.storeId}
  110. </if>
  111. <if test="example.isStoreAdmin != null">
  112. AND `is_store_admin` = #{example.isStoreAdmin}
  113. </if>
  114. <if test="example.registerTimeAfter != null">
  115. AND `register_time` <![CDATA[ >= ]]> #{example.registerTimeAfter}
  116. </if>
  117. <if test="example.registerTimeBefore != null">
  118. AND `register_time` <![CDATA[ <= ]]> #{example.registerTimeBefore}
  119. </if>
  120. <if test="example.latestLoginTimeAfter != null">
  121. AND `latest_login_time` <![CDATA[ >= ]]> #{example.latestLoginTimeAfter}
  122. </if>
  123. <if test="example.latestLoginTimeBefore != null">
  124. AND `latest_login_time` <![CDATA[ <= ]]> #{example.latestLoginTimeBefore}
  125. </if>
  126. <if test="example.latestLoginIp != null">
  127. AND `latest_login_ip` = #{example.latestLoginIp}
  128. </if>
  129. <if test="example.avatarUrl != null">
  130. AND `avatar_url` = #{example.avatarUrl}
  131. </if>
  132. <if test="example.isAllowLogin != null">
  133. AND `is_allow_login` = #{example.isAllowLogin}
  134. </if>
  135. <if test="example.rolesId != null">
  136. AND `roles_id` = #{example.rolesId}
  137. </if>
  138. <if test="example.gpUid != null">
  139. AND `gp_uid` = #{example.gpUid}
  140. </if>
  141. <if test="example.gpToken != null">
  142. AND `gp_token` = #{example.gpToken}
  143. </if>
  144. <if test="example.storeUrlBy9710 != null">
  145. AND `store_url_by9710`= #{example.storeUrlBy9710}
  146. </if>
  147. <if test="example.storeUrlBy9810 != null">
  148. AND `store_url_by9810`= #{example.storeUrlBy9810}
  149. </if>
  150. </trim>
  151. </if>
  152. </sql>
  153. <!--排序条件-->
  154. <sql id="orderBy">
  155. ORDER BY `vendor_id` DESC
  156. </sql>
  157. <sql id="orderByOther">
  158. order by ${example.orderBy}
  159. </sql>
  160. <!--分组条件-->
  161. <sql id="groupBy">
  162. group by ${example.groupBy}
  163. </sql>
  164. <!--分页条件-->
  165. <sql id="limit">
  166. <if test="size != null and size &gt; 0">
  167. limit #{startRow},#{size}
  168. </if>
  169. </sql>
  170. <!--查询符合条件的记录数-->
  171. <select id="countByExample" parameterType="com.slodon.b2b2c.seller.example.VendorExample" resultType="java.lang.Integer">
  172. SELECT
  173. COUNT(*)
  174. FROM `vendor`
  175. <include refid="whereCondition" />
  176. </select>
  177. <!--根据主键查询记录-->
  178. <select id="getByPrimaryKey" resultMap="resultMap">
  179. SELECT
  180. *
  181. FROM `vendor`
  182. <include refid="pkWhere" />
  183. </select>
  184. <!--查询符合条件的记录(所有字段)-->
  185. <select id="listByExample" resultMap="resultMap">
  186. SELECT
  187. *
  188. FROM `vendor`
  189. <include refid="whereCondition" />
  190. <if test="example.groupBy != null">
  191. <include refid="groupBy" />
  192. </if>
  193. <choose>
  194. <when test="example.orderBy != null">
  195. <include refid="orderByOther" />
  196. </when>
  197. <otherwise>
  198. <include refid="orderBy" />
  199. </otherwise>
  200. </choose>
  201. </select>
  202. <!--分页查询符合条件的记录(所有字段)-->
  203. <select id="listPageByExample" resultMap="resultMap">
  204. SELECT
  205. *
  206. FROM `vendor`
  207. <include refid="whereCondition" />
  208. <if test="example.groupBy != null">
  209. <include refid="groupBy" />
  210. </if>
  211. <choose>
  212. <when test="example.orderBy != null">
  213. <include refid="orderByOther" />
  214. </when>
  215. <otherwise>
  216. <include refid="orderBy" />
  217. </otherwise>
  218. </choose>
  219. <include refid="limit" />
  220. </select>
  221. <!--查询符合条件的记录(指定字段)-->
  222. <select id="listFieldsByExample" resultMap="resultMap">
  223. SELECT
  224. ${fields}
  225. FROM `vendor`
  226. <include refid="whereCondition" />
  227. <if test="example.groupBy != null">
  228. <include refid="groupBy" />
  229. </if>
  230. <choose>
  231. <when test="example.orderBy != null">
  232. <include refid="orderByOther" />
  233. </when>
  234. <otherwise>
  235. <include refid="orderBy" />
  236. </otherwise>
  237. </choose>
  238. </select>
  239. <!--分页查询符合条件的记录(指定字段)-->
  240. <select id="listFieldsPageByExample" resultMap="resultMap">
  241. SELECT
  242. ${fields}
  243. FROM `vendor`
  244. <include refid="whereCondition" />
  245. <if test="example.groupBy != null">
  246. <include refid="groupBy" />
  247. </if>
  248. <choose>
  249. <when test="example.orderBy != null">
  250. <include refid="orderByOther" />
  251. </when>
  252. <otherwise>
  253. <include refid="orderBy" />
  254. </otherwise>
  255. </choose>
  256. <include refid="limit" />
  257. </select>
  258. <!--根据条件删除记录,可多条删除-->
  259. <delete id="deleteByExample">
  260. DELETE FROM `vendor`
  261. <include refid="whereCondition" />
  262. </delete>
  263. <!--根据主键删除记录-->
  264. <delete id="deleteByPrimaryKey">
  265. DELETE FROM `vendor`
  266. <include refid="pkWhere" />
  267. </delete>
  268. <!--插入一条记录-->
  269. <insert id="insert" keyColumn="vendor_id" keyProperty="vendorId" parameterType="com.slodon.b2b2c.seller.pojo.Vendor" useGeneratedKeys="true">
  270. INSERT INTO `vendor`(
  271. <include refid="columns" />
  272. )
  273. VALUES(
  274. <trim suffixOverrides=",">
  275. <if test="vendorId != null">
  276. #{vendorId},
  277. </if>
  278. <if test="vendorName != null">
  279. #{vendorName},
  280. </if>
  281. <if test="vendorPassword != null">
  282. #{vendorPassword},
  283. </if>
  284. <if test="vendorMobile != null">
  285. #{vendorMobile},
  286. </if>
  287. <if test="vendorEmail != null">
  288. #{vendorEmail},
  289. </if>
  290. <if test="storeId != null">
  291. #{storeId},
  292. </if>
  293. <if test="isStoreAdmin != null">
  294. #{isStoreAdmin},
  295. </if>
  296. <if test="registerTime != null">
  297. #{registerTime},
  298. </if>
  299. <if test="latestLoginTime != null">
  300. #{latestLoginTime},
  301. </if>
  302. <if test="latestLoginIp != null">
  303. #{latestLoginIp},
  304. </if>
  305. <if test="avatarUrl != null">
  306. #{avatarUrl},
  307. </if>
  308. <if test="isAllowLogin != null">
  309. #{isAllowLogin},
  310. </if>
  311. <if test="rolesId != null">
  312. #{rolesId},
  313. </if>
  314. <if test="gpUid != null">
  315. #{gpUid},
  316. </if>
  317. <if test="gpToken != null">
  318. #{gpToken},
  319. </if>
  320. <if test="storeUrlBy9710 != null">
  321. #{storeUrlBy9710},
  322. </if>
  323. <if test="storeUrlBy9810 != null">
  324. #{storeUrlBy9810},
  325. </if>
  326. </trim>
  327. )
  328. </insert>
  329. <!--按条件更新记录中不为空的字段-->
  330. <update id="updateByExampleSelective">
  331. UPDATE `vendor`
  332. <trim prefix="SET" suffixOverrides=",">
  333. <if test="record.vendorName != null">
  334. `vendor_name` = #{record.vendorName},
  335. </if>
  336. <if test="record.vendorPassword != null">
  337. `vendor_password` = #{record.vendorPassword},
  338. </if>
  339. <if test="record.vendorMobile != null">
  340. `vendor_mobile` = #{record.vendorMobile},
  341. </if>
  342. <if test="record.vendorEmail != null">
  343. `vendor_email` = #{record.vendorEmail},
  344. </if>
  345. <if test="record.storeId != null">
  346. `store_id` = #{record.storeId},
  347. </if>
  348. <if test="record.isStoreAdmin != null">
  349. `is_store_admin` = #{record.isStoreAdmin},
  350. </if>
  351. <if test="record.registerTime != null">
  352. `register_time` = #{record.registerTime},
  353. </if>
  354. <if test="record.latestLoginTime != null">
  355. `latest_login_time` = #{record.latestLoginTime},
  356. </if>
  357. <if test="record.latestLoginIp != null">
  358. `latest_login_ip` = #{record.latestLoginIp},
  359. </if>
  360. <if test="record.avatarUrl != null">
  361. `avatar_url` = #{record.avatarUrl},
  362. </if>
  363. <if test="record.isAllowLogin != null">
  364. `is_allow_login` = #{record.isAllowLogin},
  365. </if>
  366. <if test="record.rolesId != null">
  367. `roles_id` = #{record.rolesId},
  368. </if>
  369. <if test="record.gpUid != null">
  370. `gp_uid` = #{record.gpUid},
  371. </if>
  372. <if test="record.gpToken != null">
  373. `gp_token` = #{record.gpToken},
  374. </if>
  375. <if test="record.storeUrlBy9710 != null">
  376. `store_url_by9710` = #{record.storeUrlBy9710},
  377. </if>
  378. <if test="record.storeUrlBy9810 != null">
  379. `store_url_by9810` = #{record.storeUrlBy9810},
  380. </if>
  381. </trim>
  382. <include refid="whereCondition" />
  383. </update>
  384. <!--按照主键更新记录中不为空的字段-->
  385. <update id="updateByPrimaryKeySelective">
  386. UPDATE `vendor`
  387. <trim prefix="SET" suffixOverrides=",">
  388. <if test="vendorName != null">
  389. `vendor_name` = #{vendorName},
  390. </if>
  391. <if test="vendorPassword != null">
  392. `vendor_password` = #{vendorPassword},
  393. </if>
  394. <if test="vendorMobile != null">
  395. `vendor_mobile` = #{vendorMobile},
  396. </if>
  397. <if test="vendorEmail != null">
  398. `vendor_email` = #{vendorEmail},
  399. </if>
  400. <if test="storeId != null">
  401. `store_id` = #{storeId},
  402. </if>
  403. <if test="isStoreAdmin != null">
  404. `is_store_admin` = #{isStoreAdmin},
  405. </if>
  406. <if test="registerTime != null">
  407. `register_time` = #{registerTime},
  408. </if>
  409. <if test="latestLoginTime != null">
  410. `latest_login_time` = #{latestLoginTime},
  411. </if>
  412. <if test="latestLoginIp != null">
  413. `latest_login_ip` = #{latestLoginIp},
  414. </if>
  415. <if test="avatarUrl != null">
  416. `avatar_url` = #{avatarUrl},
  417. </if>
  418. <if test="isAllowLogin != null">
  419. `is_allow_login` = #{isAllowLogin},
  420. </if>
  421. <if test="rolesId != null">
  422. `roles_id` = #{rolesId},
  423. </if>
  424. <if test="gpUid != null">
  425. `gp_uid` = #{gpUid},
  426. </if>
  427. <if test="gpToken != null">
  428. `gp_token` = #{gpToken},
  429. </if>
  430. <if test="storeUrlBy9710 != null">
  431. `store_url_by9710` = #{storeUrlBy9710},
  432. </if>
  433. <if test="storeUrlBy9810 != null">
  434. `store_url_by9810` = #{storeUrlBy9810},
  435. </if>
  436. </trim>
  437. WHERE `vendor_id` = #{vendorId}
  438. </update>
  439. </mapper>