CmPageMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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.caimei.modules.cmpage.dao.CmPageDao">
  4. <sql id="cmPageColumns">
  5. a.id AS "id",
  6. a.type AS "type",
  7. a.typeSort AS "typeSort",
  8. a.title AS "title",
  9. a.keywords AS "keywords",
  10. a.description AS "description",
  11. a.precisehKey AS "precisehKey",
  12. a.docBoost AS "docBoost",
  13. a.headImage AS "headImage",
  14. a.crmHeadImage AS "crmHeadImage",
  15. a.headLink AS "headLink",
  16. a.headText AS "headText",
  17. a.bottomImage AS "bottomImage",
  18. a.crmBottomImage1 AS "crmBottomImage1",
  19. a.crmBottomImage2 AS "crmBottomImage2",
  20. a.bottomText AS "bottomText",
  21. a.buttonName AS "buttonName",
  22. a.buttonLink AS "buttonLink",
  23. a.enabledStatus AS "enabledStatus",
  24. a.createBy AS "createBy.id",
  25. a.createDate AS "createDate",
  26. a.updateBy AS "updateBy.id",
  27. a.updateDate AS "updateDate",
  28. a.backgroundType AS "backgroundType",
  29. a.backgroundColour AS "backgroundColour",
  30. a.backgroundImage AS "backgroundImage",
  31. a.backgroundImageWay AS "backgroundImageWay",
  32. a.redPacketBeginTime,
  33. a.redPacketEndTime,
  34. a.infoBarStatus
  35. </sql>
  36. <sql id="cmPageJoins">
  37. </sql>
  38. <select id="get" resultType="CmPage">
  39. SELECT
  40. <include refid="cmPageColumns"/>
  41. FROM cm_page a
  42. <include refid="cmPageJoins"/>
  43. WHERE a.id = #{id}
  44. </select>
  45. <select id="findList" resultType="CmPage">
  46. SELECT
  47. <include refid="cmPageColumns"/>
  48. FROM cm_page a
  49. <include refid="cmPageJoins"/>
  50. <where>
  51. <if test="id != null and id != ''">
  52. AND a.id = #{id}
  53. </if>
  54. <if test="type != null and type != ''">
  55. AND a.type = #{type}
  56. </if>
  57. <if test="title != null and title != ''">
  58. AND a.title LIKE
  59. <if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
  60. <if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
  61. <if test="dbName == 'mysql'">concat('%',#{title},'%')</if>
  62. </if>
  63. <if test="enabledStatus != null and enabledStatus != ''">
  64. AND a.enabledStatus = #{enabledStatus}
  65. </if>
  66. <if test="sqlMap !=null and sqlMap !=''">
  67. ${sqlMap.pageType}
  68. </if>
  69. </where>
  70. <choose>
  71. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  72. ORDER BY ${page.orderBy}
  73. </when>
  74. <otherwise>
  75. ORDER BY enabledStatus DESC,createDate DESC
  76. </otherwise>
  77. </choose>
  78. </select>
  79. <select id="findAllList" resultType="CmPage">
  80. SELECT
  81. <include refid="cmPageColumns"/>
  82. FROM cm_page a
  83. <include refid="cmPageJoins"/>
  84. <where>
  85. </where>
  86. <choose>
  87. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  88. ORDER BY ${page.orderBy}
  89. </when>
  90. <otherwise>
  91. </otherwise>
  92. </choose>
  93. </select>
  94. <insert id="insert" parameterType="CmPage" keyProperty="id" useGeneratedKeys="true">
  95. INSERT INTO cm_page(
  96. type,
  97. title,
  98. typeSort,
  99. keywords,
  100. description,
  101. precisehKey,
  102. docBoost,
  103. headImage,
  104. crmHeadImage,
  105. headLink,
  106. headText,
  107. bottomImage,
  108. crmBottomImage1,
  109. crmBottomImage2,
  110. bottomText,
  111. buttonName,
  112. buttonLink,
  113. enabledStatus,
  114. createBy,
  115. createDate,
  116. updateBy,
  117. updateDate,
  118. backgroundType,
  119. backgroundColour,
  120. backgroundImage,
  121. backgroundImageWay,
  122. redPacketBeginTime,
  123. redPacketEndTime,
  124. infoBarStatus
  125. ) VALUES (
  126. #{type},
  127. #{title},
  128. #{typeSort},
  129. #{keywords},
  130. #{description},
  131. #{precisehKey},
  132. #{docBoost},
  133. #{headImage},
  134. #{crmHeadImage},
  135. #{headLink},
  136. #{headText},
  137. #{bottomImage},
  138. #{crmBottomImage1},
  139. #{crmBottomImage2},
  140. #{bottomText},
  141. #{buttonName},
  142. #{buttonLink},
  143. #{enabledStatus},
  144. #{createBy.id},
  145. #{createDate},
  146. #{updateBy.id},
  147. #{updateDate},
  148. #{backgroundType},
  149. #{backgroundColour},
  150. #{backgroundImage},
  151. #{backgroundImageWay},
  152. #{redPacketBeginTime},
  153. #{redPacketEndTime},
  154. #{infoBarStatus}
  155. )
  156. </insert>
  157. <update id="update">
  158. UPDATE cm_page SET
  159. title = #{title},
  160. typeSort = #{typeSort},
  161. keywords = #{keywords},
  162. description = #{description},
  163. precisehKey = #{precisehKey},
  164. docBoost = #{docBoost},
  165. headImage = #{headImage},
  166. crmHeadImage = #{crmHeadImage},
  167. headLink = #{headLink},
  168. headText = #{headText},
  169. bottomImage = #{bottomImage},
  170. crmBottomImage1 = #{crmBottomImage1},
  171. crmBottomImage2 = #{crmBottomImage2},
  172. bottomText = #{bottomText},
  173. buttonName = #{buttonName},
  174. buttonLink = #{buttonLink},
  175. enabledStatus = #{enabledStatus},
  176. createBy = #{createBy.id},
  177. createDate = #{createDate},
  178. updateBy = #{updateBy.id},
  179. updateDate = #{updateDate},
  180. backgroundType = #{backgroundType},
  181. backgroundColour = #{backgroundColour},
  182. backgroundImage = #{backgroundImage},
  183. backgroundImageWay = #{backgroundImageWay},
  184. redPacketBeginTime = #{redPacketBeginTime},
  185. redPacketEndTime = #{redPacketEndTime},
  186. infoBarStatus = #{infoBarStatus}
  187. WHERE id = #{id}
  188. </update>
  189. <delete id="delete">
  190. DELETE FROM cm_page
  191. WHERE id = #{id}
  192. </delete>
  193. <update id="updateEnabledStatusByIds">
  194. UPDATE cm_page a SET a.enabledStatus = #{param1}
  195. WHERE a.id IN
  196. <foreach collection="param2" item="id" index="index" open="(" separator="," close=")">
  197. #{id}
  198. </foreach>
  199. </update>
  200. <select id="getHotSearch" resultType="com.caimei.modules.cmpage.entity.CmPageHotSearch">
  201. SELECT * FROM cm_page_hot_search WHERE id = #{id}
  202. </select>
  203. <delete id="delectHotSearch">
  204. DELETE FROM cm_page_hot_search WHERE pageId = #{pageId}
  205. </delete>
  206. <insert id="insertHotSearch">
  207. INSERT INTO `cm_page_hot_search` (
  208. `pageId`, `name`, `link`, `sort`, `pcStatus`,
  209. `appletsStatus`, `isHot`, `creationTime`
  210. )
  211. VALUES
  212. (
  213. #{pageId}, #{name}, #{link}, #{sort}, #{pcStatus},
  214. #{appletsStatus}, #{isHot}, now()
  215. )
  216. </insert>
  217. <select id="findHotSearch" resultType="com.caimei.modules.cmpage.entity.CmPageHotSearch">
  218. SELECT * FROM cm_page_hot_search WHERE pageId = #{pageId}
  219. </select>
  220. </mapper>