1
0

GoodsDao.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  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. </resultMap>
  69. <select id="queryObject" resultType="com.kmall.admin.entity.GoodsEntity">
  70. SELECT
  71. a.*, CASE
  72. when g.id > 0 then 2 else 0 end as goodsType,
  73. mb.third_party_merch_code,
  74. mb.is_stock_share isStockShare,
  75. mb.is_supplier_goods 'isSupplierGoods'
  76. FROM
  77. mall_goods a
  78. LEFT JOIN mall_goods_group g ON g.goods_id = a.id AND g.open_status != 3
  79. LEFT JOIN third_merchant_biz mb ON a.third_party_merch_code = mb.third_party_merch_code
  80. WHERE a.id = #{value}
  81. </select>
  82. <select id="queryObjectByStoreId" resultMap="goodsMap">
  83. select
  84. a.sku,
  85. a.id,
  86. psr1.category_id,
  87. a.goods_sn,
  88. a.name,
  89. psr1.brand_id,
  90. a.goods_number,
  91. a.keywords,
  92. a.goods_brief,
  93. a.is_on_sale,
  94. a.add_time,
  95. a.sort_order,
  96. a.is_delete,
  97. psr1.attribute_category,
  98. a.counter_price,
  99. a.extra_price,
  100. a.is_new,
  101. a.goods_unit,
  102. a.primary_pic_url,
  103. a.list_pic_url,
  104. psr1.retail_price,
  105. psr1.sell_volume,
  106. a.primary_product_id,
  107. a.unit_price,
  108. a.promotion_desc,
  109. a.promotion_tag,
  110. a.app_exclusive_price,
  111. a.is_app_exclusive,
  112. a.is_limited,
  113. a.is_hot,
  114. a.merch_sn,
  115. m.merch_name,
  116. psr1.store_id,
  117. psr1.market_price,
  118. psr1.stock_num,
  119. a.goods_desc,a.goods_biz_type,a.goods_rate,
  120. a.sell_volume goods_sell_volume,
  121. mb.third_party_merch_code,
  122. mb.is_stock_share isStockShare,
  123. mb.is_supplier_goods 'isSupplierGoods',
  124. mb2.third_party_merch_code 'supplierThirdMerchCode',
  125. mb2.is_stock_share 'isStockShareBySuppler'
  126. from mall_goods a left join mall_merch m on a.merch_sn = m.merch_sn
  127. LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id and a.merch_sn = psr1.merch_sn
  128. LEFT JOIN mall_store s ON s.id = psr1.store_id
  129. LEFT JOIN third_merchant_biz mb on s.third_party_merch_code = mb.third_party_merch_code
  130. LEFT JOIN third_merchant_biz mb2 ON a.third_party_merch_code = mb2.third_party_merch_code
  131. where a.id = #{id} and psr1.store_id = #{storeId}
  132. </select>
  133. <select id="queryGoodsByGoodsSnAndStoreId" resultMap="goodsMap">
  134. select
  135. a.sku,
  136. a.id,
  137. psr1.category_id,
  138. a.goods_sn,
  139. a.name,
  140. psr1.brand_id,
  141. a.goods_number,
  142. a.keywords,
  143. a.goods_brief,
  144. a.is_on_sale,
  145. a.add_time,
  146. a.sort_order,
  147. a.is_delete,
  148. psr1.attribute_category,
  149. a.counter_price,
  150. a.extra_price,
  151. a.is_new,
  152. a.goods_unit,
  153. a.primary_pic_url,
  154. a.list_pic_url,
  155. psr1.retail_price,
  156. psr1.sell_volume,
  157. a.primary_product_id,
  158. a.unit_price,
  159. a.promotion_desc,
  160. a.promotion_tag,
  161. a.app_exclusive_price,
  162. a.is_app_exclusive,
  163. a.is_limited,
  164. a.is_hot,
  165. a.merch_sn,
  166. m.merch_name,
  167. psr1.store_id,
  168. psr1.market_price,
  169. psr1.stock_num,
  170. a.goods_desc,a.goods_biz_type,a.goods_rate,
  171. a.sell_volume goods_sell_volume,
  172. mb.third_party_merch_code,
  173. mb.is_stock_share isStockShare,
  174. mb.is_supplier_goods 'isSupplierGoods',
  175. mb2.third_party_merch_code 'supplierThirdMerchCode',
  176. mb2.is_stock_share 'isStockShareBySuppler'
  177. from mall_goods a left join mall_merch m on a.merch_sn = m.merch_sn
  178. LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id and a.merch_sn = psr1.merch_sn
  179. LEFT JOIN mall_store s ON s.id = psr1.store_id
  180. LEFT JOIN third_merchant_biz mb on s.third_party_merch_code = mb.third_party_merch_code
  181. LEFT JOIN third_merchant_biz mb2 ON a.third_party_merch_code = mb2.third_party_merch_code
  182. where a.goods_sn = #{goodsSn} and psr1.store_id = #{storeId}
  183. </select>
  184. <select id="queryObjectByProdBarcodeAndBizType" resultType="com.kmall.admin.entity.GoodsEntity">
  185. SELECT
  186. 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'
  187. FROM
  188. mall_goods a
  189. LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
  190. inner join mall_store s on r.store_id=s.id
  191. where a.prod_barcode = #{prodBarcode} and a.goods_biz_type = 11 and r.store_id = #{storeId}
  192. </select>
  193. <select id="queryObjectByProdBarcodeAndStore" resultType="com.kmall.admin.entity.GoodsEntity">
  194. SELECT
  195. 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
  196. FROM
  197. mall_goods a
  198. LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
  199. inner join mall_store s on r.store_id=s.id
  200. where a.prod_barcode = #{prodBarcode} and r.store_id = #{storeId}
  201. </select>
  202. <select id="queryObjectByProdBarcode" resultType="com.kmall.admin.entity.GoodsEntity">
  203. SELECT
  204. 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'
  205. FROM
  206. mall_goods a
  207. LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
  208. inner join mall_store s on r.store_id=s.id
  209. where a.prod_barcode = #{prodBarcode} and a.is_delete = 0
  210. <if test="goodsId != null and goodsId != ''">
  211. AND a.id != #{goodsId}
  212. </if>
  213. <if test="merchSn != null and merchSn != ''">
  214. AND a.merch_sn = #{merchSn}
  215. </if>
  216. </select>
  217. <select id="queryGoodsDetailsByProdBarcode" resultType="com.kmall.admin.dto.GoodsDetailsDto">
  218. SELECT distinct
  219. 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
  220. FROM
  221. mall_goods a
  222. LEFT JOIN mall_goods_specification r ON r.goods_id = a.id
  223. left join mall_product_store_rela m on m.goods_id = a.id and r.goods_id = m.goods_id
  224. where a.prod_barcode = #{prodBarcode} and m.store_id = #{storeId}
  225. </select>
  226. <select id="queryObjectBySn" resultType="com.kmall.admin.entity.GoodsEntity">
  227. SELECT
  228. a.*, CASE
  229. when g.id > 0 then 2 else 0 end as goodsType
  230. FROM
  231. mall_goods a
  232. LEFT JOIN mall_goods_group g ON g.goods_id = a.id
  233. AND g.open_status != 3
  234. where a.goods_sn = #{goodsSn}
  235. </select>
  236. <select id="queryList" resultType="com.kmall.admin.entity.GoodsEntity">
  237. select
  238. mall_goods.*,
  239. case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
  240. m.merch_name merchName, mb.is_stock_share isStockShare
  241. from mall_goods
  242. left join mall_merch m on mall_goods.merch_sn = m.merch_sn
  243. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  244. left join third_merchant_biz mb on mb.third_party_merch_code = mall_goods.third_party_merch_code and
  245. mb.merch_sn=mall_goods.merch_sn
  246. WHERE 1=1
  247. <!-- 数据过滤 -->
  248. ${filterSql}
  249. <if test="merchSn != null and merchSn.trim() != ''">
  250. AND mall_goods.merch_sn = #{merchSn}
  251. </if>
  252. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  253. AND mall_goods.prod_barcode = #{prodBarcode}
  254. </if>
  255. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  256. AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
  257. </if>
  258. <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
  259. AND mb.third_merch_sn = #{thirdMerchSn}
  260. </if>
  261. <if test="goodsSn != null and goodsSn != ''">
  262. AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
  263. </if>
  264. <if test="name != null and name != ''">
  265. AND mall_goods.name LIKE concat('%',#{name},'%')
  266. </if>
  267. <if test="englishName != null and englishName != ''">
  268. AND mall_goods.english_name LIKE concat('%',#{englishName},'%')
  269. </if>
  270. <!--<if test="brandId != null and brandId != ''">
  271. AND mall_goods.brand_id = #{brandId}
  272. </if>
  273. <if test="freightId != null and freightId != ''">
  274. AND mall_goods.freight_id = #{freightId}
  275. </if>
  276. <if test="categoryId != null and categoryId != ''">
  277. AND mall_goods.category_id = #{categoryId}
  278. </if>
  279. <if test="category != null and category != ''">
  280. AND mall_goods.category_id IN (select id from mall_category where parent_id = #{category})
  281. </if>
  282. <if test="categoryTwo != null and categoryTwo != ''">
  283. AND mall_goods.category_id = #{categoryTwo}
  284. </if>-->
  285. <if test="sku != null and sku != ''">
  286. AND mall_goods.sku LIKE concat('%',#{sku},'%')
  287. </if>
  288. <if test="plu != null and plu != ''">
  289. AND mall_goods.plu LIKE concat('%',#{plu},'%')
  290. </if>
  291. <if test="isDelete != null">
  292. AND mall_goods.is_Delete = #{isDelete}
  293. </if>
  294. <if test="isOnSale != null">
  295. AND mall_goods.is_on_sale = #{isOnSale}
  296. </if>
  297. <if test="goodsBizType != null and goodsBizType != ''">
  298. AND mall_goods.goods_biz_type = #{goodsBizType}
  299. </if>
  300. <if test="id != null and id != ''">
  301. AND mall_goods.id = #{id}
  302. </if>
  303. <if test="storeId != null and storeId != ''">
  304. AND mall_goods.third_party_merch_code = ( SELECT third_party_merch_code FROM mall_store WHERE id =
  305. #{storeId} )
  306. AND mall_goods.id NOT IN (
  307. SELECT
  308. goods_id
  309. FROM
  310. mall_product_store_rela pp
  311. WHERE
  312. store_id = #{storeId}
  313. )
  314. </if>
  315. <if test="storeIdBySupplier != null and storeIdBySupplier != ''">
  316. AND mall_goods.id NOT IN (
  317. SELECT
  318. goods_id
  319. FROM
  320. mall_product_store_rela pp
  321. WHERE
  322. store_id = #{storeIdBySupplier} and supplier_third_id = #{thirdMerchSn}
  323. )
  324. </if>
  325. <choose>
  326. <when test="sidx != null and sidx.trim() != ''">
  327. order by ${sidx} ${order}
  328. </when>
  329. <otherwise>
  330. order by mall_goods.id desc
  331. </otherwise>
  332. </choose>
  333. <if test="offset != null and limit != null">
  334. limit #{offset}, #{limit}
  335. </if>
  336. </select>
  337. <select id="querySame" resultType="com.kmall.admin.entity.GoodsEntity">
  338. select
  339. mall_goods.*,
  340. case when mall_goods_group.id > 0 then 2 else 0 end as goodsType
  341. from mall_goods
  342. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  343. WHERE 1=1
  344. <!-- 数据过滤 -->
  345. ${filterSql}
  346. <if test="isSame != null and isSame != ''">
  347. AND ((mall_goods.sku = #{sku} AND mall_goods.goods_biz_type = #{goodsBizType}) OR mall_goods.goods_sn =
  348. #{goodsSn})
  349. <if test="id != null and id != ''">
  350. AND mall_goods.id != #{id}
  351. </if>
  352. </if>
  353. <choose>
  354. <when test="sidx != null and sidx.trim() != ''">
  355. order by ${sidx} ${order}
  356. </when>
  357. <otherwise>
  358. order by mall_goods.id desc
  359. </otherwise>
  360. </choose>
  361. <if test="offset != null and limit != null">
  362. limit #{offset}, #{limit}
  363. </if>
  364. </select>
  365. <select id="queryTotal" resultType="int">
  366. select count(*) from mall_goods
  367. left join mall_merch m on mall_goods.merch_sn = m.merch_sn
  368. left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
  369. WHERE 1=1
  370. <!-- 数据过滤 -->
  371. ${filterSql}
  372. <if test="merchSn != null and merchSn.trim() != ''">
  373. AND mall_goods.merch_sn = #{merchSn}
  374. </if>
  375. <if test="prodBarcode != null and prodBarcode.trim() != ''">
  376. AND mall_goods.prod_barcode = #{prodBarcode}
  377. </if>
  378. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  379. AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
  380. </if>
  381. <if test="goodsSn != null and goodsSn != ''">
  382. AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
  383. </if>
  384. <if test="name != null and name != ''">
  385. AND mall_goods.name LIKE concat('%',#{name},'%')
  386. </if>
  387. <if test="sku != null and sku != ''">
  388. AND mall_goods.sku LIKE concat('%',#{sku},'%')
  389. </if>
  390. <if test="isDelete != null">
  391. AND mall_goods.is_Delete = #{isDelete}
  392. </if>
  393. <if test="isOnSale != null">
  394. AND mall_goods.is_on_sale = #{isOnSale}
  395. </if>
  396. <if test="goodsBizType != null and goodsBizType != ''">
  397. AND mall_goods.goods_biz_type = #{goodsBizType}
  398. </if>
  399. <if test="storeId != null and storeId != ''">
  400. AND mall_goods.third_party_merch_code = ( SELECT third_party_merch_code FROM mall_store WHERE id =
  401. #{storeId} )
  402. AND mall_goods.id NOT IN (
  403. SELECT
  404. goods_id
  405. FROM
  406. mall_product_store_rela pp
  407. LEFT JOIN mall_goods gg ON pp.goods_id = gg.id
  408. AND pp.merch_sn = gg.merch_sn
  409. AND pp.merch_sn
  410. LEFT JOIN mall_store s ON pp.store_id = s.id
  411. AND s.third_party_merch_code = gg.third_party_merch_code
  412. WHERE
  413. store_id = #{storeId}
  414. )
  415. </if>
  416. </select>
  417. <insert id="save" parameterType="com.kmall.admin.entity.GoodsEntity" useGeneratedKeys="true" keyProperty="id">
  418. insert into mall_goods(
  419. `merch_sn`,
  420. third_party_merch_code,
  421. `supplier_id`,
  422. `goods_sn`,
  423. `prod_barcode`,
  424. `sku`,
  425. `plu`,
  426. `english_name`,
  427. `goods_biz_type`,
  428. `name`,
  429. `unit_code`,
  430. `brand`,
  431. `goods_number`,
  432. `keywords`,
  433. `goods_brief`,
  434. `goods_desc`,
  435. `cus_goods_code`,
  436. `ciq_prod_model`,
  437. `ori_cnt_code`,
  438. `cus_decl_ele`,
  439. `cus_rec_code`,
  440. `is_on_sale`,
  441. `add_time`,
  442. `sort_order`,
  443. `is_delete`,
  444. `counter_price`,
  445. `extra_price`,
  446. `is_new`,
  447. `goods_unit`,
  448. `primary_pic_url`,
  449. `list_pic_url`,
  450. `goods_rate`,
  451. `sell_volume`,
  452. `primary_product_id`,
  453. `unit_price`,
  454. `promotion_desc`,
  455. `promotion_tag`,
  456. `app_exclusive_price`,
  457. `is_app_exclusive`,
  458. `gross_weight`,
  459. `net_weight`,
  460. is_goods_share_stock,
  461. `is_limited`,
  462. `is_hot`,
  463. `creater_sn`,
  464. `create_time`,
  465. `moder_sn`,
  466. `mod_time`,
  467. `tstm`)
  468. values(
  469. #{merchSn},
  470. #{thirdPartyMerchCode},
  471. #{supplierId},
  472. #{goodsSn},
  473. #{prodBarcode},
  474. #{sku},
  475. #{plu},
  476. #{englishName},
  477. #{goodsBizType},
  478. #{name},
  479. #{unitCode},
  480. #{brand},
  481. #{goodsNumber},
  482. #{keywords},
  483. #{goodsBrief},
  484. #{goodsDesc},
  485. #{cusGoodsCode},
  486. #{ciqProdModel},
  487. #{oriCntCode},
  488. #{cusDeclEle},
  489. #{cusRecCode},
  490. #{isOnSale},
  491. #{addTime},
  492. #{sortOrder},
  493. #{isDelete},
  494. #{counterPrice},
  495. #{extraPrice},
  496. #{isNew},
  497. #{goodsUnit},
  498. #{primaryPicUrl},
  499. #{listPicUrl},
  500. #{goodsRate},
  501. #{sellVolume},
  502. #{primaryProductId},
  503. #{unitPrice},
  504. #{promotionDesc},
  505. #{promotionTag},
  506. #{appExclusivePrice},
  507. #{isAppExclusive},
  508. #{grossWeight},
  509. #{netWeight},
  510. #{isGoodsShareStock},
  511. #{isLimited},
  512. #{isHot},
  513. #{createrSn},
  514. #{createTime},
  515. #{moderSn},
  516. #{modTime},
  517. #{tstm})
  518. </insert>
  519. <update id="update" parameterType="com.kmall.admin.entity.GoodsEntity">
  520. update mall_goods
  521. <set>
  522. <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
  523. <if test="thirdPartyMerchCode != null">`third_party_merch_code` = #{thirdPartyMerchCode},</if>
  524. <if test="supplierId != null">`supplier_id` = #{supplierId},</if>
  525. <if test="goodsSn != null">`goods_sn` = #{goodsSn},</if>
  526. <if test="prodBarcode != null">`prod_barcode` = #{prodBarcode},</if>
  527. <if test="sku != null">`sku` = #{sku},</if>
  528. <if test="plu != null">`plu` = #{plu},</if>
  529. <if test="englishName != null">`english_name` = #{englishName},</if>
  530. <if test="goodsBizType != null">`goods_biz_type` = #{goodsBizType},</if>
  531. <if test="name != null">`name` = #{name},</if>
  532. <if test="unitCode != null">`unit_code` = #{unitCode},</if>
  533. <if test="brand != null">`brand` = #{brand},</if>
  534. <if test="goodsNumber != null">`goods_number` = #{goodsNumber},</if>
  535. <if test="keywords != null">`keywords` = #{keywords},</if>
  536. <if test="goodsBrief != null">`goods_brief` = #{goodsBrief},</if>
  537. <if test="goodsDesc != null">`goods_desc` = #{goodsDesc},</if>
  538. <if test="cusGoodsCode != null">`cus_goods_code` = #{cusGoodsCode},</if>
  539. <if test="ciqProdModel != null">`ciq_prod_model` = #{ciqProdModel},</if>
  540. <if test="oriCntCode != null">`ori_cnt_code` = #{oriCntCode},</if>
  541. <if test="cusDeclEle != null">`cus_decl_ele` = #{cusDeclEle},</if>
  542. <if test="cusRecCode != null">`cus_rec_code` = #{cusRecCode},</if>
  543. <if test="isOnSale != null">`is_on_sale` = #{isOnSale},</if>
  544. <if test="addTime != null">`add_time` = #{addTime},</if>
  545. <if test="sortOrder != null">`sort_order` = #{sortOrder},</if>
  546. <if test="isDelete != null">`is_delete` = #{isDelete},</if>
  547. <if test="counterPrice != null">`counter_price` = #{counterPrice},</if>
  548. <if test="extraPrice != null">`extra_price` = #{extraPrice},</if>
  549. <if test="isNew != null">`is_new` = #{isNew},</if>
  550. <if test="goodsUnit != null">`goods_unit` = #{goodsUnit},</if>
  551. <if test="primaryPicUrl != null">`primary_pic_url` = #{primaryPicUrl},</if>
  552. <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl},</if>
  553. <if test="goodsRate != null">`goods_rate` = #{goodsRate},</if>
  554. <if test="sellVolume != null">`sell_volume` = #{sellVolume},</if>
  555. <if test="primaryProductId != null">`primary_product_id` = #{primaryProductId},</if>
  556. <if test="unitPrice != null">`unit_price` = #{unitPrice},</if>
  557. <if test="promotionDesc != null">`promotion_desc` = #{promotionDesc},</if>
  558. <if test="promotionTag != null">`promotion_tag` = #{promotionTag},</if>
  559. <if test="appExclusivePrice != null">`app_exclusive_price` = #{appExclusivePrice},</if>
  560. <if test="isAppExclusive != null">`is_app_exclusive` = #{isAppExclusive},</if>
  561. <if test="grossWeight != null">`gross_weight` = #{grossWeight},</if>
  562. <if test="netWeight != null">`net_weight` = #{netWeight},</if>
  563. <if test="isGoodsShareStock != null">`is_goods_share_stock` = #{isGoodsShareStock},</if>
  564. <if test="isLimited != null">`is_limited` = #{isLimited},</if>
  565. <if test="isHot != null">`is_hot` = #{isHot},</if>
  566. <if test="createrSn != null">`creater_sn` = #{createrSn},</if>
  567. <if test="createTime != null">`create_time` = #{createTime},</if>
  568. <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
  569. <if test="modTime != null">`mod_time` = #{modTime},</if>
  570. <if test="tstm != null">`tstm` = #{tstm}</if>
  571. </set>
  572. where id = #{id}
  573. </update>
  574. <delete id="delete">
  575. delete from mall_goods where id = #{value}
  576. </delete>
  577. <delete id="deleteBatch">
  578. delete from mall_goods where id in
  579. <foreach item="id" collection="array" open="(" separator="," close=")">
  580. #{id}
  581. </foreach>
  582. </delete>
  583. <select id="queryMaxId" resultType="java.lang.Long" parameterType="map">
  584. SELECT MAX(id) FROM mall_goods
  585. </select>
  586. <select id="searchGoodsPanoramaDtoByKeyword" resultType="com.kmall.admin.dto.GoodsPanoramaDto">
  587. SELECT
  588. g.id id,g.name `name`,g.name simpleName,g.ciq_prod_model ciqProdModel,
  589. g.goods_unit goodsBasicUnit,g.category_id categoryId,c.name categoryName,
  590. g.goods_unit goodsPurchaseUnit,g.supplier_id supplierId,s.child_supplier_name supplierName,
  591. g.prod_barcode prodBarcode,g.plu plu,g.goods_sn goodsSn,g.brand brand
  592. FROM
  593. mall_goods g
  594. INNER JOIN mall_category c
  595. INNER JOIN mall_supplier s
  596. WHERE
  597. g.category_id = c.id
  598. and g.supplier_id = s.id
  599. AND (g.goods_sn=#{keyword} OR g.prod_barcode=#{keyword})
  600. </select>
  601. </mapper>