ShopMapper.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  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.ShopMapper">
  4. <insert id="insertProduct" keyColumn="productID" keyProperty="productId"
  5. parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
  6. insert into product (
  7. shopID, name, aliasName, commodityType, bigTypeID, smallTypeID, tinyTypeID, mainImage,
  8. brandID, productType, tags, includedTax,
  9. <if test="productCategory != null and productCategory != '' ">
  10. productCategory,
  11. </if>
  12. <if test="serviceNumber != null and serviceNumber != ''">
  13. serviceNumber,
  14. </if>
  15. <if test="supplierTaxPoint != null and supplierTaxPoint != ''">
  16. supplierTaxPoint,
  17. </if>
  18. <if test="addTime != null and addTime != ''">
  19. addTime,
  20. </if>
  21. <if test="hasSkuFlag != null and hasSkuFlag != ''">
  22. hasSkuFlag,
  23. </if>
  24. <if test="sellNumber != null and sellNumber != ''">
  25. sellNumber,
  26. </if>
  27. <if test="sortIndex != null and sortIndex != ''">
  28. sortIndex,
  29. </if>
  30. <if test="featuredFlag != null and featuredFlag != ''">
  31. featuredFlag,
  32. </if>
  33. <if test="recommendType != null and recommendType != ''">
  34. recommendType,
  35. </if>
  36. <if test="priceFlag != null and priceFlag != ''">
  37. priceFlag,
  38. </if>
  39. <if test="actFlag != null and actFlag != ''">
  40. actFlag,
  41. </if>
  42. <if test="visibility != null and visibility != ''">
  43. visibility,
  44. </if>
  45. <if test="commodityDetailsFlag != null and commodityDetailsFlag != ''">
  46. commodityDetailsFlag,
  47. </if>
  48. <if test="productCode != null and productCode != ''">
  49. productCode,
  50. </if>
  51. <if test="searchKey != null and searchKey != ''">
  52. searchKey,
  53. </if>
  54. <if test="allAreaFlag != null and allAreaFlag != ''">
  55. allAreaFlag,
  56. </if>
  57. <if test="step != null and step != ''">
  58. step,
  59. </if>
  60. <if test="provinceIds != null and provinceIds != ''">
  61. provinceIds,
  62. </if>
  63. <if test="machineType != null and machineType != ''">
  64. machineType,
  65. </if>
  66. <if test="qualificationImg != null and qualificationImg != ''">
  67. qualificationImg,
  68. </if>
  69. <if test="invoiceType != null and invoiceType != ''">
  70. invoiceType,
  71. </if>
  72. <if test="qualificationNo != null and qualificationNo != ''">
  73. qualificationNo,
  74. </if>
  75. <if test="productName != null and productName != ''">
  76. productName,
  77. </if>
  78. <if test="qualificationTime != null and qualificationTime != ''">
  79. qualificationTime,
  80. </if>
  81. updateTime,validFlag,newProductType,showFlag,newvalidFlag
  82. ) values (
  83. #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
  84. #{brandId}, #{productType}, #{tags}, #{includedTax},
  85. <if test="productCategory != null and productCategory != '' ">
  86. #{productCategory},
  87. </if>
  88. <if test="serviceNumber != null and serviceNumber != ''">
  89. #{serviceNumber},
  90. </if>
  91. <if test="supplierTaxPoint != null and supplierTaxPoint != ''">
  92. #{supplierTaxPoint},
  93. </if>
  94. <if test="addTime != null and addTime != ''">
  95. #{addTime},
  96. </if>
  97. <if test="hasSkuFlag != null and hasSkuFlag != ''">
  98. #{hasSkuFlag},
  99. </if>
  100. <if test="sellNumber != null and sellNumber != ''">
  101. #{sellNumber},
  102. </if>
  103. <if test="sortIndex != null and sortIndex != ''">
  104. #{sortIndex},
  105. </if>
  106. <if test="featuredFlag != null and featuredFlag != ''">
  107. #{featuredFlag},
  108. </if>
  109. <if test="recommendType != null and recommendType != ''">
  110. #{recommendType},
  111. </if>
  112. <if test="priceFlag != null and priceFlag != ''">
  113. #{priceFlag},
  114. </if>
  115. <if test="actFlag != null and actFlag != ''">
  116. #{actFlag},
  117. </if>
  118. <if test="visibility != null and visibility != ''">
  119. #{visibility},
  120. </if>
  121. <if test="commodityDetailsFlag != null and commodityDetailsFlag != ''">
  122. #{commodityDetailsFlag},
  123. </if>
  124. <if test="productCode != null and productCode != ''">
  125. #{productCode},
  126. </if>
  127. <if test="searchKey != null and searchKey != ''">
  128. #{searchKey},
  129. </if>
  130. <if test="allAreaFlag != null and allAreaFlag != ''">
  131. #{allAreaFlag},
  132. </if>
  133. <if test="step != null and step != ''">
  134. #{step},
  135. </if>
  136. <if test="provinceIds != null and provinceIds != ''">
  137. #{provinceIds},
  138. </if>
  139. <if test="machineType != null and machineType != ''">
  140. #{machineType},
  141. </if>
  142. <if test="qualificationImg != null and qualificationImg != ''">
  143. #{qualificationImg},
  144. </if>
  145. <if test="invoiceType != null and invoiceType != ''">
  146. #{invoiceType},
  147. </if>
  148. <if test="qualificationNo != null and qualificationNo != ''">
  149. #{qualificationNo},
  150. </if>
  151. <if test="productName != null and productName != ''">
  152. #{productName},
  153. </if>
  154. <if test="qualificationTime != null and qualificationTime != ''">
  155. #{qualificationTime},
  156. </if>
  157. #{updateTime}, #{validFlag},#{newProductType},#{showFlag},3
  158. )
  159. </insert>
  160. <update id="updateProduct">
  161. update product set
  162. shopID = #{shopId}, name = #{name}, aliasName = #{aliasName}, commodityType = #{commodityType},
  163. bigTypeId = #{bigTypeId}, smallTypeId = #{smallTypeId}, tinyTypeId = #{tinyTypeId}, mainImage = #{mainImage},
  164. brandId = #{brandId}, productType = #{productType}, tags = #{tags}, includedTax = #{includedTax},newProductType=#{newProductType},
  165. <if test="qualificationNo !=null and qualificationNo != ''">
  166. qualificationNo=#{qualificationNo},
  167. </if>
  168. <if test="productName !=null and productName != ''">
  169. productName=#{productName},
  170. </if>
  171. <if test="qualificationTime !=null and qualificationTime != ''">
  172. qualificationTime=#{qualificationTime},
  173. </if>
  174. <if test="qualificationLink !=null and qualificationLink != ''">
  175. qualificationLink=#{qualificationLink},
  176. </if>
  177. <if test="productCategory != null and productCategory != ''">
  178. productCategory = #{productCategory},
  179. </if>
  180. <if test="trainingFee != null">
  181. trainingFee = #{trainingFee},
  182. </if>
  183. <if test="serviceNumber != null and serviceNumber != ''">
  184. serviceNumber = #{serviceNumber},
  185. </if>
  186. <if test="supplierTaxPoint != null and supplierTaxPoint != ''">
  187. supplierTaxPoint = #{supplierTaxPoint},
  188. </if>
  189. <if test="addTime != null and addTime != ''">
  190. addTime = #{addTime},
  191. </if>
  192. <if test="hasSkuFlag != null and hasSkuFlag != ''">
  193. hasSkuFlag = #{hasSkuFlag},
  194. </if>
  195. <if test="sellNumber != null and sellNumber != ''">
  196. sellNumber = #{sellNumber},
  197. </if>
  198. <if test="sortIndex != null and sortIndex != ''">
  199. sortIndex = #{sortIndex},
  200. </if>
  201. <if test="featuredFlag != null and featuredFlag != ''">
  202. featuredFlag = #{featuredFlag},
  203. </if>
  204. <if test="recommendType != null and recommendType != ''">
  205. recommendType = #{recommendType},
  206. </if>
  207. <if test="priceFlag != null and priceFlag != ''">
  208. priceFlag = #{priceFlag},
  209. </if>
  210. <if test="actFlag != null and actFlag != ''">
  211. actFlag = #{actFlag},
  212. </if>
  213. <if test="visibility != null and visibility != ''">
  214. visibility = #{visibility},
  215. </if>
  216. <if test="commodityDetailsFlag != null and commodityDetailsFlag != ''">
  217. commodityDetailsFlag = #{commodityDetailsFlag},
  218. </if>
  219. <if test="productCode != null and productCode != ''">
  220. productCode = #{productCode},
  221. </if>
  222. <if test="searchKey != null and searchKey != ''">
  223. searchKey = #{searchKey},
  224. </if>
  225. <if test="allAreaFlag != null and allAreaFlag != ''">
  226. allAreaFlag = #{allAreaFlag},
  227. </if>
  228. <if test="step != null and step != ''">
  229. step = #{step},
  230. </if>
  231. <if test="provinceIds != null and provinceIds != ''">
  232. provinceIds = #{provinceIds},
  233. </if>
  234. <if test="machineType != null and machineType != ''">
  235. machineType = #{machineType},
  236. </if>
  237. <if test="qualificationImg != null and qualificationImg != ''">
  238. qualificationImg = #{qualificationImg},
  239. </if>
  240. <if test="invoiceType != null and invoiceType != ''">
  241. invoiceType = #{invoiceType},
  242. </if>
  243. updateTime = #{updateTime},
  244. validFlag = #{validFlag},
  245. showFlag=#{showFlag}
  246. where productID = #{productId}
  247. </update>
  248. <insert id="insertProductImage">
  249. insert into productimage (productID, shopID, addTime, image, mainFlag, sortIndex)
  250. values (#{productId}, #{shopId}, #{addTime}, #{image}, #{mainFlag}, #{sortIndex})
  251. </insert>
  252. <insert id="insertProductParameters" parameterType="com.caimei365.commodity.model.po.ProductParameterPo">
  253. insert into cm_product_related_parameters (productId, paramsName, paramsContent, delFlag)
  254. values (#{productId}, #{paramsName}, #{paramsContent}, #{delFlag})
  255. </insert>
  256. <insert id="insertProductDetailInfo">
  257. insert into productdetailinfo (productID, propValueAlias, propValueImages,
  258. detailInfo, serviceInfo, orderInfo, detailInfoTxt, seoTitle,
  259. seoKeyword, seoDes)
  260. values (#{productId}, #{propValueAlias}, #{propValueImages},
  261. #{detailInfo}, #{serviceInfo}, #{orderInfo}, #{detailInfoTxt}, #{seoTitle},
  262. #{seoKeyword}, #{seoDes})
  263. </insert>
  264. <insert id="insertBrand" keyColumn="id" keyProperty="id" parameterType="com.caimei365.commodity.model.po.BrandPo"
  265. useGeneratedKeys="true">
  266. insert into cm_brand (name, source, userID, status, delFlag, createDate, updateDate, logo, description)
  267. values (#{name}, #{source}, #{userId}, #{status}, #{delFlag}, #{createDate}, #{updateDate}, #{logo},
  268. #{description})
  269. </insert>
  270. <insert id="insertSku">
  271. insert into cm_sku
  272. (productId,
  273. normalPrice,
  274. price,
  275. costCheckFlag,
  276. costprice,
  277. stock,
  278. minBuyNumber,
  279. unit,
  280. ladderPriceFlag)
  281. values (#{productId},
  282. #{normalPrice},
  283. #{price},
  284. ifnull(#{costCheckFlag}, 1),
  285. #{costPrice},
  286. #{stock},
  287. #{minBuyNumber},
  288. #{unit},
  289. ifnull(#{ladderPriceFlag}, 0))
  290. </insert>
  291. <update id="updateBrand">
  292. update cm_brand
  293. <set>
  294. <if test="name != null">
  295. `name` = #{name},
  296. </if>
  297. <if test="source != null">
  298. `source` = #{source},
  299. </if>
  300. <if test="userId != null">
  301. userID = #{userId},
  302. </if>
  303. <if test="status != null">
  304. `status` = #{status},
  305. </if>
  306. <if test="delFlag != null">
  307. delFlag = #{delFlag},
  308. </if>
  309. <if test="updateDate != null">
  310. updateDate = #{updateDate},
  311. </if>
  312. <if test="logo != null">
  313. logo = #{logo},
  314. </if>
  315. <if test="description != null">
  316. description = #{description},
  317. </if>
  318. </set>
  319. where id = #{id}
  320. </update>
  321. <update id="updateProductImage">
  322. update productimage
  323. set productID = #{productId},
  324. shopID = #{shopId},
  325. addTime = #{addTime},
  326. image = #{image},
  327. mainFlag = #{mainFlag},
  328. sortIndex = #{sortIndex}
  329. where productImageId = #{id}
  330. </update>
  331. <update id="updateProductDetailInfo">
  332. update productdetailinfo
  333. set propValueAlias = #{propValueAlias},
  334. propValueImages = #{propValueImages},
  335. detailInfo = #{detailInfo},
  336. detailInfoTxt = #{detailInfoTxt},
  337. seoTitle = #{seoTitle},
  338. seoKeyword = #{seoKeyword},
  339. seoDes = #{seoDes},
  340. serviceInfo = #{serviceInfo},
  341. orderInfo = #{orderInfo}
  342. where productDetailInfoID = #{productDetailInfoId}
  343. </update>
  344. <update id="updateProductFeatured">
  345. update product
  346. set featuredFlag = #{featuredFlag}
  347. where productID = #{productId}
  348. and shopID = #{shopId}
  349. </update>
  350. <update id="updateProductValidFlag">
  351. update product
  352. set validFlag = #{validFlag}
  353. where productID = #{productId}
  354. </update>
  355. <update id="updateProductCode">
  356. update product
  357. set productCode = #{productCode}
  358. where productID = #{productId}
  359. </update>
  360. <update id="updateSku">
  361. update cm_sku
  362. set minBuyNumber=#{minBuyNumber},
  363. costPrice=#{costPrice},
  364. stock=#{stock},
  365. price=#{price},
  366. normalPrice=#{normalPrice},
  367. unit=#{unit}
  368. where skuId = #{skuId}
  369. </update>
  370. <delete id="deleteProductImage">
  371. delete
  372. from productimage
  373. where productImageID = #{id}
  374. </delete>
  375. <delete id="deleteProductParameters">
  376. delete
  377. from cm_product_related_parameters
  378. where productId = #{productId}
  379. </delete>
  380. <select id="getMainProducts" resultType="com.caimei365.commodity.model.search.ProductListVo">
  381. select
  382. p.productID as productId,
  383. p.actStatus,
  384. p.shopID as shopId,
  385. p.`name` as `name`,
  386. p.mainImage as image,
  387. (select price from cm_sku where productId=p.productID order by price asc limit 1) as price,
  388. (select unit from cm_sku where productId=p.productID order by price asc limit 1) as unit,
  389. p.priceFlag as priceFlag,
  390. IFNULL(p.visibility,3) as visibility,
  391. p.productType
  392. from product p
  393. where p.shopID = #{shopId}
  394. and p.visibility in
  395. <foreach collection="visibilityList" item="visibility" index="index" open="(" separator="," close=")">
  396. #{visibility}
  397. </foreach>
  398. and p.validFlag = 2 and p.featuredFlag=1
  399. order by p.productID desc limit 4
  400. </select>
  401. <select id="getShopProductsSelect" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
  402. select DISTINCT
  403. p.productID as productId,
  404. p.actStatus,
  405. p.name,
  406. p.aliasName,
  407. p.mainImage as image,
  408. (select unit from cm_sku where productId=p.productId order by price asc LIMIT 1) as unit,
  409. p.productCode as code,
  410. p.priceFlag,
  411. (select price from cm_sku where productId=p.productId order by price asc LIMIT 1) as price,
  412. (select normalPrice from cm_sku where productId=p.productId order by price asc LIMIT 1) as normalPrice,
  413. p.searchKey as keyword,
  414. (select minBuyNumber from cm_sku where productId=p.productId order by price asc LIMIT 1) as minBuyNumber,
  415. (select ladderPriceFlag from cm_sku where productId=p.productId order by price asc LIMIT 1) as ladderPriceFlag,
  416. p.step,
  417. p.shopID as shopId,
  418. p.taxPoint as taxRate,
  419. p.includedTax,
  420. p.invoiceType,
  421. p.productCategory as productCategory,
  422. p.validFlag,
  423. p.featuredFlag,
  424. p.commodityType,
  425. p.bigTypeID as bigTypeId,
  426. p.smallTypeID as smallTypeId,
  427. p.tinyTypeID as tinyTypeId,
  428. ifnull(p.newvalidFlag,3) as newvalidFlag,
  429. ifnull(p.showFlag,0) as showFlag
  430. from product p
  431. <where>
  432. p.shopID = #{shopId}
  433. <if test="productCode != null and productCode != ''">
  434. and p.productCode = #{productCode}
  435. </if>
  436. <if test="validFlag != null and validFlag != ''">
  437. and p.validFlag = #{validFlag}
  438. </if>
  439. <if test="featuredFlag != null and featuredFlag != ''">
  440. and p.featuredFlag = #{featuredFlag}
  441. </if>
  442. <if test="tinyTypeId != null and tinyTypeId != 0">
  443. and p.tinyTypeID = #{tinyTypeId}
  444. </if>
  445. <if test="smallTypeId != null and smallTypeId != 0">
  446. and p.smallTypeID = #{smallTypeId}
  447. </if>
  448. <if test="bigTypeId != null and bigTypeId != 0">
  449. and p.bigTypeID = #{bigTypeId}
  450. </if>
  451. <if test="commodityType != null and commodityType != ''">
  452. and p.commodityType = #{commodityType}
  453. </if>
  454. <if test="name != null and name != ''">
  455. and p.name like CONCAT("%",#{name},"%")
  456. </if>
  457. <if test="newvalidFlag !=null and newvalidFlag!=''">
  458. and newvalidFlag =#{newvalidFlag}
  459. </if>
  460. <if test="showFlag != null">
  461. and showFlag =#{showFlag}
  462. </if>
  463. </where>
  464. order by p.productID desc
  465. </select>
  466. <select id="getTypeName" resultType="java.lang.String">
  467. select CONCAT_WS("-", b.name, s.name, t.name)
  468. from bigtype b
  469. left join smalltype s on s.smallTypeID = #{smallTypeId}
  470. left join tinytype t on t.tinyTypeID = #{tinyTypeId}
  471. where b.bigTypeID = #{bigTypeId};
  472. </select>
  473. <select id="getUserIdByshopId" resultType="java.lang.Integer">
  474. select userID
  475. from user
  476. where shopID = #{shopId}
  477. </select>
  478. <select id="getMainProductsCount" resultType="java.lang.Integer">
  479. select count(*)
  480. from product
  481. where shopID = #{shopId}
  482. and validFlag = '2'
  483. and featuredFlag = '1'
  484. order by productID desc
  485. </select>
  486. <select id="getCodeByTypeId" resultType="java.lang.String">
  487. select
  488. CONCAT(IFNULL(b.bigTypeCode,''), IFNULL(s.smallTypeCode,''), IFNULL(t.tinyTypeCode,''))
  489. from bigtype b
  490. left join smalltype s on s.bigTypeID = b.bigTypeID
  491. left join tinytype t on t.smallTypeID = s.smallTypeID
  492. <where>
  493. <if test="bigTypeId != null">
  494. b.bigTypeID = #{bigTypeId}
  495. </if>
  496. <if test="smallTypeId != null">
  497. and s.smallTypeID = #{smallTypeId}
  498. </if>
  499. <if test="tinyTypeId != null">
  500. and t.tinyTypeID = #{tinyTypeId}
  501. </if>
  502. </where>
  503. </select>
  504. <select id="getImageByProductId" resultType="com.caimei365.commodity.model.po.ProductImagePo">
  505. select productImageID as id, productID as productId, shopID as shopId, addTime, image, mainFlag, sortIndex
  506. from productimage
  507. where productID = #{productId}
  508. order by mainFlag DESC
  509. </select>
  510. <select id="getProductForm" resultType="com.caimei365.commodity.model.vo.ProductFormVo">
  511. select productID as productId,
  512. shopID as shopId,
  513. name,
  514. aliasName,
  515. commodityType,
  516. mainImage,
  517. (select stock from cm_sku where productId=p.productId order by price asc LIMIT 1) as stock,
  518. invoiceType,
  519. bigTypeID as bigTypeId,
  520. smallTypeID as smallTypeId,
  521. tinyTypeID as tinyTypeId,
  522. searchKey,
  523. visibility,
  524. brandID as brandId,
  525. productType,
  526. tags,
  527. (select unit from cm_sku where productId=p.productId order by price asc LIMIT 1)as unit,
  528. (select normalPrice from cm_sku where productId=p.productId order by price asc LIMIT 1)as normalPrice,
  529. (select price from cm_sku where productId=p.productId order by price asc LIMIT 1)as price,
  530. includedTax,
  531. (select minBuyNumber from cm_sku where productId=p.productId order by price asc LIMIT 1)as minBuyNumber,
  532. productCategory,
  533. serviceNumber,
  534. supplierTaxPoint,
  535. priceFlag,
  536. actFlag,
  537. (select ladderPriceFlag from cm_sku where productId=p.productId order by price asc LIMIT 1) as ladderPriceFlag,
  538. addTime,
  539. hasSkuFlag,
  540. sellNumber,
  541. sortIndex,
  542. featuredFlag,
  543. (select costCheckFlag from cm_sku where productId=p.productId order by price asc LIMIT 1)as costCheckFlag,
  544. recommendType,
  545. machineType,
  546. productCode,
  547. updateTime,
  548. validFlag,
  549. searchKey,
  550. allAreaFlag,
  551. step,
  552. (select costPrice from cm_sku where productId=p.productId order by price asc LIMIT 1)as costPrice,
  553. provinceIds,
  554. qualificationImg,
  555. trainingMethod,
  556. trainingType,
  557. trainingFee,
  558. ifnull(newProductType, 2) as newProductType,
  559. qualificationNo as qualificationNo,
  560. productName as productName,
  561. qualificationTime as qualificationTime,
  562. qualificationLink as qualificationLink
  563. from product p
  564. where productID = #{productId}
  565. </select>
  566. <select id="getBrandNameById" resultType="java.lang.String">
  567. select name
  568. from cm_brand
  569. where id = #{brandId}
  570. </select>
  571. <select id="getProductParameters" resultType="com.caimei365.commodity.model.po.ProductParameterPo">
  572. select id, productID as productId, paramsName, paramsContent
  573. from cm_product_related_parameters
  574. where productId = #{productId}
  575. AND delFlag = '0'
  576. </select>
  577. <select id="getProductImages" resultType="com.caimei365.commodity.model.po.ProductImagePo">
  578. select productImageID as id, productID as productId, shopId, addTime, image, mainFlag, sortIndex
  579. from productimage
  580. where productID = #{productId}
  581. UNION
  582. SELECT p.productImageID AS id, p.productID AS productId, p.shopId, p.ADDTIME, p.image, p.mainFlag, p.sortIndex
  583. FROM productimage p
  584. LEFT JOIN cm_mall_organize_products cmop ON p.productId = cmop.productId
  585. WHERE cmop.id = #{productId}
  586. order by mainFlag desc
  587. </select>
  588. <select id="getProductDetailInfo" resultType="com.caimei365.commodity.model.po.ProductDetailInfoPo">
  589. select productDetailInfoId,
  590. productId,
  591. detailInfo,
  592. commonDetailInfo,
  593. serviceInfo,
  594. orderInfo,
  595. propValueAlias,
  596. propValueImages,
  597. detailInfoTxt,
  598. seoTitle,
  599. seoKeyword,
  600. seoDes
  601. from productdetailinfo
  602. where productId = #{productId}
  603. </select>
  604. <select id="getProductOrganizeDetailInfo" resultType="com.caimei365.commodity.model.po.ProductDetailInfoPo">
  605. SELECT p.productDetailInfoId,
  606. p.productId,
  607. p.detailInfo,
  608. p.commonDetailInfo,
  609. p.serviceInfo,
  610. p.orderInfo,
  611. p.propValueAlias,
  612. p.propValueImages,
  613. p.detailInfoTxt,
  614. p.seoTitle,
  615. p.seoKeyword,
  616. p.seoDes
  617. FROM productdetailinfo p
  618. LEFT JOIN cm_mall_organize_products cmop ON cmop.productId = p.productId
  619. WHERE p.productId = #{product} OR cmop.id = #{product}
  620. </select>
  621. <select id="getProductShopById" resultType="com.caimei365.commodity.model.vo.ShopVo">
  622. select userID as userId,
  623. shopID as shopId,
  624. name,
  625. sname as shortName,
  626. linkMan,
  627. contractMobile,
  628. contractEmail,
  629. contractEmail as email,
  630. provinceID as proviceId,
  631. cityID as cityId,
  632. townID as townId,
  633. address,
  634. socialCreditCode,
  635. businessLicenseImage as businessLicense,
  636. firstShopType,
  637. secondShopType,
  638. mainpro as mainProduct,
  639. productDesc as mainProductDesc,
  640. legalPerson,
  641. registeredCapital,
  642. fax as faxNumber,
  643. nature as companyNature,
  644. turnover,
  645. medicalPracticeLicenseImg1 as medicalPracticeLicense,
  646. info as shopDesc,
  647. businessScope,
  648. logo,
  649. addTime,
  650. status,
  651. contractPhone,
  652. validFlag,
  653. website,
  654. wxOfficialAccount,
  655. wxApplets
  656. from shop
  657. where shopID = #{shopId}
  658. </select>
  659. <select id="getProductNumById" resultType="java.lang.Integer">
  660. select COUNT(*) as normalNum
  661. from product p
  662. where p.shopID = #{shopId}
  663. and p.validFlag = 2
  664. group by p.shopID
  665. </select>
  666. <select id="getUserIdentityById" resultType="java.lang.Integer">
  667. select userIdentity
  668. from user
  669. where userID = #{userId}
  670. </select>
  671. <select id="getBrandAssociation" resultType="com.caimei365.commodity.model.vo.BrandVo">
  672. select id, name
  673. from cm_brand
  674. where status = '1'
  675. and delFlag = '0'
  676. and name like CONCAT("%", #{name}, "%")
  677. order by case
  678. when (source = '1' and userID = #{userId})
  679. then 0
  680. else 1
  681. end asc,
  682. LENGTH(name) asc
  683. </select>
  684. <select id="getBrandByName" resultType="com.caimei365.commodity.model.vo.BrandVo">
  685. select id, name
  686. from cm_brand
  687. where name = #{name}
  688. and delFlag = '0'
  689. </select>
  690. <select id="getShopBrandList" resultType="com.caimei365.commodity.model.vo.BrandVo">
  691. select id, name, source, userId, status, auditNote, sort, delFlag, logo, description, createDate, updateDate
  692. from cm_brand
  693. <where>
  694. userID = #{userId}
  695. and delFlag = '0'
  696. <if test="name != null and name != ''">
  697. and name like CONCAT("%",#{name},"%")
  698. </if>
  699. <if test="status != null and status != ''">
  700. and status = #{status}
  701. </if>
  702. </where>
  703. order by createDate desc
  704. </select>
  705. <select id="getPcBeautyStatusById" resultType="java.lang.Integer">
  706. select i.productId
  707. from new_page_floor_image i
  708. left join cm_page_centre c on i.centreId = c.id
  709. left join cm_page p on c.pageId = p.id
  710. where i.productId = #{productId}
  711. and i.pcStatus = 1
  712. and p.type = 7
  713. and c.enabledStatus = 1
  714. and p.enabledStatus = 1
  715. limit 1
  716. </select>
  717. <select id="getAppletsBeautyStatusById" resultType="java.lang.Integer">
  718. select i.productId
  719. from new_page_floor_image i
  720. left join cm_page_centre c on i.centreId = c.id
  721. left join cm_page p on c.pageId = p.id
  722. where i.productId = #{productId}
  723. and i.appletsStatus = 1
  724. and p.type = 7
  725. and c.crmEnabledStatus = 1
  726. and p.enabledStatus = 1
  727. limit 1
  728. </select>
  729. <select id="getShopNameByShopId" resultType="java.lang.String">
  730. select name
  731. from shop
  732. where shopID = #{shopId}
  733. </select>
  734. <select id="listingFee" resultType="java.lang.Integer">
  735. SELECT COUNT(*)
  736. FROM `cm_discern_receipt`
  737. WHERE newReceiptType = 1
  738. AND shopID = #{shopID}
  739. </select>
  740. <select id="listingfeeExpire" resultType="java.lang.Integer">
  741. SELECT COUNT(*)
  742. FROM `cm_discern_receipt`
  743. WHERE newReceiptType = 1
  744. AND shopID = #{shopID}
  745. AND NOW() > DATE_ADD(receiptDate, INTERVAL 1 YEAR)
  746. </select>
  747. <select id="receStatct" resultType="java.lang.Integer">
  748. SELECT COUNT(*)
  749. FROM `cm_discern_receipt`
  750. WHERE newReceiptType = 1
  751. AND shopID = #{shopID}
  752. AND receStatct = 2
  753. </select>
  754. </mapper>