PolicyMapper.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  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.goafanti.common.dao.PolicyMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.Policy">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  9. -->
  10. <id column="id" jdbcType="BIGINT" property="id" />
  11. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  12. <result column="edit_time" jdbcType="TIMESTAMP" property="editTime" />
  13. <result column="title" jdbcType="VARCHAR" property="title" />
  14. <result column="title_img" jdbcType="VARCHAR" property="titleImg" />
  15. <result column="author" jdbcType="VARCHAR" property="author" />
  16. <result column="type" jdbcType="INTEGER" property="type" />
  17. <result column="source" jdbcType="VARCHAR" property="source" />
  18. <result column="source_url" jdbcType="VARCHAR" property="sourceUrl" />
  19. <result column="summary" jdbcType="VARCHAR" property="summary" />
  20. <result column="audit_status" jdbcType="INTEGER" property="auditStatus" />
  21. <result column="hot" jdbcType="INTEGER" property="hot" />
  22. <result column="province" jdbcType="INTEGER" property="province" />
  23. <result column="city" jdbcType="INTEGER" property="city" />
  24. <result column="release_date" jdbcType="TIMESTAMP" property="releaseDate" />
  25. <result column="keyword" jdbcType="VARCHAR" property="keyword" />
  26. </resultMap>
  27. <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.Policy">
  28. <!--
  29. WARNING - @mbg.generated
  30. This element is automatically generated by MyBatis Generator, do not modify.
  31. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  32. -->
  33. <result column="content" jdbcType="LONGVARCHAR" property="content" />
  34. </resultMap>
  35. <sql id="Example_Where_Clause">
  36. <!--
  37. WARNING - @mbg.generated
  38. This element is automatically generated by MyBatis Generator, do not modify.
  39. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  40. -->
  41. <where>
  42. <foreach collection="oredCriteria" item="criteria" separator="or">
  43. <if test="criteria.valid">
  44. <trim prefix="(" prefixOverrides="and" suffix=")">
  45. <foreach collection="criteria.criteria" item="criterion">
  46. <choose>
  47. <when test="criterion.noValue">
  48. and ${criterion.condition}
  49. </when>
  50. <when test="criterion.singleValue">
  51. and ${criterion.condition} #{criterion.value}
  52. </when>
  53. <when test="criterion.betweenValue">
  54. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  55. </when>
  56. <when test="criterion.listValue">
  57. and ${criterion.condition}
  58. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  59. #{listItem}
  60. </foreach>
  61. </when>
  62. </choose>
  63. </foreach>
  64. </trim>
  65. </if>
  66. </foreach>
  67. </where>
  68. </sql>
  69. <sql id="Update_By_Example_Where_Clause">
  70. <!--
  71. WARNING - @mbg.generated
  72. This element is automatically generated by MyBatis Generator, do not modify.
  73. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  74. -->
  75. <where>
  76. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  77. <if test="criteria.valid">
  78. <trim prefix="(" prefixOverrides="and" suffix=")">
  79. <foreach collection="criteria.criteria" item="criterion">
  80. <choose>
  81. <when test="criterion.noValue">
  82. and ${criterion.condition}
  83. </when>
  84. <when test="criterion.singleValue">
  85. and ${criterion.condition} #{criterion.value}
  86. </when>
  87. <when test="criterion.betweenValue">
  88. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  89. </when>
  90. <when test="criterion.listValue">
  91. and ${criterion.condition}
  92. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  93. #{listItem}
  94. </foreach>
  95. </when>
  96. </choose>
  97. </foreach>
  98. </trim>
  99. </if>
  100. </foreach>
  101. </where>
  102. </sql>
  103. <sql id="Base_Column_List">
  104. <!--
  105. WARNING - @mbg.generated
  106. This element is automatically generated by MyBatis Generator, do not modify.
  107. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  108. -->
  109. id, create_time as createTime, edit_time as editTime, title, title_img as titleImg, author, type, source, source_url as sourceUrl, summary,
  110. audit_status as auditStatus, hot, province, city, release_date as releaseDate,keyword
  111. </sql>
  112. <sql id="Blob_Column_List">
  113. <!--
  114. WARNING - @mbg.generated
  115. This element is automatically generated by MyBatis Generator, do not modify.
  116. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  117. -->
  118. content
  119. </sql>
  120. <select id="selectByExampleWithBLOBs" parameterType="com.goafanti.common.model.PolicyExample" resultMap="ResultMapWithBLOBs">
  121. <!--
  122. WARNING - @mbg.generated
  123. This element is automatically generated by MyBatis Generator, do not modify.
  124. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  125. -->
  126. select
  127. <if test="distinct">
  128. distinct
  129. </if>
  130. <include refid="Base_Column_List" />
  131. ,
  132. <include refid="Blob_Column_List" />
  133. from policy
  134. <if test="_parameter != null">
  135. <include refid="Example_Where_Clause" />
  136. </if>
  137. <if test="orderByClause != null">
  138. order by ${orderByClause}
  139. </if>
  140. </select>
  141. <select id="selectByExample" parameterType="com.goafanti.common.model.PolicyExample" resultMap="BaseResultMap">
  142. <!--
  143. WARNING - @mbg.generated
  144. This element is automatically generated by MyBatis Generator, do not modify.
  145. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  146. -->
  147. select
  148. <if test="distinct">
  149. distinct
  150. </if>
  151. <include refid="Base_Column_List" />
  152. from policy
  153. <if test="_parameter != null">
  154. <include refid="Example_Where_Clause" />
  155. </if>
  156. <if test="orderByClause != null">
  157. order by ${orderByClause}
  158. </if>
  159. </select>
  160. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultType="com.goafanti.news.bo.PolicyResult">
  161. <!--
  162. WARNING - @mbg.generated
  163. This element is automatically generated by MyBatis Generator, do not modify.
  164. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  165. -->
  166. select
  167. <include refid="Base_Column_List" />,
  168. <include refid="Blob_Column_List" />
  169. from policy
  170. where id = #{id,jdbcType=BIGINT}
  171. </select>
  172. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  173. <!--
  174. WARNING - @mbg.generated
  175. This element is automatically generated by MyBatis Generator, do not modify.
  176. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  177. -->
  178. delete from policy
  179. where id = #{id,jdbcType=BIGINT}
  180. </delete>
  181. <delete id="deleteByExample" parameterType="com.goafanti.common.model.PolicyExample">
  182. <!--
  183. WARNING - @mbg.generated
  184. This element is automatically generated by MyBatis Generator, do not modify.
  185. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  186. -->
  187. delete from policy
  188. <if test="_parameter != null">
  189. <include refid="Example_Where_Clause" />
  190. </if>
  191. </delete>
  192. <insert id="insert" parameterType="com.goafanti.common.model.Policy">
  193. <!--
  194. WARNING - @mbg.generated
  195. This element is automatically generated by MyBatis Generator, do not modify.
  196. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  197. -->
  198. insert into policy (id, create_time, edit_time,
  199. title, title_img, author,
  200. type, source, source_url,
  201. summary, audit_status, hot,
  202. province, city, release_date,
  203. content,keyword)
  204. values (#{id,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{editTime,jdbcType=TIMESTAMP},
  205. #{title,jdbcType=VARCHAR}, #{titleImg,jdbcType=VARCHAR}, #{author,jdbcType=VARCHAR},
  206. #{type,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR}, #{sourceUrl,jdbcType=VARCHAR},
  207. #{summary,jdbcType=VARCHAR}, #{auditStatus,jdbcType=INTEGER}, #{hot,jdbcType=INTEGER},
  208. #{province,jdbcType=INTEGER}, #{city,jdbcType=INTEGER}, #{releaseDate,jdbcType=TIMESTAMP},
  209. #{content,jdbcType=LONGVARCHAR},#{keyword,jdbcType=VARCHAR})
  210. </insert>
  211. <insert id="insertSelective" parameterType="com.goafanti.common.model.Policy">
  212. <!--
  213. WARNING - @mbg.generated
  214. This element is automatically generated by MyBatis Generator, do not modify.
  215. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  216. -->
  217. insert into policy
  218. <trim prefix="(" suffix=")" suffixOverrides=",">
  219. <if test="id != null">
  220. id,
  221. </if>
  222. <if test="createTime != null">
  223. create_time,
  224. </if>
  225. <if test="editTime != null">
  226. edit_time,
  227. </if>
  228. <if test="title != null">
  229. title,
  230. </if>
  231. <if test="titleImg != null">
  232. title_img,
  233. </if>
  234. <if test="author != null">
  235. author,
  236. </if>
  237. <if test="type != null">
  238. type,
  239. </if>
  240. <if test="source != null">
  241. source,
  242. </if>
  243. <if test="sourceUrl != null">
  244. source_url,
  245. </if>
  246. <if test="summary != null">
  247. summary,
  248. </if>
  249. <if test="auditStatus != null">
  250. audit_status,
  251. </if>
  252. <if test="hot != null">
  253. hot,
  254. </if>
  255. <if test="province != null">
  256. province,
  257. </if>
  258. <if test="city != null">
  259. city,
  260. </if>
  261. <if test="releaseDate != null">
  262. release_date,
  263. </if>
  264. <if test="content != null">
  265. content,
  266. </if>
  267. <if test="keyword != null">
  268. keyword,
  269. </if>
  270. </trim>
  271. <trim prefix="values (" suffix=")" suffixOverrides=",">
  272. <if test="id != null">
  273. #{id,jdbcType=BIGINT},
  274. </if>
  275. <if test="createTime != null">
  276. #{createTime,jdbcType=TIMESTAMP},
  277. </if>
  278. <if test="editTime != null">
  279. #{editTime,jdbcType=TIMESTAMP},
  280. </if>
  281. <if test="title != null">
  282. #{title,jdbcType=VARCHAR},
  283. </if>
  284. <if test="titleImg != null">
  285. #{titleImg,jdbcType=VARCHAR},
  286. </if>
  287. <if test="author != null">
  288. #{author,jdbcType=VARCHAR},
  289. </if>
  290. <if test="type != null">
  291. #{type,jdbcType=INTEGER},
  292. </if>
  293. <if test="source != null">
  294. #{source,jdbcType=VARCHAR},
  295. </if>
  296. <if test="sourceUrl != null">
  297. #{sourceUrl,jdbcType=VARCHAR},
  298. </if>
  299. <if test="summary != null">
  300. #{summary,jdbcType=VARCHAR},
  301. </if>
  302. <if test="auditStatus != null">
  303. #{auditStatus,jdbcType=INTEGER},
  304. </if>
  305. <if test="hot != null">
  306. #{hot,jdbcType=INTEGER},
  307. </if>
  308. <if test="province != null">
  309. #{province,jdbcType=INTEGER},
  310. </if>
  311. <if test="city != null">
  312. #{city,jdbcType=INTEGER},
  313. </if>
  314. <if test="releaseDate != null">
  315. #{releaseDate,jdbcType=TIMESTAMP},
  316. </if>
  317. <if test="content != null">
  318. #{content,jdbcType=LONGVARCHAR},
  319. </if>
  320. <if test="keyword != null">
  321. #{keyword,jdbcType=VARCHAR},
  322. </if>
  323. </trim>
  324. </insert>
  325. <select id="countByExample" parameterType="com.goafanti.common.model.PolicyExample" resultType="java.lang.Long">
  326. <!--
  327. WARNING - @mbg.generated
  328. This element is automatically generated by MyBatis Generator, do not modify.
  329. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  330. -->
  331. select count(*) from policy
  332. <if test="_parameter != null">
  333. <include refid="Example_Where_Clause" />
  334. </if>
  335. </select>
  336. <update id="updateByExampleSelective" parameterType="map">
  337. <!--
  338. WARNING - @mbg.generated
  339. This element is automatically generated by MyBatis Generator, do not modify.
  340. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  341. -->
  342. update policy
  343. <set>
  344. <if test="record.id != null">
  345. id = #{record.id,jdbcType=BIGINT},
  346. </if>
  347. <if test="record.createTime != null">
  348. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  349. </if>
  350. <if test="record.editTime != null">
  351. edit_time = #{record.editTime,jdbcType=TIMESTAMP},
  352. </if>
  353. <if test="record.title != null">
  354. title = #{record.title,jdbcType=VARCHAR},
  355. </if>
  356. <if test="record.titleImg != null">
  357. title_img = #{record.titleImg,jdbcType=VARCHAR},
  358. </if>
  359. <if test="record.author != null">
  360. author = #{record.author,jdbcType=VARCHAR},
  361. </if>
  362. <if test="record.type != null">
  363. type = #{record.type,jdbcType=INTEGER},
  364. </if>
  365. <if test="record.source != null">
  366. source = #{record.source,jdbcType=VARCHAR},
  367. </if>
  368. <if test="record.sourceUrl != null">
  369. source_url = #{record.sourceUrl,jdbcType=VARCHAR},
  370. </if>
  371. <if test="record.summary != null">
  372. summary = #{record.summary,jdbcType=VARCHAR},
  373. </if>
  374. <if test="record.auditStatus != null">
  375. audit_status = #{record.auditStatus,jdbcType=INTEGER},
  376. </if>
  377. <if test="record.hot != null">
  378. hot = #{record.hot,jdbcType=INTEGER},
  379. </if>
  380. <if test="record.province != null">
  381. province = #{record.province,jdbcType=INTEGER},
  382. </if>
  383. <if test="record.city != null">
  384. city = #{record.city,jdbcType=INTEGER},
  385. </if>
  386. <if test="record.releaseDate != null">
  387. release_date = #{record.releaseDate,jdbcType=TIMESTAMP},
  388. </if>
  389. <if test="record.content != null">
  390. content = #{record.content,jdbcType=LONGVARCHAR},
  391. </if>
  392. <if test="keyword != null">
  393. keyword= #{keyword,jdbcType=VARCHAR},
  394. </if>
  395. </set>
  396. <if test="_parameter != null">
  397. <include refid="Update_By_Example_Where_Clause" />
  398. </if>
  399. </update>
  400. <update id="updateByExampleWithBLOBs" parameterType="map">
  401. <!--
  402. WARNING - @mbg.generated
  403. This element is automatically generated by MyBatis Generator, do not modify.
  404. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  405. -->
  406. update policy
  407. set id = #{record.id,jdbcType=BIGINT},
  408. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  409. edit_time = #{record.editTime,jdbcType=TIMESTAMP},
  410. title = #{record.title,jdbcType=VARCHAR},
  411. title_img = #{record.titleImg,jdbcType=VARCHAR},
  412. author = #{record.author,jdbcType=VARCHAR},
  413. type = #{record.type,jdbcType=INTEGER},
  414. source = #{record.source,jdbcType=VARCHAR},
  415. source_url = #{record.sourceUrl,jdbcType=VARCHAR},
  416. summary = #{record.summary,jdbcType=VARCHAR},
  417. audit_status = #{record.auditStatus,jdbcType=INTEGER},
  418. hot = #{record.hot,jdbcType=INTEGER},
  419. province = #{record.province,jdbcType=INTEGER},
  420. city = #{record.city,jdbcType=INTEGER},
  421. release_date = #{record.releaseDate,jdbcType=TIMESTAMP},
  422. content = #{record.content,jdbcType=LONGVARCHAR},
  423. keyword= #{keyword,jdbcType=VARCHAR}
  424. <if test="_parameter != null">
  425. <include refid="Update_By_Example_Where_Clause" />
  426. </if>
  427. </update>
  428. <update id="updateByExample" parameterType="map">
  429. <!--
  430. WARNING - @mbg.generated
  431. This element is automatically generated by MyBatis Generator, do not modify.
  432. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  433. -->
  434. update policy
  435. set id = #{record.id,jdbcType=BIGINT},
  436. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  437. edit_time = #{record.editTime,jdbcType=TIMESTAMP},
  438. title = #{record.title,jdbcType=VARCHAR},
  439. title_img = #{record.titleImg,jdbcType=VARCHAR},
  440. author = #{record.author,jdbcType=VARCHAR},
  441. type = #{record.type,jdbcType=INTEGER},
  442. source = #{record.source,jdbcType=VARCHAR},
  443. source_url = #{record.sourceUrl,jdbcType=VARCHAR},
  444. summary = #{record.summary,jdbcType=VARCHAR},
  445. audit_status = #{record.auditStatus,jdbcType=INTEGER},
  446. hot = #{record.hot,jdbcType=INTEGER},
  447. province = #{record.province,jdbcType=INTEGER},
  448. city = #{record.city,jdbcType=INTEGER},
  449. release_date = #{record.releaseDate,jdbcType=TIMESTAMP},
  450. keyword= #{keyword,jdbcType=VARCHAR}
  451. <if test="_parameter != null">
  452. <include refid="Update_By_Example_Where_Clause" />
  453. </if>
  454. </update>
  455. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Policy">
  456. <!--
  457. WARNING - @mbg.generated
  458. This element is automatically generated by MyBatis Generator, do not modify.
  459. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  460. -->
  461. update policy
  462. <set>
  463. <if test="createTime != null">
  464. create_time = #{createTime,jdbcType=TIMESTAMP},
  465. </if>
  466. <if test="editTime != null">
  467. edit_time = #{editTime,jdbcType=TIMESTAMP},
  468. </if>
  469. <if test="title != null">
  470. title = #{title,jdbcType=VARCHAR},
  471. </if>
  472. <if test="titleImg != null">
  473. title_img = #{titleImg,jdbcType=VARCHAR},
  474. </if>
  475. <if test="author != null">
  476. author = #{author,jdbcType=VARCHAR},
  477. </if>
  478. <if test="type != null">
  479. type = #{type,jdbcType=INTEGER},
  480. </if>
  481. <if test="source != null">
  482. source = #{source,jdbcType=VARCHAR},
  483. </if>
  484. <if test="sourceUrl != null">
  485. source_url = #{sourceUrl,jdbcType=VARCHAR},
  486. </if>
  487. <if test="summary != null">
  488. summary = #{summary,jdbcType=VARCHAR},
  489. </if>
  490. <if test="auditStatus != null">
  491. audit_status = #{auditStatus,jdbcType=INTEGER},
  492. </if>
  493. <if test="hot != null">
  494. hot = #{hot,jdbcType=INTEGER},
  495. </if>
  496. <if test="province != null">
  497. province = #{province,jdbcType=INTEGER},
  498. </if>
  499. <if test="city != null">
  500. city = #{city,jdbcType=INTEGER},
  501. </if>
  502. <if test="releaseDate != null">
  503. release_date = #{releaseDate,jdbcType=TIMESTAMP},
  504. </if>
  505. <if test="content != null">
  506. content = #{content,jdbcType=LONGVARCHAR},
  507. </if>
  508. <if test="keyword != null">
  509. keyword= #{keyword,jdbcType=VARCHAR},
  510. </if>
  511. </set>
  512. where id = #{id,jdbcType=BIGINT}
  513. </update>
  514. <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.goafanti.common.model.Policy">
  515. <!--
  516. WARNING - @mbg.generated
  517. This element is automatically generated by MyBatis Generator, do not modify.
  518. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  519. -->
  520. update policy
  521. set create_time = #{createTime,jdbcType=TIMESTAMP},
  522. edit_time = #{editTime,jdbcType=TIMESTAMP},
  523. title = #{title,jdbcType=VARCHAR},
  524. title_img = #{titleImg,jdbcType=VARCHAR},
  525. author = #{author,jdbcType=VARCHAR},
  526. type = #{type,jdbcType=INTEGER},
  527. source = #{source,jdbcType=VARCHAR},
  528. source_url = #{sourceUrl,jdbcType=VARCHAR},
  529. summary = #{summary,jdbcType=VARCHAR},
  530. audit_status = #{auditStatus,jdbcType=INTEGER},
  531. hot = #{hot,jdbcType=INTEGER},
  532. province = #{province,jdbcType=INTEGER},
  533. city = #{city,jdbcType=INTEGER},
  534. release_date = #{releaseDate,jdbcType=TIMESTAMP},
  535. content = #{content,jdbcType=LONGVARCHAR},
  536. keyword= #{keyword,jdbcType=VARCHAR},
  537. where id = #{id,jdbcType=BIGINT}
  538. </update>
  539. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Policy">
  540. <!--
  541. WARNING - @mbg.generated
  542. This element is automatically generated by MyBatis Generator, do not modify.
  543. This element was generated on Thu Jun 28 16:23:43 CST 2018.
  544. -->
  545. update policy
  546. set create_time = #{createTime,jdbcType=TIMESTAMP},
  547. edit_time = #{editTime,jdbcType=TIMESTAMP},
  548. title = #{title,jdbcType=VARCHAR},
  549. title_img = #{titleImg,jdbcType=VARCHAR},
  550. author = #{author,jdbcType=VARCHAR},
  551. type = #{type,jdbcType=INTEGER},
  552. source = #{source,jdbcType=VARCHAR},
  553. source_url = #{sourceUrl,jdbcType=VARCHAR},
  554. summary = #{summary,jdbcType=VARCHAR},
  555. audit_status = #{auditStatus,jdbcType=INTEGER},
  556. hot = #{hot,jdbcType=INTEGER},
  557. province = #{province,jdbcType=INTEGER},
  558. city = #{city,jdbcType=INTEGER},
  559. release_date = #{releaseDate,jdbcType=TIMESTAMP},
  560. keyword= #{keyword,jdbcType=VARCHAR}
  561. where id = #{id,jdbcType=BIGINT}
  562. </update>
  563. <select id="findPolicyByPageAndPublishPages" resultType="com.goafanti.news.bo.PolicyResult">
  564. select
  565. p.title,
  566. p.author,
  567. p.audit_status as auditStatus,
  568. p.edit_time as editTime,
  569. p.id,
  570. p.source,
  571. p.release_date as releaseDate,
  572. p.title_img as titleImg ,
  573. p.content,
  574. p.summary,
  575. p.hot,
  576. dg.name as provinceS,
  577. dgg.name as cityS
  578. from policy p
  579. left join district_glossory dg on dg.id =p.province
  580. left join district_glossory dgg on dgg.id=p.city
  581. <if test="publishPage!=null">
  582. left join policy_publish pp on pp.policy_id=p.id
  583. </if>
  584. where 1=1
  585. <if test="publishPage!=null">
  586. and pp.publish_page =#{publishPage,jdbcType=VARCHAR}
  587. </if>
  588. <if test="title!=null">
  589. and p.title like concat('%',#{title,jdbcType=VARCHAR},'%')
  590. </if>
  591. <if test="auditStatus!=null">
  592. and p.audit_status =#{auditStatus,jdbcType=INTEGER}
  593. </if>
  594. <if test="startDate!=null">
  595. and p.release_date <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
  596. </if>
  597. <if test="endDate !=null">
  598. and p.release_date <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
  599. </if>
  600. <if test="provinceId !=null">
  601. and p.province=#{provinceId,jdbcType=INTEGER}
  602. </if>
  603. <if test="city !=null">
  604. and p.city=#{city,jdbcType=VARCHAR}
  605. </if>
  606. order by p.release_date desc
  607. <if test="page_sql!=null">
  608. ${page_sql}
  609. </if>
  610. </select>
  611. <select id="findPolicyCountByPageAndPublishPages" resultType="java.lang.Integer">
  612. select
  613. count(0)
  614. from policy p
  615. <if test="publishPage!=null">
  616. left join policy_publish pp on pp.policy_id=p.id
  617. </if>
  618. where 1=1
  619. <if test="publishPage!=null">
  620. and pp.publish_page =#{publishPage,jdbcType=VARCHAR}
  621. </if>
  622. <if test="title!=null">
  623. and p.title like concat('%',#{title,jdbcType=VARCHAR},'%')
  624. </if>
  625. <if test="auditStatus!=null">
  626. and p.audit_status =#{auditStatus,jdbcType=INTEGER}
  627. </if>
  628. <if test="startDate!=null">
  629. and p.release_date <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
  630. </if>
  631. <if test="endDate !=null">
  632. and p.release_date <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
  633. </if>
  634. <if test="provinceId !=null">
  635. and p.province=#{provinceId,jdbcType=INTEGER}
  636. </if>
  637. </select>
  638. <select id="findPolicyAppList" resultType="com.goafanti.app.bo.AppDiscoveryBo">
  639. select
  640. p.id,
  641. p.title,
  642. p.content,
  643. date_format(p.release_date,'%Y-%m-%d %H:%I:%S')as releaseDate,
  644. p.title_img as titleImg
  645. from policy p
  646. where audit_status=2
  647. order by p.release_date desc
  648. <if test="page_sql!=null">
  649. ${page_sql}
  650. </if>
  651. </select>
  652. <select id="findPolicyAppCount" resultType="java.lang.Integer">
  653. select count(*)
  654. from policy p
  655. </select>
  656. <select id="selectPolicyDetail" resultType="com.goafanti.news.bo.PolicyResult">
  657. select
  658. p.title,
  659. p.author,
  660. p.audit_status as auditStatus,
  661. p.edit_time as editTime,
  662. p.create_time as createTime,
  663. p.id,
  664. p.source,
  665. p.release_date as releaseDate,
  666. p.title_img as titleImg ,
  667. p.content,
  668. p.summary,
  669. dg.name as provinceS,
  670. dgg.name as cityS
  671. from policy p
  672. left join district_glossory dg on dg.id =p.province
  673. left join district_glossory dgg on dgg.id=p.city
  674. where p.id= #{id,jdbcType=VARCHAR}
  675. </select>
  676. <!-- 获得所有的政策和新闻等内容 -->
  677. <select id="searchPolicyAndNewsList" parameterType="Map" resultType="com.goafanti.news.bo.PolicyResult">
  678. select * from (
  679. select p.title, p.author, p.audit_status as auditStatus,
  680. p.edit_time as editTime, p.id, p.source, p.release_date as releaseDate,
  681. p.title_img as titleImg , p.content, p.summary, dg.name as provinceS, 0 `type`
  682. , p.hot
  683. from policy p
  684. left join district_glossory dg on dg.id =p.province
  685. where p.audit_status =2
  686. <if test="policy.title != null ">
  687. and p.title like concat('%',#{policy.title,jdbcType=VARCHAR},'%')
  688. </if>
  689. <if test="policy.province != null">
  690. and p.province = #{policy.province,jdbcType=INTEGER}
  691. </if>
  692. union
  693. select n.title, n.author, n.audit_status as auditStatus,
  694. n.edit_time as editTime, n.id, n.source, n.release_date as releaseDate,
  695. n.title_img as titleImg, n.content, n.summary, dg.name as provinceS, 1 `type`
  696. ,n.hotspot
  697. from news n
  698. left join district_glossory dg on dg.id = n.province_id
  699. where audit_status = 2
  700. <if test="policy.title != null ">
  701. and title like concat('%',#{policy.title,jdbcType=VARCHAR},'%')
  702. </if>
  703. <if test="policy.province != null">
  704. and province_id = #{policy.province,jdbcType=INTEGER}
  705. </if>
  706. ) a order by releaseDate desc
  707. <if test="page_sql!=null">
  708. ${page_sql}
  709. </if>
  710. </select>
  711. <select id="searchPolicyAndNewsCount" parameterType="Map" resultType="java.lang.Integer">
  712. select count(*) from (
  713. select p.id
  714. from policy p
  715. left join district_glossory dg on dg.id =p.province
  716. where p.audit_status =2
  717. <if test="policy.title != null ">
  718. and p.title like concat('%',#{policy.title,jdbcType=VARCHAR},'%')
  719. </if>
  720. <if test="policy.province != null">
  721. and p.province = #{policy.province,jdbcType=INTEGER}
  722. </if>
  723. union
  724. select n.id
  725. from news n
  726. left join district_glossory dg on dg.id = n.province_id
  727. where audit_status = 2
  728. <if test="policy.title != null ">
  729. and title like concat('%',#{policy.title,jdbcType=VARCHAR},'%')
  730. </if>
  731. <if test="policy.province != null">
  732. and province_id = #{policy.province,jdbcType=INTEGER}
  733. </if>
  734. ) a
  735. </select>
  736. </mapper>