ProductNewMapper.xml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.caimei.modules.product.dao.ProductNewDao">
  4. <resultMap id="productModelResultMap" type="com.caimei.modules.product.entity.Product">
  5. <id property="id" column="id"/>
  6. <result property="name" column="name"/>
  7. </resultMap>
  8. <sql id="productColumns">
  9. a.newvalidFlag,
  10. ifnull(a.newProductType,2) as newProductType,
  11. ifnull(a.announType,1) as announType,
  12. a.productID AS "id",
  13. a.productID AS "productID",
  14. a.brandID AS "brandID",
  15. ifnull(a.bigTypeID,0) AS "bigTypeID",
  16. ifnull(a.smallTypeID,0) AS "smallTypeID",
  17. ifnull(a.tinyTypeID,0) AS "tinyTypeID",
  18. a.productCategory AS "productCategory",
  19. a.selfTypeID AS "selfTypeID",
  20. a.preferredFlag AS "preferredFlag",
  21. a.shopID AS "shopID",
  22. a.name AS "name",
  23. a.searchKey AS "searchKey",
  24. a.combinationID AS "combinationID",
  25. a.productRemarks AS "productRemarks",
  26. a.normalPrice AS "normalPrice",
  27. a.price AS "price",
  28. a.priceFlag AS "priceFlag",
  29. a.beautyActFlag AS "beautyActFlag",
  30. a.ladderPriceFlag AS "ladderPriceFlag",
  31. a.stock AS "stock",
  32. a.hasSkuFlag AS "hasSkuFlag",
  33. a.mainImage AS "mainImage",
  34. a.propertiesInfo AS "propertiesInfo",
  35. a.addTime AS "addTime",
  36. a.updateTime AS "updateTime",
  37. a.sellNumber AS "sellNumber",
  38. a.weekSellNumber AS "weekSellNumber",
  39. a.beforeValidFlag AS "beforeValidFlag",
  40. a.validFlag AS "validFlag",
  41. a.favoriteTimes AS "favoriteTimes",
  42. a.commentScore AS "commentScore",
  43. a.commentTimes AS "commentTimes",
  44. a.selfRecommendFlag AS "selfRecommendFlag",
  45. a.sysRecommendFlag AS "sysRecommendFlag",
  46. a.sortIndex AS "sortIndex",
  47. a.featuredFlag AS "featuredFlag",
  48. a.featuredSortIndex AS "featuredSortIndex",
  49. a.productCode AS "productCode",
  50. a.unit AS "unit",
  51. a.synToERPFlag AS "synToERPFlag",
  52. a.allAreaFlag AS "allAreaFlag",
  53. a.provinceIDs AS "provinceIDs",
  54. a.serviceNumber AS "serviceNumber",
  55. a.maxBuyNumber AS "maxBuyNumber",
  56. a.minBuyNumber AS "minBuyNumber",
  57. a.packageCount AS "packageCount",
  58. a.byFlag AS "byFlag",
  59. a.normalProductFlag AS "normalProductFlag",
  60. a.wholeSaleProductFlag AS "wholeSaleProductFlag",
  61. a.promotionProductFlag AS "promotionProductFlag",
  62. a.groupBuyProductFlag AS "groupBuyProductFlag",
  63. a.step AS "step",
  64. a.actStatus AS "actStatus",
  65. a.actFlag AS "actFlag",
  66. a.actType AS "actType",
  67. a.onlineTime AS "onlineTime",
  68. a.downlineTime AS "downlineTime",
  69. a.freePostFlag AS "freePostFlag",
  70. a.costPrice AS "costPrice",
  71. a.costProportional AS "costProportional",
  72. a.costCheckFlag AS "costCheckFlag",
  73. a.precisehKey AS "precisehKey",
  74. s.name AS "shopName",
  75. a.actSort AS "actSort",
  76. a.recommendType AS "recommendType",
  77. a.aliasName as "aliasName",
  78. a.visibility as "visibility",
  79. a.productType as "productType",
  80. a.qualificationImg as "qualificationImg",
  81. a.includedTax as "includedTax",
  82. a.invoiceType as "invoiceType",
  83. a.taxPoint as "taxPoint",
  84. a.supplierTaxPoint as "supplierTaxPoint",
  85. a.tags as "tags",
  86. a.machineType as "machineType",
  87. a.commodityType as "commodityType",
  88. a.trainingMethod as "trainingMethod",
  89. a.trainingType as "trainingType",
  90. a.trainingFee as "trainingFee",
  91. a.splitCode as "splitCode",
  92. a.productDescribe as "productDescribe",
  93. cshd.secondHandType as "secondHandType",
  94. cshd.instrumentType as "instrumentType",
  95. cshd.sold as "sold",
  96. cshd.payStatus as "payStatus",
  97. cshd.contactName as "contactName",
  98. cshd.originalPrice as "originalPrice",
  99. cshd.submitDate AS "submitDate",
  100. cshd.reviewedDate AS "reviewedDate",
  101. cshd.onLineDate AS "onLineDate",
  102. cshd.brandName AS "otherBrandName",
  103. cshd.publisher AS "publisher",
  104. cshd.source AS "source",
  105. cshd.dockingPeopleName AS "dockingPeopleName",
  106. cb.name as "brandName",
  107. if(csp.id is not null,1,0) as "svipFlag",
  108. cshd.companyName as "companyName",
  109. cshd.publishIdentity as "publishIdentity",
  110. a.qualificationNo,
  111. a.productName,
  112. a.qualificationTime,
  113. a.qualificationLink
  114. </sql>
  115. <sql id="productJoins">
  116. LEFT JOIN shop s ON s.shopID = a.shopID
  117. LEFT JOIN cm_second_hand_detail cshd ON cshd.productID = a.productID
  118. LEFT JOIN cm_brand cb ON a.brandID = cb.id
  119. LEFT JOIN cm_svip_product csp on a.productID = csp.productId
  120. </sql>
  121. <sql id="ActivityJoins">
  122. LEFT JOIN shop s on s.shopID = a.shopID
  123. INNER JOIN tinytype AS b ON a.`tinyTypeID` = b.`tinyTypeID`
  124. INNER JOIN smalltype AS c ON b.`smallTypeID` = c.`smallTypeID`
  125. INNER JOIN bigtype AS d ON c.`bigTypeID` = d.`bigTypeID`
  126. </sql>
  127. <select id="get" resultType="Product">
  128. SELECT
  129. <include refid="productColumns"/>
  130. FROM product a
  131. <include refid="productJoins"/>
  132. WHERE a.productID = #{id}
  133. </select>
  134. <select id="getProductParams" resultType="com.caimei.modules.product.entity.ProductParameters">
  135. select *
  136. from cm_product_related_parameters
  137. where productId = #{productId}
  138. and delFlag = 0
  139. LIMIT 50
  140. </select>
  141. <select id="findList" resultType="Product">
  142. SELECT
  143. <include refid="productColumns"/>
  144. FROM product a
  145. <include refid="productJoins"/>
  146. LEFT JOIN cm_product_activity cp on cp.productId = a.productID
  147. <where>
  148. <if test="id !=null and id !=''">
  149. AND a.productID=#{id}
  150. </if>
  151. <if test="commodityType != null and commodityType != ''">
  152. AND a.commodityType=#{commodityType}
  153. </if>
  154. <if test="bigTypeID != null and bigTypeID != 0">
  155. AND a.bigTypeID = #{bigTypeID}
  156. </if>
  157. <if test="smallTypeID != null and smallTypeID != 0">
  158. AND a.smallTypeID = #{smallTypeID}
  159. </if>
  160. <if test="tinyTypeID != null and tinyTypeID != 0">
  161. AND a.tinyTypeID = #{tinyTypeID}
  162. </if>
  163. <if test="productCategory != null and productCategory != ''">
  164. AND a.productCategory = #{productCategory}
  165. <if test="productCategory == 2">
  166. AND a.validFlag != '0'
  167. </if>
  168. </if>
  169. <if test="brandID != null and brandID != ''">
  170. AND a.brandID = #{brandID}
  171. </if>
  172. <if test="shopID != null and shopID != ''">
  173. AND a.shopID = #{shopID}
  174. </if>
  175. <if test="productType != null and productType !=''">
  176. AND a.productType = #{productType}
  177. </if>
  178. <if test='actStatus == "1"'>
  179. AND cp.delFlag = '0'
  180. </if>
  181. <if test="preferredFlag != null and preferredFlag != ''and preferredFlag != 0">
  182. <if test="preferredFlag/100>=1">
  183. AND a.preferredFlag in (100,101,110,111)
  184. </if>
  185. <if test="(preferredFlag%100)/10>=1">
  186. AND a.preferredFlag in (10,11,110,111)
  187. </if>
  188. <if test="preferredFlag%10>=1">
  189. AND a.preferredFlag in (1,11,101,111)
  190. </if>
  191. </if>
  192. <if test="name != null and name != ''">
  193. AND a.name LIKE
  194. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  195. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  196. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  197. </if>
  198. <if test="shopName != null and shopName != ''">
  199. AND s.name LIKE
  200. <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
  201. <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
  202. <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
  203. </if>
  204. <if test="validFlagString !=null and validFlagString !=''">
  205. AND a.validFlag in
  206. <foreach collection="validFlagString" separator="," item="valid" open="(" close=")">
  207. #{valid}
  208. </foreach>
  209. </if>
  210. <if test="actFlag !=null and actFlag !=''">
  211. AND a.actFlag=#{actFlag}
  212. </if>
  213. <if test="actType !=null and actType !=''">
  214. AND a.actType=#{actType}
  215. </if>
  216. <if test="secondHandType !=null and secondHandType !=''">
  217. AND cshd.secondHandType=#{secondHandType}
  218. </if>
  219. <if test="instrumentType !=null and instrumentType !=''">
  220. AND cshd.instrumentType like concat('%',#{instrumentType},'%')
  221. </if>
  222. <if test="sold != null and sold != ''">
  223. AND cshd.sold=#{sold}
  224. </if>
  225. <if test="source != null and source != ''">
  226. AND cshd.source=#{source}
  227. </if>
  228. <if test="publishIdentity != null and publishIdentity !=''">
  229. AND cshd.publishIdentity = #{publishIdentity}
  230. </if>
  231. <if test="announType !=null and announType!= '' and productCategory == 2">
  232. AND a.announType=#{announType}
  233. </if>
  234. <if test="newvalidFlag !=null and newvalidFlag!= ''">
  235. AND a.newvalidFlag=#{newvalidFlag}
  236. </if>
  237. <if test="newProductType !=null and productCategory == 1">
  238. AND a.newProductType=#{newProductType}
  239. </if>
  240. <if test="contactName !=null and contactName !=''">
  241. AND (cshd.contactName LIKE concat('%',#{contactName},'%') or cshd.companyName LIKE
  242. concat('%',#{contactName},'%'))
  243. </if>
  244. <if test="sqlMap !=null and sqlMap !=''">
  245. ${sqlMap.dsf}
  246. </if>
  247. AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
  248. AND a.productID NOT IN (6060, 6061, 6062, 6063, 6064,6065, 6066, 6067, 6068, 6069)
  249. </where>
  250. <choose>
  251. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  252. ORDER BY ${page.orderBy}
  253. </when>
  254. <otherwise>
  255. order by a.productID desc
  256. </otherwise>
  257. </choose>
  258. </select>
  259. <select id="findAllList" resultType="Product">
  260. SELECT
  261. <include refid="productColumns"/>
  262. FROM product a
  263. <include refid="productJoins"/>
  264. <where>
  265. a.productCategory = 1
  266. <if test="productCategory != null and productCategory != ''">
  267. AND a.productCategory = #{productCategory}
  268. </if>
  269. </where>
  270. <choose>
  271. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  272. ORDER BY ${page.orderBy}
  273. </when>
  274. <otherwise>
  275. </otherwise>
  276. </choose>
  277. </select>
  278. <select id="getImageList" resultType="com.caimei.po.ProductImage">
  279. select *
  280. from productimage
  281. where productID = #{productId}
  282. ORDER BY mainFlag DESC, sortIndex is null, sortIndex ASC
  283. </select>
  284. <select id="getImageById" resultType="com.caimei.po.ProductImage">
  285. select *
  286. from productimage
  287. where productImageID = #{productImageID}
  288. </select>
  289. <select id="getValidFlagByProductId" resultType="java.lang.String">
  290. select validFlag
  291. from product
  292. where productID = #{productID}
  293. </select>
  294. <select id="getBeforeValidFlagByProductId" resultType="java.lang.String">
  295. select beforeValidFlag
  296. from product
  297. where productID = #{productID}
  298. </select>
  299. <insert id="insert" parameterType="Product" keyProperty="id" useGeneratedKeys="true">
  300. INSERT INTO product(productID,
  301. brandID,
  302. tinyTypeID,
  303. productCategory,
  304. selfTypeID,
  305. shopID,
  306. name,
  307. searchKey,
  308. normalPrice,
  309. price,
  310. priceFlag,
  311. beautyActFlag,
  312. ladderPriceFlag,
  313. stock,
  314. hasSkuFlag,
  315. mainImage,
  316. propertiesInfo,
  317. addTime,
  318. updateTime,
  319. sellNumber,
  320. weekSellNumber,
  321. beforeValidFlag,
  322. validFlag,
  323. favoriteTimes,
  324. commentScore,
  325. commentTimes,
  326. selfRecommendFlag,
  327. sysRecommendFlag,
  328. sortIndex,
  329. featuredFlag,
  330. featuredSortIndex,
  331. productCode,
  332. unit,
  333. synToERPFlag,
  334. allAreaFlag,
  335. provinceIDs,
  336. serviceNumber,
  337. maxBuyNumber,
  338. minBuyNumber,
  339. packageCount,
  340. byFlag,
  341. normalProductFlag,
  342. wholeSaleProductFlag,
  343. promotionProductFlag,
  344. groupBuyProductFlag,
  345. step,
  346. actFlag,
  347. actType,
  348. onlineTime,
  349. downlineTime,
  350. freePostFlag,
  351. costPrice,
  352. costProportional,
  353. costCheckFlag,
  354. precisehKey)
  355. VALUES (#{id},
  356. #{brandID},
  357. #{tinyTypeID},
  358. #{productCategory},
  359. #{selfTypeID},
  360. #{shopID},
  361. #{name},
  362. #{searchKey},
  363. #{normalPrice},
  364. #{price},
  365. #{priceFlag},
  366. #{beautyActFlag},
  367. #{ladderPriceFlag},
  368. #{stock},
  369. #{hasSkuFlag},
  370. #{mainImage},
  371. #{propertiesInfo},
  372. #{addTime},
  373. #{updateTime},
  374. #{sellNumber},
  375. #{weekSellNumber},
  376. #{beforeValidFlag},
  377. #{validFlag},
  378. #{favoriteTimes},
  379. #{commentScore},
  380. #{commentTimes},
  381. #{selfRecommendFlag},
  382. #{sysRecommendFlag},
  383. #{sortIndex},
  384. #{featuredFlag},
  385. #{featuredSortIndex},
  386. #{productCode},
  387. #{unit},
  388. #{synToERPFlag},
  389. #{allAreaFlag},
  390. #{provinceIDs},
  391. #{serviceNumber},
  392. #{maxBuyNumber},
  393. #{minBuyNumber},
  394. #{packageCount},
  395. #{byFlag},
  396. #{normalProductFlag},
  397. #{wholeSaleProductFlag},
  398. #{promotionProductFlag},
  399. #{groupBuyProductFlag},
  400. #{step},
  401. #{actFlag},
  402. #{actType},
  403. #{onlineTime},
  404. #{downlineTime},
  405. #{freePostFlag},
  406. #{costPrice},
  407. #{costProportional},
  408. #{costCheckFlag},
  409. #{precisehKey})
  410. </insert>
  411. <update id="update">
  412. UPDATE product
  413. SET productID = #{id},
  414. brandID = #{brandID},
  415. tinyTypeID = #{tinyTypeID},
  416. productCategory = #{productCategory},
  417. selfTypeID = #{selfTypeID},
  418. shopID = #{shopID},
  419. name = #{name},
  420. searchKey = #{searchKey},
  421. normalPrice = #{normalPrice},
  422. price = #{price},
  423. priceFlag = #{priceFlag},
  424. beautyActFlag = #{beautyActFlag},
  425. ladderPriceFlag = #{ladderPriceFlag},
  426. stock = #{stock},
  427. hasSkuFlag = #{hasSkuFlag},
  428. mainImage = #{mainImage},
  429. propertiesInfo = #{propertiesInfo},
  430. addTime = #{addTime},
  431. updateTime = #{updateTime},
  432. sellNumber = #{sellNumber},
  433. weekSellNumber = #{weekSellNumber},
  434. beforeValidFlag = #{beforeValidFlag},
  435. validFlag = #{validFlag},
  436. favoriteTimes = #{favoriteTimes},
  437. commentScore = #{commentScore},
  438. commentTimes = #{commentTimes},
  439. selfRecommendFlag = #{selfRecommendFlag},
  440. sysRecommendFlag = #{sysRecommendFlag},
  441. sortIndex = #{sortIndex},
  442. featuredFlag = #{featuredFlag},
  443. featuredSortIndex = #{featuredSortIndex},
  444. productCode = #{productCode},
  445. unit = #{unit},
  446. synToERPFlag = #{synToERPFlag},
  447. allAreaFlag = #{allAreaFlag},
  448. provinceIDs = #{provinceIDs},
  449. serviceNumber = #{serviceNumber},
  450. maxBuyNumber = #{maxBuyNumber},
  451. minBuyNumber = #{minBuyNumber},
  452. packageCount = #{packageCount},
  453. byFlag = #{byFlag},
  454. normalProductFlag = #{normalProductFlag},
  455. wholeSaleProductFlag = #{wholeSaleProductFlag},
  456. promotionProductFlag = #{promotionProductFlag},
  457. groupBuyProductFlag = #{groupBuyProductFlag},
  458. step = #{step},
  459. actFlag = #{actFlag},
  460. actType = #{actType},
  461. onlineTime = #{onlineTime},
  462. downlineTime = #{downlineTime},
  463. freePostFlag = #{freePostFlag},
  464. costPrice = #{costPrice},
  465. costProportional = #{costProportional},
  466. costCheckFlag = #{costCheckFlag},
  467. precisehKey = #{precisehKey},
  468. actSort = #{actSort},
  469. productType = #{productType},
  470. qualificationImg = #{qualificationImg},
  471. includedTax = #{includedTax},
  472. invoiceType = #{invoiceType},
  473. taxPoint = #{taxPoint},
  474. supplierTaxPoint = #{supplierTaxPoint}
  475. WHERE productID = #{id}
  476. </update>
  477. <update id="updateIndex" parameterType="java.lang.Integer">
  478. update cm_syntolucenedoc set synFlag = 0,synType = 2
  479. <where>
  480. <if test="id !=null and id !=''">
  481. productID=#{id}
  482. </if>
  483. </where>
  484. </update>
  485. <insert id="insertProductImage" parameterType="com.caimei.po.ProductImage">
  486. insert into productimage (productID, shopID, addTime, image, mainFlag, sortIndex)
  487. values (#{productID}, #{shopID}, #{addTime}, #{image}, #{mainFlag}, #{sortIndex});
  488. </insert>
  489. <select id="newFloorId" resultType="java.lang.Integer">
  490. select id
  491. from new_page_floor
  492. where floorType = 1
  493. limit 1
  494. </select>
  495. <update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
  496. update product
  497. <set>
  498. <if test="floorId != null and floorId != ''">
  499. floorId=#{floorId},
  500. </if>
  501. <if test="newvalidFlag != null and newvalidFlag != '' ">
  502. newvalidFlag=#{newvalidFlag},
  503. </if>
  504. <if test="brandID != null and brandID != ''">
  505. brandID = #{brandID},
  506. </if>
  507. <if test="bigTypeID != null and bigTypeID !=''">
  508. bigTypeID = #{bigTypeID},
  509. smallTypeID = #{smallTypeID},
  510. tinyTypeID = #{tinyTypeID},
  511. </if>
  512. <if test="preferredFlag != null and preferredFlag !=''">
  513. preferredFlag = #{preferredFlag},
  514. </if>
  515. <if test="selfTypeID != null and selfTypeID !=''">
  516. selfTypeID = #{selfTypeID},
  517. </if>
  518. <if test="shopID != null and shopID !=''">
  519. shopID = #{shopID},
  520. </if>
  521. <if test="name != null and name !=''">
  522. `name` = #{name},
  523. </if>
  524. <if test="aliasName != null and aliasName !=''">
  525. aliasName = #{aliasName},
  526. </if>
  527. <if test="searchKey != null and searchKey !=''">
  528. searchKey = #{searchKey},
  529. </if>
  530. <if test="productRemarks != null and productRemarks !=''">
  531. productRemarks = #{productRemarks},
  532. </if>
  533. <if test="combinationID != null and combinationID !=''">
  534. combinationID = #{combinationID},
  535. </if>
  536. <if test="normalPrice != null and normalPrice !=''">
  537. normalPrice = #{normalPrice},
  538. </if>
  539. <if test="price != null and price !=''">
  540. price = #{price},
  541. </if>
  542. <if test="priceFlag != null and priceFlag !=''">
  543. priceFlag = #{priceFlag},
  544. </if>
  545. <if test="beautyActFlag != null and beautyActFlag !=''">
  546. beautyActFlag = #{beautyActFlag},
  547. </if>
  548. <if test="ladderPriceFlag != null and ladderPriceFlag !=''">
  549. ladderPriceFlag = #{ladderPriceFlag},
  550. </if>
  551. <if test="stock != null and stock !=''">
  552. stock = #{stock},
  553. </if>
  554. <if test="hasSkuFlag != null and hasSkuFlag !=''">
  555. hasSkuFlag = #{hasSkuFlag},
  556. </if>
  557. <if test="mainImage != null and mainImage !=''">
  558. mainImage = #{mainImage},
  559. </if>
  560. <if test="propertiesInfo != null and propertiesInfo !=''">
  561. propertiesInfo = #{propertiesInfo},
  562. </if>
  563. <if test="addTime != null and addTime !=''">
  564. addTime = #{addTime},
  565. </if>
  566. <if test="updateTime != null and updateTime !=''">
  567. updateTime = #{updateTime},
  568. </if>
  569. <if test="sellNumber != null and sellNumber !=''">
  570. sellNumber = #{sellNumber},
  571. </if>
  572. <if test="weekSellNumber != null and weekSellNumber !=''">
  573. weekSellNumber = #{weekSellNumber},
  574. </if>
  575. <if test="beforeValidFlag != null and beforeValidFlag !=''">
  576. beforeValidFlag = #{beforeValidFlag},
  577. </if>
  578. <if test="validFlag != null and validFlag !=''">
  579. validFlag = #{validFlag},
  580. </if>
  581. <if test="favoriteTimes != null and favoriteTimes !=''">
  582. favoriteTimes = #{favoriteTimes},
  583. </if>
  584. <if test="commentScore != null and commentScore !=''">
  585. commentScore = #{commentScore},
  586. </if>
  587. <if test="commentTimes != null and commentTimes !=''">
  588. commentTimes = #{commentTimes},
  589. </if>
  590. <if test="selfRecommendFlag != null and selfRecommendFlag !=''">
  591. selfRecommendFlag = #{selfRecommendFlag},
  592. </if>
  593. <if test="sysRecommendFlag != null and sysRecommendFlag !=''">
  594. sysRecommendFlag = #{sysRecommendFlag},
  595. </if>
  596. <if test="sortIndex != null and sortIndex != ''">
  597. sortIndex = #{sortIndex},
  598. </if>
  599. <if test="featuredFlag != null and featuredFlag !=''">
  600. featuredFlag = #{featuredFlag},
  601. </if>
  602. <if test="featuredSortIndex != null and featuredSortIndex !=''">
  603. featuredSortIndex = #{featuredSortIndex},
  604. </if>
  605. <if test="productCode != null and productCode !=''">
  606. productCode = #{productCode},
  607. </if>
  608. <if test="unit != null and unit !=''">
  609. unit = #{unit},
  610. </if>
  611. <if test="synToERPFlag != null and synToERPFlag !=''">
  612. synToERPFlag = #{synToERPFlag},
  613. </if>
  614. <if test="allAreaFlag != null and allAreaFlag !=''">
  615. allAreaFlag = #{allAreaFlag},
  616. </if>
  617. <if test="provinceIDs != null and provinceIDs !=''">
  618. provinceIDs = #{provinceIDs},
  619. </if>
  620. <if test="serviceNumber != null and serviceNumber !=''">
  621. serviceNumber = #{serviceNumber},
  622. </if>
  623. <if test="maxBuyNumber != null and maxBuyNumber !=''">
  624. maxBuyNumber = #{maxBuyNumber},
  625. </if>
  626. <if test="minBuyNumber != null and minBuyNumber !=''">
  627. minBuyNumber = #{minBuyNumber},
  628. </if>
  629. <if test="packageCount != null and packageCount !=''">
  630. packageCount = #{packageCount},
  631. </if>
  632. <if test="byFlag != null and byFlag !=''">
  633. byFlag = #{byFlag},
  634. </if>
  635. <if test="normalProductFlag != null and normalProductFlag !=''">
  636. normalProductFlag = #{normalProductFlag},
  637. </if>
  638. <if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">
  639. wholeSaleProductFlag = #{wholeSaleProductFlag},
  640. </if>
  641. <if test="promotionProductFlag != null and promotionProductFlag !=''">
  642. promotionProductFlag = #{promotionProductFlag},
  643. </if>
  644. <if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">
  645. groupBuyProductFlag = #{groupBuyProductFlag},
  646. </if>
  647. <if test="step != null and step !=''">
  648. step = #{step},
  649. </if>
  650. <if test="actFlag != null and actFlag !=''">
  651. actFlag = #{actFlag},
  652. </if>
  653. <if test="actSort != null and actSort !=''">
  654. actSort = #{actSort},
  655. </if>
  656. <if test="actType != null and actType !=''">
  657. actType = #{actType},
  658. </if>
  659. <if test="onlineTime != null and onlineTime !=''">
  660. onlineTime = #{onlineTime},
  661. </if>
  662. <if test="downlineTime != null and downlineTime !=''">
  663. downlineTime = #{downlineTime},
  664. </if>
  665. <if test="freePostFlag != null and freePostFlag !=''">
  666. freePostFlag = #{freePostFlag},
  667. </if>
  668. <if test="costPrice != null and costPrice != ''">
  669. costPrice = #{costPrice},
  670. </if>
  671. <if test="costProportional != null and costProportional !=''">
  672. costProportional = #{costProportional},
  673. </if>
  674. <if test="costCheckFlag != null and costCheckFlag !=''">
  675. costCheckFlag = #{costCheckFlag},
  676. </if>
  677. <if test="precisehKey != null and precisehKey !=''">
  678. precisehKey = #{precisehKey},
  679. </if>
  680. <if test="visibility != null and visibility !=''">
  681. visibility = #{visibility},
  682. </if>
  683. <if test="endTimeStr != null and endTimeStr !=''">
  684. endTimeStr = #{endTimeStr},
  685. </if>
  686. <if test="tags != null and tags !=''">
  687. tags = #{tags},
  688. </if>
  689. <if test="recommendType != null and recommendType !=''">
  690. recommendType = #{recommendType},
  691. </if>
  692. <if test="machineType != null and machineType !=''">
  693. machineType = #{machineType},
  694. </if>
  695. <if test="commodityType != null and commodityType != ''">
  696. commodityType = #{commodityType},
  697. </if>
  698. <if test="showTime!= '' and showTime!=null">
  699. showTime=#{showTime},
  700. </if>
  701. <if test="newshowTime !=null">
  702. newshowTime=#{newshowTime},
  703. </if>
  704. <if test="newvalidFlag == 1">
  705. showFlag=1
  706. </if>
  707. <if test="newvalidFlag == 2">
  708. showFlag=4
  709. </if>
  710. </set>
  711. where productID = #{productID}
  712. </update>
  713. <update id="updateImageSort">
  714. update productimage
  715. set sortIndex = #{sortIndex}
  716. where productImageID = #{productImageID}
  717. </update>
  718. <update id="cancelImageMainFlag">
  719. update productimage
  720. set mainFlag = 0
  721. where productID = #{productID}
  722. and mainFlag = 1
  723. </update>
  724. <update id="setImageMainFlag">
  725. update productimage
  726. set mainFlag = 1
  727. where productImageID = #{productImageID}
  728. </update>
  729. <update id="setProductImage">
  730. UPDATE product
  731. SET mainImage = #{mainImage}
  732. WHERE productID = #{productID}
  733. </update>
  734. <delete id="deleteImage">
  735. DELETE
  736. FROM productimage
  737. WHERE productImageID = #{productImageID}
  738. </delete>
  739. <delete id="mulDeleteImage">
  740. DELETE FROM productimage
  741. WHERE productImageID IN
  742. <foreach collection="idList" item="productImageID" index="index" open="(" separator="," close=")">
  743. #{productImageID}
  744. </foreach>
  745. </delete>
  746. <delete id="deleteParameters">
  747. DELETE
  748. FROM cm_product_related_parameters
  749. WHERE productId = #{productId}
  750. </delete>
  751. <delete id="deleteImageByProductId">
  752. DELETE
  753. FROM productimage
  754. WHERE productID = #{productID}
  755. </delete>
  756. <insert id="insertParameters" parameterType="com.caimei.modules.product.entity.ProductParameters">
  757. insert into cm_product_related_parameters
  758. (productId,
  759. paramsName,
  760. paramsContent,
  761. delFlag)
  762. values (#{productId},
  763. #{paramsName},
  764. #{paramsContent},
  765. #{delFlag})
  766. </insert>
  767. <insert id="insertStatusRecord">
  768. INSERT INTO `product_status_record` (`productId`,
  769. `modifyUserId`,
  770. `validFlag`,
  771. `remarks`,
  772. `addTime`)
  773. VALUES (#{productId},
  774. #{modifyUserId},
  775. #{validFlag},
  776. #{remarks},
  777. #{addTime})
  778. </insert>
  779. <insert id="addProductData">
  780. update product
  781. set costPrice = #{costPrice},
  782. costProportional = #{costProportional},
  783. taxPoint = #{taxPoint},
  784. supplierTaxPoint = #{supplierTaxPoint}
  785. where productID = #{productId}
  786. </insert>
  787. <select id="findAllStatusRemarks" resultType="com.caimei.modules.product.entity.ProductStatusRecord">
  788. SELECT id,
  789. `productId`,
  790. `modifyUserId`,
  791. `validFlag`,
  792. `remarks`,
  793. `addTime`
  794. FROM `product_status_record`
  795. WHERE productId = #{productId}
  796. ORDER BY addTime DESC
  797. </select>
  798. <select id="findSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
  799. select shopId, commercialCode as splitCode, codeDetail as codeRemark
  800. from cm_shop_splitcode
  801. where shopId = #{shopID}
  802. </select>
  803. <select id="findSplitCodeByProduct" resultType="java.lang.String">
  804. select splitCode
  805. from product
  806. where productID = #{productID}
  807. </select>
  808. <select id="getShopIdByName" resultType="java.lang.Integer">
  809. select shopID
  810. from shop
  811. where name like concat('%', #{shopName}, '%')
  812. order by shopID desc
  813. limit 1
  814. </select>
  815. <select id="findSecondSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
  816. select css.shopId, css.commercialCode as splitCode, css.codeDetail as codeRemark
  817. from cm_shop_splitcode css
  818. left join product p on p.shopID = css.shopId
  819. where p.productID = #{id}
  820. </select>
  821. <select id="validIList" resultType="com.caimei.modules.product.entity.Product">
  822. select p.*,s.contractMobile as mobile,s.userID as userId,s.name as shopName
  823. from product p
  824. left join shop s on p.shopID = s.shopId
  825. where p.productID = #{productID}
  826. </select>
  827. </mapper>