12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.kmall.admin.dao.GoodsDao">
- <resultMap type="com.kmall.admin.entity.GoodsEntity" id="goodsMap">
- <result property="id" column="id"/>
- <result property="merchSn" column="merch_sn"/>
- <result property="categoryId" column="category_id"/>
- <result property="goodsSn" column="goods_sn"/>
- <result property="name" column="name"/>
- <result property="brandId" column="brand_id"/>
- <!--<result property="freightId" column="freight_id"/>-->
- <result property="brand" column="brand"/>
- <result property="goodsNumber" column="goods_number"/>
- <result property="keywords" column="keywords"/>
- <result property="goodsBrief" column="goods_brief"/>
- <result property="goodsDesc" column="goods_desc"/>
- <result property="isOnSale" column="is_on_sale"/>
- <result property="addTime" column="add_time"/>
- <result property="sortOrder" column="sort_order"/>
- <result property="isDelete" column="is_delete"/>
- <!--<result property="attributeCategory" column="attribute_category"/>-->
- <result property="counterPrice" column="counter_price"/>
- <result property="extraPrice" column="extra_price"/>
- <result property="isNew" column="is_new"/>
- <result property="goodsUnit" column="goods_unit"/>
- <result property="primaryPicUrl" column="primary_pic_url"/>
- <result property="listPicUrl" column="list_pic_url"/>
- <!--<result property="retailPrice" column="retail_price"/>-->
- <result property="sellVolume" column="sell_volume"/>
- <result property="primaryProductId" column="primary_product_id"/>
- <result property="unitPrice" column="unit_price"/>
- <result property="promotionDesc" column="promotion_desc"/>
- <result property="promotionTag" column="promotion_tag"/>
- <result property="appExclusivePrice" column="app_exclusive_price"/>
- <result property="isAppExclusive" column="is_app_exclusive"/>
- <result property="isLimited" column="is_limited"/>
- <result property="isHot" column="is_hot"/>
- <!--<result property="marketPrice" column="market_price"/>-->
- <result property="goodsType" column="goodsType"/>
- <result property="sku" column="sku"/>
- <result property="goodsBizType" column="goods_biz_type"/>
- <result column="creater_sn" property="createrSn" jdbcType="VARCHAR"/>
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
- <result column="moder_sn" property="moderSn" jdbcType="VARCHAR"/>
- <result column="mod_time" property="modTime" jdbcType="TIMESTAMP"/>
- <result column="tstm" property="tstm" jdbcType="TIMESTAMP"/>
- <result property="prodBarcode" column="prod_barcode"/>
- <result property="unitCode" column="unit_code"/>
- <result property="goodsDesc" column="goods_desc"/>
- <result property="cusGoodsCode" column="cus_goods_code"/>
- <result property="ciqProdModel" column="ciq_prod_model"/>
- <result property="oriCntCode" column="ori_cnt_code"/>
- <result property="cusDeclEle" column="cus_decl_ele"/>
- <result property="cusRecCode" column="cus_rec_code"/>
- <result property="supplierId" column="supplier_id"/>
- <result property="stockNum" column="stock_num"/>
- <result property="storeName" column="store_name"/>
- <result property="productId" column="product_id"/>
- <result property="storeId" column="storeId"/>
- <result column="merch_name" property="merchName"/>
- <result column="storeMarketPrice" property="storeMarketPrice"/>
- <result column="storeRetailPrice" property="storeRetailPrice"/>
- <result column="third_party_merch_code" property="thirdPartyMerchCode"/>
- <result column="isStockShare" property="isStockShare"/>
- <result column="gross_weight" property="grossWeight"/>
- <result column="net_weight" property="netWeight"/>
- <result property="isGoodsShareStock" column="is_goods_share_stock"/>
- <result column="cost_price" property="costPrice"/>
- <result property="dailyPrice" column="daily_price"/>
- <result column="last_sale_time" property="lastSaleTime" jdbcType="TIMESTAMP"/>
- <result column="mychem_id" property="mychemId"/>
- <result column="hs_code" property="hsCode"/>
- <result column="hs_code_name" property="hsCodeName"/>
- <result column="is_sync_hs_code" property="isSyncHsCode"/>
- <result column="is_sync_goods_rate" property="isSyncGoodsRate"/>
- <result column="imp_consum_tax_rate" property="impConsumTaxRate"/>
- <result column="value_added_tax_rate" property="valueAddedTaxRate"/>
- <result column="legal_unit1_qty" property="legalUnit1Qty"/>
- <result column="legal_unit2_qty" property="legalUnit2Qty"/>
- <result column="cosm_threshold_value" property="cosmThresholdValue"/>
- <result column="to_be_restored" property="toBeRestored" />
- <result column="prod_name" property="prodName" />
- <result column="prod_record_name" property="prodRecordName" />
- <result column="exit_region_number" property="exitRegionNumber"/>
- <result column="net_weight" property="netWeight"/>
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT
- a.*, CASE
- when g.id > 0 then 2 else 0 end as goodsType,
- mb.third_party_merch_code,
- mb.is_stock_share isStockShare,
- mb.is_supplier_goods 'isSupplierGoods'
- FROM
- mall_goods a
- LEFT JOIN mall_goods_group g ON g.goods_id = a.id AND g.open_status != 3
- LEFT JOIN third_merchant_biz mb ON a.third_party_merch_code = mb.third_party_merch_code
- WHERE a.id = #{value}
- </select>
- <select id="queryObjectByStoreId" resultMap="goodsMap">
- select
- a.sku,
- a.id,
- psr1.category_id,
- a.goods_sn,
- a.name,
- psr1.brand_id,
- a.goods_number,
- a.keywords,
- a.goods_brief,
- a.is_on_sale,
- a.add_time,
- a.sort_order,
- a.is_delete,
- psr1.attribute_category,
- a.counter_price,
- a.extra_price,
- a.is_new,
- a.goods_unit,
- a.primary_pic_url,
- a.list_pic_url,
- psr1.retail_price,
- psr1.sell_volume,
- a.primary_product_id,
- a.unit_price,
- a.promotion_desc,
- a.promotion_tag,
- a.app_exclusive_price,
- a.is_app_exclusive,
- a.is_limited,
- a.is_hot,
- a.merch_sn,
- a.to_be_restored,
- m.merch_name,
- psr1.store_id,
- psr1.market_price,
- psr1.stock_num,
- a.goods_desc,a.goods_biz_type,a.goods_rate,
- a.sell_volume goods_sell_volume,
- mb.third_party_merch_code,
- mb.is_stock_share isStockShare,
- mb.is_supplier_goods 'isSupplierGoods',
- mb2.third_party_merch_code 'supplierThirdMerchCode',
- mb2.is_stock_share 'isStockShareBySuppler',
- a.hs_code, a.legal_unit1_qty, a.legal_unit2_qty,a.ciq_prod_model
- from mall_goods a left join mall_merch m on a.merch_sn = m.merch_sn
- LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id and a.merch_sn = psr1.merch_sn
- LEFT JOIN mall_store s ON s.id = psr1.store_id
- LEFT JOIN third_merchant_biz mb on s.third_party_merch_code = mb.third_party_merch_code
- LEFT JOIN third_merchant_biz mb2 ON a.third_party_merch_code = mb2.third_party_merch_code
- where a.is_delete=0 and a.id = #{id} and psr1.store_id = #{storeId}
- </select>
- <select id="queryGoodsByGoodsSnAndStoreId" resultMap="goodsMap">
- select
- a.sku,
- a.id,
- psr1.category_id,
- a.goods_sn,
- a.name,
- psr1.brand_id,
- a.goods_number,
- a.keywords,
- a.goods_brief,
- a.is_on_sale,
- a.add_time,
- a.sort_order,
- a.is_delete,
- psr1.attribute_category,
- a.counter_price,
- a.extra_price,
- a.is_new,
- a.goods_unit,
- a.primary_pic_url,
- a.list_pic_url,
- psr1.retail_price,
- psr1.sell_volume,
- a.primary_product_id,
- a.unit_price,
- a.promotion_desc,
- a.promotion_tag,
- a.app_exclusive_price,
- a.is_app_exclusive,
- a.is_limited,
- a.is_hot,
- a.merch_sn,
- a.to_be_restored,
- m.merch_name,
- psr1.store_id,
- psr1.market_price,
- psr1.stock_num,
- a.goods_desc,a.goods_biz_type,a.goods_rate,
- a.sell_volume goods_sell_volume,
- mb.third_party_merch_code,
- mb.is_stock_share isStockShare,
- mb.is_supplier_goods 'isSupplierGoods',
- mb2.third_party_merch_code 'supplierThirdMerchCode',
- mb2.is_stock_share 'isStockShareBySuppler',
- a.hs_code, a.legal_unit1_qty, a.legal_unit2_qty,a.ciq_prod_model
- from mall_goods a left join mall_merch m on a.merch_sn = m.merch_sn
- LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id and a.merch_sn = psr1.merch_sn
- LEFT JOIN mall_store s ON s.id = psr1.store_id
- LEFT JOIN third_merchant_biz mb on s.third_party_merch_code = mb.third_party_merch_code
- LEFT JOIN third_merchant_biz mb2 ON a.third_party_merch_code = mb2.third_party_merch_code
- where a.is_delete=0 and a.goods_sn = #{goodsSn} and psr1.store_id = #{storeId}
- </select>
- <select id="queryObjectByProdBarcodeAndBizType" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT
- 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',
- 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
- FROM
- mall_goods a
- LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
- inner join mall_store s on r.store_id=s.id
- where a.is_delete=0 and a.prod_barcode = #{prodBarcode} and a.goods_biz_type = 11 and r.store_id = #{storeId}
- </select>
- <select id="queryObjectByProdBarcodeAndStoreId" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT
- 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',
- 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
- FROM
- mall_goods a
- LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
- inner join mall_store s on r.store_id=s.id
- where a.is_delete=0 and a.prod_barcode = #{prodBarcode} and r.store_id = #{storeId}
- </select>
- <select id="queryObjectByProdBarcodeAndStore" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT
- 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,
- 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
- FROM
- mall_goods a
- LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
- inner join mall_store s on r.store_id=s.id
- where a.is_delete=0 and a.prod_barcode = #{prodBarcode} and r.store_id = #{storeId}
- and r.stock_num > 0
- limit 1
- </select>
- <select id="queryObjectByProdBarcode" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT
- 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',
- 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
- FROM
- mall_goods a
- LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
- inner join mall_store s on r.store_id=s.id
- where a.prod_barcode = #{prodBarcode} and a.is_delete = 0
- <if test="goodsId != null and goodsId != ''">
- AND a.id != #{goodsId}
- </if>
- <if test="merchSn != null and merchSn != ''">
- AND a.merch_sn = #{merchSn}
- </if>
- </select>
- <select id="queryGoodsDetailsByProdBarcode" resultType="com.kmall.admin.dto.GoodsDetailsDto">
- SELECT distinct
- a.goods_sn as GoodsSn, a.goods_sn as sku, 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,a.goods_unit as specification
- ,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, m.exit_region_number as exitRegionNumber,
- a.warehouse_sn as warehouseSn, a.consignor_sn as consignorSn, a.warehous_sys_good_id as warehouseSysGoodId
- FROM
- mall_goods a
- LEFT JOIN mall_goods_specification r ON r.goods_id = a.id
- 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 and a.is_delete=0
- where a.prod_barcode = #{prodBarcode} and m.store_id = #{storeId}
- <if test="sku != null and sku != ''">
- and a.sku=#{sku}
- </if>
- and m.stock_num > 0 and a.is_delete = 0 order by m.stock_num desc
- limit 1
- </select>
- <select id="queryGoodsSkuList" resultType="com.kmall.admin.dto.GoodsDetailsDto">
- SELECT distinct
- 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,a.goods_unit as specification
- ,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,a.sku as sku,a.name,a.market_price as marketPrice
- FROM
- mall_goods a
- LEFT JOIN mall_goods_specification r ON r.goods_id = a.id
- left join mall_product_store_rela m on m.goods_id = a.id and r.goods_id = m.goods_id
- where a.prod_barcode = #{prodBarcode} and m.store_id = #{storeId}
- and m.stock_num > 0 and a.is_on_sale = 1 and a.is_delete = 0 order by m.stock_num desc
- </select>
- <select id="queryObjectBySn" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT
- a.*, CASE
- when g.id > 0 then 2 else 0 end as goodsType
- FROM
- mall_goods a
- LEFT JOIN mall_goods_group g ON g.goods_id = a.id
- AND g.open_status != 3 and a.is_delete=0
- where a.goods_sn = #{goodsSn}
- </select>
- <select id="queryObjectBySnNew" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT
- a.*
- FROM
- mall_goods a
- where a.is_delete=0 and a.is_on_sale=1 and a.sku = #{goodsSn}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.GoodsEntity">
- select * from (
- select
- mall_goods.*,
- case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
- m.merch_name merchName,
- mb.is_stock_share isStockShare,
- catagory.keywords as categoryName
- from mall_goods
- left join mall_merch m on mall_goods.merch_sn = m.merch_sn
- left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
- left join third_merchant_biz mb on mb.third_party_merch_code = mall_goods.third_party_merch_code and
- mb.merch_sn=mall_goods.merch_sn
- left join mall_category catagory on catagory.id = mall_goods.category_id
- WHERE 1=1
- <!-- 数据过滤 -->
- ${filterSql}
- <if test="merchSn != null and merchSn.trim() != ''">
- AND mall_goods.merch_sn = #{merchSn}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND mall_goods.prod_barcode = #{prodBarcode}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn.trim() != ''">
- AND mb.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="goodsSn != null and goodsSn != ''">
- AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
- </if>
- <if test="name != null and name != ''">
- AND mall_goods.name LIKE concat('%',#{name},'%')
- </if>
- <if test="englishName != null and englishName != ''">
- AND mall_goods.english_name LIKE concat('%',#{englishName},'%')
- </if>
- <!--<if test="brandId != null and brandId != ''">
- AND mall_goods.brand_id = #{brandId}
- </if>
- <if test="freightId != null and freightId != ''">
- AND mall_goods.freight_id = #{freightId}
- </if>
- <if test="categoryId != null and categoryId != ''">
- AND mall_goods.category_id = #{categoryId}
- </if>
- <if test="category != null and category != ''">
- AND mall_goods.category_id IN (select id from mall_category where parent_id = #{category})
- </if>
- <if test="categoryTwo != null and categoryTwo != ''">
- AND mall_goods.category_id = #{categoryTwo}
- </if>-->
- <if test="sku != null and sku != ''">
- AND mall_goods.sku LIKE concat('%',#{sku},'%')
- </if>
- <if test="plu != null and plu != ''">
- AND mall_goods.plu LIKE concat('%',#{plu},'%')
- </if>
- <if test="isDelete != null">
- AND mall_goods.is_Delete = #{isDelete}
- </if>
- <if test="isOnSale != null">
- AND mall_goods.is_on_sale = #{isOnSale}
- </if>
- <if test="goodsBizType != null and goodsBizType != ''">
- AND mall_goods.goods_biz_type = #{goodsBizType}
- </if>
- <if test="id != null and id != ''">
- AND mall_goods.id = #{id}
- </if>
- <if test="storeId != null and storeId != ''">
- AND mall_goods.third_party_merch_code = ( SELECT third_party_merch_code FROM mall_store WHERE id =
- #{storeId} )
- AND mall_goods.id NOT IN (
- SELECT
- goods_id
- FROM
- mall_product_store_rela pp
- WHERE
- store_id = #{storeId}
- )
- </if>
- <if test="storeIdBySupplier != null and storeIdBySupplier != ''">
- AND mall_goods.id NOT IN (
- SELECT
- goods_id
- FROM
- mall_product_store_rela pp
- WHERE
- store_id = #{storeIdBySupplier} and supplier_third_id = #{thirdMerchSn}
- )
- </if>
- ) temp where 1=1
- <if test="lastSaleTime != null and lastSaleTime != ''">
- AND temp.last_sale_time >= #{lastSaleTime} or temp.last_sale_time is null
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by temp.id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="querySame" resultType="com.kmall.admin.entity.GoodsEntity">
- select
- mall_goods.*,
- case when mall_goods_group.id > 0 then 2 else 0 end as goodsType
- from mall_goods
- left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
- WHERE 1=1
- <!-- 数据过滤 -->
- ${filterSql}
- <if test="isSame != null and isSame != ''">
- AND ((mall_goods.sku = #{sku} AND mall_goods.goods_biz_type = #{goodsBizType}) OR mall_goods.goods_sn =
- #{goodsSn})
- <if test="id != null and id != ''">
- AND mall_goods.id != #{id}
- </if>
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by mall_goods.id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryTotal" resultType="int">
- select count(*) from mall_goods
- left join mall_merch m on mall_goods.merch_sn = m.merch_sn
- left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
- WHERE 1=1
- <!-- 数据过滤 -->
- ${filterSql}
- <if test="merchSn != null and merchSn.trim() != ''">
- AND mall_goods.merch_sn = #{merchSn}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND mall_goods.prod_barcode = #{prodBarcode}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="goodsSn != null and goodsSn != ''">
- AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
- </if>
- <if test="name != null and name != ''">
- AND mall_goods.name LIKE concat('%',#{name},'%')
- </if>
- <if test="sku != null and sku != ''">
- AND mall_goods.sku LIKE concat('%',#{sku},'%')
- </if>
- <if test="isDelete != null">
- AND mall_goods.is_Delete = #{isDelete}
- </if>
- <if test="isOnSale != null">
- AND mall_goods.is_on_sale = #{isOnSale}
- </if>
- <if test="goodsBizType != null and goodsBizType != ''">
- AND mall_goods.goods_biz_type = #{goodsBizType}
- </if>
- <if test="storeId != null and storeId != ''">
- AND mall_goods.third_party_merch_code = ( SELECT third_party_merch_code FROM mall_store WHERE id =
- #{storeId} )
- AND mall_goods.id NOT IN (
- SELECT
- goods_id
- FROM
- mall_product_store_rela pp
- LEFT JOIN mall_goods gg ON pp.goods_id = gg.id
- AND pp.merch_sn = gg.merch_sn
- AND pp.merch_sn
- LEFT JOIN mall_store s ON pp.store_id = s.id
- AND s.third_party_merch_code = gg.third_party_merch_code
- WHERE
- store_id = #{storeId}
- )
- </if>
- </select>
- <insert id="save" parameterType="com.kmall.admin.entity.GoodsEntity" useGeneratedKeys="true" keyProperty="id">
- insert into mall_goods(
- `merch_sn`,
- third_party_merch_code,
- `supplier_id`,
- `goods_sn`,
- `prod_barcode`,
- `sku`,
- `plu`,
- `english_name`,
- `cost_price`,
- `daily_price`,
- `goods_biz_type`,
- `name`,
- `unit_code`,
- `brand`,
- `brand_id`,
- `category_id`,
- attribute_category,
- `goods_number`,
- `keywords`,
- `goods_brief`,
- `goods_desc`,
- `cus_goods_code`,
- `ciq_prod_model`,
- `ori_cnt_code`,
- `cus_decl_ele`,
- `cus_rec_code`,
- `is_on_sale`,
- `add_time`,
- `sort_order`,
- `is_delete`,
- `counter_price`,
- `extra_price`,
- `is_new`,
- `goods_unit`,
- `primary_pic_url`,
- `list_pic_url`,
- `goods_rate`,
- `sell_volume`,
- `primary_product_id`,
- `unit_price`,
- `promotion_desc`,
- `promotion_tag`,
- `app_exclusive_price`,
- `is_app_exclusive`,
- `gross_weight`,
- `net_weight`,
- is_goods_share_stock,
- `is_limited`,
- `is_hot`,
- `creater_sn`,
- `create_time`,
- `moder_sn`,
- `mod_time`,
- `mychem_id`,
- `hs_code`,
- `hs_code_name`,
- `is_sync_hs_code`,
- `is_sync_goods_rate`,
- `imp_consum_tax_rate`,
- `value_added_tax_rate`,
- `legal_unit1_qty`,
- `legal_unit2_qty`,
- `cosm_threshold_value`,
- `to_be_restored`,
- `tstm`,
- warehouse_sn,
- consignor_sn,
- warehous_sys_good_id,
- inventory_type,
- defective_products_grade
- )
- values(
- #{merchSn},
- #{thirdPartyMerchCode},
- #{supplierId},
- #{goodsSn},
- #{prodBarcode},
- #{sku},
- #{plu},
- #{englishName},
- #{costPrice},
- #{dailyPrice},
- #{goodsBizType},
- #{name},
- #{unitCode},
- #{brand},
- #{brandId},
- #{categoryId},
- #{attributeCategory},
- #{goodsNumber},
- #{keywords},
- #{goodsBrief},
- #{goodsDesc},
- #{cusGoodsCode},
- #{ciqProdModel},
- #{oriCntCode},
- #{cusDeclEle},
- #{cusRecCode},
- #{isOnSale},
- #{addTime},
- #{sortOrder},
- #{isDelete},
- #{counterPrice},
- #{extraPrice},
- #{isNew},
- #{goodsUnit},
- #{primaryPicUrl},
- #{listPicUrl},
- #{goodsRate},
- #{sellVolume},
- #{primaryProductId},
- #{unitPrice},
- #{promotionDesc},
- #{promotionTag},
- #{appExclusivePrice},
- #{isAppExclusive},
- #{grossWeight},
- #{netWeight},
- #{isGoodsShareStock},
- #{isLimited},
- #{isHot},
- #{createrSn},
- #{createTime},
- #{moderSn},
- #{modTime},
- #{mychemId},
- #{hsCode},
- #{hsCodeName},
- '0',
- '0',
- #{impConsumTaxRate},
- #{valueAddedTaxRate},
- #{legalUnit1Qty},
- #{legalUnit2Qty},
- #{cosmThresholdValue},
- 0,
- #{tstm},
- #{warehouseSn},
- #{consignorSn},
- #{warehousSysGoodId},
- #{inventoryType},
- #{defectiveProductsGrade}
- )
- </insert>
- <update id="update" parameterType="com.kmall.admin.entity.GoodsEntity">
- update mall_goods
- <set>
- <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
- <if test="thirdPartyMerchCode != null">`third_party_merch_code` = #{thirdPartyMerchCode},</if>
- <if test="supplierId != null">`supplier_id` = #{supplierId},</if>
- <if test="goodsSn != null">`goods_sn` = #{goodsSn},</if>
- <if test="prodBarcode != null">`prod_barcode` = #{prodBarcode},</if>
- <if test="sku != null">`sku` = #{sku},</if>
- <if test="plu != null">`plu` = #{plu},</if>
- <if test="englishName != null">`english_name` = #{englishName},</if>
- <if test="costPrice != null">`cost_price` = #{costPrice},</if>
- <if test="dailyPrice != null">`daily_price` = #{dailyPrice},</if>
- <if test="goodsBizType != null">`goods_biz_type` = #{goodsBizType},</if>
- <if test="name != null">`name` = #{name},</if>
- <if test="unitCode != null">`unit_code` = #{unitCode},</if>
- <if test="brand != null">`brand` = #{brand},</if>
- <if test="brandId != null">`brand_id` = #{brandId},</if>
- <if test="categoryId != null">`category_id` = #{categoryId},</if>
- <if test="attributeCategory != null">`attribute_category` = #{attributeCategory},</if>
- <if test="goodsNumber != null">`goods_number` = #{goodsNumber},</if>
- <if test="keywords != null">`keywords` = #{keywords},</if>
- <if test="goodsBrief != null">`goods_brief` = #{goodsBrief},</if>
- <if test="goodsDesc != null">`goods_desc` = #{goodsDesc},</if>
- <if test="cusGoodsCode != null">`cus_goods_code` = #{cusGoodsCode},</if>
- <if test="ciqProdModel != null">`ciq_prod_model` = #{ciqProdModel},</if>
- <if test="oriCntCode != null">`ori_cnt_code` = #{oriCntCode},</if>
- <if test="cusDeclEle != null">`cus_decl_ele` = #{cusDeclEle},</if>
- <if test="cusRecCode != null">`cus_rec_code` = #{cusRecCode},</if>
- <if test="isOnSale != null">`is_on_sale` = #{isOnSale},</if>
- <if test="addTime != null">`add_time` = #{addTime},</if>
- <if test="sortOrder != null">`sort_order` = #{sortOrder},</if>
- <if test="isDelete != null">`is_delete` = #{isDelete},</if>
- <if test="counterPrice != null">`counter_price` = #{counterPrice},</if>
- <if test="extraPrice != null">`extra_price` = #{extraPrice},</if>
- <if test="isNew != null">`is_new` = #{isNew},</if>
- <if test="goodsUnit != null">`goods_unit` = #{goodsUnit},</if>
- <if test="primaryPicUrl != null">`primary_pic_url` = #{primaryPicUrl},</if>
- <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl},</if>
- <if test="goodsRate != null">`goods_rate` = #{goodsRate},</if>
- <if test="sellVolume != null">`sell_volume` = #{sellVolume},</if>
- <if test="primaryProductId != null">`primary_product_id` = #{primaryProductId},</if>
- <if test="unitPrice != null">`unit_price` = #{unitPrice},</if>
- <if test="promotionDesc != null">`promotion_desc` = #{promotionDesc},</if>
- <if test="promotionTag != null">`promotion_tag` = #{promotionTag},</if>
- <if test="appExclusivePrice != null">`app_exclusive_price` = #{appExclusivePrice},</if>
- <if test="isAppExclusive != null">`is_app_exclusive` = #{isAppExclusive},</if>
- <if test="grossWeight != null">`gross_weight` = #{grossWeight},</if>
- <if test="netWeight != null">`net_weight` = #{netWeight},</if>
- <if test="isGoodsShareStock != null">`is_goods_share_stock` = #{isGoodsShareStock},</if>
- <if test="isLimited != null">`is_limited` = #{isLimited},</if>
- <if test="isHot != null">`is_hot` = #{isHot},</if>
- <if test="createrSn != null">`creater_sn` = #{createrSn},</if>
- <if test="createTime != null">`create_time` = #{createTime},</if>
- <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
- <if test="modTime != null">`mod_time` = #{modTime},</if>
- <if test="tstm != null">`tstm` = #{tstm},</if>
- <if test="lastSaleTime != null">`last_sale_time` = #{lastSaleTime},</if>
- <if test="mychemId != null">`mychem_id` = #{mychemId},</if>
- <if test="hsCode != null">`hs_code` = #{hsCode},</if>
- <if test="hsCodeName != null">`hs_code_name` = #{hsCodeName},</if>
- <if test="isSyncHsCode != null">`is_sync_hs_code` = #{isSyncHsCode},</if>
- <if test="isSyncGoodsRate != null">`is_sync_goods_rate` = #{isSyncGoodsRate},</if>
- <if test="impConsumTaxRate != null">`imp_consum_tax_rate` = #{impConsumTaxRate},</if>
- <if test="valueAddedTaxRate != null">`value_added_tax_rate` = #{valueAddedTaxRate},</if>
- <if test="legalUnit1Qty != null">`legal_unit1_qty` = #{legalUnit1Qty},</if>
- <if test="legalUnit2Qty != null">`legal_unit2_qty` = #{legalUnit2Qty},</if>
- <if test="cosmThresholdValue != null">`cosm_threshold_value` = #{cosmThresholdValue},</if>
- <if test="toBeRestored != null">`to_be_restored` = #{toBeRestored},</if>
- <if test="warehouseSn != null">`warehouse_sn` = #{warehouseSn},</if>
- <if test="consignorSn != null">`consignor_sn` = #{consignorSn},</if>
- <if test="warehousSysGoodId != null">`warehous_sys_good_id` = #{warehousSysGoodId},</if>
- <if test="inventoryType != null">`inventory_type` = #{inventoryType},</if>
- <if test="defectiveProductsGrade != null">`defective_products_grade` = #{defectiveProductsGrade}</if>
- </set>
- where id = #{id}
- </update>
- <delete id="delete">
- delete from mall_goods where id = #{value}
- </delete>
- <delete id="deleteBatch">
- delete from mall_goods where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="queryMaxId" resultType="java.lang.Long" parameterType="map">
- SELECT MAX(id) FROM mall_goods
- </select>
- <select id="searchGoodsPanoramaDtoByKeyword" resultType="com.kmall.admin.dto.GoodsPanoramaDto">
- SELECT
- g.id id,g.name `name`,g.name simpleName,g.ciq_prod_model ciqProdModel,
- g.goods_unit goodsBasicUnit,g.category_id categoryId,c.name categoryName,
- g.goods_unit goodsPurchaseUnit,g.supplier_id supplierId,s.child_supplier_name supplierName,
- g.prod_barcode prodBarcode,g.plu plu,g.goods_sn goodsSn,g.brand brand
- FROM
- mall_goods g
- INNER JOIN mall_category c
- INNER JOIN mall_supplier s
- WHERE
- g.category_id = c.id
- and g.is_delete=0
- and g.supplier_id = s.id
- AND (g.goods_sn=#{keyword} OR g.prod_barcode=#{keyword})
- </select>
- <select id="queryExportList" resultType="com.kmall.admin.entity.GoodsEntity">
- select * from (
- select
- mall_goods.*,
- case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
- m.merch_name merchName, mb.is_stock_share isStockShare,
- catagory.keywords as categoryName,
- scnc.`name` as oriCntName,
- scucode.name as unitCodeName
- from mall_goods
- left join mall_merch m on mall_goods.merch_sn = m.merch_sn
- left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
- left join third_merchant_biz mb on mb.third_party_merch_code = mall_goods.third_party_merch_code and
- mb.merch_sn=mall_goods.merch_sn
- left join mall_category catagory on catagory.id = mall_goods.category_id
- left join sys_cus_nation_code scnc on mall_goods.ori_cnt_code = scnc.code
- left join sys_cus_unit_code scucode on scucode.code = mall_goods.unit_code
- WHERE 1=1
- <!-- 数据过滤 -->
- ${filterSql}
- <if test="merchSn != null and merchSn.trim() != ''">
- AND mall_goods.merch_sn = #{merchSn}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND mall_goods.prod_barcode = #{prodBarcode}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="goodsSn != null and goodsSn != ''">
- AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
- </if>
- <if test="name != null and name != ''">
- AND mall_goods.name LIKE concat('%',#{name},'%')
- </if>
- <if test="englishName != null and englishName != ''">
- AND mall_goods.english_name LIKE concat('%',#{englishName},'%')
- </if>
- <if test="goodsBizType != null and goodsBizType != ''">
- AND mall_goods.goods_biz_type = #{goodsBizType}
- </if>
- <if test="isDelete != null">
- AND mall_goods.is_Delete = #{isDelete}
- </if>
- ) temp
- where 1=1
- <if test="lastSaleTime != null and lastSaleTime != ''">
- AND temp.last_sale_time >= #{lastSaleTime} or temp.last_sale_time is null
- </if>
- </select>
- <select id="queryForPDFData" resultType="com.kmall.api.entity.exportpdf.PDFGoodsDto">
- select
- g.name as productName,
- g.english_name as englishName,
- rela.retail_price as price,
- IFNULL((rela.market_price - rela.retail_price ),0) as savings,
- g.goods_rate as startFax,
- g.goods_rate as endFax,
- g.plu as plu,
- g.prod_barcode as barCode
- from
- mall_goods g
- left join mall_product_store_rela rela on g.id = rela.goods_id and g.is_delete = 0
- <where>
- <if test="sku != null and sku != ''">
- and g.sku = #{sku}
- </if>
- <if test="prodBarcode != null and prodBarcode != ''">
- and g.prod_barcode = #{prodBarcode}
- </if>
- <if test="storeId != null and storeId != ''">
- and rela.store_id = #{storeId}
- </if>
- </where>
- </select>
- <select id="queryByBarcode" resultType="com.kmall.admin.entity.GoodsEntity">
- select *
- from mall_goods
- where is_delete = 0 and prod_barcode = #{barCode}
- </select>
- <select id="queryBySku" resultType="com.kmall.admin.entity.GoodsEntity">
- select *
- from mall_goods
- where is_delete = 0 and sku = #{sku}
- </select>
- <select id="queryListByBarcode" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT
- 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,
- 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, r.stock_num
- FROM
- mall_goods a
- LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
- inner join mall_store s on r.store_id=s.id
- where a.prod_barcode = #{prodBarcode} and r.store_id = #{storeId} and a.sku = #{sku} and a.is_on_sale = 1 and a.is_delete = 0
- and r.stock_num > 0 order by r.stock_num desc
- </select>
- <select id="queryByName" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT DISTINCT
- g.id,
- g.NAME,
- g.sku,
- g.prod_barcode
- FROM
- mall_product_store_rela r
- LEFT JOIN mall_goods g ON g.id = r.goods_id
- WHERE
- r.store_id = #{storeId}
- <if test="goodsName != null and goodsName != ''">
- AND g.NAME LIKE concat('%',#{goodsName},'%');
- </if>
- </select>
- <select id="queryNonSyncOmsHsCodeSkuList" resultType="java.lang.String">
- select sku
- from mall_goods
- where is_sync_hs_code = '0'
- </select>
- <select id="queryListBySku" resultType="com.kmall.admin.entity.GoodsEntity">
- select *
- from mall_goods
- where is_delete = 0 and sku = #{sku}
- </select>
- <select id="queryNonSyncOmsGoodsRateSkuList" resultType="com.kmall.admin.entity.GoodsEntity">
- select *
- from mall_goods
- where is_sync_goods_rate = '0'
- </select>
- <select id="queryAllList" resultType="com.kmall.admin.entity.GoodsEntity">
- select * from mall_goods where is_delete = 0
- <if test="page != null and pageSize != null">
- limit #{page}, #{pageSize}
- </if>
- </select>
- <select id="queryByBarcodeAndSku" resultType="com.kmall.admin.entity.GoodsEntity">
- select * from mall_goods where is_delete = 0 and
- goods_sn = #{goodsSn} and prod_barcode = #{prodBarcode}
- </select>
- <select id="querySpecialCosmetics" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT distinct
- a.*,
- m.retail_price as retailPrice,
- m.stock_num as stockNum,
- m.store_id as storeId
- FROM
- mall_goods a
- left join mall_product_store_rela m on m.goods_id = a.id and a.is_delete = 0
- <where>
- a.cus_rec_code in
- <foreach collection="hdCodeSet" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </where>
- </select>
- <insert id="saveBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
- insert into mall_goods(
- `merch_sn`,
- third_party_merch_code,
- `supplier_id`,
- `goods_sn`,
- `prod_barcode`,
- `sku`,
- `plu`,
- `english_name`,
- `cost_price`,
- `daily_price`,
- `goods_biz_type`,
- `name`,
- `unit_code`,
- `brand`,
- `brand_id`,
- `category_id`,
- `goods_number`,
- `keywords`,
- `goods_brief`,
- `goods_desc`,
- `cus_goods_code`,
- `ciq_prod_model`,
- `ori_cnt_code`,
- `cus_decl_ele`,
- `cus_rec_code`,
- `is_on_sale`,
- `add_time`,
- `sort_order`,
- `is_delete`,
- `counter_price`,
- `extra_price`,
- `is_new`,
- `goods_unit`,
- `primary_pic_url`,
- `list_pic_url`,
- `goods_rate`,
- `sell_volume`,
- `primary_product_id`,
- `unit_price`,
- `promotion_desc`,
- `promotion_tag`,
- `app_exclusive_price`,
- `is_app_exclusive`,
- `gross_weight`,
- `net_weight`,
- is_goods_share_stock,
- `is_limited`,
- `is_hot`,
- `creater_sn`,
- `create_time`,
- `moder_sn`,
- `mod_time`,
- `mychem_id`,
- `hs_code`,
- `hs_code_name`,
- `is_sync_hs_code`,
- `is_sync_goods_rate`,
- `imp_consum_tax_rate`,
- `value_added_tax_rate`,
- `legal_unit1_qty`,
- `legal_unit2_qty`,
- `cosm_threshold_value`,
- `to_be_restored`,
- `tstm`)
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (
- #{item.merchSn},
- #{item.thirdPartyMerchCode},
- #{item.supplierId},
- #{item.goodsSn},
- #{item.prodBarcode},
- #{item.sku},
- #{item.plu},
- #{item.englishName},
- #{item.costPrice},
- #{item.dailyPrice},
- #{item.goodsBizType},
- #{item.name},
- #{item.unitCode},
- #{item.brand},
- #{item.brandId},
- #{item.categoryId},
- #{item.goodsNumber},
- #{item.keywords},
- #{item.goodsBrief},
- #{item.goodsDesc},
- #{item.cusGoodsCode},
- #{item.ciqProdModel},
- #{item.oriCntCode},
- #{item.cusDeclEle},
- #{item.cusRecCode},
- #{item.isOnSale},
- #{item.addTime},
- #{item.sortOrder},
- #{item.isDelete},
- #{item.counterPrice},
- #{item.extraPrice},
- #{item.isNew},
- #{item.goodsUnit},
- #{item.primaryPicUrl},
- #{item.listPicUrl},
- #{item.goodsRate},
- #{item.sellVolume},
- #{item.primaryProductId},
- #{item.unitPrice},
- #{item.promotionDesc},
- #{item.promotionTag},
- #{item.appExclusivePrice},
- #{item.isAppExclusive},
- #{item.grossWeight},
- #{item.netWeight},
- #{item.isGoodsShareStock},
- #{item.isLimited},
- #{item.isHot},
- #{item.createrSn},
- #{item.createTime},
- #{item.moderSn},
- #{item.modTime},
- #{item.mychemId},
- #{item.hsCode},
- #{item.hsCodeName},
- '0',
- '0',
- #{item.impConsumTaxRate},
- #{item.valueAddedTaxRate},
- #{item.legalUnit1Qty},
- #{item.legalUnit2Qty},
- #{item.cosmThresholdValue},
- #{item.toBeRestored},
- #{item.tstm})
- </foreach>
- </insert>
- <update id="updateBatch" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update mall_goods
- <set>
- <if test="item.merchSn != null">`merch_sn` = #{item.merchSn},</if>
- <if test="item.thirdPartyMerchCode != null">`third_party_merch_code` = #{item.thirdPartyMerchCode},</if>
- <if test="item.supplierId != null">`supplier_id` = #{item.supplierId},</if>
- <if test="item.goodsSn != null">`goods_sn` = #{item.goodsSn},</if>
- <if test="item.prodBarcode != null">`prod_barcode` = #{item.prodBarcode},</if>
- <if test="item.sku != null">`sku` = #{item.sku},</if>
- <if test="item.plu != null">`plu` = #{item.plu},</if>
- <if test="item.englishName != null">`english_name` = #{item.englishName},</if>
- <if test="item.costPrice != null">`cost_price` = #{item.costPrice},</if>
- <if test="item.dailyPrice != null">`daily_price` = #{item.dailyPrice},</if>
- <if test="item.goodsBizType != null">`goods_biz_type` = #{item.goodsBizType},</if>
- <if test="item.name != null">`name` = #{item.name},</if>
- <if test="item.unitCode != null">`unit_code` = #{item.unitCode},</if>
- <if test="item.brand != null">`brand` = #{item.brand},</if>
- <if test="item.brandId != null">`brand_id` = #{item.brandId},</if>
- <if test="item.categoryId != null">`category_id` = #{item.categoryId},</if>
- <if test="item.goodsNumber != null">`goods_number` = #{item.goodsNumber},</if>
- <if test="item.keywords != null">`keywords` = #{item.keywords},</if>
- <if test="item.goodsBrief != null">`goods_brief` = #{item.goodsBrief},</if>
- <if test="item.goodsDesc != null">`goods_desc` = #{item.goodsDesc},</if>
- <if test="item.cusGoodsCode != null">`cus_goods_code` = #{item.cusGoodsCode},</if>
- <if test="item.ciqProdModel != null">`ciq_prod_model` = #{item.ciqProdModel},</if>
- <if test="item.oriCntCode != null">`ori_cnt_code` = #{item.oriCntCode},</if>
- <if test="item.cusDeclEle != null">`cus_decl_ele` = #{item.cusDeclEle},</if>
- <if test="item.cusRecCode != null">`cus_rec_code` = #{item.cusRecCode},</if>
- <if test="item.isOnSale != null">`is_on_sale` = #{item.isOnSale},</if>
- <if test="item.addTime != null">`add_time` = #{item.addTime},</if>
- <if test="item.sortOrder != null">`sort_order` = #{item.sortOrder},</if>
- <if test="item.isDelete != null">`is_delete` = #{item.isDelete},</if>
- <if test="item.counterPrice != null">`counter_price` = #{item.counterPrice},</if>
- <if test="item.extraPrice != null">`extra_price` = #{item.extraPrice},</if>
- <if test="item.isNew != null">`is_new` = #{item.isNew},</if>
- <if test="item.goodsUnit != null">`goods_unit` = #{item.goodsUnit},</if>
- <if test="item.primaryPicUrl != null">`primary_pic_url` = #{item.primaryPicUrl},</if>
- <if test="item.listPicUrl != null">`list_pic_url` = #{item.listPicUrl},</if>
- <if test="item.goodsRate != null">`goods_rate` = #{item.goodsRate},</if>
- <if test="item.sellVolume != null">`sell_volume` = #{item.sellVolume},</if>
- <if test="item.primaryProductId != null">`primary_product_id` = #{item.primaryProductId},</if>
- <if test="item.unitPrice != null">`unit_price` = #{item.unitPrice},</if>
- <if test="item.promotionDesc != null">`promotion_desc` = #{item.promotionDesc},</if>
- <if test="item.promotionTag != null">`promotion_tag` = #{item.promotionTag},</if>
- <if test="item.appExclusivePrice != null">`app_exclusive_price` = #{item.appExclusivePrice},</if>
- <if test="item.isAppExclusive != null">`is_app_exclusive` = #{item.isAppExclusive},</if>
- <if test="item.grossWeight != null">`gross_weight` = #{item.grossWeight},</if>
- <if test="item.netWeight != null">`net_weight` = #{item.netWeight},</if>
- <if test="item.isGoodsShareStock != null">`is_goods_share_stock` = #{item.isGoodsShareStock},</if>
- <if test="item.isLimited != null">`is_limited` = #{item.isLimited},</if>
- <if test="item.isHot != null">`is_hot` = #{item.isHot},</if>
- <if test="item.createrSn != null">`creater_sn` = #{item.createrSn},</if>
- <if test="item.createTime != null">`create_time` = #{item.createTime},</if>
- <if test="item.moderSn != null">`moder_sn` = #{item.moderSn},</if>
- <if test="item.modTime != null">`mod_time` = #{item.modTime},</if>
- <if test="item.tstm != null">`tstm` = #{item.tstm},</if>
- <if test="item.lastSaleTime != null">`last_sale_time` = #{item.lastSaleTime},</if>
- <if test="item.mychemId != null">`mychem_id` = #{item.mychemId},</if>
- <if test="item.hsCode != null">`hs_code` = #{item.hsCode},</if>
- <if test="item.hsCodeName != null">`hs_code_name` = #{item.hsCodeName},</if>
- <if test="item.isSyncHsCode != null">`is_sync_hs_code` = #{item.isSyncHsCode},</if>
- <if test="item.isSyncGoodsRate != null">`is_sync_goods_rate` = #{item.isSyncGoodsRate},</if>
- <if test="item.impConsumTaxRate != null">`imp_consum_tax_rate` = #{item.impConsumTaxRate},</if>
- <if test="item.valueAddedTaxRate != null">`value_added_tax_rate` = #{item.valueAddedTaxRate},</if>
- <if test="item.legalUnit1Qty != null">`legal_unit1_qty` = #{item.legalUnit1Qty},</if>
- <if test="item.legalUnit2Qty != null">`legal_unit2_qty` = #{item.legalUnit2Qty},</if>
- <if test="item.cosmThresholdValue != null">`cosm_threshold_value` = #{item.cosmThresholdValue},</if>
- <if test="item.toBeRestored != null">`to_be_restored` = #{item.toBeRestored}</if>
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <update id="restoreBatch" parameterType="java.util.List">
- update mall_goods
- <trim prefix="set" suffixOverrides=",">
- goods_number=
- <foreach collection="list" item="item" open="case" close=" end,">
- when sku=#{item.sku} then goods_number+#{item.goodsNumber}
- </foreach>
- </trim>
- where
- <foreach collection="list" item="item" open="( " separator=" ) or ( " close=" )">
- sku=#{item.sku}
- </foreach>
- </update>
- <update id="updateStockNumberByProductCodeAndSku">
- update mall_goods
- set goods_number = #{goodsNumber}
- where
- prod_barcode = #{prodBarcode} and sku = #{sku}
- </update>
- <update id="updateStockNumberByOutbound">
- update mall_goods
- <trim prefix="set" suffixOverrides=",">
- goods_number =
- <foreach collection="list" item="item" open="case " close=" end,">
- when sku = #{item.sku} then goods_number - #{item.number}
- </foreach>
- </trim>
- where
- <foreach collection="list" item="item" open="(" separator=") or (" close=")">
- sku = #{item.sku}
- </foreach>
- </update>
- <update id="updateStockNumberByStorage">
- update mall_goods
- <trim prefix="set" suffixOverrides=",">
- goods_number =
- <foreach collection="list" item="item" open="case " close=" end,">
- when sku = #{item.sku} then goods_number + #{item.number}
- </foreach>
- </trim>
- where
- <foreach collection="list" item="item" open="(" separator=") or (" close=")">
- sku = #{item.sku}
- </foreach>
- </update>
- <select id="syncOmsHsCodeGoode" resultType="java.lang.String">
- select sku from mall_goods where id in
- <foreach collection="list" item="id" index="index"
- open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <select id="syncGoodsRateGoode" resultType="com.kmall.admin.entity.GoodsEntity">
- select * from mall_goods where is_delete = 0 and id in
- <foreach collection="list" item="id" index="index"
- open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <select id="queryGoodsStockByBarcodeAndStoreIdAndSku" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT
- 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,
- 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, r.stock_num, r.exit_region_number as exitRegionNumber
- FROM
- mall_goods a
- LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
- inner join mall_store s on r.store_id=s.id
- where a.prod_barcode = #{prodBarcode} and r.store_id = #{storeId} and a.sku = #{sku} and a.is_on_sale = 1 and a.is_delete = 0
- and r.stock_num > 0 order by r.stock_num desc
- </select>
- <select id="queryGoodsStockByQueryGoodsVoList" resultType="com.kmall.admin.entity.GoodsEntity">
- SELECT
- 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 as retailPrice,r.retail_price storeRetailPrice ,r.stock_num,s.store_name,r.product_id as productId,s.id 'storeId',a.goods_rate as goodsRate,
- 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, r.stock_num, r.exit_region_number as exitRegionNumber,
- a.category_id as categoryId, a.brand_id as brandId,a.net_weight as netWeight,
- a.warehouse_sn as warehouseSn, a.warehous_sys_good_id as warehousSysGoodId, a.inventory_type as inventoryType
- FROM
- mall_goods a
- LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
- inner join mall_store s on r.store_id=s.id
- where
- a.is_delete = 0 and
- a.is_on_sale = 1
- and
- <foreach collection="list" item="item" open="(" separator=" or " close=")">
- (a.prod_barcode = #{item.prodBarcode} and r.store_id = #{item.storeId} and a.sku = #{item.sku})
- </foreach>
- and r.stock_num > 0
- </select>
- <!-- 根据产品条码和sku查询保税展示补货的商品 -->
- <select id="queryGoodsInfoByProductBarcodeAndSku" resultMap="goodsMap">
- select mg.*,
- from mall_goods mg
- where mg.goods_biz_type = '02' and mg.prod_barcode = #{prodBarcode} and mg.sku = #{sku}
- </select>
- </mapper>
|