CmPageMapper.xml 6.3 KB

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