1
0

GoodsDao.xml 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119
  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 and a.is_on_sale = 1
  250. where a.prod_barcode = #{prodBarcode} and m.store_id = #{storeId}
  251. <if test="sku != null and sku != ''">
  252. and a.sku=#{sku}
  253. </if>
  254. and m.stock_num > 0 order by m.stock_num desc
  255. limit 1
  256. </select>
  257. <select id="queryGoodsSkuList" resultType="com.kmall.admin.dto.GoodsDetailsDto">
  258. SELECT distinct
  259. a.goods_sn as GoodsSn,m.retail_price as retailPrice,a.prod_barcode as prodBarcode,a.name,
  260. a.brand,a.goods_desc as goodsDesc,a.goods_unit as goodsUnit,a.goods_rate as goodsRate,a.primary_pic_url ,
  261. m.stock_num as stockNum,r.value as specification
  262. ,a.hs_code as hsCode , a.legal_unit1_qty as legalUnit1Qty , a.legal_unit2_qty as legalUnit2Qty,
  263. a.ciq_prod_model as ciqProdModel,a.to_be_restored,a.sku as sku,a.name,a.market_price as marketPrice
  264. FROM
  265. mall_goods a
  266. LEFT JOIN mall_goods_specification r ON r.goods_id = a.id
  267. left join mall_product_store_rela m on m.goods_id = a.id and r.goods_id = m.goods_id
  268. where a.prod_barcode = #{prodBarcode} and m.store_id = #{storeId}
  269. and m.stock_num > 0 and a.is_on_sale = 1 order by m.stock_num desc
  270. </select>
  271. <select id="queryObjectBySn" resultType="com.kmall.admin.entity.GoodsEntity">
  272. SELECT
  273. a.*, CASE
  274. when g.id > 0 then 2 else 0 end as goodsType
  275. FROM
  276. mall_goods a
  277. LEFT JOIN mall_goods_group g ON g.goods_id = a.id
  278. AND g.open_status != 3
  279. where a.goods_sn = #{goodsSn}
  280. </select>
  281. <select id="queryList" resultType="com.kmall.admin.entity.GoodsEntity">
  282. select * from (
  283. select
  284. mall_goods.*,
  285. case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
  286. m.merch_name merchName,
  287. mb.is_stock_share isStockShare,
  288. catagory.keywords as categoryName
  289. from mall_goods
  290. left join mall_merch m on mall_goods.merch_sn = m.merch_sn
  291. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  292. left join third_merchant_biz mb on mb.third_party_merch_code = mall_goods.third_party_merch_code and
  293. mb.merch_sn=mall_goods.merch_sn
  294. left join mall_category catagory on catagory.id = mall_goods.category_id
  295. WHERE 1=1
  296. <!-- 数据过滤 -->
  297. ${filterSql}
  298. <if test="merchSn != null and merchSn.trim() != ''">
  299. AND mall_goods.merch_sn = #{merchSn}
  300. </if>
  301. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  302. AND mall_goods.prod_barcode = #{prodBarcode}
  303. </if>
  304. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  305. AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
  306. </if>
  307. <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
  308. AND mb.third_merch_sn = #{thirdMerchSn}
  309. </if>
  310. <if test="goodsSn != null and goodsSn != ''">
  311. AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
  312. </if>
  313. <if test="name != null and name != ''">
  314. AND mall_goods.name LIKE concat('%',#{name},'%')
  315. </if>
  316. <if test="englishName != null and englishName != ''">
  317. AND mall_goods.english_name LIKE concat('%',#{englishName},'%')
  318. </if>
  319. <!--<if test="brandId != null and brandId != ''">
  320. AND mall_goods.brand_id = #{brandId}
  321. </if>
  322. <if test="freightId != null and freightId != ''">
  323. AND mall_goods.freight_id = #{freightId}
  324. </if>
  325. <if test="categoryId != null and categoryId != ''">
  326. AND mall_goods.category_id = #{categoryId}
  327. </if>
  328. <if test="category != null and category != ''">
  329. AND mall_goods.category_id IN (select id from mall_category where parent_id = #{category})
  330. </if>
  331. <if test="categoryTwo != null and categoryTwo != ''">
  332. AND mall_goods.category_id = #{categoryTwo}
  333. </if>-->
  334. <if test="sku != null and sku != ''">
  335. AND mall_goods.sku LIKE concat('%',#{sku},'%')
  336. </if>
  337. <if test="plu != null and plu != ''">
  338. AND mall_goods.plu LIKE concat('%',#{plu},'%')
  339. </if>
  340. <if test="isDelete != null">
  341. AND mall_goods.is_Delete = #{isDelete}
  342. </if>
  343. <if test="isOnSale != null">
  344. AND mall_goods.is_on_sale = #{isOnSale}
  345. </if>
  346. <if test="goodsBizType != null and goodsBizType != ''">
  347. AND mall_goods.goods_biz_type = #{goodsBizType}
  348. </if>
  349. <if test="id != null and id != ''">
  350. AND mall_goods.id = #{id}
  351. </if>
  352. <if test="storeId != null and storeId != ''">
  353. AND mall_goods.third_party_merch_code = ( SELECT third_party_merch_code FROM mall_store WHERE id =
  354. #{storeId} )
  355. AND mall_goods.id NOT IN (
  356. SELECT
  357. goods_id
  358. FROM
  359. mall_product_store_rela pp
  360. WHERE
  361. store_id = #{storeId}
  362. )
  363. </if>
  364. <if test="storeIdBySupplier != null and storeIdBySupplier != ''">
  365. AND mall_goods.id NOT IN (
  366. SELECT
  367. goods_id
  368. FROM
  369. mall_product_store_rela pp
  370. WHERE
  371. store_id = #{storeIdBySupplier} and supplier_third_id = #{thirdMerchSn}
  372. )
  373. </if>
  374. ) temp where 1=1
  375. <if test="lastSaleTime != null and lastSaleTime != ''">
  376. AND temp.last_sale_time &gt;= #{lastSaleTime} or temp.last_sale_time is null
  377. </if>
  378. <choose>
  379. <when test="sidx != null and sidx.trim() != ''">
  380. order by ${sidx} ${order}
  381. </when>
  382. <otherwise>
  383. order by temp.id desc
  384. </otherwise>
  385. </choose>
  386. <if test="offset != null and limit != null">
  387. limit #{offset}, #{limit}
  388. </if>
  389. </select>
  390. <select id="querySame" resultType="com.kmall.admin.entity.GoodsEntity">
  391. select
  392. mall_goods.*,
  393. case when mall_goods_group.id > 0 then 2 else 0 end as goodsType
  394. from mall_goods
  395. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  396. WHERE 1=1
  397. <!-- 数据过滤 -->
  398. ${filterSql}
  399. <if test="isSame != null and isSame != ''">
  400. AND ((mall_goods.sku = #{sku} AND mall_goods.goods_biz_type = #{goodsBizType}) OR mall_goods.goods_sn =
  401. #{goodsSn})
  402. <if test="id != null and id != ''">
  403. AND mall_goods.id != #{id}
  404. </if>
  405. </if>
  406. <choose>
  407. <when test="sidx != null and sidx.trim() != ''">
  408. order by ${sidx} ${order}
  409. </when>
  410. <otherwise>
  411. order by mall_goods.id desc
  412. </otherwise>
  413. </choose>
  414. <if test="offset != null and limit != null">
  415. limit #{offset}, #{limit}
  416. </if>
  417. </select>
  418. <select id="queryTotal" resultType="int">
  419. select count(*) from mall_goods
  420. left join mall_merch m on mall_goods.merch_sn = m.merch_sn
  421. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  422. WHERE 1=1
  423. <!-- 数据过滤 -->
  424. ${filterSql}
  425. <if test="merchSn != null and merchSn.trim() != ''">
  426. AND mall_goods.merch_sn = #{merchSn}
  427. </if>
  428. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  429. AND mall_goods.prod_barcode = #{prodBarcode}
  430. </if>
  431. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  432. AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
  433. </if>
  434. <if test="goodsSn != null and goodsSn != ''">
  435. AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
  436. </if>
  437. <if test="name != null and name != ''">
  438. AND mall_goods.name LIKE concat('%',#{name},'%')
  439. </if>
  440. <if test="sku != null and sku != ''">
  441. AND mall_goods.sku LIKE concat('%',#{sku},'%')
  442. </if>
  443. <if test="isDelete != null">
  444. AND mall_goods.is_Delete = #{isDelete}
  445. </if>
  446. <if test="isOnSale != null">
  447. AND mall_goods.is_on_sale = #{isOnSale}
  448. </if>
  449. <if test="goodsBizType != null and goodsBizType != ''">
  450. AND mall_goods.goods_biz_type = #{goodsBizType}
  451. </if>
  452. <if test="storeId != null and storeId != ''">
  453. AND mall_goods.third_party_merch_code = ( SELECT third_party_merch_code FROM mall_store WHERE id =
  454. #{storeId} )
  455. AND mall_goods.id NOT IN (
  456. SELECT
  457. goods_id
  458. FROM
  459. mall_product_store_rela pp
  460. LEFT JOIN mall_goods gg ON pp.goods_id = gg.id
  461. AND pp.merch_sn = gg.merch_sn
  462. AND pp.merch_sn
  463. LEFT JOIN mall_store s ON pp.store_id = s.id
  464. AND s.third_party_merch_code = gg.third_party_merch_code
  465. WHERE
  466. store_id = #{storeId}
  467. )
  468. </if>
  469. </select>
  470. <insert id="save" parameterType="com.kmall.admin.entity.GoodsEntity" useGeneratedKeys="true" keyProperty="id">
  471. insert into mall_goods(
  472. `merch_sn`,
  473. third_party_merch_code,
  474. `supplier_id`,
  475. `goods_sn`,
  476. `prod_barcode`,
  477. `sku`,
  478. `plu`,
  479. `english_name`,
  480. `cost_price`,
  481. `daily_price`,
  482. `goods_biz_type`,
  483. `name`,
  484. `unit_code`,
  485. `brand`,
  486. `brand_id`,
  487. `category_id`,
  488. `goods_number`,
  489. `keywords`,
  490. `goods_brief`,
  491. `goods_desc`,
  492. `cus_goods_code`,
  493. `ciq_prod_model`,
  494. `ori_cnt_code`,
  495. `cus_decl_ele`,
  496. `cus_rec_code`,
  497. `is_on_sale`,
  498. `add_time`,
  499. `sort_order`,
  500. `is_delete`,
  501. `counter_price`,
  502. `extra_price`,
  503. `is_new`,
  504. `goods_unit`,
  505. `primary_pic_url`,
  506. `list_pic_url`,
  507. `goods_rate`,
  508. `sell_volume`,
  509. `primary_product_id`,
  510. `unit_price`,
  511. `promotion_desc`,
  512. `promotion_tag`,
  513. `app_exclusive_price`,
  514. `is_app_exclusive`,
  515. `gross_weight`,
  516. `net_weight`,
  517. is_goods_share_stock,
  518. `is_limited`,
  519. `is_hot`,
  520. `creater_sn`,
  521. `create_time`,
  522. `moder_sn`,
  523. `mod_time`,
  524. `mychem_id`,
  525. `hs_code`,
  526. `hs_code_name`,
  527. `is_sync_hs_code`,
  528. `is_sync_goods_rate`,
  529. `imp_consum_tax_rate`,
  530. `value_added_tax_rate`,
  531. `legal_unit1_qty`,
  532. `legal_unit2_qty`,
  533. `cosm_threshold_value`,
  534. `to_be_restored`,
  535. `tstm`)
  536. values(
  537. #{merchSn},
  538. #{thirdPartyMerchCode},
  539. #{supplierId},
  540. #{goodsSn},
  541. #{prodBarcode},
  542. #{sku},
  543. #{plu},
  544. #{englishName},
  545. #{costPrice},
  546. #{dailyPrice},
  547. #{goodsBizType},
  548. #{name},
  549. #{unitCode},
  550. #{brand},
  551. #{brandId},
  552. #{categoryId},
  553. #{goodsNumber},
  554. #{keywords},
  555. #{goodsBrief},
  556. #{goodsDesc},
  557. #{cusGoodsCode},
  558. #{ciqProdModel},
  559. #{oriCntCode},
  560. #{cusDeclEle},
  561. #{cusRecCode},
  562. #{isOnSale},
  563. #{addTime},
  564. #{sortOrder},
  565. #{isDelete},
  566. #{counterPrice},
  567. #{extraPrice},
  568. #{isNew},
  569. #{goodsUnit},
  570. #{primaryPicUrl},
  571. #{listPicUrl},
  572. #{goodsRate},
  573. #{sellVolume},
  574. #{primaryProductId},
  575. #{unitPrice},
  576. #{promotionDesc},
  577. #{promotionTag},
  578. #{appExclusivePrice},
  579. #{isAppExclusive},
  580. #{grossWeight},
  581. #{netWeight},
  582. #{isGoodsShareStock},
  583. #{isLimited},
  584. #{isHot},
  585. #{createrSn},
  586. #{createTime},
  587. #{moderSn},
  588. #{modTime},
  589. #{mychemId},
  590. #{hsCode},
  591. #{hsCodeName},
  592. '0',
  593. '0',
  594. #{impConsumTaxRate},
  595. #{valueAddedTaxRate},
  596. #{legalUnit1Qty},
  597. #{legalUnit2Qty},
  598. #{cosmThresholdValue},
  599. 0,
  600. #{tstm})
  601. </insert>
  602. <update id="update" parameterType="com.kmall.admin.entity.GoodsEntity">
  603. update mall_goods
  604. <set>
  605. <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
  606. <if test="thirdPartyMerchCode != null">`third_party_merch_code` = #{thirdPartyMerchCode},</if>
  607. <if test="supplierId != null">`supplier_id` = #{supplierId},</if>
  608. <if test="goodsSn != null">`goods_sn` = #{goodsSn},</if>
  609. <if test="prodBarcode != null">`prod_barcode` = #{prodBarcode},</if>
  610. <if test="sku != null">`sku` = #{sku},</if>
  611. <if test="plu != null">`plu` = #{plu},</if>
  612. <if test="englishName != null">`english_name` = #{englishName},</if>
  613. <if test="costPrice != null">`cost_price` = #{costPrice},</if>
  614. <if test="dailyPrice != null">`daily_price` = #{dailyPrice},</if>
  615. <if test="goodsBizType != null">`goods_biz_type` = #{goodsBizType},</if>
  616. <if test="name != null">`name` = #{name},</if>
  617. <if test="unitCode != null">`unit_code` = #{unitCode},</if>
  618. <if test="brand != null">`brand` = #{brand},</if>
  619. <if test="brandId != null">`brand_id` = #{brandId},</if>
  620. <if test="categoryId != null">`category_id` = #{categoryId},</if>
  621. <if test="goodsNumber != null">`goods_number` = #{goodsNumber},</if>
  622. <if test="keywords != null">`keywords` = #{keywords},</if>
  623. <if test="goodsBrief != null">`goods_brief` = #{goodsBrief},</if>
  624. <if test="goodsDesc != null">`goods_desc` = #{goodsDesc},</if>
  625. <if test="cusGoodsCode != null">`cus_goods_code` = #{cusGoodsCode},</if>
  626. <if test="ciqProdModel != null">`ciq_prod_model` = #{ciqProdModel},</if>
  627. <if test="oriCntCode != null">`ori_cnt_code` = #{oriCntCode},</if>
  628. <if test="cusDeclEle != null">`cus_decl_ele` = #{cusDeclEle},</if>
  629. <if test="cusRecCode != null">`cus_rec_code` = #{cusRecCode},</if>
  630. <if test="isOnSale != null">`is_on_sale` = #{isOnSale},</if>
  631. <if test="addTime != null">`add_time` = #{addTime},</if>
  632. <if test="sortOrder != null">`sort_order` = #{sortOrder},</if>
  633. <if test="isDelete != null">`is_delete` = #{isDelete},</if>
  634. <if test="counterPrice != null">`counter_price` = #{counterPrice},</if>
  635. <if test="extraPrice != null">`extra_price` = #{extraPrice},</if>
  636. <if test="isNew != null">`is_new` = #{isNew},</if>
  637. <if test="goodsUnit != null">`goods_unit` = #{goodsUnit},</if>
  638. <if test="primaryPicUrl != null">`primary_pic_url` = #{primaryPicUrl},</if>
  639. <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl},</if>
  640. <if test="goodsRate != null">`goods_rate` = #{goodsRate},</if>
  641. <if test="sellVolume != null">`sell_volume` = #{sellVolume},</if>
  642. <if test="primaryProductId != null">`primary_product_id` = #{primaryProductId},</if>
  643. <if test="unitPrice != null">`unit_price` = #{unitPrice},</if>
  644. <if test="promotionDesc != null">`promotion_desc` = #{promotionDesc},</if>
  645. <if test="promotionTag != null">`promotion_tag` = #{promotionTag},</if>
  646. <if test="appExclusivePrice != null">`app_exclusive_price` = #{appExclusivePrice},</if>
  647. <if test="isAppExclusive != null">`is_app_exclusive` = #{isAppExclusive},</if>
  648. <if test="grossWeight != null">`gross_weight` = #{grossWeight},</if>
  649. <if test="netWeight != null">`net_weight` = #{netWeight},</if>
  650. <if test="isGoodsShareStock != null">`is_goods_share_stock` = #{isGoodsShareStock},</if>
  651. <if test="isLimited != null">`is_limited` = #{isLimited},</if>
  652. <if test="isHot != null">`is_hot` = #{isHot},</if>
  653. <if test="createrSn != null">`creater_sn` = #{createrSn},</if>
  654. <if test="createTime != null">`create_time` = #{createTime},</if>
  655. <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
  656. <if test="modTime != null">`mod_time` = #{modTime},</if>
  657. <if test="tstm != null">`tstm` = #{tstm},</if>
  658. <if test="lastSaleTime != null">`last_sale_time` = #{lastSaleTime},</if>
  659. <if test="mychemId != null">`mychem_id` = #{mychemId},</if>
  660. <if test="hsCode != null">`hs_code` = #{hsCode},</if>
  661. <if test="hsCodeName != null">`hs_code_name` = #{hsCodeName},</if>
  662. <if test="isSyncHsCode != null">`is_sync_hs_code` = #{isSyncHsCode},</if>
  663. <if test="isSyncGoodsRate != null">`is_sync_goods_rate` = #{isSyncGoodsRate},</if>
  664. <if test="impConsumTaxRate != null">`imp_consum_tax_rate` = #{impConsumTaxRate},</if>
  665. <if test="valueAddedTaxRate != null">`value_added_tax_rate` = #{valueAddedTaxRate},</if>
  666. <if test="legalUnit1Qty != null">`legal_unit1_qty` = #{legalUnit1Qty},</if>
  667. <if test="legalUnit2Qty != null">`legal_unit2_qty` = #{legalUnit2Qty},</if>
  668. <if test="cosmThresholdValue != null">`cosm_threshold_value` = #{cosmThresholdValue},</if>
  669. <if test="toBeRestored != null">`to_be_restored` = #{toBeRestored}</if>
  670. </set>
  671. where id = #{id}
  672. </update>
  673. <delete id="delete">
  674. delete from mall_goods where id = #{value}
  675. </delete>
  676. <delete id="deleteBatch">
  677. delete from mall_goods where id in
  678. <foreach item="id" collection="array" open="(" separator="," close=")">
  679. #{id}
  680. </foreach>
  681. </delete>
  682. <select id="queryMaxId" resultType="java.lang.Long" parameterType="map">
  683. SELECT MAX(id) FROM mall_goods
  684. </select>
  685. <select id="searchGoodsPanoramaDtoByKeyword" resultType="com.kmall.admin.dto.GoodsPanoramaDto">
  686. SELECT
  687. g.id id,g.name `name`,g.name simpleName,g.ciq_prod_model ciqProdModel,
  688. g.goods_unit goodsBasicUnit,g.category_id categoryId,c.name categoryName,
  689. g.goods_unit goodsPurchaseUnit,g.supplier_id supplierId,s.child_supplier_name supplierName,
  690. g.prod_barcode prodBarcode,g.plu plu,g.goods_sn goodsSn,g.brand brand
  691. FROM
  692. mall_goods g
  693. INNER JOIN mall_category c
  694. INNER JOIN mall_supplier s
  695. WHERE
  696. g.category_id = c.id
  697. and g.supplier_id = s.id
  698. AND (g.goods_sn=#{keyword} OR g.prod_barcode=#{keyword})
  699. </select>
  700. <select id="queryExportList" resultType="com.kmall.admin.entity.GoodsEntity">
  701. select * from (
  702. select
  703. mall_goods.*,
  704. case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
  705. m.merch_name merchName, mb.is_stock_share isStockShare,
  706. catagory.keywords as categoryName,
  707. scnc.`name` as oriCntName
  708. from mall_goods
  709. left join mall_merch m on mall_goods.merch_sn = m.merch_sn
  710. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  711. left join third_merchant_biz mb on mb.third_party_merch_code = mall_goods.third_party_merch_code and
  712. mb.merch_sn=mall_goods.merch_sn
  713. left join mall_category catagory on catagory.id = mall_goods.category_id
  714. left join sys_cus_nation_code scnc on mall_goods.ori_cnt_code = scnc.code
  715. WHERE 1=1
  716. <!-- 数据过滤 -->
  717. ${filterSql}
  718. <if test="merchSn != null and merchSn.trim() != ''">
  719. AND mall_goods.merch_sn = #{merchSn}
  720. </if>
  721. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  722. AND mall_goods.prod_barcode = #{prodBarcode}
  723. </if>
  724. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  725. AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
  726. </if>
  727. <if test="goodsSn != null and goodsSn != ''">
  728. AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
  729. </if>
  730. <if test="name != null and name != ''">
  731. AND mall_goods.name LIKE concat('%',#{name},'%')
  732. </if>
  733. <if test="englishName != null and englishName != ''">
  734. AND mall_goods.english_name LIKE concat('%',#{englishName},'%')
  735. </if>
  736. <if test="goodsBizType != null and goodsBizType != ''">
  737. AND mall_goods.goods_biz_type = #{goodsBizType}
  738. </if>
  739. <if test="isDelete != null">
  740. AND mall_goods.is_Delete = #{isDelete}
  741. </if>
  742. ) temp
  743. where 1=1
  744. <if test="lastSaleTime != null and lastSaleTime != ''">
  745. AND temp.last_sale_time &gt;= #{lastSaleTime} or temp.last_sale_time is null
  746. </if>
  747. </select>
  748. <select id="queryForPDFData" resultType="com.kmall.api.entity.exportpdf.PDFGoodsDto">
  749. select
  750. g.name as productName,
  751. g.english_name as englishName,
  752. rela.retail_price as price,
  753. IFNULL((rela.market_price - rela.retail_price ),0) as savings,
  754. g.goods_rate as startFax,
  755. g.goods_rate as endFax,
  756. g.plu as plu,
  757. g.prod_barcode as barCode
  758. from
  759. mall_goods g
  760. left join mall_product_store_rela rela on g.id = rela.goods_id
  761. <where>
  762. <if test="sku != null and sku != ''">
  763. and g.sku = #{sku}
  764. </if>
  765. <if test="prodBarcode != null and prodBarcode != ''">
  766. and g.prod_barcode = #{prodBarcode}
  767. </if>
  768. <if test="storeId != null and storeId != ''">
  769. and rela.store_id = #{storeId}
  770. </if>
  771. </where>
  772. </select>
  773. <select id="queryByBarcode" resultType="com.kmall.admin.entity.GoodsEntity">
  774. select *
  775. from mall_goods
  776. where prod_barcode = #{barCode}
  777. </select>
  778. <select id="queryBySku" resultType="com.kmall.admin.entity.GoodsEntity">
  779. select *
  780. from mall_goods
  781. where sku = #{sku}
  782. </select>
  783. <select id="queryListByBarcode" resultType="com.kmall.admin.entity.GoodsEntity">
  784. SELECT
  785. 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,
  786. 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
  787. FROM
  788. mall_goods a
  789. LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
  790. inner join mall_store s on r.store_id=s.id
  791. where a.prod_barcode = #{prodBarcode} and r.store_id = #{storeId} and a.sku = #{sku} and a.is_on_sale = 1
  792. and r.stock_num > 0 order by r.stock_num desc
  793. </select>
  794. <select id="queryByName" resultType="com.kmall.admin.entity.GoodsEntity">
  795. SELECT DISTINCT
  796. g.id,
  797. g.NAME,
  798. g.sku,
  799. g.prod_barcode
  800. FROM
  801. mall_product_store_rela r
  802. LEFT JOIN mall_goods g ON g.id = r.goods_id
  803. WHERE
  804. r.store_id = #{storeId}
  805. <if test="goodsName != null and goodsName != ''">
  806. AND g.NAME LIKE concat('%',#{goodsName},'%');
  807. </if>
  808. </select>
  809. <select id="queryNonSyncOmsHsCodeSkuList" resultType="java.lang.String">
  810. select sku
  811. from mall_goods
  812. where is_sync_hs_code = '0'
  813. </select>
  814. <select id="queryListBySku" resultType="com.kmall.admin.entity.GoodsEntity">
  815. select *
  816. from mall_goods
  817. where sku = #{sku}
  818. </select>
  819. <select id="queryNonSyncOmsGoodsRateSkuList" resultType="com.kmall.admin.entity.GoodsEntity">
  820. select *
  821. from mall_goods
  822. where is_sync_goods_rate = '0'
  823. </select>
  824. <select id="queryAllList" resultType="com.kmall.admin.entity.GoodsEntity">
  825. select * from mall_goods where is_delete = 0
  826. <if test="page != null and pageSize != null">
  827. limit #{page}, #{pageSize}
  828. </if>
  829. </select>
  830. <select id="queryByBarcodeAndSku" resultType="com.kmall.admin.entity.GoodsEntity">
  831. select * from mall_goods where
  832. goods_sn = #{goodsSn} and prod_barcode = #{prodBarcode}
  833. </select>
  834. <select id="querySpecialCosmetics" resultType="com.kmall.admin.entity.GoodsEntity">
  835. SELECT distinct
  836. a.*,
  837. m.retail_price as retailPrice,
  838. m.stock_num as stockNum,
  839. m.store_id as storeId
  840. FROM
  841. mall_goods a
  842. left join mall_product_store_rela m on m.goods_id = a.id
  843. <where>
  844. a.cus_rec_code in
  845. <foreach collection="hdCodeSet" item="item" open="(" close=")" separator=",">
  846. #{item}
  847. </foreach>
  848. </where>
  849. </select>
  850. <insert id="saveBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
  851. insert into mall_goods(
  852. `merch_sn`,
  853. third_party_merch_code,
  854. `supplier_id`,
  855. `goods_sn`,
  856. `prod_barcode`,
  857. `sku`,
  858. `plu`,
  859. `english_name`,
  860. `cost_price`,
  861. `daily_price`,
  862. `goods_biz_type`,
  863. `name`,
  864. `unit_code`,
  865. `brand`,
  866. `brand_id`,
  867. `category_id`,
  868. `goods_number`,
  869. `keywords`,
  870. `goods_brief`,
  871. `goods_desc`,
  872. `cus_goods_code`,
  873. `ciq_prod_model`,
  874. `ori_cnt_code`,
  875. `cus_decl_ele`,
  876. `cus_rec_code`,
  877. `is_on_sale`,
  878. `add_time`,
  879. `sort_order`,
  880. `is_delete`,
  881. `counter_price`,
  882. `extra_price`,
  883. `is_new`,
  884. `goods_unit`,
  885. `primary_pic_url`,
  886. `list_pic_url`,
  887. `goods_rate`,
  888. `sell_volume`,
  889. `primary_product_id`,
  890. `unit_price`,
  891. `promotion_desc`,
  892. `promotion_tag`,
  893. `app_exclusive_price`,
  894. `is_app_exclusive`,
  895. `gross_weight`,
  896. `net_weight`,
  897. is_goods_share_stock,
  898. `is_limited`,
  899. `is_hot`,
  900. `creater_sn`,
  901. `create_time`,
  902. `moder_sn`,
  903. `mod_time`,
  904. `mychem_id`,
  905. `hs_code`,
  906. `hs_code_name`,
  907. `is_sync_hs_code`,
  908. `is_sync_goods_rate`,
  909. `imp_consum_tax_rate`,
  910. `value_added_tax_rate`,
  911. `legal_unit1_qty`,
  912. `legal_unit2_qty`,
  913. `cosm_threshold_value`,
  914. `to_be_restored`,
  915. `tstm`)
  916. values
  917. <foreach collection="list" index="index" item="item" separator=",">
  918. (
  919. #{item.merchSn},
  920. #{item.thirdPartyMerchCode},
  921. #{item.supplierId},
  922. #{item.goodsSn},
  923. #{item.prodBarcode},
  924. #{item.sku},
  925. #{item.plu},
  926. #{item.englishName},
  927. #{item.costPrice},
  928. #{item.dailyPrice},
  929. #{item.goodsBizType},
  930. #{item.name},
  931. #{item.unitCode},
  932. #{item.brand},
  933. #{item.brandId},
  934. #{item.categoryId},
  935. #{item.goodsNumber},
  936. #{item.keywords},
  937. #{item.goodsBrief},
  938. #{item.goodsDesc},
  939. #{item.cusGoodsCode},
  940. #{item.ciqProdModel},
  941. #{item.oriCntCode},
  942. #{item.cusDeclEle},
  943. #{item.cusRecCode},
  944. #{item.isOnSale},
  945. #{item.addTime},
  946. #{item.sortOrder},
  947. #{item.isDelete},
  948. #{item.counterPrice},
  949. #{item.extraPrice},
  950. #{item.isNew},
  951. #{item.goodsUnit},
  952. #{item.primaryPicUrl},
  953. #{item.listPicUrl},
  954. #{item.goodsRate},
  955. #{item.sellVolume},
  956. #{item.primaryProductId},
  957. #{item.unitPrice},
  958. #{item.promotionDesc},
  959. #{item.promotionTag},
  960. #{item.appExclusivePrice},
  961. #{item.isAppExclusive},
  962. #{item.grossWeight},
  963. #{item.netWeight},
  964. #{item.isGoodsShareStock},
  965. #{item.isLimited},
  966. #{item.isHot},
  967. #{item.createrSn},
  968. #{item.createTime},
  969. #{item.moderSn},
  970. #{item.modTime},
  971. #{item.mychemId},
  972. #{item.hsCode},
  973. #{item.hsCodeName},
  974. '0',
  975. '0',
  976. #{item.impConsumTaxRate},
  977. #{item.valueAddedTaxRate},
  978. #{item.legalUnit1Qty},
  979. #{item.legalUnit2Qty},
  980. #{item.cosmThresholdValue},
  981. #{item.toBeRestored},
  982. #{item.tstm})
  983. </foreach>
  984. </insert>
  985. <update id="updateBatch" parameterType="java.util.List">
  986. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  987. update mall_goods
  988. <set>
  989. <if test="item.merchSn != null">`merch_sn` = #{item.merchSn},</if>
  990. <if test="item.thirdPartyMerchCode != null">`third_party_merch_code` = #{item.thirdPartyMerchCode},</if>
  991. <if test="item.supplierId != null">`supplier_id` = #{item.supplierId},</if>
  992. <if test="item.goodsSn != null">`goods_sn` = #{item.goodsSn},</if>
  993. <if test="item.prodBarcode != null">`prod_barcode` = #{item.prodBarcode},</if>
  994. <if test="item.sku != null">`sku` = #{item.sku},</if>
  995. <if test="item.plu != null">`plu` = #{item.plu},</if>
  996. <if test="item.englishName != null">`english_name` = #{item.englishName},</if>
  997. <if test="item.costPrice != null">`cost_price` = #{item.costPrice},</if>
  998. <if test="item.dailyPrice != null">`daily_price` = #{item.dailyPrice},</if>
  999. <if test="item.goodsBizType != null">`goods_biz_type` = #{item.goodsBizType},</if>
  1000. <if test="item.name != null">`name` = #{item.name},</if>
  1001. <if test="item.unitCode != null">`unit_code` = #{item.unitCode},</if>
  1002. <if test="item.brand != null">`brand` = #{item.brand},</if>
  1003. <if test="item.brandId != null">`brand_id` = #{item.brandId},</if>
  1004. <if test="item.categoryId != null">`category_id` = #{item.categoryId},</if>
  1005. <if test="item.goodsNumber != null">`goods_number` = #{item.goodsNumber},</if>
  1006. <if test="item.keywords != null">`keywords` = #{item.keywords},</if>
  1007. <if test="item.goodsBrief != null">`goods_brief` = #{item.goodsBrief},</if>
  1008. <if test="item.goodsDesc != null">`goods_desc` = #{item.goodsDesc},</if>
  1009. <if test="item.cusGoodsCode != null">`cus_goods_code` = #{item.cusGoodsCode},</if>
  1010. <if test="item.ciqProdModel != null">`ciq_prod_model` = #{item.ciqProdModel},</if>
  1011. <if test="item.oriCntCode != null">`ori_cnt_code` = #{item.oriCntCode},</if>
  1012. <if test="item.cusDeclEle != null">`cus_decl_ele` = #{item.cusDeclEle},</if>
  1013. <if test="item.cusRecCode != null">`cus_rec_code` = #{item.cusRecCode},</if>
  1014. <if test="item.isOnSale != null">`is_on_sale` = #{item.isOnSale},</if>
  1015. <if test="item.addTime != null">`add_time` = #{item.addTime},</if>
  1016. <if test="item.sortOrder != null">`sort_order` = #{item.sortOrder},</if>
  1017. <if test="item.isDelete != null">`is_delete` = #{item.isDelete},</if>
  1018. <if test="item.counterPrice != null">`counter_price` = #{item.counterPrice},</if>
  1019. <if test="item.extraPrice != null">`extra_price` = #{item.extraPrice},</if>
  1020. <if test="item.isNew != null">`is_new` = #{item.isNew},</if>
  1021. <if test="item.goodsUnit != null">`goods_unit` = #{item.goodsUnit},</if>
  1022. <if test="item.primaryPicUrl != null">`primary_pic_url` = #{item.primaryPicUrl},</if>
  1023. <if test="item.listPicUrl != null">`list_pic_url` = #{item.listPicUrl},</if>
  1024. <if test="item.goodsRate != null">`goods_rate` = #{item.goodsRate},</if>
  1025. <if test="item.sellVolume != null">`sell_volume` = #{item.sellVolume},</if>
  1026. <if test="item.primaryProductId != null">`primary_product_id` = #{item.primaryProductId},</if>
  1027. <if test="item.unitPrice != null">`unit_price` = #{item.unitPrice},</if>
  1028. <if test="item.promotionDesc != null">`promotion_desc` = #{item.promotionDesc},</if>
  1029. <if test="item.promotionTag != null">`promotion_tag` = #{item.promotionTag},</if>
  1030. <if test="item.appExclusivePrice != null">`app_exclusive_price` = #{item.appExclusivePrice},</if>
  1031. <if test="item.isAppExclusive != null">`is_app_exclusive` = #{item.isAppExclusive},</if>
  1032. <if test="item.grossWeight != null">`gross_weight` = #{item.grossWeight},</if>
  1033. <if test="item.netWeight != null">`net_weight` = #{item.netWeight},</if>
  1034. <if test="item.isGoodsShareStock != null">`is_goods_share_stock` = #{item.isGoodsShareStock},</if>
  1035. <if test="item.isLimited != null">`is_limited` = #{item.isLimited},</if>
  1036. <if test="item.isHot != null">`is_hot` = #{item.isHot},</if>
  1037. <if test="item.createrSn != null">`creater_sn` = #{item.createrSn},</if>
  1038. <if test="item.createTime != null">`create_time` = #{item.createTime},</if>
  1039. <if test="item.moderSn != null">`moder_sn` = #{item.moderSn},</if>
  1040. <if test="item.modTime != null">`mod_time` = #{item.modTime},</if>
  1041. <if test="item.tstm != null">`tstm` = #{item.tstm},</if>
  1042. <if test="item.lastSaleTime != null">`last_sale_time` = #{item.lastSaleTime},</if>
  1043. <if test="item.mychemId != null">`mychem_id` = #{item.mychemId},</if>
  1044. <if test="item.hsCode != null">`hs_code` = #{item.hsCode},</if>
  1045. <if test="item.hsCodeName != null">`hs_code_name` = #{item.hsCodeName},</if>
  1046. <if test="item.isSyncHsCode != null">`is_sync_hs_code` = #{item.isSyncHsCode},</if>
  1047. <if test="item.isSyncGoodsRate != null">`is_sync_goods_rate` = #{item.isSyncGoodsRate},</if>
  1048. <if test="item.impConsumTaxRate != null">`imp_consum_tax_rate` = #{item.impConsumTaxRate},</if>
  1049. <if test="item.valueAddedTaxRate != null">`value_added_tax_rate` = #{item.valueAddedTaxRate},</if>
  1050. <if test="item.legalUnit1Qty != null">`legal_unit1_qty` = #{item.legalUnit1Qty},</if>
  1051. <if test="item.legalUnit2Qty != null">`legal_unit2_qty` = #{item.legalUnit2Qty},</if>
  1052. <if test="item.cosmThresholdValue != null">`cosm_threshold_value` = #{item.cosmThresholdValue},</if>
  1053. <if test="item.toBeRestored != null">`to_be_restored` = #{item.toBeRestored}</if>
  1054. </set>
  1055. where id = #{item.id}
  1056. </foreach>
  1057. </update>
  1058. <select id="syncOmsHsCodeGoode" resultType="java.lang.String">
  1059. select sku from mall_goods where id in
  1060. <foreach collection="list" item="id" index="index"
  1061. open="(" close=")" separator=",">
  1062. #{id}
  1063. </foreach>
  1064. </select>
  1065. <select id="syncGoodsRateGoode" resultType="com.kmall.admin.entity.GoodsEntity">
  1066. select * from mall_goods where is_delete = 0 and id in
  1067. <foreach collection="list" item="id" index="index"
  1068. open="(" close=")" separator=",">
  1069. #{id}
  1070. </foreach>
  1071. </select>
  1072. </mapper>