PageMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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.caimei365.commodity.mapper.PageMapper">
  4. <select id="getPageTypeSort" resultType="java.lang.Integer">
  5. select typeSort from cm_page
  6. where id = #{pageId} and enabledStatus = '1'
  7. </select>
  8. <select id="getHotSearchByPageId" resultType="com.caimei365.commodity.model.vo.HotSearchVo">
  9. select
  10. id, pageId, name, isHot, link, pcStatus, sort, appletsStatus, creationTime
  11. from
  12. cm_page_hot_search
  13. where
  14. pageId = #{pageId}
  15. <if test="source == 1">
  16. and pcStatus = 1
  17. </if>
  18. <if test="source == 2">
  19. and appletsStatus = 1
  20. </if>
  21. order by -sort desc, creationTime desc
  22. </select>
  23. <select id="getHomePageFloor" resultType="com.caimei365.commodity.model.vo.PageFloorVo">
  24. select id, type, floorTitle as title, floorDetail as detail
  25. from new_page_floor
  26. where delFlag = 0
  27. <if test="source == 1">
  28. AND wwwEnabledStatus = 1
  29. </if>
  30. <if test="source == 2">
  31. AND crmEnabledStatus = 1
  32. </if>
  33. order by -sort desc,createDate desc
  34. </select>
  35. <select id="getFloorByPageId" resultType="com.caimei365.commodity.model.vo.PageFloorVo">
  36. select id, title ,description as detail
  37. from cm_page_centre
  38. where pageId = #{pageId}
  39. <if test="source == 1">
  40. and enabledStatus = 1
  41. </if>
  42. <if test="source == 2">
  43. and crmEnabledStatus = 1
  44. </if>
  45. order by -sort desc, createDate desc
  46. </select>
  47. <select id="getFloorContentById" resultType="com.caimei365.commodity.model.vo.FloorContentVo">
  48. select
  49. id, floorId, centreId, templateType, pcAdsImage1, pcAdsImage2, pcAdsImage3,pcAdsImage4,pcAdsImage5,
  50. appletsAdsImage1, appletsAdsImage2, appletsAdsImage3, appletsAdsImage4, appletsAdsImage5, adsLink1, adsLink2, adsLink3
  51. from new_page_floor_content where floorId = #{id}
  52. </select>
  53. <select id="getFloorImageById" resultType="com.caimei365.commodity.model.vo.FloorImageVo">
  54. select
  55. id, floorId, centreId, productId, name, link, image, appletsImage, label, pcStatus, appletsStatus, sort, createDate
  56. from new_page_floor_image
  57. where floorId = #{id}
  58. <if test="source == 1">
  59. and pcStatus = 1
  60. </if>
  61. <if test="source == 2">
  62. and appletsStatus = 1
  63. </if>
  64. order by -sort desc, createDate desc
  65. </select>
  66. <select id="getFloorContentByCentreId" resultType="com.caimei365.commodity.model.vo.FloorContentVo">
  67. select id,
  68. floorId,
  69. centreId,
  70. templateType,
  71. pcAdsImage1,
  72. pcAdsImage2,
  73. pcAdsImage3,
  74. pcAdsImage4,
  75. pcAdsImage5,
  76. appletsAdsImage1,
  77. appletsAdsImage2,
  78. appletsAdsImage3,
  79. appletsAdsImage4,
  80. appletsAdsImage5,
  81. adsLink1,
  82. adsLink2,
  83. adsLink3,
  84. adsLink4,
  85. adsLink5,
  86. displayDate1,
  87. displayDate2,
  88. displayDate3
  89. from new_page_floor_content
  90. where centreId = #{id}
  91. </select>
  92. <select id="getFloorImageByCentreId" resultType="com.caimei365.commodity.model.vo.FloorImageVo">
  93. select
  94. id, floorId, centreId, productId, name, link, image, appletsImage,adsImage, label,content, pcStatus, appletsStatus, sort,displaySort, createDate
  95. from new_page_floor_image
  96. where centreId = #{id}
  97. <if test="source == 1">
  98. and pcStatus = 1
  99. </if>
  100. <if test="source == 2">
  101. and appletsStatus = 1
  102. </if>
  103. order by -sort desc, createDate desc
  104. </select>
  105. <select id="getProductItemById" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
  106. select
  107. p.productID as productId,
  108. p.actStatus,
  109. p.name,
  110. p.aliasName,
  111. p.mainImage as image,
  112. p.unit,
  113. p.productCode as code,
  114. p.price1TextFlag as priceFlag,
  115. p.price1 as price,
  116. p.shopID as shopId,
  117. p.searchKey as keyword,
  118. p.price8Text as beautyActFlag,
  119. p.minBuyNumber as minBuyNumber,
  120. p.maxBuyNumber as maxBuyNumber,
  121. p.ladderPriceFlag,
  122. p.normalPrice,
  123. p.step,
  124. p.shopID as shopId,
  125. p.taxPoint as taxRate,
  126. p.includedTax,
  127. p.invoiceType,
  128. p.productCategory as productCategory,
  129. p.validFlag,
  130. p.featuredFlag,
  131. p.commodityType,
  132. p.bigTypeID as bigTypeId,
  133. p.smallTypeID as smallTypeId,
  134. p.tinyTypeID as tinyTypeId,
  135. p.visibility as visibility,
  136. cshd.detailTalkFlag as detailTalkFlag
  137. from product p
  138. left join cm_second_hand_detail cshd on p.productID = cshd.productID
  139. where p.productID = #{productId} and p.validFlag = 2
  140. </select>
  141. <select id="getSupplierFloorImage" resultType="com.caimei365.commodity.model.vo.ShopFloorVo">
  142. select id, crmImage, wwwImage, wwwLink
  143. from new_page_quality_supplier_image
  144. limit 1
  145. </select>
  146. <select id="getSupplierImage" resultType="com.caimei365.commodity.model.vo.ShopImageVo">
  147. select
  148. id, supplierName, image, link, sort, wwwEnabledStatus, crmEnabledStatus,
  149. createBy, createDate, updateBy, updateDate, delFlag
  150. from
  151. new_page_quality_supplier
  152. where
  153. delFlag = 0
  154. <if test="source == 1">
  155. and wwwEnabledStatus = 1
  156. </if>
  157. <if test="source == 2">
  158. and crmEnabledStatus = 1
  159. </if>
  160. order by - sort desc,createDate desc
  161. </select>
  162. <select id="getProductDetails" resultType="com.caimei365.commodity.model.vo.ProductDetailVo">
  163. select productID as productId, shopID as shopId, name, aliasName, commodityType, mainImage, stock, invoiceType,
  164. bigTypeID as bigTypeId, smallTypeID as smallTypeId, tinyTypeID as tinyTypeId, searchKey, visibility,
  165. brandID as brandId, productType, tags, unit, normalPrice, price1 as price, includedTax, minBuyNumber,
  166. productCategory, serviceNumber, taxPoint, supplierTaxPoint, price1TextFlag as priceFlag, actFlag, ladderPriceFlag,
  167. addTime, hasSkuFlag, sellNumber, sortIndex, featuredFlag, costCheckFlag, recommendType, machineType,
  168. productCode, updateTime, validFlag, searchKey, allAreaFlag, step, costPrice, provinceIds, qualificationImg,
  169. trainingMethod, trainingType ,trainingFee
  170. from product
  171. where productID = #{productId}
  172. </select>
  173. <select id="getBuyAgainProducts" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
  174. select
  175. p.productID as productId,
  176. p.actStatus,
  177. p.name,
  178. p.aliasName,
  179. p.mainImage as image,
  180. p.unit,
  181. p.productCode as code,
  182. p.price1TextFlag as priceFlag,
  183. p.price1 as price,
  184. p.costPrice,
  185. p.costCheckFlag,
  186. p.shopID as shopId,
  187. p.searchKey as keyword,
  188. p.price8Text as beautyActFlag,
  189. p.minBuyNumber as minBuyNumber,
  190. p.maxBuyNumber as maxBuyNumber,
  191. p.ladderPriceFlag,
  192. p.normalPrice,
  193. p.step,
  194. p.shopID as shopId,
  195. p.taxPoint as taxRate,
  196. p.includedTax,
  197. p.invoiceType,
  198. p.productCategory as productCategory,
  199. p.validFlag,
  200. p.featuredFlag,
  201. p.commodityType,
  202. p.bigTypeID as bigTypeId,
  203. p.smallTypeID as smallTypeId,
  204. p.tinyTypeID as tinyTypeId,
  205. rpp.currentPrice as discountPrice
  206. from
  207. repeat_purchase_price rpp
  208. left join product p on rpp.productId = p.productID
  209. where rpp.delFlag = '0' and p.validFlag='2'
  210. and rpp.userId = #{userId}
  211. order by rpp.createTime desc
  212. </select>
  213. <select id="getEquipmentById" resultType="com.caimei365.commodity.model.vo.EquipmentVo">
  214. select id, type, title, keywords, description, headImage as image
  215. from cm_page
  216. where id = #{equipmentId} and type='2' and enabledStatus=1
  217. </select>
  218. <select id="getEquipmentParametersByType" resultType="com.caimei365.commodity.model.vo.EquipmentParameterVo">
  219. select id, pageId as parentId, name, content, type
  220. from cm_page_name_content
  221. where pageId = #{equipmentId}
  222. and type = #{typeId}
  223. </select>
  224. <select id="getImageLinkByFloorId" resultType="com.caimei365.commodity.model.vo.ImageLinkVo">
  225. select a.id,
  226. a.title,
  227. a.link,
  228. a.image
  229. from cm_page_image a
  230. right join cm_page_centre_image b on b.imageId=a.id
  231. where b.centreId=#{floorId} and a.enabledStatus=1
  232. order by a.sort desc,a.createDate desc
  233. </select>
  234. <select id="getProductRecommendsById" resultType="com.caimei365.commodity.model.search.ProductListVo">
  235. select
  236. p.productID as productId,
  237. p.actStatus,
  238. p.`name` as `name`,
  239. p.mainImage as image,
  240. IFNULL(p.visibility,3) as visibility
  241. from product as p
  242. left join cm_product_recommend as pr on pr.recommendProductID = p.productID
  243. where
  244. pr.productID = #{productId} and p.validFlag = 2
  245. order by pr.sort desc
  246. </select>
  247. <select id="getAutoProductRecommends" resultType="com.caimei365.commodity.model.search.ProductListVo">
  248. select
  249. p.productID as productId,
  250. p.actStatus,
  251. p.`name` as `name`,
  252. p.mainImage as image,
  253. IFNULL(p.visibility,3) as visibility
  254. from product as p
  255. where p.validFlag = 2
  256. and p.commodityType = (select commodityType from product as p1 where p1.productID = #{productId})
  257. and p.smallTypeID = (select smallTypeID from product as p2 where p2.productID = #{productId})
  258. order by p.sellNumber desc limit 0,7
  259. </select>
  260. <select id="findCmPageById" resultType="com.caimei365.commodity.model.vo.CmPageVo">
  261. select id,
  262. type,
  263. title,
  264. keywords,
  265. description,
  266. headImage,
  267. crmHeadImage,
  268. headLink,
  269. headText,
  270. redPacketBeginTime,
  271. redPacketEndTime,
  272. infoBarStatus
  273. from cm_page
  274. where id = #{pageId}
  275. and enabledStatus = '1'
  276. </select>
  277. <select id="getSearchKeyword" resultType="java.lang.String">
  278. select name from keyword
  279. where validFlag=1
  280. order by sortIndex desc
  281. </select>
  282. <select id="getTopMenus" resultType="com.caimei365.commodity.model.vo.TopMenuVo">
  283. select
  284. id,
  285. navigationName as name,
  286. type,
  287. link,
  288. icon,
  289. sort
  290. from new_page_first_navigation
  291. where delFlag = 0
  292. <if test="source == 1">
  293. and wwwEnabledStatus = 1
  294. </if>
  295. <if test="source == 2">
  296. and crmEnabledStatus = 1
  297. </if>
  298. order by -sort desc,createDate desc
  299. limit 8
  300. </select>
  301. <select id="getHelpPageTypes" resultType="com.caimei365.commodity.model.vo.BaseLinkVo">
  302. select
  303. c_helpPageTypeID as id,
  304. c_helpPageTypeName as name
  305. from c_helpPageType
  306. </select>
  307. <select id="getHelpPagesByType" resultType="com.caimei365.commodity.model.vo.BaseLinkVo">
  308. select
  309. helpPageID as id,
  310. helpPageTypeID as typeId,
  311. title as name
  312. from helpPage
  313. where validFlag = 1
  314. and helpPageTypeID = #{typeId}
  315. order by sortIndex
  316. </select>
  317. <select id="getFriendLinks" resultType="com.caimei365.commodity.model.vo.BaseLinkVo">
  318. select id,name,link
  319. from new_page_friendship_link
  320. where delFlag = 0 order by id
  321. </select>
  322. <select id="getMaintenanceIdByCode" resultType="java.lang.Integer">
  323. select cmInstrumentMaintenanceId from cm_instrument_maintenance_links where linkCode = #{code}
  324. </select>
  325. <select id="getMaintenanceById" resultType="com.caimei365.commodity.model.vo.ProductRepairVo">
  326. SELECT
  327. a.id AS "id",
  328. a.orderNo AS "orderNo",
  329. a.userId AS "userId",
  330. a.instrumentName AS "instrumentName",
  331. a.manufacturer AS "manufacturer",
  332. a.instrumentBrand AS "instrumentBrand",
  333. a.maintenanceNum AS "maintenanceNum",
  334. a.instrumentImage1 AS "instrumentImage1",
  335. a.instrumentImage2 AS "instrumentImage2",
  336. a.instrumentImage3 AS "instrumentImage3",
  337. a.instrumentImage4 AS "instrumentImage4",
  338. a.instrumentImage5 AS "instrumentImage5",
  339. a.problemDescription AS "problemDescription",
  340. a.userAccount AS "userAccount",
  341. a.userName AS "userName",
  342. a.userContact AS "userContact",
  343. a.userMobile AS "userMobile",
  344. concat(a.provinceName, a.cityName, a.townName, a.userAddress) AS userAddress,
  345. a.maintainerName AS "maintainerName",
  346. a.maintainerMobile AS "maintainerMobile",
  347. a.maintainerAddress AS "maintainerAddress",
  348. a.status AS "status",
  349. a.authenticity AS "authenticity",
  350. a.serviceRating AS "serviceRating",
  351. a.serviceEvaluate AS "serviceEvaluate",
  352. a.solveStatus AS "solveStatus",
  353. a.cancelReason AS "cancelReason",
  354. a.submitDate AS "submitDate",
  355. a.dockingDate AS "dockingDate",
  356. a.evaluateDate AS "evaluateDate",
  357. a.cancelDate AS "cancelDate",
  358. a.provinceName AS "provinceName",
  359. a.cityName AS "cityName",
  360. a.townName AS "townName",
  361. b.type AS "viewerType"
  362. FROM cm_instrument_maintenance a
  363. LEFT JOIN cm_instrument_maintenance_links b on a.id = b.cmInstrumentMaintenanceId
  364. WHERE a.id = #{id}
  365. limit 1
  366. </select>
  367. <select id="findAllCoupon" resultType="com.caimei365.commodity.model.vo.CouponVo">
  368. SELECT
  369. `id` AS "couponId",
  370. `couponAmount`,
  371. `touchPrice`,
  372. `startDate`,
  373. `endDate`,
  374. `couponType`,
  375. `userId`,
  376. `shopId`,
  377. `productType`,
  378. `categoryType`
  379. FROM
  380. cm_coupon
  381. WHERE
  382. delFlag = 0
  383. AND NOW() BETWEEN startDate
  384. AND endDate
  385. AND status != 2
  386. AND couponsMode = 0
  387. <if test="userId > 0">
  388. AND (couponType IN (0,1,3)
  389. OR couponType = 2 AND userId = #{userId}
  390. OR (SELECT registerTime FROM USER WHERE userID = #{userId}) <![CDATA[ >= ]]> startDate)
  391. </if>
  392. ORDER BY
  393. createDate DESC
  394. </select>
  395. <select id="findAllProductId" resultType="integer">
  396. SELECT
  397. productId
  398. FROM
  399. cm_coupon_product
  400. WHERE
  401. couponId = #{couponId}
  402. <if test="source == 1">
  403. AND pcStatus = 2
  404. </if>
  405. <if test="source == 2">
  406. AND appletsStatus = 1
  407. </if>
  408. </select>
  409. </mapper>