GoodsDao.xml 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  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.kmall.admin.dao.GoodsDao">
  4. <resultMap type="com.kmall.admin.entity.GoodsEntity" id="goodsMap">
  5. <result property="id" column="id"/>
  6. <result property="merchSn" column="merch_sn"/>
  7. <result property="categoryId" column="category_id"/>
  8. <result property="goodsSn" column="goods_sn"/>
  9. <result property="name" column="name"/>
  10. <result property="brandId" column="brand_id"/>
  11. <!--<result property="freightId" column="freight_id"/>-->
  12. <result property="brand" column="brand"/>
  13. <result property="goodsNumber" column="goods_number"/>
  14. <result property="keywords" column="keywords"/>
  15. <result property="goodsBrief" column="goods_brief"/>
  16. <result property="goodsDesc" column="goods_desc"/>
  17. <result property="isOnSale" column="is_on_sale"/>
  18. <result property="addTime" column="add_time"/>
  19. <result property="sortOrder" column="sort_order"/>
  20. <result property="isDelete" column="is_delete"/>
  21. <!--<result property="attributeCategory" column="attribute_category"/>-->
  22. <result property="counterPrice" column="counter_price"/>
  23. <result property="extraPrice" column="extra_price"/>
  24. <result property="isNew" column="is_new"/>
  25. <result property="goodsUnit" column="goods_unit"/>
  26. <result property="primaryPicUrl" column="primary_pic_url"/>
  27. <result property="listPicUrl" column="list_pic_url"/>
  28. <!--<result property="retailPrice" column="retail_price"/>-->
  29. <result property="sellVolume" column="sell_volume"/>
  30. <result property="primaryProductId" column="primary_product_id"/>
  31. <result property="unitPrice" column="unit_price"/>
  32. <result property="promotionDesc" column="promotion_desc"/>
  33. <result property="promotionTag" column="promotion_tag"/>
  34. <result property="appExclusivePrice" column="app_exclusive_price"/>
  35. <result property="isAppExclusive" column="is_app_exclusive"/>
  36. <result property="isLimited" column="is_limited"/>
  37. <result property="isHot" column="is_hot"/>
  38. <!--<result property="marketPrice" column="market_price"/>-->
  39. <result property="goodsType" column="goodsType"/>
  40. <result property="sku" column="sku"/>
  41. <result property="goodsBizType" column="goods_biz_type"/>
  42. <result column="creater_sn" property="createrSn" jdbcType="VARCHAR"/>
  43. <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
  44. <result column="moder_sn" property="moderSn" jdbcType="VARCHAR"/>
  45. <result column="mod_time" property="modTime" jdbcType="TIMESTAMP"/>
  46. <result column="tstm" property="tstm" jdbcType="TIMESTAMP"/>
  47. <result property="prodBarcode" column="prod_barcode"/>
  48. <result property="unitCode" column="unit_code"/>
  49. <result property="goodsDesc" column="goods_desc"/>
  50. <result property="cusGoodsCode" column="cus_goods_code"/>
  51. <result property="ciqProdModel" column="ciq_prod_model"/>
  52. <result property="oriCntCode" column="ori_cnt_code"/>
  53. <result property="cusDeclEle" column="cus_decl_ele"/>
  54. <result property="cusRecCode" column="cus_rec_code"/>
  55. <result property="supplierId" column="supplier_id"/>
  56. <result property="stockNum" column="stock_num"/>
  57. <result property="storeName" column="store_name"/>
  58. <result property="productId" column="productId"/>
  59. <result property="storeId" column="storeId"/>
  60. <result column="merch_name" property="merchName"/>
  61. <result column="storeMarketPrice" property="storeMarketPrice"/>
  62. <result column="storeRetailPrice" property="storeRetailPrice"/>
  63. <result column="third_party_merch_code" property="thirdPartyMerchCode"/>
  64. <result column="isStockShare" property="isStockShare"/>
  65. <result column="gross_weight" property="grossWeight"/>
  66. <result column="net_weight" property="netWeight"/>
  67. <result property="isGoodsShareStock" column="is_goods_share_stock"/>
  68. <result column="cost_price" property="costPrice"/>
  69. <result property="dailyPrice" column="daily_price"/>
  70. <result column="last_sale_time" property="lastSaleTime" jdbcType="TIMESTAMP"/>
  71. <result column="mychem_id" property="mychemId"/>
  72. <result column="hs_code" property="hsCode"/>
  73. <result column="hs_code_name" property="hsCodeName"/>
  74. <result column="is_sync_hs_code" property="isSyncHsCode"/>
  75. <result column="is_sync_goods_rate" property="isSyncGoodsRate"/>
  76. <result column="imp_consum_tax_rate" property="impConsumTaxRate"/>
  77. <result column="value_added_tax_rate" property="valueAddedTaxRate"/>
  78. <result column="legal_unit1_qty" property="legalUnit1Qty"/>
  79. <result column="legal_unit2_qty" property="legalUnit2Qty"/>
  80. <result column="cosm_threshold_value" property="cosmThresholdValue"/>
  81. <result column="to_be_restored" property="toBeRestored" />
  82. <result column="prod_name" property="prodName" />
  83. <result column="prod_record_name" property="prodRecordName" />
  84. </resultMap>
  85. <select id="queryObject" resultType="com.kmall.admin.entity.GoodsEntity">
  86. SELECT
  87. a.*, CASE
  88. when g.id > 0 then 2 else 0 end as goodsType,
  89. mb.third_party_merch_code,
  90. mb.is_stock_share isStockShare,
  91. mb.is_supplier_goods 'isSupplierGoods'
  92. FROM
  93. mall_goods a
  94. LEFT JOIN mall_goods_group g ON g.goods_id = a.id AND g.open_status != 3
  95. LEFT JOIN third_merchant_biz mb ON a.third_party_merch_code = mb.third_party_merch_code
  96. WHERE a.id = #{value}
  97. </select>
  98. <select id="queryObjectByStoreId" resultMap="goodsMap">
  99. select
  100. a.sku,
  101. a.id,
  102. psr1.category_id,
  103. a.goods_sn,
  104. a.name,
  105. psr1.brand_id,
  106. a.goods_number,
  107. a.keywords,
  108. a.goods_brief,
  109. a.is_on_sale,
  110. a.add_time,
  111. a.sort_order,
  112. a.is_delete,
  113. psr1.attribute_category,
  114. a.counter_price,
  115. a.extra_price,
  116. a.is_new,
  117. a.goods_unit,
  118. a.primary_pic_url,
  119. a.list_pic_url,
  120. psr1.retail_price,
  121. psr1.sell_volume,
  122. a.primary_product_id,
  123. a.unit_price,
  124. a.promotion_desc,
  125. a.promotion_tag,
  126. a.app_exclusive_price,
  127. a.is_app_exclusive,
  128. a.is_limited,
  129. a.is_hot,
  130. a.merch_sn,
  131. a.to_be_restored,
  132. m.merch_name,
  133. psr1.store_id,
  134. psr1.market_price,
  135. psr1.stock_num,
  136. a.goods_desc,a.goods_biz_type,a.goods_rate,
  137. a.sell_volume goods_sell_volume,
  138. mb.third_party_merch_code,
  139. mb.is_stock_share isStockShare,
  140. mb.is_supplier_goods 'isSupplierGoods',
  141. mb2.third_party_merch_code 'supplierThirdMerchCode',
  142. mb2.is_stock_share 'isStockShareBySuppler',
  143. a.hs_code, a.legal_unit1_qty, a.legal_unit2_qty,a.ciq_prod_model
  144. from mall_goods a left join mall_merch m on a.merch_sn = m.merch_sn
  145. LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id and a.merch_sn = psr1.merch_sn
  146. LEFT JOIN mall_store s ON s.id = psr1.store_id
  147. LEFT JOIN third_merchant_biz mb on s.third_party_merch_code = mb.third_party_merch_code
  148. LEFT JOIN third_merchant_biz mb2 ON a.third_party_merch_code = mb2.third_party_merch_code
  149. where a.id = #{id} and psr1.store_id = #{storeId}
  150. </select>
  151. <select id="queryGoodsByGoodsSnAndStoreId" resultMap="goodsMap">
  152. select
  153. a.sku,
  154. a.id,
  155. psr1.category_id,
  156. a.goods_sn,
  157. a.name,
  158. psr1.brand_id,
  159. a.goods_number,
  160. a.keywords,
  161. a.goods_brief,
  162. a.is_on_sale,
  163. a.add_time,
  164. a.sort_order,
  165. a.is_delete,
  166. psr1.attribute_category,
  167. a.counter_price,
  168. a.extra_price,
  169. a.is_new,
  170. a.goods_unit,
  171. a.primary_pic_url,
  172. a.list_pic_url,
  173. psr1.retail_price,
  174. psr1.sell_volume,
  175. a.primary_product_id,
  176. a.unit_price,
  177. a.promotion_desc,
  178. a.promotion_tag,
  179. a.app_exclusive_price,
  180. a.is_app_exclusive,
  181. a.is_limited,
  182. a.is_hot,
  183. a.merch_sn,
  184. a.to_be_restored,
  185. m.merch_name,
  186. psr1.store_id,
  187. psr1.market_price,
  188. psr1.stock_num,
  189. a.goods_desc,a.goods_biz_type,a.goods_rate,
  190. a.sell_volume goods_sell_volume,
  191. mb.third_party_merch_code,
  192. mb.is_stock_share isStockShare,
  193. mb.is_supplier_goods 'isSupplierGoods',
  194. mb2.third_party_merch_code 'supplierThirdMerchCode',
  195. mb2.is_stock_share 'isStockShareBySuppler',
  196. a.hs_code, a.legal_unit1_qty, a.legal_unit2_qty,a.ciq_prod_model
  197. from mall_goods a left join mall_merch m on a.merch_sn = m.merch_sn
  198. LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id and a.merch_sn = psr1.merch_sn
  199. LEFT JOIN mall_store s ON s.id = psr1.store_id
  200. LEFT JOIN third_merchant_biz mb on s.third_party_merch_code = mb.third_party_merch_code
  201. LEFT JOIN third_merchant_biz mb2 ON a.third_party_merch_code = mb2.third_party_merch_code
  202. where a.goods_sn = #{goodsSn} and psr1.store_id = #{storeId}
  203. </select>
  204. <select id="queryObjectByProdBarcodeAndBizType" resultType="com.kmall.admin.entity.GoodsEntity">
  205. SELECT
  206. a.id,a.sku,a.goods_sn,a.name,a.list_pic_url,a.prod_barcode,r.market_price storeMarketPrice,r.retail_price storeRetailPrice ,r.stock_num,s.store_name,r.product_id,s.id 'storeId',
  207. a.hs_code as hsCode , a.legal_unit1_qty as legalUnit1Qty , a.legal_unit2_qty as legalUnit2Qty,a.ciq_prod_model as ciqProdModel,a.to_be_restored
  208. FROM
  209. mall_goods a
  210. LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
  211. inner join mall_store s on r.store_id=s.id
  212. where a.prod_barcode = #{prodBarcode} and a.goods_biz_type = 11 and r.store_id = #{storeId}
  213. </select>
  214. <select id="queryObjectByProdBarcodeAndStore" resultType="com.kmall.admin.entity.GoodsEntity">
  215. SELECT
  216. a.id,a.sku,a.goods_number,a.goods_sn,a.name,a.list_pic_url,a.prod_barcode,r.market_price storeMarketPrice,r.retail_price storeRetailPrice ,r.stock_num,s.store_name,r.product_id,s.id 'storeId',a.goods_rate as goodsRate,
  217. a.hs_code as hsCode , a.legal_unit1_qty as legalUnit1Qty , a.legal_unit2_qty as legalUnit2Qty,a.ciq_prod_model as ciqProdModel,a.to_be_restored
  218. FROM
  219. mall_goods a
  220. LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
  221. inner join mall_store s on r.store_id=s.id
  222. where a.prod_barcode = #{prodBarcode} and r.store_id = #{storeId}
  223. and r.stock_num > 0
  224. limit 1
  225. </select>
  226. <select id="queryObjectByProdBarcode" resultType="com.kmall.admin.entity.GoodsEntity">
  227. SELECT
  228. a.id,a.sku,a.goods_sn,a.name,a.list_pic_url,a.prod_barcode,r.market_price storeMarketPrice,r.retail_price storeRetailPrice ,r.stock_num,s.store_name,r.product_id,s.id 'storeId',
  229. a.hs_code as hsCode , a.legal_unit1_qty as legalUnit1Qty , a.legal_unit2_qty as legalUnit2Qty,a.ciq_prod_model as ciqProdModel,a.to_be_restored
  230. FROM
  231. mall_goods a
  232. LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
  233. inner join mall_store s on r.store_id=s.id
  234. where a.prod_barcode = #{prodBarcode} and a.is_delete = 0
  235. <if test="goodsId != null and goodsId != ''">
  236. AND a.id != #{goodsId}
  237. </if>
  238. <if test="merchSn != null and merchSn != ''">
  239. AND a.merch_sn = #{merchSn}
  240. </if>
  241. </select>
  242. <select id="queryGoodsDetailsByProdBarcode" resultType="com.kmall.admin.dto.GoodsDetailsDto">
  243. SELECT distinct
  244. a.goods_sn as GoodsSn,m.retail_price as retailPrice,a.prod_barcode as prodBarcode,a.name,a.brand,a.goods_desc as goodsDesc,a.goods_unit as goodsUnit,a.goods_rate as goodsRate,a.primary_pic_url ,m.stock_num as stockNum,r.value as specification
  245. ,a.hs_code as hsCode , a.legal_unit1_qty as legalUnit1Qty , a.legal_unit2_qty as legalUnit2Qty,a.ciq_prod_model as ciqProdModel,a.to_be_restored
  246. FROM
  247. mall_goods a
  248. LEFT JOIN mall_goods_specification r ON r.goods_id = a.id
  249. left join mall_product_store_rela m on m.goods_id = a.id and r.goods_id = m.goods_id
  250. where a.prod_barcode = #{prodBarcode} and m.store_id = #{storeId}
  251. and m.stock_num > 0 order by m.stock_num desc
  252. limit 1
  253. </select>
  254. <select id="queryObjectBySn" resultType="com.kmall.admin.entity.GoodsEntity">
  255. SELECT
  256. a.*, CASE
  257. when g.id > 0 then 2 else 0 end as goodsType
  258. FROM
  259. mall_goods a
  260. LEFT JOIN mall_goods_group g ON g.goods_id = a.id
  261. AND g.open_status != 3
  262. where a.goods_sn = #{goodsSn}
  263. </select>
  264. <select id="queryList" resultType="com.kmall.admin.entity.GoodsEntity">
  265. select * from (
  266. select
  267. mall_goods.*,
  268. case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
  269. m.merch_name merchName,
  270. mb.is_stock_share isStockShare,
  271. catagory.keywords as categoryName
  272. from mall_goods
  273. left join mall_merch m on mall_goods.merch_sn = m.merch_sn
  274. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  275. left join third_merchant_biz mb on mb.third_party_merch_code = mall_goods.third_party_merch_code and
  276. mb.merch_sn=mall_goods.merch_sn
  277. left join mall_category catagory on catagory.id = mall_goods.category_id
  278. WHERE 1=1
  279. <!-- 数据过滤 -->
  280. ${filterSql}
  281. <if test="merchSn != null and merchSn.trim() != ''">
  282. AND mall_goods.merch_sn = #{merchSn}
  283. </if>
  284. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  285. AND mall_goods.prod_barcode = #{prodBarcode}
  286. </if>
  287. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  288. AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
  289. </if>
  290. <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
  291. AND mb.third_merch_sn = #{thirdMerchSn}
  292. </if>
  293. <if test="goodsSn != null and goodsSn != ''">
  294. AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
  295. </if>
  296. <if test="name != null and name != ''">
  297. AND mall_goods.name LIKE concat('%',#{name},'%')
  298. </if>
  299. <if test="englishName != null and englishName != ''">
  300. AND mall_goods.english_name LIKE concat('%',#{englishName},'%')
  301. </if>
  302. <!--<if test="brandId != null and brandId != ''">
  303. AND mall_goods.brand_id = #{brandId}
  304. </if>
  305. <if test="freightId != null and freightId != ''">
  306. AND mall_goods.freight_id = #{freightId}
  307. </if>
  308. <if test="categoryId != null and categoryId != ''">
  309. AND mall_goods.category_id = #{categoryId}
  310. </if>
  311. <if test="category != null and category != ''">
  312. AND mall_goods.category_id IN (select id from mall_category where parent_id = #{category})
  313. </if>
  314. <if test="categoryTwo != null and categoryTwo != ''">
  315. AND mall_goods.category_id = #{categoryTwo}
  316. </if>-->
  317. <if test="sku != null and sku != ''">
  318. AND mall_goods.sku LIKE concat('%',#{sku},'%')
  319. </if>
  320. <if test="plu != null and plu != ''">
  321. AND mall_goods.plu LIKE concat('%',#{plu},'%')
  322. </if>
  323. <if test="isDelete != null">
  324. AND mall_goods.is_Delete = #{isDelete}
  325. </if>
  326. <if test="isOnSale != null">
  327. AND mall_goods.is_on_sale = #{isOnSale}
  328. </if>
  329. <if test="goodsBizType != null and goodsBizType != ''">
  330. AND mall_goods.goods_biz_type = #{goodsBizType}
  331. </if>
  332. <if test="id != null and id != ''">
  333. AND mall_goods.id = #{id}
  334. </if>
  335. <if test="storeId != null and storeId != ''">
  336. AND mall_goods.third_party_merch_code = ( SELECT third_party_merch_code FROM mall_store WHERE id =
  337. #{storeId} )
  338. AND mall_goods.id NOT IN (
  339. SELECT
  340. goods_id
  341. FROM
  342. mall_product_store_rela pp
  343. WHERE
  344. store_id = #{storeId}
  345. )
  346. </if>
  347. <if test="storeIdBySupplier != null and storeIdBySupplier != ''">
  348. AND mall_goods.id NOT IN (
  349. SELECT
  350. goods_id
  351. FROM
  352. mall_product_store_rela pp
  353. WHERE
  354. store_id = #{storeIdBySupplier} and supplier_third_id = #{thirdMerchSn}
  355. )
  356. </if>
  357. ) temp where 1=1
  358. <if test="lastSaleTime != null and lastSaleTime != ''">
  359. AND temp.last_sale_time &gt;= #{lastSaleTime} or temp.last_sale_time is null
  360. </if>
  361. <choose>
  362. <when test="sidx != null and sidx.trim() != ''">
  363. order by ${sidx} ${order}
  364. </when>
  365. <otherwise>
  366. order by temp.id desc
  367. </otherwise>
  368. </choose>
  369. <if test="offset != null and limit != null">
  370. limit #{offset}, #{limit}
  371. </if>
  372. </select>
  373. <select id="querySame" resultType="com.kmall.admin.entity.GoodsEntity">
  374. select
  375. mall_goods.*,
  376. case when mall_goods_group.id > 0 then 2 else 0 end as goodsType
  377. from mall_goods
  378. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  379. WHERE 1=1
  380. <!-- 数据过滤 -->
  381. ${filterSql}
  382. <if test="isSame != null and isSame != ''">
  383. AND ((mall_goods.sku = #{sku} AND mall_goods.goods_biz_type = #{goodsBizType}) OR mall_goods.goods_sn =
  384. #{goodsSn})
  385. <if test="id != null and id != ''">
  386. AND mall_goods.id != #{id}
  387. </if>
  388. </if>
  389. <choose>
  390. <when test="sidx != null and sidx.trim() != ''">
  391. order by ${sidx} ${order}
  392. </when>
  393. <otherwise>
  394. order by mall_goods.id desc
  395. </otherwise>
  396. </choose>
  397. <if test="offset != null and limit != null">
  398. limit #{offset}, #{limit}
  399. </if>
  400. </select>
  401. <select id="queryTotal" resultType="int">
  402. select count(*) from mall_goods
  403. left join mall_merch m on mall_goods.merch_sn = m.merch_sn
  404. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  405. WHERE 1=1
  406. <!-- 数据过滤 -->
  407. ${filterSql}
  408. <if test="merchSn != null and merchSn.trim() != ''">
  409. AND mall_goods.merch_sn = #{merchSn}
  410. </if>
  411. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  412. AND mall_goods.prod_barcode = #{prodBarcode}
  413. </if>
  414. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  415. AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
  416. </if>
  417. <if test="goodsSn != null and goodsSn != ''">
  418. AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
  419. </if>
  420. <if test="name != null and name != ''">
  421. AND mall_goods.name LIKE concat('%',#{name},'%')
  422. </if>
  423. <if test="sku != null and sku != ''">
  424. AND mall_goods.sku LIKE concat('%',#{sku},'%')
  425. </if>
  426. <if test="isDelete != null">
  427. AND mall_goods.is_Delete = #{isDelete}
  428. </if>
  429. <if test="isOnSale != null">
  430. AND mall_goods.is_on_sale = #{isOnSale}
  431. </if>
  432. <if test="goodsBizType != null and goodsBizType != ''">
  433. AND mall_goods.goods_biz_type = #{goodsBizType}
  434. </if>
  435. <if test="storeId != null and storeId != ''">
  436. AND mall_goods.third_party_merch_code = ( SELECT third_party_merch_code FROM mall_store WHERE id =
  437. #{storeId} )
  438. AND mall_goods.id NOT IN (
  439. SELECT
  440. goods_id
  441. FROM
  442. mall_product_store_rela pp
  443. LEFT JOIN mall_goods gg ON pp.goods_id = gg.id
  444. AND pp.merch_sn = gg.merch_sn
  445. AND pp.merch_sn
  446. LEFT JOIN mall_store s ON pp.store_id = s.id
  447. AND s.third_party_merch_code = gg.third_party_merch_code
  448. WHERE
  449. store_id = #{storeId}
  450. )
  451. </if>
  452. </select>
  453. <insert id="save" parameterType="com.kmall.admin.entity.GoodsEntity" useGeneratedKeys="true" keyProperty="id">
  454. insert into mall_goods(
  455. `merch_sn`,
  456. third_party_merch_code,
  457. `supplier_id`,
  458. `goods_sn`,
  459. `prod_barcode`,
  460. `sku`,
  461. `plu`,
  462. `english_name`,
  463. `cost_price`,
  464. `daily_price`,
  465. `goods_biz_type`,
  466. `name`,
  467. `unit_code`,
  468. `brand`,
  469. `brand_id`,
  470. `category_id`,
  471. `goods_number`,
  472. `keywords`,
  473. `goods_brief`,
  474. `goods_desc`,
  475. `cus_goods_code`,
  476. `ciq_prod_model`,
  477. `ori_cnt_code`,
  478. `cus_decl_ele`,
  479. `cus_rec_code`,
  480. `is_on_sale`,
  481. `add_time`,
  482. `sort_order`,
  483. `is_delete`,
  484. `counter_price`,
  485. `extra_price`,
  486. `is_new`,
  487. `goods_unit`,
  488. `primary_pic_url`,
  489. `list_pic_url`,
  490. `goods_rate`,
  491. `sell_volume`,
  492. `primary_product_id`,
  493. `unit_price`,
  494. `promotion_desc`,
  495. `promotion_tag`,
  496. `app_exclusive_price`,
  497. `is_app_exclusive`,
  498. `gross_weight`,
  499. `net_weight`,
  500. is_goods_share_stock,
  501. `is_limited`,
  502. `is_hot`,
  503. `creater_sn`,
  504. `create_time`,
  505. `moder_sn`,
  506. `mod_time`,
  507. `mychem_id`,
  508. `hs_code`,
  509. `hs_code_name`,
  510. `is_sync_hs_code`,
  511. `is_sync_goods_rate`,
  512. `imp_consum_tax_rate`,
  513. `value_added_tax_rate`,
  514. `legal_unit1_qty`,
  515. `legal_unit2_qty`,
  516. `cosm_threshold_value`,
  517. `to_be_restored`,
  518. `tstm`)
  519. values(
  520. #{merchSn},
  521. #{thirdPartyMerchCode},
  522. #{supplierId},
  523. #{goodsSn},
  524. #{prodBarcode},
  525. #{sku},
  526. #{plu},
  527. #{englishName},
  528. #{costPrice},
  529. #{dailyPrice},
  530. #{goodsBizType},
  531. #{name},
  532. #{unitCode},
  533. #{brand},
  534. #{brandId},
  535. #{categoryId},
  536. #{goodsNumber},
  537. #{keywords},
  538. #{goodsBrief},
  539. #{goodsDesc},
  540. #{cusGoodsCode},
  541. #{ciqProdModel},
  542. #{oriCntCode},
  543. #{cusDeclEle},
  544. #{cusRecCode},
  545. #{isOnSale},
  546. #{addTime},
  547. #{sortOrder},
  548. #{isDelete},
  549. #{counterPrice},
  550. #{extraPrice},
  551. #{isNew},
  552. #{goodsUnit},
  553. #{primaryPicUrl},
  554. #{listPicUrl},
  555. #{goodsRate},
  556. #{sellVolume},
  557. #{primaryProductId},
  558. #{unitPrice},
  559. #{promotionDesc},
  560. #{promotionTag},
  561. #{appExclusivePrice},
  562. #{isAppExclusive},
  563. #{grossWeight},
  564. #{netWeight},
  565. #{isGoodsShareStock},
  566. #{isLimited},
  567. #{isHot},
  568. #{createrSn},
  569. #{createTime},
  570. #{moderSn},
  571. #{modTime},
  572. #{mychemId},
  573. #{hsCode},
  574. #{hsCodeName},
  575. '0',
  576. '0',
  577. #{impConsumTaxRate},
  578. #{valueAddedTaxRate},
  579. #{legalUnit1Qty},
  580. #{legalUnit2Qty},
  581. #{cosmThresholdValue},
  582. 0,
  583. #{tstm})
  584. </insert>
  585. <update id="update" parameterType="com.kmall.admin.entity.GoodsEntity">
  586. update mall_goods
  587. <set>
  588. <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
  589. <if test="thirdPartyMerchCode != null">`third_party_merch_code` = #{thirdPartyMerchCode},</if>
  590. <if test="supplierId != null">`supplier_id` = #{supplierId},</if>
  591. <if test="goodsSn != null">`goods_sn` = #{goodsSn},</if>
  592. <if test="prodBarcode != null">`prod_barcode` = #{prodBarcode},</if>
  593. <if test="sku != null">`sku` = #{sku},</if>
  594. <if test="plu != null">`plu` = #{plu},</if>
  595. <if test="englishName != null">`english_name` = #{englishName},</if>
  596. <if test="costPrice != null">`cost_price` = #{costPrice},</if>
  597. <if test="dailyPrice != null">`daily_price` = #{dailyPrice},</if>
  598. <if test="goodsBizType != null">`goods_biz_type` = #{goodsBizType},</if>
  599. <if test="name != null">`name` = #{name},</if>
  600. <if test="unitCode != null">`unit_code` = #{unitCode},</if>
  601. <if test="brand != null">`brand` = #{brand},</if>
  602. <if test="brandId != null">`brand_id` = #{brandId},</if>
  603. <if test="categoryId != null">`category_id` = #{categoryId},</if>
  604. <if test="goodsNumber != null">`goods_number` = #{goodsNumber},</if>
  605. <if test="keywords != null">`keywords` = #{keywords},</if>
  606. <if test="goodsBrief != null">`goods_brief` = #{goodsBrief},</if>
  607. <if test="goodsDesc != null">`goods_desc` = #{goodsDesc},</if>
  608. <if test="cusGoodsCode != null">`cus_goods_code` = #{cusGoodsCode},</if>
  609. <if test="ciqProdModel != null">`ciq_prod_model` = #{ciqProdModel},</if>
  610. <if test="oriCntCode != null">`ori_cnt_code` = #{oriCntCode},</if>
  611. <if test="cusDeclEle != null">`cus_decl_ele` = #{cusDeclEle},</if>
  612. <if test="cusRecCode != null">`cus_rec_code` = #{cusRecCode},</if>
  613. <if test="isOnSale != null">`is_on_sale` = #{isOnSale},</if>
  614. <if test="addTime != null">`add_time` = #{addTime},</if>
  615. <if test="sortOrder != null">`sort_order` = #{sortOrder},</if>
  616. <if test="isDelete != null">`is_delete` = #{isDelete},</if>
  617. <if test="counterPrice != null">`counter_price` = #{counterPrice},</if>
  618. <if test="extraPrice != null">`extra_price` = #{extraPrice},</if>
  619. <if test="isNew != null">`is_new` = #{isNew},</if>
  620. <if test="goodsUnit != null">`goods_unit` = #{goodsUnit},</if>
  621. <if test="primaryPicUrl != null">`primary_pic_url` = #{primaryPicUrl},</if>
  622. <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl},</if>
  623. <if test="goodsRate != null">`goods_rate` = #{goodsRate},</if>
  624. <if test="sellVolume != null">`sell_volume` = #{sellVolume},</if>
  625. <if test="primaryProductId != null">`primary_product_id` = #{primaryProductId},</if>
  626. <if test="unitPrice != null">`unit_price` = #{unitPrice},</if>
  627. <if test="promotionDesc != null">`promotion_desc` = #{promotionDesc},</if>
  628. <if test="promotionTag != null">`promotion_tag` = #{promotionTag},</if>
  629. <if test="appExclusivePrice != null">`app_exclusive_price` = #{appExclusivePrice},</if>
  630. <if test="isAppExclusive != null">`is_app_exclusive` = #{isAppExclusive},</if>
  631. <if test="grossWeight != null">`gross_weight` = #{grossWeight},</if>
  632. <if test="netWeight != null">`net_weight` = #{netWeight},</if>
  633. <if test="isGoodsShareStock != null">`is_goods_share_stock` = #{isGoodsShareStock},</if>
  634. <if test="isLimited != null">`is_limited` = #{isLimited},</if>
  635. <if test="isHot != null">`is_hot` = #{isHot},</if>
  636. <if test="createrSn != null">`creater_sn` = #{createrSn},</if>
  637. <if test="createTime != null">`create_time` = #{createTime},</if>
  638. <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
  639. <if test="modTime != null">`mod_time` = #{modTime},</if>
  640. <if test="tstm != null">`tstm` = #{tstm},</if>
  641. <if test="lastSaleTime != null">`last_sale_time` = #{lastSaleTime},</if>
  642. <if test="mychemId != null">`mychem_id` = #{mychemId},</if>
  643. <if test="hsCode != null">`hs_code` = #{hsCode},</if>
  644. <if test="hsCodeName != null">`hs_code_name` = #{hsCodeName},</if>
  645. <if test="isSyncHsCode != null">`is_sync_hs_code` = #{isSyncHsCode},</if>
  646. <if test="isSyncGoodsRate != null">`is_sync_goods_rate` = #{isSyncGoodsRate},</if>
  647. <if test="impConsumTaxRate != null">`imp_consum_tax_rate` = #{impConsumTaxRate},</if>
  648. <if test="valueAddedTaxRate != null">`value_added_tax_rate` = #{valueAddedTaxRate},</if>
  649. <if test="legalUnit1Qty != null">`legal_unit1_qty` = #{legalUnit1Qty},</if>
  650. <if test="legalUnit2Qty != null">`legal_unit2_qty` = #{legalUnit2Qty},</if>
  651. <if test="cosmThresholdValue != null">`cosm_threshold_value` = #{cosmThresholdValue},</if>
  652. <if test="toBeRestored != null">`to_be_restored` = #{toBeRestored}</if>
  653. </set>
  654. where id = #{id}
  655. </update>
  656. <delete id="delete">
  657. delete from mall_goods where id = #{value}
  658. </delete>
  659. <delete id="deleteBatch">
  660. delete from mall_goods where id in
  661. <foreach item="id" collection="array" open="(" separator="," close=")">
  662. #{id}
  663. </foreach>
  664. </delete>
  665. <select id="queryMaxId" resultType="java.lang.Long" parameterType="map">
  666. SELECT MAX(id) FROM mall_goods
  667. </select>
  668. <select id="searchGoodsPanoramaDtoByKeyword" resultType="com.kmall.admin.dto.GoodsPanoramaDto">
  669. SELECT
  670. g.id id,g.name `name`,g.name simpleName,g.ciq_prod_model ciqProdModel,
  671. g.goods_unit goodsBasicUnit,g.category_id categoryId,c.name categoryName,
  672. g.goods_unit goodsPurchaseUnit,g.supplier_id supplierId,s.child_supplier_name supplierName,
  673. g.prod_barcode prodBarcode,g.plu plu,g.goods_sn goodsSn,g.brand brand
  674. FROM
  675. mall_goods g
  676. INNER JOIN mall_category c
  677. INNER JOIN mall_supplier s
  678. WHERE
  679. g.category_id = c.id
  680. and g.supplier_id = s.id
  681. AND (g.goods_sn=#{keyword} OR g.prod_barcode=#{keyword})
  682. </select>
  683. <select id="queryExportList" resultType="com.kmall.admin.entity.GoodsEntity">
  684. select * from (
  685. select
  686. mall_goods.*,
  687. case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
  688. m.merch_name merchName, mb.is_stock_share isStockShare,
  689. catagory.keywords as categoryName,
  690. scnc.`name` as oriCntName
  691. from mall_goods
  692. left join mall_merch m on mall_goods.merch_sn = m.merch_sn
  693. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  694. left join third_merchant_biz mb on mb.third_party_merch_code = mall_goods.third_party_merch_code and
  695. mb.merch_sn=mall_goods.merch_sn
  696. left join mall_category catagory on catagory.id = mall_goods.category_id
  697. left join sys_cus_nation_code scnc on mall_goods.ori_cnt_code = scnc.code
  698. WHERE 1=1
  699. <!-- 数据过滤 -->
  700. ${filterSql}
  701. <if test="merchSn != null and merchSn.trim() != ''">
  702. AND mall_goods.merch_sn = #{merchSn}
  703. </if>
  704. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  705. AND mall_goods.prod_barcode = #{prodBarcode}
  706. </if>
  707. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  708. AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
  709. </if>
  710. <if test="goodsSn != null and goodsSn != ''">
  711. AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
  712. </if>
  713. <if test="name != null and name != ''">
  714. AND mall_goods.name LIKE concat('%',#{name},'%')
  715. </if>
  716. <if test="englishName != null and englishName != ''">
  717. AND mall_goods.english_name LIKE concat('%',#{englishName},'%')
  718. </if>
  719. <if test="goodsBizType != null and goodsBizType != ''">
  720. AND mall_goods.goods_biz_type = #{goodsBizType}
  721. </if>
  722. <if test="isDelete != null">
  723. AND mall_goods.is_Delete = #{isDelete}
  724. </if>
  725. ) temp
  726. where 1=1
  727. <if test="lastSaleTime != null and lastSaleTime != ''">
  728. AND temp.last_sale_time &gt;= #{lastSaleTime} or temp.last_sale_time is null
  729. </if>
  730. </select>
  731. <select id="queryForPDFData" resultType="com.kmall.api.entity.exportpdf.PDFGoodsDto">
  732. select
  733. g.name as productName,
  734. g.english_name as englishName,
  735. rela.retail_price as price,
  736. IFNULL((rela.market_price - rela.retail_price ),0) as savings,
  737. g.goods_rate as startFax,
  738. g.goods_rate as endFax,
  739. g.plu as plu,
  740. g.prod_barcode as barCode
  741. from
  742. mall_goods g
  743. left join mall_product_store_rela rela on g.id = rela.goods_id
  744. <where>
  745. <if test="sku != null and sku != ''">
  746. and g.sku = #{sku}
  747. </if>
  748. <if test="prodBarcode != null and prodBarcode != ''">
  749. and g.prod_barcode = #{prodBarcode}
  750. </if>
  751. <if test="storeId != null and storeId != ''">
  752. and rela.store_id = #{storeId}
  753. </if>
  754. </where>
  755. </select>
  756. <select id="queryByBarcode" resultType="com.kmall.admin.entity.GoodsEntity">
  757. select *
  758. from mall_goods
  759. where prod_barcode = #{barCode}
  760. </select>
  761. <select id="queryBySku" resultType="com.kmall.admin.entity.GoodsEntity">
  762. select *
  763. from mall_goods
  764. where sku = #{sku}
  765. </select>
  766. <select id="queryListByBarcode" resultType="com.kmall.admin.entity.GoodsEntity">
  767. SELECT
  768. a.id,a.sku,a.goods_number,a.goods_sn,a.name,a.list_pic_url,a.prod_barcode,r.market_price storeMarketPrice,r.retail_price storeRetailPrice ,r.stock_num,s.store_name,r.product_id,s.id 'storeId',a.goods_rate as goodsRate,
  769. a.hs_code as hsCode , a.legal_unit1_qty as legalUnit1Qty , a.legal_unit2_qty as legalUnit2Qty,a.ciq_prod_model as ciqProdModel,a.to_be_restored
  770. FROM
  771. mall_goods a
  772. LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
  773. inner join mall_store s on r.store_id=s.id
  774. where a.prod_barcode = #{prodBarcode} and r.store_id = #{storeId}
  775. and r.stock_num > 0 order by r.stock_num desc
  776. </select>
  777. <select id="queryByName" resultType="com.kmall.admin.entity.GoodsEntity">
  778. SELECT DISTINCT
  779. g.id,
  780. g.NAME,
  781. g.sku,
  782. g.prod_barcode
  783. FROM
  784. mall_product_store_rela r
  785. LEFT JOIN mall_goods g ON g.id = r.goods_id
  786. WHERE
  787. r.store_id = #{storeId}
  788. <if test="goodsName != null and goodsName != ''">
  789. AND g.NAME LIKE concat('%',#{goodsName},'%');
  790. </if>
  791. </select>
  792. <select id="queryNonSyncOmsHsCodeSkuList" resultType="java.lang.String">
  793. select sku
  794. from mall_goods
  795. where is_sync_hs_code = '0'
  796. </select>
  797. <select id="queryListBySku" resultType="com.kmall.admin.entity.GoodsEntity">
  798. select *
  799. from mall_goods
  800. where sku = #{sku}
  801. </select>
  802. <select id="queryNonSyncOmsGoodsRateSkuList" resultType="com.kmall.admin.entity.GoodsEntity">
  803. select *
  804. from mall_goods
  805. where is_sync_goods_rate = '0'
  806. </select>
  807. <select id="queryAllList" resultType="com.kmall.admin.entity.GoodsEntity">
  808. select * from mall_goods where is_delete = 0
  809. <if test="page != null and pageSize != null">
  810. limit #{page}, #{pageSize}
  811. </if>
  812. </select>
  813. <select id="queryByBarcodeAndSku" resultType="com.kmall.admin.entity.GoodsEntity">
  814. select * from mall_goods where
  815. goods_sn = #{goodsSn} and prod_barcode = #{prodBarcode}
  816. </select>
  817. <select id="querySpecialCosmetics" resultType="com.kmall.admin.entity.GoodsEntity">
  818. SELECT distinct
  819. a.*,
  820. m.retail_price as retailPrice,
  821. m.stock_num as stockNum,
  822. m.store_id as storeId
  823. FROM
  824. mall_goods a
  825. left join mall_product_store_rela m on m.goods_id = a.id
  826. <where>
  827. a.cus_rec_code in
  828. <foreach collection="hdCodeSet" item="item" open="(" close=")" separator=",">
  829. #{item}
  830. </foreach>
  831. </where>
  832. </select>
  833. <insert id="saveBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
  834. insert into mall_goods(
  835. `merch_sn`,
  836. third_party_merch_code,
  837. `supplier_id`,
  838. `goods_sn`,
  839. `prod_barcode`,
  840. `sku`,
  841. `plu`,
  842. `english_name`,
  843. `cost_price`,
  844. `daily_price`,
  845. `goods_biz_type`,
  846. `name`,
  847. `unit_code`,
  848. `brand`,
  849. `brand_id`,
  850. `category_id`,
  851. `goods_number`,
  852. `keywords`,
  853. `goods_brief`,
  854. `goods_desc`,
  855. `cus_goods_code`,
  856. `ciq_prod_model`,
  857. `ori_cnt_code`,
  858. `cus_decl_ele`,
  859. `cus_rec_code`,
  860. `is_on_sale`,
  861. `add_time`,
  862. `sort_order`,
  863. `is_delete`,
  864. `counter_price`,
  865. `extra_price`,
  866. `is_new`,
  867. `goods_unit`,
  868. `primary_pic_url`,
  869. `list_pic_url`,
  870. `goods_rate`,
  871. `sell_volume`,
  872. `primary_product_id`,
  873. `unit_price`,
  874. `promotion_desc`,
  875. `promotion_tag`,
  876. `app_exclusive_price`,
  877. `is_app_exclusive`,
  878. `gross_weight`,
  879. `net_weight`,
  880. is_goods_share_stock,
  881. `is_limited`,
  882. `is_hot`,
  883. `creater_sn`,
  884. `create_time`,
  885. `moder_sn`,
  886. `mod_time`,
  887. `mychem_id`,
  888. `hs_code`,
  889. `hs_code_name`,
  890. `is_sync_hs_code`,
  891. `is_sync_goods_rate`,
  892. `imp_consum_tax_rate`,
  893. `value_added_tax_rate`,
  894. `legal_unit1_qty`,
  895. `legal_unit2_qty`,
  896. `cosm_threshold_value`,
  897. `to_be_restored`,
  898. `tstm`)
  899. values
  900. <foreach collection="list" index="index" item="item" separator=",">
  901. (
  902. #{item.merchSn},
  903. #{item.thirdPartyMerchCode},
  904. #{item.supplierId},
  905. #{item.goodsSn},
  906. #{item.prodBarcode},
  907. #{item.sku},
  908. #{item.plu},
  909. #{item.englishName},
  910. #{item.costPrice},
  911. #{item.dailyPrice},
  912. #{item.goodsBizType},
  913. #{item.name},
  914. #{item.unitCode},
  915. #{item.brand},
  916. #{item.brandId},
  917. #{item.categoryId},
  918. #{item.goodsNumber},
  919. #{item.keywords},
  920. #{item.goodsBrief},
  921. #{item.goodsDesc},
  922. #{item.cusGoodsCode},
  923. #{item.ciqProdModel},
  924. #{item.oriCntCode},
  925. #{item.cusDeclEle},
  926. #{item.cusRecCode},
  927. #{item.isOnSale},
  928. #{item.addTime},
  929. #{item.sortOrder},
  930. #{item.isDelete},
  931. #{item.counterPrice},
  932. #{item.extraPrice},
  933. #{item.isNew},
  934. #{item.goodsUnit},
  935. #{item.primaryPicUrl},
  936. #{item.listPicUrl},
  937. #{item.goodsRate},
  938. #{item.sellVolume},
  939. #{item.primaryProductId},
  940. #{item.unitPrice},
  941. #{item.promotionDesc},
  942. #{item.promotionTag},
  943. #{item.appExclusivePrice},
  944. #{item.isAppExclusive},
  945. #{item.grossWeight},
  946. #{item.netWeight},
  947. #{item.isGoodsShareStock},
  948. #{item.isLimited},
  949. #{item.isHot},
  950. #{item.createrSn},
  951. #{item.createTime},
  952. #{item.moderSn},
  953. #{item.modTime},
  954. #{item.mychemId},
  955. #{item.hsCode},
  956. #{item.hsCodeName},
  957. '0',
  958. '0',
  959. #{item.impConsumTaxRate},
  960. #{item.valueAddedTaxRate},
  961. #{item.legalUnit1Qty},
  962. #{item.legalUnit2Qty},
  963. #{item.cosmThresholdValue},
  964. #{item.toBeRestored},
  965. #{item.tstm})
  966. </foreach>
  967. </insert>
  968. <update id="updateBatch" parameterType="java.util.List">
  969. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  970. update mall_goods
  971. <set>
  972. <if test="item.merchSn != null">`merch_sn` = #{item.merchSn},</if>
  973. <if test="item.thirdPartyMerchCode != null">`third_party_merch_code` = #{item.thirdPartyMerchCode},</if>
  974. <if test="item.supplierId != null">`supplier_id` = #{item.supplierId},</if>
  975. <if test="item.goodsSn != null">`goods_sn` = #{item.goodsSn},</if>
  976. <if test="item.prodBarcode != null">`prod_barcode` = #{item.prodBarcode},</if>
  977. <if test="item.sku != null">`sku` = #{item.sku},</if>
  978. <if test="item.plu != null">`plu` = #{item.plu},</if>
  979. <if test="item.englishName != null">`english_name` = #{item.englishName},</if>
  980. <if test="item.costPrice != null">`cost_price` = #{item.costPrice},</if>
  981. <if test="item.dailyPrice != null">`daily_price` = #{item.dailyPrice},</if>
  982. <if test="item.goodsBizType != null">`goods_biz_type` = #{item.goodsBizType},</if>
  983. <if test="item.name != null">`name` = #{item.name},</if>
  984. <if test="item.unitCode != null">`unit_code` = #{item.unitCode},</if>
  985. <if test="item.brand != null">`brand` = #{item.brand},</if>
  986. <if test="item.brandId != null">`brand_id` = #{item.brandId},</if>
  987. <if test="item.categoryId != null">`category_id` = #{item.categoryId},</if>
  988. <if test="item.goodsNumber != null">`goods_number` = #{item.goodsNumber},</if>
  989. <if test="item.keywords != null">`keywords` = #{item.keywords},</if>
  990. <if test="item.goodsBrief != null">`goods_brief` = #{item.goodsBrief},</if>
  991. <if test="item.goodsDesc != null">`goods_desc` = #{item.goodsDesc},</if>
  992. <if test="item.cusGoodsCode != null">`cus_goods_code` = #{item.cusGoodsCode},</if>
  993. <if test="item.ciqProdModel != null">`ciq_prod_model` = #{item.ciqProdModel},</if>
  994. <if test="item.oriCntCode != null">`ori_cnt_code` = #{item.oriCntCode},</if>
  995. <if test="item.cusDeclEle != null">`cus_decl_ele` = #{item.cusDeclEle},</if>
  996. <if test="item.cusRecCode != null">`cus_rec_code` = #{item.cusRecCode},</if>
  997. <if test="item.isOnSale != null">`is_on_sale` = #{item.isOnSale},</if>
  998. <if test="item.addTime != null">`add_time` = #{item.addTime},</if>
  999. <if test="item.sortOrder != null">`sort_order` = #{item.sortOrder},</if>
  1000. <if test="item.isDelete != null">`is_delete` = #{item.isDelete},</if>
  1001. <if test="item.counterPrice != null">`counter_price` = #{item.counterPrice},</if>
  1002. <if test="item.extraPrice != null">`extra_price` = #{item.extraPrice},</if>
  1003. <if test="item.isNew != null">`is_new` = #{item.isNew},</if>
  1004. <if test="item.goodsUnit != null">`goods_unit` = #{item.goodsUnit},</if>
  1005. <if test="item.primaryPicUrl != null">`primary_pic_url` = #{item.primaryPicUrl},</if>
  1006. <if test="item.listPicUrl != null">`list_pic_url` = #{item.listPicUrl},</if>
  1007. <if test="item.goodsRate != null">`goods_rate` = #{item.goodsRate},</if>
  1008. <if test="item.sellVolume != null">`sell_volume` = #{item.sellVolume},</if>
  1009. <if test="item.primaryProductId != null">`primary_product_id` = #{item.primaryProductId},</if>
  1010. <if test="item.unitPrice != null">`unit_price` = #{item.unitPrice},</if>
  1011. <if test="item.promotionDesc != null">`promotion_desc` = #{item.promotionDesc},</if>
  1012. <if test="item.promotionTag != null">`promotion_tag` = #{item.promotionTag},</if>
  1013. <if test="item.appExclusivePrice != null">`app_exclusive_price` = #{item.appExclusivePrice},</if>
  1014. <if test="item.isAppExclusive != null">`is_app_exclusive` = #{item.isAppExclusive},</if>
  1015. <if test="item.grossWeight != null">`gross_weight` = #{item.grossWeight},</if>
  1016. <if test="item.netWeight != null">`net_weight` = #{item.netWeight},</if>
  1017. <if test="item.isGoodsShareStock != null">`is_goods_share_stock` = #{item.isGoodsShareStock},</if>
  1018. <if test="item.isLimited != null">`is_limited` = #{item.isLimited},</if>
  1019. <if test="item.isHot != null">`is_hot` = #{item.isHot},</if>
  1020. <if test="item.createrSn != null">`creater_sn` = #{item.createrSn},</if>
  1021. <if test="item.createTime != null">`create_time` = #{item.createTime},</if>
  1022. <if test="item.moderSn != null">`moder_sn` = #{item.moderSn},</if>
  1023. <if test="item.modTime != null">`mod_time` = #{item.modTime},</if>
  1024. <if test="item.tstm != null">`tstm` = #{item.tstm},</if>
  1025. <if test="item.lastSaleTime != null">`last_sale_time` = #{item.lastSaleTime},</if>
  1026. <if test="item.mychemId != null">`mychem_id` = #{item.mychemId},</if>
  1027. <if test="item.hsCode != null">`hs_code` = #{item.hsCode},</if>
  1028. <if test="item.hsCodeName != null">`hs_code_name` = #{item.hsCodeName},</if>
  1029. <if test="item.isSyncHsCode != null">`is_sync_hs_code` = #{item.isSyncHsCode},</if>
  1030. <if test="item.isSyncGoodsRate != null">`is_sync_goods_rate` = #{item.isSyncGoodsRate},</if>
  1031. <if test="item.impConsumTaxRate != null">`imp_consum_tax_rate` = #{item.impConsumTaxRate},</if>
  1032. <if test="item.valueAddedTaxRate != null">`value_added_tax_rate` = #{item.valueAddedTaxRate},</if>
  1033. <if test="item.legalUnit1Qty != null">`legal_unit1_qty` = #{item.legalUnit1Qty},</if>
  1034. <if test="item.legalUnit2Qty != null">`legal_unit2_qty` = #{item.legalUnit2Qty},</if>
  1035. <if test="item.cosmThresholdValue != null">`cosm_threshold_value` = #{item.cosmThresholdValue},</if>
  1036. <if test="item.toBeRestored != null">`to_be_restored` = #{item.toBeRestored}</if>
  1037. </set>
  1038. where id = #{item.id}
  1039. </foreach>
  1040. </update>
  1041. <select id="syncOmsHsCodeGoode" resultType="java.lang.String">
  1042. select sku from mall_goods where id in
  1043. <foreach collection="list" item="id" index="index"
  1044. open="(" close=")" separator=",">
  1045. #{id}
  1046. </foreach>
  1047. </select>
  1048. <select id="syncGoodsRateGoode" resultType="com.kmall.admin.entity.GoodsEntity">
  1049. select * from mall_goods where is_delete = 0 and id in
  1050. <foreach collection="list" item="id" index="index"
  1051. open="(" close=")" separator=",">
  1052. #{id}
  1053. </foreach>
  1054. </select>
  1055. </mapper>