ContentDao.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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="platform.modules.government.dao.ContentDao">
  4. <select id="findContents" resultType="platform.modules.government.entity.Content">
  5. SELECT
  6. a.title,a.brief,a.id,a.create_time
  7. FROM z_content a
  8. where a.navigation_id =#{request.id} and a.del_flag=0
  9. and a.is_start=1
  10. <if test="request.keyword!=null and request.keyword!=''">
  11. and (a.title LIKE CONCAT ('%',#{ request.keyword},'%')
  12. or a.brief LIKE CONCAT ('%',#{ request.keyword},'%') )
  13. </if>
  14. order by a.is_top desc,a.sort asc, a.create_time desc
  15. limit #{request.start},#{request.page_size}
  16. </select>
  17. <select id="findContentsCount" resultType="integer">
  18. SELECT
  19. count(0)
  20. FROM z_content a
  21. where a.navigation_id =#{request.id}
  22. and a.del_flag=0
  23. and a.is_start=1
  24. <if test="request.keyword!=null and request.keyword!=''">
  25. and (a.title LIKE CONCAT ('%',#{ request.keyword},'%')
  26. or a.brief LIKE CONCAT ('%',#{ request.keyword},'%') )
  27. </if>
  28. </select>
  29. <select id="findContentsByNavigationId" resultType="platform.modules.government.entity.Content">
  30. SELECT
  31. a.id,a.title
  32. FROM z_content a
  33. where a.navigation_id =2
  34. and a.del_flag=0
  35. and a.is_start=1
  36. order by a.is_top desc,a.sort asc, a.create_time desc
  37. </select>
  38. <select id="countContent" resultType="integer">
  39. SELECT
  40. count(0)
  41. FROM z_content a
  42. where a.navigation_id =1
  43. and a.del_flag=0
  44. and a.is_start=1
  45. </select>
  46. <select id="findContentsByNavigationIdForIndex" resultType="platform.modules.government.entity.Content">
  47. SELECT
  48. a.id,
  49. a.title,
  50. a.create_time publish_time
  51. FROM
  52. z_content a
  53. WHERE
  54. a.navigation_id = #{id}
  55. AND a.del_flag = 0
  56. AND a.is_start = 1
  57. ORDER BY
  58. a.is_top DESC,
  59. a.sort ASC,
  60. a.create_time DESC
  61. LIMIT 5
  62. </select>
  63. <select id="findContentList" resultType="platform.modules.government.entity.Content">
  64. SELECT
  65. a.title,a.brief,a.id,a.create_time,a.content
  66. FROM z_content a
  67. where a.navigation_id =#{request.id} and a.del_flag=0
  68. and a.is_start=1
  69. <if test="request.keyword!=null and request.keyword!=''">
  70. and (a.title LIKE CONCAT ('%',#{ request.keyword},'%')
  71. or a.brief LIKE CONCAT ('%',#{ request.keyword},'%') )
  72. </if>
  73. order by a.is_top desc,a.sort asc, a.create_time desc
  74. </select>
  75. <select id="searchGlobal" resultType="platform.modules.home.dto.SearchGlobalDto">
  76. SELECT
  77. id,
  78. title,
  79. content,
  80. type,
  81. create_time
  82. FROM
  83. (
  84. SELECT
  85. content.id id,
  86. content.title title,
  87. content.content content,
  88. "content" type,
  89. content.create_time create_time
  90. FROM
  91. z_content content
  92. WHERE
  93. content.del_flag = 0 UNION ALL
  94. SELECT
  95. activity.id id,
  96. activity.activity_title title,
  97. activity.content content,
  98. "activity" type,
  99. activity.create_time create_time
  100. FROM
  101. ac_activity_detail activity
  102. WHERE
  103. activity.del_flag = 0
  104. ) temp
  105. WHERE
  106. 1 = 1
  107. <if test="keyword != null and keyword != ''">
  108. AND ( title LIKE CONCAT ( '%', #{keyword}, '%' ) OR content LIKE CONCAT ( '%', #{keyword}, '%' ) )
  109. </if>
  110. ORDER BY
  111. create_time DESC
  112. </select>
  113. </mapper>