PolicyMapper.xml 22 KB

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