LiveBroadReadMapper.xml 14 KB

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