ProductNewMapper.xml 31 KB

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