ProductNewMapper.xml 34 KB

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