NewPageFloorMapper.xml 6.0 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.newhome.dao.NewPageFloorDao">
  4. <sql id="newPageFloorColumns">
  5. a.id AS "id",
  6. a.floorTitle AS "floorTitle",
  7. a.floorDetail AS "floorDetail",
  8. a.type AS "type",
  9. a.sort AS "sort",
  10. a.wwwEnabledStatus AS "wwwEnabledStatus",
  11. a.crmEnabledStatus AS "crmEnabledStatus",
  12. a.createBy AS "createBy.id",
  13. a.createDate AS "createDate",
  14. a.updateBy AS "updateBy.id",
  15. a.updateDate AS "updateDate",
  16. a.delFlag AS "delFlag"
  17. </sql>
  18. <sql id="newPageFloorJoins">
  19. </sql>
  20. <select id="get" resultType="NewPageFloor">
  21. SELECT
  22. <include refid="newPageFloorColumns"/>
  23. FROM new_page_floor a
  24. <include refid="newPageFloorJoins"/>
  25. WHERE a.id = #{id}
  26. </select>
  27. <select id="findList" resultType="NewPageFloor">
  28. SELECT
  29. <include refid="newPageFloorColumns"/>
  30. FROM new_page_floor a
  31. <include refid="newPageFloorJoins"/>
  32. <where>
  33. AND delFlag = 0
  34. </where>
  35. <choose>
  36. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  37. ORDER BY ${page.orderBy}
  38. </when>
  39. <otherwise>
  40. </otherwise>
  41. </choose>
  42. </select>
  43. <select id="findAllList" resultType="NewPageFloor">
  44. SELECT
  45. <include refid="newPageFloorColumns"/>
  46. FROM new_page_floor a
  47. <include refid="newPageFloorJoins"/>
  48. <where>
  49. </where>
  50. <choose>
  51. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  52. ORDER BY ${page.orderBy}
  53. </when>
  54. <otherwise>
  55. </otherwise>
  56. </choose>
  57. </select>
  58. <insert id="insert" parameterType="NewPageFloor" keyProperty="id" useGeneratedKeys="true">
  59. INSERT INTO new_page_floor(
  60. floorTitle,
  61. floorDetail,
  62. type,
  63. <if test="sort != null and sort != ''" >
  64. sort,
  65. </if>
  66. wwwEnabledStatus,
  67. crmEnabledStatus,
  68. createBy,
  69. createDate,
  70. updateBy,
  71. updateDate,
  72. delFlag
  73. ) VALUES (
  74. #{floorTitle},
  75. #{floorDetail},
  76. #{type},
  77. <if test="sort != null and sort != ''" >
  78. #{sort},
  79. </if>
  80. #{wwwEnabledStatus},
  81. #{crmEnabledStatus},
  82. #{createBy.id},
  83. #{createDate},
  84. #{updateBy.id},
  85. #{updateDate},
  86. #{delFlag}
  87. )
  88. </insert>
  89. <update id="update">
  90. UPDATE new_page_floor SET
  91. floorTitle = #{floorTitle},
  92. floorDetail = #{floorDetail},
  93. type = #{type},
  94. sort = #{sort},
  95. wwwEnabledStatus = #{wwwEnabledStatus},
  96. crmEnabledStatus = #{crmEnabledStatus},
  97. createBy = #{createBy.id},
  98. createDate = #{createDate},
  99. updateBy = #{updateBy.id},
  100. updateDate = #{updateDate},
  101. delFlag = #{delFlag}
  102. WHERE id = #{id}
  103. </update>
  104. <delete id="delete">
  105. UPDATE new_page_floor SET delFlag = 1
  106. WHERE id = #{id}
  107. </delete>
  108. <update id="updateEnabledStatusByIds">
  109. UPDATE new_page_floor a SET a.wwwEnabledStatus = #{param1}
  110. WHERE a.id IN
  111. <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
  112. #{id}
  113. </foreach>
  114. </update>
  115. <update id="updateCrmEnabledStatusByIds">
  116. UPDATE new_page_floor a SET a.crmEnabledStatus = #{param1}
  117. WHERE a.id IN
  118. <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
  119. #{id}
  120. </foreach>
  121. </update>
  122. <update id="saveSort">
  123. UPDATE new_page_floor SET
  124. sort = #{sort}
  125. WHERE id = #{id}
  126. </update>
  127. <select id="findFloorContentByfloorId" resultType="com.caimei.modules.newhome.entity.NewPageFloorContent">
  128. SELECT
  129. npfc.*,
  130. npf.floorTitle AS floorTitle
  131. FROM
  132. new_page_floor npf
  133. LEFT JOIN new_page_floor_content npfc ON npfc.floorId = npf.id
  134. WHERE
  135. npf.id = #{floorId}
  136. </select>
  137. <select id="findFloorImage" resultType="com.caimei.modules.newhome.entity.NewPageFloorImage">
  138. SELECT
  139. id,
  140. floorId,
  141. productId,
  142. `name`,
  143. content,
  144. link,
  145. image,
  146. appletsImage,
  147. adsImage,
  148. `label`,
  149. pcStatus,
  150. appletsStatus,
  151. sort,
  152. DATE_FORMAT(createDate,'%Y-%m-%d %H:%i:%S') AS createDate
  153. FROM
  154. new_page_floor_image
  155. WHERE
  156. floorId = #{floorId}
  157. </select>
  158. <insert id="insertFloorContent">
  159. INSERT INTO `new_page_floor_content` (
  160. `floorId`, `templateType`, `pcAdsImage1`,
  161. `pcAdsImage2`, `pcAdsImage3`, `pcAdsImage4`, `pcAdsImage5`, `appletsAdsImage1`,
  162. `appletsAdsImage2`, `appletsAdsImage3`,`appletsAdsImage4`, `appletsAdsImage5`,adsLink1,
  163. adsLink2, adsLink3,adsLink4, adsLink5, centreId
  164. )
  165. VALUES
  166. (
  167. #{floorId}, #{templateType}, #{pcAdsImage1},
  168. #{pcAdsImage2}, #{pcAdsImage3},#{pcAdsImage4}, #{pcAdsImage5}, #{appletsAdsImage1},
  169. #{appletsAdsImage2}, #{appletsAdsImage3}, #{appletsAdsImage4}, #{appletsAdsImage5}, #{adsLink1},
  170. #{adsLink2}, #{adsLink3}, #{adsLink4}, #{adsLink5}, #{centreId}
  171. )
  172. </insert>
  173. <update id="updateFloorContent">
  174. UPDATE
  175. `new_page_floor_content`
  176. SET
  177. `floorId` = #{floorId},
  178. `centreId` = #{centreId},
  179. `templateType` = #{templateType},
  180. `pcAdsImage1` = #{pcAdsImage1},
  181. `pcAdsImage2` = #{pcAdsImage2},
  182. `pcAdsImage3` = #{pcAdsImage3},
  183. `pcAdsImage4` = #{pcAdsImage4},
  184. `pcAdsImage5` = #{pcAdsImage5},
  185. `appletsAdsImage1` = #{appletsAdsImage1},
  186. `appletsAdsImage2` = #{appletsAdsImage2},
  187. `appletsAdsImage3` = #{appletsAdsImage3},
  188. `appletsAdsImage4` = #{appletsAdsImage4},
  189. `appletsAdsImage5` = #{appletsAdsImage5},
  190. `adsLink1` = #{adsLink1},
  191. `adsLink2` = #{adsLink2},
  192. `adsLink3` = #{adsLink3},
  193. `adsLink4` = #{adsLink4},
  194. `adsLink5` = #{adsLink5}
  195. WHERE `id` = #{id}
  196. </update>
  197. <delete id="deleteFloorImage">
  198. DELETE FROM
  199. new_page_floor_image
  200. WHERE
  201. <if test="status == 1">
  202. floorId = #{floorId}
  203. </if>
  204. <if test="status == 2">
  205. centreId = #{floorId}
  206. </if>
  207. </delete>
  208. <insert id="insertFloorImage">
  209. INSERT INTO `new_page_floor_image` (
  210. `floorId`, `productId`, `name`, `link`,
  211. `image`,`appletsImage`, `adsImage`, `label`, `content`, `pcStatus`, `appletsStatus`,
  212. `sort`, `createDate`, centreId
  213. )
  214. VALUES
  215. (
  216. #{floorId}, #{productId}, #{name}, #{link},
  217. #{image},#{appletsImage}, #{adsImage}, #{label}, #{content}, #{pcStatus}, #{appletsStatus},
  218. #{sort}, #{createDate}, #{centreId}
  219. )
  220. </insert>
  221. </mapper>