PageMapper.xml 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516
  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. <delete id="delSku">
  5. delete
  6. from cm_sku
  7. where skuId = #{skuId}
  8. </delete>
  9. <select id="getPageTypeSort" resultType="java.lang.Integer">
  10. select typeSort
  11. from cm_page
  12. where id = #{pageId}
  13. and enabledStatus = '1'
  14. </select>
  15. <select id="getPageLabel" resultType="java.lang.String">
  16. select contentLabel
  17. from cm_page
  18. where id = #{pageId}
  19. and enabledStatus = '1'
  20. </select>
  21. <select id="getHotSearchByPageId" resultType="com.caimei365.commodity.model.vo.HotSearchVo">
  22. select
  23. id, pageId, name, isHot, link, pcStatus, sort, appletsStatus, creationTime
  24. from
  25. cm_page_hot_search
  26. where
  27. pageId = #{pageId}
  28. <if test="source == 1">
  29. and pcStatus = 1
  30. </if>
  31. <if test="source == 2">
  32. and appletsStatus = 1
  33. </if>
  34. order by -sort desc, creationTime desc
  35. </select>
  36. <select id="getHotSearchByPageIds" resultType="com.caimei365.commodity.model.vo.HotSearchVo">
  37. select id, pageId, name, isHot, link, pcStatus, sort, appletsStatus, creationTime
  38. from cm_page_hot_search
  39. where appletsStatus = 1
  40. <if test="pageIds.size() > 0">
  41. and pageId in
  42. <foreach collection="pageIds" open="(" separator="," close=")" item="pageId">
  43. #{pageId}
  44. </foreach>
  45. </if>
  46. order by -sort desc, creationTime desc
  47. </select>
  48. <select id="getHomePageFloor" resultType="com.caimei365.commodity.model.vo.PageFloorVo">
  49. select id, type, floorTitle as title, floorDetail as detail
  50. from new_page_floor
  51. where delFlag = 0
  52. <if test="source == 1">
  53. AND wwwEnabledStatus = 1
  54. </if>
  55. <if test="source == 2">
  56. AND crmEnabledStatus = 1
  57. </if>
  58. order by -sort desc,createDate desc
  59. </select>
  60. <select id="getPageFloor" resultType="com.caimei365.commodity.model.vo.PageFloorVo">
  61. select id, type, floorTitle as title, floorDetail as detail,floorType
  62. from new_page_floor
  63. where delFlag = 0
  64. <if test="source == 1">
  65. AND wwwEnabledStatus = 1
  66. </if>
  67. <if test="source == 2">
  68. AND crmEnabledStatus = 1
  69. </if>
  70. and floorType is not null
  71. order by -sort desc,createDate desc
  72. </select>
  73. <select id="getFloorByPageId" resultType="com.caimei365.commodity.model.vo.PageFloorVo">
  74. select id, title ,description as detail
  75. from cm_page_centre
  76. where pageId = #{pageId}
  77. <if test="source == 1">
  78. and enabledStatus = 1
  79. </if>
  80. <if test="source == 2">
  81. and crmEnabledStatus = 1
  82. </if>
  83. order by -sort desc, createDate desc
  84. </select>
  85. <select id="getFloorContentById" resultType="com.caimei365.commodity.model.vo.FloorContentVo">
  86. select id,
  87. floorId,
  88. centreId,
  89. templateType,
  90. pcAdsImage1,
  91. pcAdsImage2,
  92. pcAdsImage3,
  93. appletsAdsImage1,
  94. appletsAdsImage2,
  95. appletsAdsImage3,
  96. adsLink1,
  97. adsLink2,
  98. adsLink3
  99. from new_page_floor_content
  100. where floorId = #{id}
  101. </select>
  102. <select id="getFloorImageById" resultType="com.caimei365.commodity.model.vo.FloorImageVo">
  103. select
  104. id, floorId, centreId, productId, name, link, image, appletsImage, label, pcStatus, appletsStatus, sort,
  105. createDate
  106. from new_page_floor_image
  107. where floorId = #{id}
  108. <if test="source == 1">
  109. and pcStatus = 1
  110. </if>
  111. <if test="source == 2">
  112. and appletsStatus = 1
  113. </if>
  114. order by -sort desc, createDate desc
  115. </select>
  116. <select id="getFloorContentByCentreId" resultType="com.caimei365.commodity.model.vo.FloorContentVo">
  117. select id,
  118. floorId,
  119. centreId,
  120. templateType,
  121. pcAdsImage1,
  122. pcAdsImage2,
  123. pcAdsImage3,
  124. pcAdsImage4,
  125. pcAdsImage5,
  126. appletsAdsImage1,
  127. appletsAdsImage2,
  128. appletsAdsImage3,
  129. appletsAdsImage4,
  130. appletsAdsImage5,
  131. adsLink1,
  132. adsLink2,
  133. adsLink3,
  134. adsLink4,
  135. adsLink5,
  136. displayDate1,
  137. displayDate2,
  138. displayDate3
  139. from new_page_floor_content
  140. where centreId = #{id}
  141. </select>
  142. <select id="getFloorImageByCentreId" resultType="com.caimei365.commodity.model.vo.FloorImageVo">
  143. select
  144. id, floorId, centreId, productId, name, link, image, appletsImage, label, pcStatus, appletsStatus, sort,
  145. displaySort, createDate, content
  146. from new_page_floor_image
  147. where centreId = #{id}
  148. <if test="source == 1">
  149. and pcStatus = 1
  150. </if>
  151. <if test="source == 2">
  152. and appletsStatus = 1
  153. </if>
  154. order by -sort desc, createDate desc
  155. <if test="limitNum != null">
  156. limit ${limitNum}
  157. </if>
  158. </select>
  159. <select id="getProductItemById" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
  160. select p.productID as productId,
  161. p.actStatus,
  162. p.name,
  163. p.aliasName,
  164. p.mainImage as image,
  165. p.productCode as code,
  166. p.priceFlag,
  167. (select unit from cm_sku where productID = #{productId} order by price asc LIMIT 1) as unit,
  168. (select price from cm_sku where productID = #{productId} order by price asc LIMIT 1) as price,
  169. (select price
  170. from cm_sku
  171. where productID = #{productId}
  172. order by price asc
  173. LIMIT 1) as originalPrice,
  174. p.shopID as shopId,
  175. p.searchKey as keyword,
  176. (select minBuyNumber
  177. from cm_sku
  178. where productID = #{productId}
  179. order by price asc
  180. LIMIT 1) as minBuyNumber,
  181. (select ladderPriceFlag
  182. from cm_sku
  183. where productID = #{productId}
  184. order by price asc
  185. LIMIT 1) as ladderPriceFlag,
  186. (select normalPrice
  187. from cm_sku
  188. where productID = #{productId}
  189. order by price asc
  190. LIMIT 1) as normalPrice,
  191. p.step,
  192. p.shopID as shopId,
  193. p.taxPoint as taxRate,
  194. p.includedTax,
  195. p.invoiceType,
  196. p.productCategory as productCategory,
  197. p.validFlag,
  198. p.featuredFlag,
  199. p.commodityType,
  200. p.bigTypeID as bigTypeId,
  201. p.smallTypeID as smallTypeId,
  202. p.tinyTypeID as tinyTypeId,
  203. p.visibility as visibility,
  204. cshd.detailTalkFlag as detailTalkFlag,
  205. p.productType
  206. from product p
  207. left join cm_second_hand_detail cshd on p.productID = cshd.productID
  208. where p.productID = #{productId}
  209. and p.validFlag = 2
  210. </select>
  211. <select id="getSupplierFloorImage" resultType="com.caimei365.commodity.model.vo.ShopFloorVo">
  212. select id, crmImage, wwwImage, wwwLink
  213. from new_page_quality_supplier_image
  214. limit 1
  215. </select>
  216. <select id="getSupplierImage" resultType="com.caimei365.commodity.model.vo.ShopImageVo">
  217. select
  218. id, supplierName, image, link, sort, wwwEnabledStatus, crmEnabledStatus,
  219. createBy, createDate, updateBy, updateDate, delFlag
  220. from
  221. new_page_quality_supplier
  222. where
  223. delFlag = 0
  224. <if test="source == 1">
  225. and wwwEnabledStatus = 1
  226. </if>
  227. <if test="source == 2">
  228. and crmEnabledStatus = 1
  229. </if>
  230. order by - sort desc,createDate desc
  231. </select>
  232. <select id="getOrganizeId" resultType="java.lang.Integer">
  233. SELECT userOrganizeID FROM USER WHERE userId = #{userId}
  234. </select>
  235. <select id="getProductDetails" resultType="com.caimei365.commodity.model.vo.ProductDetailVo">
  236. select p.productID as productId,
  237. p.shopID as shopId,
  238. (select normalPrice
  239. from cm_sku
  240. where productId = #{productId}
  241. order by price asc
  242. limit 1) as normalPrice,
  243. ifnull((select stock from cm_sku where productId = #{productId} order by price asc limit 1), 0) as stock,
  244. (select minBuyNumber
  245. from cm_sku
  246. where productId = #{productId}
  247. order by price asc
  248. limit 1) as minBuyNumber,
  249. (select unit from cm_sku where productId = #{productId} order by price asc limit 1) as unit,
  250. p.name,
  251. p.aliasName,
  252. p.commodityType,
  253. p.mainImage,
  254. p.invoiceType,
  255. p.bigTypeID as bigTypeId,
  256. p.smallTypeID as smallTypeId,
  257. p.tinyTypeID as tinyTypeId,
  258. p.searchKey,
  259. p.visibility,
  260. p.commodityDetailsFlag,
  261. p.brandID as brandId,
  262. p.productType,
  263. p.tags,
  264. p.includedTax,
  265. p.productCategory,
  266. p.serviceNumber,
  267. p.taxPoint,
  268. p.supplierTaxPoint,
  269. p.priceFlag,
  270. p.actFlag,
  271. p.addTime,
  272. p.hasSkuFlag,
  273. p.sellNumber,
  274. p.sortIndex,
  275. p.featuredFlag,
  276. p.recommendType,
  277. p.machineType,
  278. p.productCode,
  279. p.updateTime,
  280. p.validFlag,
  281. p.searchKey,
  282. p.allAreaFlag,
  283. p.step,
  284. p.provinceIds,
  285. p.qualificationImg,
  286. p.trainingMethod,
  287. p.trainingType,
  288. p.trainingFee,
  289. p.productRemarks,
  290. p.productDetail as productDetailChose,
  291. s.shopType as shopType,
  292. p.qualificationNo as qualificationNo,
  293. p.productName as productName,
  294. p.qualificationTime as qualificationTime,
  295. p.qualificationLink as qualificationLink,
  296. p.returnGoodsStutas,
  297. P.relatedLabels
  298. from product p
  299. left join shop s on s.shopId = p.shopId
  300. where p.productID = #{productId}
  301. </select>
  302. <select id="getProductOrganizeDetails" resultType="com.caimei365.commodity.model.vo.ProductDetailVo">
  303. select p.productID as productId,
  304. p.shopID as shopId,
  305. (select normalPrice
  306. from cm_sku
  307. where productId = #{productId}
  308. order by price asc
  309. limit 1) as normalPrice,
  310. ifnull((select stock from cm_sku where productId = #{productId} order by price asc limit 1), 0) as stock,
  311. (select minBuyNumber
  312. from cm_mall_product_sku
  313. where productId = #{productId} or mallProductId = #{productId}
  314. order by price asc
  315. limit 1) as minBuyNumber,
  316. (select cs.unit from cm_sku cs
  317. left join cm_mall_product_sku cmps on cs.skuId = cmps.skuId
  318. where cmps.productId = #{productId} or cmps.mallProductId = #{productId} order by cs.price asc limit 1) as unit,
  319. p.name,
  320. p.aliasName,
  321. p.commodityType,
  322. p.mainImage,
  323. p.invoiceType,
  324. p.bigTypeID as bigTypeId,
  325. p.smallTypeID as smallTypeId,
  326. p.tinyTypeID as tinyTypeId,
  327. p.searchKey,
  328. p.visibility,
  329. p.commodityDetailsFlag,
  330. p.brandID as brandId,
  331. p.productType,
  332. p.tags,
  333. p.includedTax,
  334. p.productCategory,
  335. p.serviceNumber,
  336. p.taxPoint,
  337. p.supplierTaxPoint,
  338. p.priceFlag,
  339. p.actFlag,
  340. p.addTime,
  341. p.hasSkuFlag,
  342. p.sellNumber,
  343. p.sortIndex,
  344. p.featuredFlag,
  345. p.recommendType,
  346. p.machineType,
  347. p.productCode,
  348. p.updateTime,
  349. p.validFlag,
  350. p.searchKey,
  351. p.allAreaFlag,
  352. p.step,
  353. p.provinceIds,
  354. p.qualificationImg,
  355. p.trainingMethod,
  356. p.trainingType,
  357. p.trainingFee,
  358. p.productRemarks,
  359. p.productDetail as productDetailChose,
  360. s.shopType as shopType,
  361. p.qualificationNo as qualificationNo,
  362. p.productName as productName,
  363. p.qualificationTime as qualificationTime,
  364. p.qualificationLink as qualificationLink,
  365. p.returnGoodsStutas,
  366. P.relatedLabels
  367. from product p
  368. left join cm_mall_organize_products cmop on p.productId = cmop.productId
  369. left join shop s on s.shopId = p.shopId
  370. where p.productID = #{productId} or cmop.id = #{productId}
  371. </select>
  372. <select id="getBuyAgainProducts" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
  373. select p.productID as productId,
  374. p.actStatus,
  375. p.name,
  376. p.aliasName,
  377. p.mainImage as image,
  378. rpp.skuId,
  379. cs.unit,
  380. p.productCode as code,
  381. p.priceFlag,
  382. cs.price,
  383. cs.costPrice,
  384. ifnull(cs.costCheckFlag, 1) as costCheckFlag,
  385. p.searchKey as keyword,
  386. cs.minBuyNumber as minBuyNumber,
  387. cs.ladderPriceFlag,
  388. cs.normalPrice,
  389. p.step,
  390. p.shopID as shopId,
  391. p.taxPoint as taxRate,
  392. p.includedTax,
  393. p.invoiceType,
  394. p.productCategory as productCategory,
  395. p.validFlag,
  396. p.featuredFlag,
  397. p.commodityType,
  398. p.bigTypeID as bigTypeId,
  399. p.smallTypeID as smallTypeId,
  400. p.tinyTypeID as tinyTypeId,
  401. rpp.currentPrice as discountPrice,
  402. p.productType
  403. from repeat_purchase_price rpp
  404. left join product p on rpp.productId = p.productID
  405. left join cm_sku cs on rpp.skuId = cs.skuId
  406. where rpp.delFlag = '0'
  407. and p.validFlag = '2'
  408. and rpp.userId = #{userId}
  409. order by rpp.createTime desc
  410. </select>
  411. <select id="getPageDetails" resultType="com.caimei365.commodity.model.vo.PageDetailVo">
  412. select a.id,
  413. a.type,
  414. a.title,
  415. a.keywords,
  416. a.description,
  417. a.headImage as image,
  418. a.headText as content,
  419. a.buttonName,
  420. a.buttonLink,
  421. a.backgroundColour,
  422. a.backgroundImage,
  423. a.backgroundImageWay,
  424. a.contentLabel,
  425. a.backgroundType
  426. from cm_page a
  427. where a.id = #{id}
  428. and a.type = #{type}
  429. and a.enabledStatus = 1
  430. </select>
  431. <select id="getEquipmentParametersByType" resultType="com.caimei365.commodity.model.vo.EquipmentParameterVo">
  432. select id, pageId as parentId, name, content, type
  433. from cm_page_name_content
  434. where pageId = #{equipmentId}
  435. and type = #{typeId}
  436. </select>
  437. <select id="getImageLinkByFloorId" resultType="com.caimei365.commodity.model.vo.ImageLinkVo">
  438. select a.id,
  439. a.title,
  440. a.link,
  441. a.image
  442. from cm_page_image a
  443. right join cm_page_centre_image b on b.imageId = a.id
  444. where b.centreId = #{floorId}
  445. and a.enabledStatus = 1
  446. order by a.sort desc, a.createDate desc
  447. </select>
  448. <select id="getProductRecommendsById" resultType="com.caimei365.commodity.model.search.ProductListVo">
  449. select p.productID as productId,
  450. p.actStatus,
  451. p.`name` as `name`,
  452. p.mainImage as image,
  453. IFNULL(p.visibility, 3) as visibility,
  454. p.productType
  455. from product as p
  456. left join cm_product_recommend as pr on pr.recommendProductID = p.productID
  457. where pr.productID = #{productId}
  458. and p.validFlag = 2
  459. order by pr.sort desc
  460. </select>
  461. <select id="getAutoProductRecommends" resultType="com.caimei365.commodity.model.search.ProductListVo">
  462. select p.productID as productId,
  463. p.actStatus,
  464. p.`name` as `name`,
  465. p.mainImage as image,
  466. IFNULL(p.visibility, 3) as visibility,
  467. p.productType
  468. from product as p
  469. where p.validFlag = 2
  470. and p.commodityType = (select commodityType from product as p1 where p1.productID = #{productId})
  471. and p.smallTypeID = (select smallTypeID from product as p2 where p2.productID = #{productId})
  472. order by p.sellNumber desc
  473. limit 0,7
  474. </select>
  475. <select id="findCmPageById" resultType="com.caimei365.commodity.model.vo.CmPageVo">
  476. select id,
  477. type,
  478. title,
  479. keywords,
  480. description,
  481. headImage,
  482. crmHeadImage,
  483. headLink,
  484. headText,
  485. redPacketBeginTime,
  486. redPacketEndTime,
  487. infoBarStatus,
  488. backgroundColour,
  489. backgroundImage,
  490. backgroundImageWay,
  491. contentLabel,
  492. backgroundType
  493. from cm_page
  494. where id = #{pageId}
  495. and enabledStatus = '1'
  496. </select>
  497. <select id="getSearchKeyword" resultType="java.lang.String">
  498. select name
  499. from keyword
  500. where validFlag = 1
  501. order by sortIndex desc
  502. </select>
  503. <select id="getTopMenus" resultType="com.caimei365.commodity.model.vo.TopMenuVo">
  504. select
  505. id,
  506. navigationName as name,
  507. link,
  508. icon,
  509. sort
  510. from new_page_first_navigation
  511. where delFlag = 0
  512. <if test="source == 1">
  513. and wwwEnabledStatus = 1
  514. </if>
  515. <if test="source == 2">
  516. and crmEnabledStatus = 1
  517. </if>
  518. order by -sort desc,createDate desc
  519. limit 8
  520. </select>
  521. <select id="getHelpPageTypes" resultType="com.caimei365.commodity.model.vo.BaseLinkVo">
  522. select c_helpPageTypeID as id,
  523. c_helpPageTypeName as name
  524. from c_helpPageType
  525. </select>
  526. <select id="getHelpPagesByType" resultType="com.caimei365.commodity.model.vo.BaseLinkVo">
  527. select helpPageID as id,
  528. helpPageTypeID as typeId,
  529. title as name
  530. from helpPage
  531. where validFlag = 1
  532. and helpPageTypeID = #{typeId}
  533. order by sortIndex
  534. </select>
  535. <select id="getFriendLinks" resultType="com.caimei365.commodity.model.vo.BaseLinkVo">
  536. select id, name, link
  537. from new_page_friendship_link
  538. where delFlag = 0
  539. order by id
  540. </select>
  541. <select id="getMaintenanceIdByCode" resultType="java.lang.Integer">
  542. select cmInstrumentMaintenanceId
  543. from cm_instrument_maintenance_links
  544. where linkCode = #{code}
  545. </select>
  546. <select id="getMaintenanceById" resultType="com.caimei365.commodity.model.vo.ProductRepairVo">
  547. SELECT a.id AS "id",
  548. a.orderNo AS "orderNo",
  549. a.userId AS "userId",
  550. a.instrumentName AS "instrumentName",
  551. a.manufacturer AS "manufacturer",
  552. a.instrumentBrand AS "instrumentBrand",
  553. a.maintenanceNum AS "maintenanceNum",
  554. a.instrumentImage1 AS "instrumentImage1",
  555. a.instrumentImage2 AS "instrumentImage2",
  556. a.instrumentImage3 AS "instrumentImage3",
  557. a.instrumentImage4 AS "instrumentImage4",
  558. a.instrumentImage5 AS "instrumentImage5",
  559. a.problemDescription AS "problemDescription",
  560. a.userAccount AS "userAccount",
  561. a.userName AS "userName",
  562. a.userContact AS "userContact",
  563. a.userMobile AS "userMobile",
  564. concat(a.provinceName, a.cityName, a.townName, a.userAddress) AS userAddress,
  565. a.maintainerName AS "maintainerName",
  566. a.maintainerMobile AS "maintainerMobile",
  567. a.maintainerAddress AS "maintainerAddress",
  568. a.status AS "status",
  569. a.authenticity AS "authenticity",
  570. a.serviceRating AS "serviceRating",
  571. a.serviceEvaluate AS "serviceEvaluate",
  572. a.solveStatus AS "solveStatus",
  573. a.cancelReason AS "cancelReason",
  574. a.submitDate AS "submitDate",
  575. a.dockingDate AS "dockingDate",
  576. a.evaluateDate AS "evaluateDate",
  577. a.cancelDate AS "cancelDate",
  578. a.provinceName AS "provinceName",
  579. a.cityName AS "cityName",
  580. a.townName AS "townName",
  581. b.type AS "viewerType"
  582. FROM cm_instrument_maintenance a
  583. LEFT JOIN cm_instrument_maintenance_links b on a.id = b.cmInstrumentMaintenanceId
  584. WHERE a.id = #{id}
  585. limit 1
  586. </select>
  587. <select id="findAllCoupon" resultType="com.caimei365.commodity.model.vo.CouponVo">
  588. SELECT
  589. `id` AS "couponId",
  590. `couponAmount`,
  591. `touchPrice`,
  592. `startDate`,
  593. `endDate`,
  594. `couponType`,
  595. `userId`,
  596. `shopId`,
  597. `productType`,
  598. `categoryType`
  599. FROM
  600. cm_coupon
  601. WHERE
  602. delFlag = 0 AND vipFlag != 1
  603. AND status != 2
  604. AND couponsMode = 0
  605. <if test="userId == null or userId == 0">
  606. AND couponType != 2
  607. AND NOW() <![CDATA[ > ]]> startDate
  608. AND NOW() <![CDATA[ < ]]> if(receiveFlag = 1,endDate,date_add(startDate,interval receivePeriod day))
  609. </if>
  610. <if test="userId > 0">
  611. AND (couponType IN (0,1,3)
  612. OR couponType = 2 AND userId = #{userId}
  613. OR (SELECT registerTime FROM USER WHERE userID = #{userId}) <![CDATA[ >= ]]> startDate)
  614. and NOW() <![CDATA[ > ]]> startDate
  615. and NOW() <![CDATA[ < ]]> if(receiveFlag = 1,endDate,
  616. date_add(if(#{registerTime} <![CDATA[ > ]]> startDate and #{registerTime} <![CDATA[ < ]]>
  617. endDate,#{registerTime},startDate),interval receivePeriod day)
  618. )
  619. </if>
  620. ORDER BY
  621. createDate DESC
  622. </select>
  623. <select id="findAllProductId" resultType="integer">
  624. SELECT
  625. productId
  626. FROM
  627. cm_coupon_product
  628. WHERE
  629. couponId = #{couponId}
  630. <if test="source == 1">
  631. AND pcStatus = 1
  632. </if>
  633. <if test="source == 2">
  634. AND appletsStatus = 1
  635. </if>
  636. </select>
  637. <select id="getProductArchiveList" resultType="com.caimei365.commodity.model.vo.ArchiveVo">
  638. select cpa.id AS "archiveId",
  639. cpa.productId AS "productId",
  640. if(cpa.productId is not null, p.name, cpa.productName) AS "productName",
  641. if(cpa.productId is not null, s.name, cpa.shopName) AS "shopName",
  642. if(cpa.productId is not null, p.mainImage, cpa.productImage) AS "productImage",
  643. if(cpa.productId is not null, ifnull(p.commodityType, cpa.productType),cpa.productType) AS "productType",
  644. if(cpa.productId is not null,1,2) AS "redirectType"
  645. from cm_product_archive cpa
  646. left join product p on cpa.productId = p.productID
  647. left join shop s on p.shopID = s.shopID
  648. <where>
  649. <if test="keyword != null and keyword != ''">
  650. and (cpa.productName LIKE concat('%', #{keyword}, '%') or p.name like concat('%', #{keyword}, '%')
  651. or cpa.shopName LIKE concat('%', #{keyword}, '%') or s.name like concat('%', #{keyword}, '%'))
  652. </if>
  653. <if test="productType != null and productType != 0">
  654. and if(cpa.productId is not null and p.commodityType is not null,p.commodityType = #{productType},
  655. cpa.productType = #{productType})
  656. </if>
  657. </where>
  658. order by cpa.addTime desc
  659. </select>
  660. <select id="getImageArchiveList" resultType="com.caimei365.commodity.model.vo.ArchiveContentVo">
  661. select id as archiveContentId, title, addTime
  662. from cm_product_archive_content
  663. where productArchiveId = #{archiveId}
  664. and type = 1
  665. order by addTime desc
  666. </select>
  667. <select id="getVideoArchiveList" resultType="com.caimei365.commodity.model.vo.ArchiveContentVo">
  668. select id as archiveContentId, title, addTime
  669. from cm_product_archive_content
  670. where productArchiveId = #{archiveId}
  671. and type = 2
  672. order by addTime desc
  673. </select>
  674. <select id="getFileArchiveList" resultType="com.caimei365.commodity.model.vo.ArchiveContentVo">
  675. select id as archiveContentId, title, addTime
  676. from cm_product_archive_content
  677. where productArchiveId = #{archiveId}
  678. and type = 3
  679. order by addTime desc
  680. </select>
  681. <select id="getArchiveImageList" resultType="java.lang.String">
  682. select ifnull(waterOssUrl, ossUrl) as ossUrl
  683. from cm_product_archive_file
  684. where archiveContentId = #{archiveContentId}
  685. </select>
  686. <select id="getArchiveFile" resultType="com.caimei365.commodity.model.po.ArchiveFilePo">
  687. select fileName, if(cc.type = 2, ossName, ifnull(waterOssName, ossName)) as ossName, uploadTime
  688. from cm_product_archive_file cf
  689. left join cm_product_archive_content cc on cf.archiveContentId = cc.id
  690. where archiveContentId = #{archiveContentId}
  691. </select>
  692. <select id="getArchiveByArchiveId" resultType="com.caimei365.commodity.model.po.ArchivePo">
  693. select cpa.id AS "archiveId",
  694. cpa.productId AS "productId",
  695. if(cpa.productId is not null, p.name, cpa.productName) AS "productName",
  696. if(cpa.productId is not null, s.name, cpa.shopName) AS "shopName",
  697. if(cpa.productId is not null, p.mainImage, cpa.productImage) AS "productImage",
  698. cpa.archiveLevel AS "archiveLevel",
  699. if(cpa.productId is not null, ifnull(p.commodityType, cpa.productType),
  700. cpa.productType) AS "productType",
  701. cpa.productClassify AS "productClassify",
  702. cpa.labelIds AS "labelIds"
  703. from cm_product_archive cpa
  704. left join product p on cpa.productId = p.productID
  705. left join shop s on p.shopID = s.shopID
  706. where cpa.id = #{archiveId}
  707. </select>
  708. <select id="keyWordList" resultType="java.lang.String">
  709. select keyword from cm_user_search_frequency
  710. where
  711. id in
  712. <foreach collection="ids" item="id" open="(" close=")" separator=",">
  713. #{id}
  714. </foreach>
  715. </select>
  716. <select id="getClubTypeByUserId" resultType="java.lang.Integer">
  717. select ifnull(firstClubType, 0)
  718. from club
  719. where userID = #{userId}
  720. </select>
  721. <select id="getArchiveIdById" resultType="java.lang.Integer">
  722. select id
  723. from cm_product_archive
  724. where productId = #{productId}
  725. </select>
  726. <select id="findBeansHistoryByArchiveId" resultType="java.lang.Integer">
  727. select id
  728. from user_beans_history
  729. where userId = #{userId}
  730. and archiveId = #{archiveId}
  731. </select>
  732. <select id="getSvipProductAdsImage" resultType="java.lang.String">
  733. select if(#{source} = 1, pcImage, appletsImage)
  734. from cm_svip_product_adsimage
  735. limit 1
  736. </select>
  737. <select id="getSvipProductList" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
  738. select p.productID as productId,
  739. p.actStatus,
  740. p.name,
  741. p.aliasName,
  742. p.mainImage as image,
  743. (select unit from cm_sku where productId = csp.productId order by price asc limit 1) as unit,
  744. p.productCode as code,
  745. p.priceFlag,
  746. (select price from cm_sku where productId = csp.productId order by price asc limit 1) as price,
  747. p.shopID as shopId,
  748. p.searchKey as keyword,
  749. (select minBuyNumber
  750. from cm_sku
  751. where productId = csp.productId
  752. order by price asc
  753. limit 1) as minBuyNumber,
  754. (select ladderPriceFlag
  755. from cm_sku
  756. where productId = csp.productId
  757. order by price asc
  758. limit 1) as ladderPriceFlag,
  759. (select normalPrice
  760. from cm_sku
  761. where productId = csp.productId
  762. order by price asc
  763. limit 1) as normalPrice,
  764. p.step,
  765. p.shopID as shopId,
  766. p.taxPoint as taxRate,
  767. p.includedTax,
  768. p.invoiceType,
  769. p.productCategory as productCategory,
  770. p.validFlag,
  771. p.featuredFlag,
  772. p.commodityType,
  773. p.bigTypeID as bigTypeId,
  774. p.smallTypeID as smallTypeId,
  775. p.tinyTypeID as tinyTypeId,
  776. p.visibility as visibility
  777. from cm_svip_product csp
  778. left join product p on p.productID = csp.productId
  779. where p.validFlag = 2
  780. order by -csp.sort desc, csp.addTime desc
  781. </select>
  782. <select id="getSvipUserIdByUserId" resultType="java.lang.Integer">
  783. select userId
  784. from cm_svip_user
  785. where userId = #{userId}
  786. and delFlag = '0'
  787. and now() <![CDATA[ < ]]> endTime
  788. </select>
  789. <select id="getBannerImages" resultType="com.caimei365.commodity.model.vo.ImageLinkVo">
  790. select id, title, link, crmImage as image, crmImage, crmLink, crmTitle
  791. from new_page_homeimage
  792. where crmEnabledStatus = 1
  793. order by sort desc, createDate desc
  794. </select>
  795. <select id="getAfterSale" resultType="com.caimei365.commodity.model.vo.AfterSaleVo">
  796. SELECT id,
  797. organizeName,
  798. organizeLinkName,
  799. mobile,
  800. contactNumber,
  801. systemName,
  802. systemImage,
  803. introduction,
  804. afterSale,
  805. shoppingNotes,
  806. updateTime,
  807. addTime,
  808. delFlag
  809. FROM cm_mall_organize
  810. WHERE id = 0
  811. AND delFlag = '0'
  812. </select>
  813. <select id="getPageIdByTypeSort" resultType="java.lang.Integer">
  814. SELECT id
  815. FROM cm_page
  816. WHERE enabledStatus = 1
  817. AND typeSort = #{typeSort}
  818. </select>
  819. <select id="getSidebarLive" resultType="com.caimei365.commodity.model.vo.LiveVo">
  820. SELECT
  821. id,
  822. liveTitle,
  823. homePageImage,
  824. advertisingImage,
  825. link,
  826. wwwValidFlag,
  827. crmValidFlag,
  828. topPosition,
  829. createTime,
  830. startTime,
  831. endTime,
  832. liveStatus,
  833. delFlag
  834. FROM
  835. new_page_live
  836. WHERE
  837. topPosition IN (1, 2, 3)
  838. AND delFlag = '0'
  839. <if test="source == 1">
  840. AND wwwValidFlag = '1'
  841. </if>
  842. <if test="source == 2">
  843. AND crmValidFlag = '1'
  844. </if>
  845. ORDER BY topPosition
  846. </select>
  847. <select id="getSidebarInfo" resultType="com.caimei365.commodity.model.vo.InfoVo">
  848. SELECT id,
  849. typeId,
  850. title,
  851. label,
  852. publisher,
  853. source,
  854. keyword,
  855. recommendContent,
  856. infoContent,
  857. guidanceImage,
  858. homePageImage,
  859. pubdate,
  860. recommendStatus,
  861. enabledStatus,
  862. basePraise,
  863. basePv,
  864. priorityIndex,
  865. createBy,
  866. createDate,
  867. updateBy,
  868. updateDate,
  869. topPosition
  870. FROM info
  871. WHERE topPosition IN (1, 2, 3)
  872. AND enabledStatus = '1'
  873. ORDER BY topPosition
  874. </select>
  875. <select id="getSidebarPageImage" resultType="com.caimei365.commodity.model.vo.PageImageVo">
  876. SELECT
  877. id,
  878. title,
  879. link,
  880. appLink,
  881. image,
  882. homePageImage,
  883. appletsImage,
  884. appletsLink,
  885. appletsEnabledStatus,
  886. sort,
  887. type,
  888. enabledStatus,
  889. crmEnabledStatus,
  890. beginTime,
  891. endTime,
  892. actType,
  893. createBy,
  894. createDate,
  895. updateBy,
  896. updateDate,
  897. topPosition
  898. FROM
  899. cm_page_image
  900. WHERE
  901. topPosition IN (1, 2, 3)
  902. <if test="source == 1">
  903. AND enabledstatus = '1'
  904. </if>
  905. <if test="source == 2">
  906. AND appletsEnabledStatus = '1'
  907. </if>
  908. ORDER BY topPosition
  909. </select>
  910. <select id="getLiveAdvertisingImage" resultType="java.lang.String">
  911. SELECT advertisingImage
  912. FROM new_page_live_advertising_image
  913. LIMIT 1;
  914. </select>
  915. <select id="getAuthProductByProductId" resultType="com.caimei365.commodity.model.vo.AuthProductVo">
  916. select p.name as productName,
  917. p.snCode,
  918. p.pcImage,
  919. p.appletsImage,
  920. p.pcCertificateImage,
  921. p.appletsCertificateImage,
  922. p.brandId,
  923. b.authLogo,
  924. b.name as brandName,
  925. c.name as productionPlace,
  926. a.id as authId,
  927. a.authParty,
  928. u.authUserId as authUserId,
  929. u.name as shopName,
  930. u.shopType,
  931. u.qrCodeImage,
  932. i.securityLink,
  933. i.statementType,
  934. i.statementContent,
  935. i.statementLink,
  936. i.statementImage
  937. from cm_brand_auth_product p
  938. left join cm_brand_auth a on p.authId = a.id
  939. left join cm_brand_auth_user u on a.authUserId = u.authUserId
  940. left join cm_brand_auth_shop_info i on u.authUserId = i.authUserId and p.brandId = i.brandId
  941. left join cm_brand b on i.brandId = b.id
  942. left join country c on i.countryId = c.countryId
  943. where p.id = #{productId}
  944. and u.status = 1
  945. and a.status = 1
  946. and p.status = 1
  947. and a.auditStatus = 1
  948. and p.auditStatus = 1
  949. </select>
  950. <select id="getStatementFile" resultType="com.caimei365.commodity.model.vo.StatementFileVo">
  951. select name, ossName, md5Hex, uploadTime
  952. from cm_brand_auth_file
  953. where authUserId = #{authUserId}
  954. and brandId = #{brandId}
  955. limit 1
  956. </select>
  957. <select id="getAuthProductParams" resultType="com.caimei365.commodity.model.po.BrandProductParamPo">
  958. select name, content
  959. from cm_brand_product_param
  960. where productId = #{productId}
  961. </select>
  962. <select id="getSidebarBaike" resultType="com.caimei365.commodity.model.vo.BaikeProductVo">
  963. select id as productId, id, commodityType, name, image, publishTime
  964. from cm_baike_product
  965. WHERE topPosition IN (1, 2, 3)
  966. and status = 1
  967. and NOW() > publishTime
  968. order by topPosition
  969. </select>
  970. <select id="getBaikeTypeList" resultType="com.caimei365.commodity.model.vo.BaikeTypeVo">
  971. select id as typeId, name
  972. from cm_baike_type
  973. where if(#{commodityType} = 1, typeSort = 1, typeSort = 2)
  974. and status = 1
  975. order by -sort desc, addTime desc
  976. </select>
  977. <select id="getBaikeProducts" resultType="com.caimei365.commodity.model.vo.BaikeProductVo">
  978. select id as productId, id,commodityType, image, name, discription, publishTime, (basePv + actualPv) as pv
  979. from cm_baike_product
  980. <where>
  981. status = 1 and NOW() > publishTime and delFlag = 0 and auditStatus = 2 and onlineStatus = 2
  982. <if test="typeId != null">
  983. and typeId = #{typeId}
  984. </if>
  985. <if test="keyword != null">
  986. and name like concat ('%',#{keyword},'%')
  987. </if>
  988. </where>
  989. order by addTime desc
  990. <if test="limitNum != null">
  991. limit #{limitNum}
  992. </if>
  993. </select>
  994. <select id="getBaikeQuestionList" resultType="java.lang.String">
  995. select question
  996. from cm_baike_product_question
  997. where productId = #{productId}
  998. limit 3
  999. </select>
  1000. <select id="findHeheHomePage" resultType="com.caimei365.commodity.model.vo.CmPageVo">
  1001. select id,
  1002. type,
  1003. title,
  1004. keywords,
  1005. description,
  1006. headImage,
  1007. crmHeadImage,
  1008. headLink,
  1009. headText,
  1010. redPacketBeginTime,
  1011. redPacketEndTime,
  1012. infoBarStatus
  1013. from cm_page
  1014. where type = 8
  1015. and enabledStatus = '1'
  1016. limit 1
  1017. </select>
  1018. <select id="getNewFloorRecommend" resultType="com.caimei365.commodity.model.po.ProductPo">
  1019. SELECT DISTINCT
  1020. p.productID,
  1021. p.actStatus,
  1022. p.name,
  1023. p.aliasName,
  1024. p.visibility,
  1025. p.mainImage,
  1026. (select unit from cm_sku where productId=p.productID order by price asc limit 1)as unit,
  1027. p.productCode as code,
  1028. p.priceFlag,
  1029. p.shopID as shopId,
  1030. p.searchKey as keyword,
  1031. (select minBuyNumber from cm_sku where productId=p.productID order by price asc limit 1)as minBuyNumber,
  1032. (select ladderPriceFlag from cm_sku where productId=p.productID order by price asc limit 1)as ladderPriceFlag,
  1033. (select normalPrice from cm_sku where productId=p.productID order by price asc limit 1)as normalPrice,
  1034. p.step,
  1035. p.taxPoint as taxRate,
  1036. p.includedTax,
  1037. p.invoiceType,
  1038. p.productCategory as productCategory,
  1039. p.validFlag,
  1040. p.featuredFlag,
  1041. p.commodityType,
  1042. p.bigTypeID as bigTypeId,
  1043. p.smallTypeID as smallTypeId,
  1044. p.tinyTypeID as tinyTypeId,
  1045. p.productType,
  1046. p.brandID,
  1047. (select price from cm_sku where productId=p.productID order by price asc limit 1)as price
  1048. from product p
  1049. <where>
  1050. and p.showFlag!=5
  1051. and p.newvalidFlag = 1
  1052. and p.newProductType=1
  1053. and p.validFlag = 2
  1054. and p.showFlag!=2
  1055. and p.recommend=1
  1056. </where>
  1057. order by p.sortIndex desc,newshowTime desc
  1058. limit 5
  1059. </select>
  1060. <select id="getNewFloorList" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
  1061. SELECT DISTINCT
  1062. (select price from cm_sku where productID=p.productID order by price asc limit 1)as price,
  1063. (select unit from cm_sku where productID=p.productID order by price asc limit 1)as unit,
  1064. (select normalPrice from cm_sku where productID=p.productID order by price asc limit 1)as normalPrice,
  1065. (select minBuyNumber from cm_sku where productID=p.productID order by price asc limit 1)as minBuyNumber,
  1066. (select ladderPriceFlag from cm_sku where productID=p.productID order by price asc limit 1)as ladderPriceFlag,
  1067. p.productID,
  1068. p.actStatus,
  1069. p.name,
  1070. p.aliasName,
  1071. p.visibility,
  1072. p.mainImage as image,
  1073. p.productCode as code,
  1074. p.priceFlag,
  1075. p.shopID as shopId,
  1076. p.searchKey as keyword,
  1077. p.step,
  1078. p.taxPoint as taxRate,
  1079. p.includedTax,
  1080. p.invoiceType,
  1081. p.productCategory as productCategory,
  1082. p.validFlag,
  1083. p.featuredFlag,
  1084. p.commodityType,
  1085. p.bigTypeID as bigTypeId,
  1086. p.smallTypeID as smallTypeId,
  1087. p.tinyTypeID as tinyTypeId,
  1088. p.productType,
  1089. p.brandID
  1090. from product p
  1091. <where>
  1092. and p.showFlag!=5
  1093. and p.newvalidFlag = 1
  1094. and p.newProductType=1
  1095. and p.validFlag = 2
  1096. and p.showFlag!=2
  1097. <if test="brandID != null and brandID.size > 0">
  1098. and
  1099. <foreach collection="brandID" item="item" index="index" open="(" close=")" separator="OR">
  1100. p.brandID LIKE CONCAT('%',#{item},'%')
  1101. </foreach>
  1102. </if>
  1103. </where>
  1104. order by p.sortIndex desc,newshowTime desc
  1105. <if test="status == 1">
  1106. limit 20
  1107. </if>
  1108. </select>
  1109. <select id="getNewFloor" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
  1110. SELECT
  1111. p.productID,
  1112. p.actStatus,
  1113. p.name,
  1114. p.aliasName,
  1115. p.visibility,
  1116. p.mainImage as image,
  1117. (select unit from cm_sku where productId=p.productID order by price asc limit 1)as unit,
  1118. p.productCode as code,
  1119. p.priceFlag,
  1120. (select price from cm_sku where productId=p.productID order by price asc limit 1)as price,
  1121. p.shopID as shopId,
  1122. p.searchKey as keyword,
  1123. (select minBuyNumber from cm_sku where productId=p.productID order by price asc limit 1)as minBuyNumber,
  1124. (select ladderPriceFlag from cm_sku where productId=p.productID order by price asc limit 1)as ladderPriceFlag,
  1125. (select normalPrice from cm_sku where productId=p.productID order by price asc limit 1)as normalPrice,
  1126. p.step,
  1127. p.taxPoint as taxRate,
  1128. p.includedTax,
  1129. p.invoiceType,
  1130. p.productCategory as productCategory,
  1131. p.validFlag,
  1132. p.featuredFlag,
  1133. p.commodityType,
  1134. p.bigTypeID as bigTypeId,
  1135. p.smallTypeID as smallTypeId,
  1136. p.tinyTypeID as tinyTypeId,
  1137. p.productType,
  1138. p.brandID,
  1139. (select price from cm_sku where productId=p.productID order by price asc limit 1)as price
  1140. from product p
  1141. <where>
  1142. <if test="productID != null and productID!=''">
  1143. and productID=#{productID}
  1144. </if>
  1145. and p.newvalidFlag = 1
  1146. and p.newProductType=1
  1147. and p.validFlag = 2
  1148. </where>
  1149. # order by p.combinationSort != 0 desc, p.combinationSort asc
  1150. # 在设置重点关注时给排序值1000为了让重点关注始终在列表前端
  1151. <if test="sortIndex==1000">
  1152. ORDER BY p.newshowTime DESC
  1153. </if>
  1154. <if test="sortIndex!=1000">
  1155. ORDER BY p.sortIndex desc
  1156. </if>
  1157. </select>
  1158. <select id="getNewFloorBrand" resultType="com.caimei365.commodity.model.vo.BrandVo">
  1159. SELECT DISTINCT s.`id`, s.`name`
  1160. FROM product a
  1161. LEFT JOIN `cm_brand` s ON s.id = a.brandID
  1162. WHERE a.newvalidFlag = 1
  1163. AND a.newProductType = 1
  1164. AND a.validFlag = 2
  1165. AND a.showFlag != 2
  1166. AND s.id IS NOT NULL
  1167. AND s.name IS NOT NULL
  1168. AND s.id IS NOT NULL
  1169. AND s.name IS NOT NULL
  1170. </select>
  1171. <select id="findLink" resultType="java.lang.String">
  1172. select link
  1173. from new_page_floor_image
  1174. where productId = #{productId}
  1175. limit 1
  1176. </select>
  1177. <select id="getAuthUserList" resultType="com.caimei365.commodity.model.vo.BaikeProductVo">
  1178. select
  1179. p.id as productId,
  1180. p.id,
  1181. p.commodityType,
  1182. p.name,
  1183. p.discription,
  1184. p.typeId,
  1185. p.actualPv as pv,
  1186. p.auditStatus,
  1187. p.onlineStatus,
  1188. p.status,
  1189. p.publishTime,
  1190. p.publishSource,
  1191. p.shopId,
  1192. p.image,
  1193. t.name as typeName,
  1194. p.addTime
  1195. from cm_baike_product p
  1196. left join cm_baike_type t on p.typeId=t.id
  1197. where 1=1
  1198. <if test="null !=productId">
  1199. and p.id=#{productId}
  1200. </if>
  1201. <if test="null !=typeId">
  1202. and p.typeId=#{typeId}
  1203. </if>
  1204. <if test="null !=auditStatus">
  1205. and p.auditStatus=#{auditStatus}
  1206. </if>
  1207. <if test="null !=onlineStatus">
  1208. and p.onlineStatus=#{onlineStatus}
  1209. </if>
  1210. <if test="null !=status">
  1211. and p.status=#{status}
  1212. </if>
  1213. <if test="null !=shopId">
  1214. and p.shopId=#{shopId}
  1215. </if>
  1216. <if test="null !=name and '' != name">
  1217. and p.name like concat('%',#{name},'%')
  1218. </if>
  1219. order by p.addTime desc
  1220. </select>
  1221. <update id="upEntryStatusById">
  1222. update cm_baike_product
  1223. set status=#{status},
  1224. publishTime=#{publishTime}
  1225. where id = #{id};
  1226. </update>
  1227. <delete id="delEntryStatusById">
  1228. delete
  1229. from cm_baike_product
  1230. where id = #{id};
  1231. </delete>
  1232. <select id="getEntryInfoById" resultType="com.caimei365.commodity.model.vo.BaikeProductVo">
  1233. select p.id as productId,
  1234. p.id,
  1235. p.commodityType,
  1236. p.name,
  1237. p.discription,
  1238. p.typeId,
  1239. p.actualPv as pv,
  1240. p.auditStatus,
  1241. p.onlineStatus,
  1242. p.status,
  1243. p.publishTime,
  1244. p.addTime,
  1245. p.alias,
  1246. p.image,
  1247. t.name as typeName,
  1248. p.publishSource,
  1249. p.shopId,
  1250. p.seoKeyword,
  1251. p.labelIds
  1252. from cm_baike_product p
  1253. left join cm_baike_type t on p.typeId = t.id
  1254. where p.id = #{id}
  1255. </select>
  1256. <select id="getImageListById" resultType="com.caimei365.commodity.model.vo.BaikeImageVo">
  1257. select id, productId as entryId, image
  1258. from cm_baike_product_image
  1259. where productId = #{id}
  1260. </select>
  1261. <select id="getInfoListById" resultType="com.caimei365.commodity.model.vo.BaikeInfoVo">
  1262. select id, productId as entryId, name as infoName, content as infoContent
  1263. from cm_baike_product_param
  1264. where productId = #{id}
  1265. </select>
  1266. <select id="getTextInfoListById" resultType="com.caimei365.commodity.model.vo.BaikeTextInfoVo">
  1267. select id, productId as entryId, textType, dictionaryContent, referenceId, parentId, dictionaryType
  1268. from cm_baike_text_info
  1269. where productId = #{id}
  1270. </select>
  1271. <select id="getReferenceListById" resultType="com.caimei365.commodity.model.vo.CmBaikeReferenceInfo">
  1272. select id,
  1273. referenceType,
  1274. website,
  1275. articleName,
  1276. websiteName,
  1277. publishTime,
  1278. acitationTime,
  1279. author,
  1280. workName,
  1281. publicationPlace,
  1282. press,
  1283. publicationYear,
  1284. acitationWeb,
  1285. referenceDescription,
  1286. imageDescription,
  1287. imageUrl,
  1288. ctrlId,
  1289. productId as entryId,
  1290. productType as entryType
  1291. from cm_baike_reference_info
  1292. where productId = #{id}
  1293. </select>
  1294. <select id="geTypeList" resultType="com.caimei365.commodity.model.vo.BaikeTypeVo">
  1295. select id as typeId, name
  1296. from cm_baike_type
  1297. </select>
  1298. <select id="getVideoListById" resultType="com.caimei365.commodity.model.vo.BaikeVideoVo">
  1299. select id, productId as entryId, fileTitle, fileName, ossName, ossUrl
  1300. from cm_baike_product_file
  1301. where productId = #{id}
  1302. </select>
  1303. <delete id="delReferenceById">
  1304. delete
  1305. from cm_baike_reference_info
  1306. where id = #{id}
  1307. </delete>
  1308. <select id="getReferenceById" resultType="com.caimei365.commodity.model.vo.CmBaikeReferenceInfo">
  1309. select id,
  1310. referenceType,
  1311. website,
  1312. articleName,
  1313. websiteName,
  1314. publishTime,
  1315. acitationTime,
  1316. author,
  1317. workName,
  1318. publicationPlace,
  1319. press,
  1320. publicationYear,
  1321. acitationWeb,
  1322. referenceDescription,
  1323. imageDescription,
  1324. imageUrl,
  1325. ctrlId,
  1326. productId as entryId,
  1327. productType as entryType
  1328. from cm_baike_reference_info
  1329. where id = #{id}
  1330. </select>
  1331. <update id="upReferenceInfoByid">
  1332. update cm_baike_reference_info
  1333. set referenceType=#{referenceType},
  1334. website=#{website},
  1335. articleName=#{articleName},
  1336. websiteName=#{websiteName},
  1337. publishTime=#{publishTimeStr},
  1338. acitationTime=#{acitationTimeStr},
  1339. author=#{author},
  1340. workName=#{workName},
  1341. publicationPlace=#{publicationPlace},
  1342. press=#{press},
  1343. publicationYear=#{publicationYearStr},
  1344. acitationWeb=#{acitationWeb},
  1345. ctrlId=#{ctrlId},
  1346. referenceDescription=#{referenceDescription},
  1347. imageDescription=#{imageDescription},
  1348. imageUrl=#{imageUrl}
  1349. where id = #{id}
  1350. </update>
  1351. <insert id="insertReferenceInfo">
  1352. insert into cm_baike_reference_info(referenceType, website, articleName, websiteName, publishTime,
  1353. acitationTime, author, workName, publicationPlace, press, publicationYear,
  1354. acitationWeb, referenceDescription, imageDescription, imageUrl, productId,
  1355. productType, ctrlId)
  1356. values (#{referenceType}, #{website}, #{articleName}, #{websiteName}, #{publishTimeStr}, #{acitationTimeStr},
  1357. #{author}, #{workName}, #{publicationPlace}, #{press}, #{publicationYearStr}, #{acitationWeb},
  1358. #{referenceDescription}, #{imageDescription}, #{imageUrl}, #{entryId}, #{entryType}, #{ctrlId})
  1359. </insert>
  1360. <update id="upEntryInfo">
  1361. update cm_baike_product
  1362. set commodityType=#{commodityType},
  1363. name=#{name},
  1364. discription=#{discription},
  1365. typeId=#{typeId},
  1366. auditStatus =1,
  1367. onlineStatus=1,
  1368. status=#{status},
  1369. publishTime=#{publishTime},
  1370. addTime=NOW(),
  1371. alias=#{alias},
  1372. image=#{image},
  1373. publishSource=#{publishSource},
  1374. shopId=#{shopId},
  1375. seoKeyword=#{seoKeyword},
  1376. labelIds = #{labelIds},
  1377. relatedLabels = #{labelStrs}
  1378. where id = #{id}
  1379. </update>
  1380. <insert id="insertEntryInfo" useGeneratedKeys="true" keyProperty="id">
  1381. insert into cm_baike_product
  1382. (commodityType, name, discription, typeId, actualPv, auditStatus, onlineStatus, status, publishTime, addTime,
  1383. alias, image, seoKeyword, publishSource, shopId, labelIds, relatedLabels)
  1384. values (#{commodityType}, #{name}, #{discription}, #{typeId}, 0, 1, 1, #{status}, #{publishTime}, NOW(),
  1385. #{alias}, #{image}, #{seoKeyword}, #{publishSource}, #{shopId}, #{labelIds}, #{labelStrs})
  1386. </insert>
  1387. <delete id="delImageListByEntryId">
  1388. delete
  1389. from cm_baike_product_image
  1390. where productId = #{id}
  1391. </delete>
  1392. <delete id="delVideoListByEntryId">
  1393. delete
  1394. from cm_baike_product_file
  1395. where productId = #{id}
  1396. </delete>
  1397. <delete id="delInfoListByEntryId">
  1398. delete
  1399. from cm_baike_product_param
  1400. where productId = #{id}
  1401. </delete>
  1402. <delete id="delTextListByEntryId">
  1403. delete
  1404. from cm_baike_text_info
  1405. where productId = #{id}
  1406. </delete>
  1407. <delete id="delreferenceByEntryId">
  1408. delete
  1409. from cm_baike_reference_info
  1410. where productId = #{id}
  1411. </delete>
  1412. <insert id="insertImage">
  1413. insert into cm_baike_product_image(productId, image)
  1414. values (#{entryId}, #{image})
  1415. </insert>
  1416. <insert id="insertVideo">
  1417. insert into cm_baike_product_file(productId, fileTitle, fileName, ossName, ossUrl)
  1418. values (#{entryId}, #{fileTitle}, #{fileName}, #{ossName}, #{ossUrl})
  1419. </insert>
  1420. <insert id="insertInfo">
  1421. insert into cm_baike_product_param(productId, name, content)
  1422. values (#{entryId}, #{infoName}, #{infoContent})
  1423. </insert>
  1424. <insert id="insertText">
  1425. insert into cm_baike_text_info(textType, productId, dictionaryContent, referenceId, parentId, dictionaryType)
  1426. values (#{textType}, #{entryId}, #{dictionaryContent}, #{referenceId}, #{parentId}, #{dictionaryType})
  1427. </insert>
  1428. <insert id="insertreference">
  1429. insert into cm_baike_reference_info(referenceType, website, articleName, websiteName, publishTime,
  1430. acitationTime, author, workName, publicationPlace, press, publicationYear,
  1431. acitationWeb, referenceDescription, imageDescription, imageUrl, productId,
  1432. productType, ctrlId)
  1433. values (#{referenceType}, #{website}, #{articleName}, #{websiteName}, #{publishTimeStr}, #{acitationTimeStr},
  1434. #{author}, #{workName}, #{publicationPlace}, #{press}, #{publicationYearStr}, #{acitationWeb},
  1435. #{referenceDescription}, #{imageDescription}, #{imageUrl}, #{entryId}, #{entryType}, #{ctrlId})
  1436. </insert>
  1437. <select id="getShopid" resultType="java.lang.Integer">
  1438. select cmShopId
  1439. from cm_brand_auth_user
  1440. where authUserId = #{authUserId}
  1441. </select>
  1442. <select id="getHelpContent" resultType="java.lang.String">
  1443. select content
  1444. from helppage
  1445. where helpPageID = #{helpId}
  1446. </select>
  1447. <select id="findLabels" resultType="java.lang.String">
  1448. select keyword
  1449. from cm_user_search_frequency
  1450. where trueStatus = 1
  1451. and delStatus = 1
  1452. and id in (#{labelIds})
  1453. </select>
  1454. <select id="findKeyWordId" resultType="java.lang.String">
  1455. select keyword
  1456. from cm_user_search_frequency
  1457. where id = #{id}
  1458. </select>
  1459. </mapper>