12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222 |
- <?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.caimei.modules.product.dao.ProductDao">
- <resultMap id="productModelResultMap" type="com.caimei.modules.product.entity.Product">
- <id property="id" column="id"/>
- <result property="name" column="name"/>
- </resultMap>
- <sql id="productColumns">
- a.productID AS "id",
- a.productID AS "productID",
- a.groundMall AS "groundMall",
- a.brandID AS "brandID",
- a.bigTypeID AS "bigTypeID",
- ifnull(a.smallTypeID,-1) AS "smallTypeID",
- ifnull(a.tinyTypeID,-1) AS "tinyTypeID",
- -- a.selfTypeID AS "selfTypeID",
- a.preferredFlag AS "preferredFlag",
- a.shopID AS "shopID",
- a.name AS "name",
- a.searchKey AS "searchKey",
- a.combinationID AS "combinationID",
- a.productRemarks AS "productRemarks",
- a.priceFlag AS "priceFlag",
- a.beautyActFlag AS "beautyActFlag",
- a.hasSkuFlag AS "hasSkuFlag",
- a.mainImage AS "mainImage",
- a.propertiesInfo AS "propertiesInfo",
- a.addTime AS "addTime",
- a.updateTime AS "updateTime",
- a.sellNumber AS "sellNumber",
- -- a.weekSellNumber AS "weekSellNumber",
- a.beforeValidFlag AS "beforeValidFlag",
- copi.validFlag AS "validFlag",
- a.favoriteTimes AS "favoriteTimes",
- a.commentScore AS "commentScore",
- a.commentTimes AS "commentTimes",
- -- a.selfRecommendFlag AS "selfRecommendFlag",
- -- a.sysRecommendFlag AS "sysRecommendFlag",
- a.sortIndex AS "sortIndex",
- a.featuredFlag AS "featuredFlag",
- a.featuredSortIndex AS "featuredSortIndex",
- a.productCode AS "productCode",
- -- a.synToERPFlag AS "synToERPFlag",
- a.allAreaFlag AS "allAreaFlag",
- a.provinceIDs AS "provinceIDs",
- a.serviceNumber AS "serviceNumber",
- a.packageCount AS "packageCount",
- a.byFlag AS "byFlag",
- a.normalProductFlag AS "normalProductFlag",
- -- a.wholeSaleProductFlag AS "wholeSaleProductFlag",
- -- a.promotionProductFlag AS "promotionProductFlag",
- -- a.groupBuyProductFlag AS "groupBuyProductFlag",
- a.step AS "step",
- a.actStatus AS "actStatus",
- a.actFlag AS "actFlag",
- a.actType AS "actType",
- a.onlineTime AS "onlineTime",
- a.downlineTime AS "downlineTime",
- a.freePostFlag AS "freePostFlag",
- -- a.precisehKey AS "precisehKey",
- s.name AS "shopName",
- a.actSort AS "actSort",
- a.recommendType AS "recommendType",
- a.aliasName as "aliasName",
- a.visibility as "visibility",
- a.productType as "productType",
- a.qualificationImg as "qualificationImg",
- a.includedTax as "includedTax",
- a.invoiceType as "invoiceType",
- a.taxPoint as "taxPoint",
- a.tags as "tags",
- a.machineType as "machineType",
- a.trainingMethod as "trainingMethod",
- a.trainingType as "trainingType",
- a.trainingFee as "trainingFee",
- a.commodityType as "commodityType",
- a.splitCode,
- a.announType,
- ifnull(a.newvalidFlag,0),
- ifnull(a.newProductType,2),
- a.showFlag,
- a.showTime,
- a.newshowTime,
- a.recommend,
- a.qualificationNo,
- a.productName,
- a.qualificationTime,
- a.qualificationLink,
- a.labelIds
- </sql>
- <sql id="productJoins">
- LEFT JOIN shop s on s.shopID = a.shopID
- left join product p on a.productID = p.productId
- left join cm_organize_product_info copi on copi.productId = a.productID
- </sql>
- <sql id="ActivityJoins">
- LEFT JOIN shop s on s.shopID = a.shopID
- </sql>
- <insert id="insertMallProduct" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
- parameterType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
- INSERT INTO cm_mall_organize_products (organizeID, productID, shopId, normalPrice, costPrice, ladderPriceFlag,
- minBuyNumber,
- validFlag, addTime, updateTime, delFlag)
- VALUES (#{organizeId}, #{productId}, #{shopId}, #{normalPrice}, #{costPrice}, #{ladderPriceFlag},
- #{minBuyNumber},
- #{validFlag}, #{addTime}, #{updateTime}, #{delFlag})
- </insert>
- <update id="saveSort">
- UPDATE cm_search_recommend_product
- SET sort = #{sort}
- WHERE id = #{id}
- </update>
- <select id="findLadderPriceByNum" resultType="Integer">
- select IFNULL(buyNum, 1)
- FROM product_ladder_price
- WHERE userType = 3
- and ladderNum = 1
- and delFlag = 0
- and productID = #{productID}
- </select>
- <select id="get" resultType="Product">
- SELECT
- <include refid="productColumns"/>,
- (select costCheckFlag from cm_organize_product_info where productId = #{id} and organizeId = 0 ) as
- costCheckFlag,
- (select costCheckFlag from cm_organize_product_info where productId = #{id} and organizeId = 4 ) as
- mallCostCheckFlag
- FROM product a
- <include refid="productJoins"/>
- WHERE a.productID = #{id}
- group by a.productID
- </select>
- <select id="getAllExistsProductList" resultType="Integer">
- SELECT p.productID
- FROM product p
- left join cm_organize_product_info copi on copi.productId = p.productID
- WHERE
- and copi.organizeID = #{organizeID}
- </select>
- <select id="findRecommendPage" resultType="Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- <include refid="productJoins"/>
- <where>
- <if test="productID !=null and productID !=''">
- AND a.productID=#{productID}
- </if>
- <if test="tinyTypeID != null and tinyTypeID != ''">
- AND a.tinyTypeID = #{tinyTypeID}
- </if>
- <if test="shopID != null and shopID != ''">
- AND a.shopID = #{shopID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name LIKE
- <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
- </if>
- <if test="validFlag !=null and validFlag !=''">
- AND copi.validFlag=#{validFlag}
- </if>
- <if test="actFlag !=null and actFlag !=''">
- AND a.actFlag=#{actFlag}
- </if>
- <if test="speCommisionFlag !=null and speCommisionFlag !=''">
- AND a.speCommisionFlag=#{speCommisionFlag}
- </if>
- <if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
- AND a.displayOnCRMFlag=#{displayOnCRMFlag}
- </if>
- <if test="crmBigTypeId !=null and crmBigTypeId !=''">
- AND a.crmBigTypeId=#{crmBigTypeId}
- </if>
- <if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
- AND a.crmSmallTypeId=#{crmSmallTypeId}
- </if>
- <if test="sqlMap !=null and sqlMap !=''">
- ${sqlMap.dsf}
- </if>
- <choose>
- <when test="actType != null and actType != ''">
- AND a.actType = #{actType}
- </when>
- <otherwise>
- AND a.actType != 3
- </otherwise>
- </choose>
- AND copi.validFlag != 0
- AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
- and a.productCategory = 1
- </where>
- group by a.productID
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by case WHEN copi.validFlag = 1 then 0 else 1 END asc,a.productID desc
- </otherwise>
- </choose>
- </select>
- <!--小程序商品获取采美2已上架 3已下架 9已冻结的商品-->
- <select id="findListBuyMall" resultType="Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- <include refid="productJoins"/>
- <where>
- <if test="productID !=null and productID !=''">
- AND a.productID=#{productID}
- </if>
- <if test="groundMall !=null and groundMall !=''">
- AND a.groundMall=concat('%',#{groundMall},'%')
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name LIKE
- <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
- </if>
- AND copi.validFlag in (2,3,9)
- and a.productCategory = 1
- </where>
- group by a.productID
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by a.productID desc
- </otherwise>
- </choose>
- </select>
- <select id="findList" resultType="Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- <include refid="productJoins"/>
- <where>
- <if test="id !=null and id !=''">
- AND a.productID=#{id}
- </if>
- <if test="tinyTypeID != null and tinyTypeID != ''">
- AND a.tinyTypeID = #{tinyTypeID}
- </if>
- <if test="shopID != null and shopID != ''">
- AND a.shopID = #{shopID}
- </if>
- <if test="preferredFlag != null and preferredFlag != ''and preferredFlag != 0">
- <if test="preferredFlag/100>=1">
- AND a.preferredFlag in (100,101,110,111)
- </if>
- <if test="(preferredFlag%100)/10>=1">
- AND a.preferredFlag in (10,11,110,111)
- </if>
- <if test="preferredFlag%10>=1">
- AND a.preferredFlag in (1,11,101,111)
- </if>
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name LIKE
- <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
- </if>
- <if test="validFlag !=null and validFlag !=''">
- AND copi.validFlag=#{validFlag}
- </if>
- <if test="actFlag !=null and actFlag !=''">
- AND a.actFlag=#{actFlag}
- </if>
- <if test="actType !=null and actType !=''">
- AND a.actType=#{actType}
- </if>
- <if test="speCommisionFlag !=null and speCommisionFlag !=''">
- AND a.speCommisionFlag=#{speCommisionFlag}
- </if>
- <if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
- AND a.displayOnCRMFlag=#{displayOnCRMFlag}
- </if>
- <if test="crmBigTypeId !=null and crmBigTypeId !=''">
- AND a.crmBigTypeId=#{crmBigTypeId}
- </if>
- <if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
- AND a.crmSmallTypeId=#{crmSmallTypeId}
- </if>
- <if test="sqlMap !=null and sqlMap !=''">
- ${sqlMap.dsf}
- </if>
- AND copi.validFlag != 0
- AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
- and a.productCategory = 1
- </where>
- group by a.productID
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by case WHEN copi.validFlag = 1 then 0 else 1 END asc,a.productID desc
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- <include refid="productJoins"/>
- <where>
- a.productCategory = 1
- </where>
- group by a.productID
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <insert id="insert" parameterType="Product" keyProperty="productID" keyColumn="productID" useGeneratedKeys="true">
- INSERT INTO product(brandID,
- groundMall,
- bigTypeID,
- smallTypeID,
- tinyTypeID,
- -- selfTypeID,
- shopID,
- aliasName,
- name,
- searchKey,
- priceFlag,
- beautyActFlag,
- hasSkuFlag,
- mainImage,
- propertiesInfo,
- addTime,
- updateTime,
- -- weekSellNumber,
- beforeValidFlag,
- validFlag,
- favoriteTimes,
- commentScore,
- commentTimes,
- -- selfRecommendFlag,
- -- sysRecommendFlag,
- sortIndex,
- featuredFlag,
- featuredSortIndex,
- productCode,
- -- synToERPFlag,
- allAreaFlag,
- provinceIDs,
- serviceNumber,
- packageCount,
- byFlag,
- normalProductFlag,
- -- wholeSaleProductFlag,
- -- promotionProductFlag,
- -- groupBuyProductFlag,
- step,
- actFlag,
- actType,
- actSort,
- onlineTime,
- downlineTime,
- freePostFlag,
- -- precisehKey,
- visibility,
- commodityDetailsFlag,
- productType,
- qualificationImg,
- invoiceType,
- taxPoint,
- supplierTaxPoint,
- tags,
- recommendType,
- machineType,
- includedTax,
- commodityType,
- trainingMethod,
- trainingType,
- trainingFee,
- productDescribe,
- splitCode,
- productDetail,
- announType,
- newProductType,
- <if test="qualificationNo != null and qualificationNo != ''">
- qualificationNo,
- </if>
- <if test="productName != null and productName != ''">
- productName,
- </if>
- <if test="qualificationTime != null and qualificationTime != ''">
- qualificationTime,
- </if>
- <if test="qualificationLink != null and qualificationLink != ''">
- qualificationLink,
- </if>
- showFlag)
- VALUES (#{brandID},
- #{groundMall},
- #{bigTypeID},
- #{smallTypeID},
- #{tinyTypeID},
- -- #{selfTypeID},
- #{shopID},
- #{aliasName},
- #{name},
- #{searchKey},
- #{priceFlag},
- #{beautyActFlag},
- #{hasSkuFlag},
- #{mainImage},
- #{propertiesInfo},
- #{addTime},
- #{updateTime},
- -- #{weekSellNumber},
- #{beforeValidFlag},
- #{validFlag},
- #{favoriteTimes},
- #{commentScore},
- #{commentTimes},
- -- #{selfRecommendFlag},
- -- #{sysRecommendFlag},
- #{sortIndex},
- #{featuredFlag},
- #{featuredSortIndex},
- #{productCode},
- -- #{synToERPFlag},
- #{allAreaFlag},
- #{provinceIDs},
- #{serviceNumber},
- #{packageCount},
- #{byFlag},
- #{normalProductFlag},
- -- #{wholeSaleProductFlag},
- -- #{promotionProductFlag},
- -- #{groupBuyProductFlag},
- #{step},
- #{actFlag},
- #{actType},
- #{actSort},
- #{onlineTime},
- #{downlineTime},
- #{freePostFlag},
- -- #{precisehKey},
- #{visibility},
- #{commodityDetailsFlag},
- #{productType},
- #{qualificationImg},
- #{invoiceType},
- #{sqlTaxPoint},
- #{sqlSupplierTaxPoint},
- #{tags},
- #{recommendType},
- #{machineType},
- #{includedTax},
- #{commodityType},
- #{trainingMethod},
- #{trainingType},
- #{trainingFee},
- #{productDescribe},
- #{splitCode},
- #{productDetail},
- #{announType},
- #{newProductType},
- <if test="qualificationNo != null and qualificationNo != ''">
- #{qualificationNo},
- </if>
- <if test="productName != null and productName != ''">
- #{productName},
- </if>
- <if test="qualificationTime != null and qualificationTime != ''">
- #{qualificationTime},
- </if>
- <if test="qualificationLink != null and qualificationLink != ''">
- #{qualificationLink},
- </if>
- #{showFlag})
- </insert>
- <update id="update">
- UPDATE product
- SET productID = #{id},
- brandID = #{brandID},
- tinyTypeID = #{tinyTypeID},
- -- selfTypeID = #{selfTypeID},
- shopID = #{shopID},
- name = #{name},
- searchKey = #{searchKey},
- priceFlag = #{priceFlag},
- beautyActFlag = #{beautyActFlag},
- hasSkuFlag = #{hasSkuFlag},
- mainImage = #{mainImage},
- propertiesInfo = #{propertiesInfo},
- addTime = #{addTime},
- updateTime = #{updateTime},
- sellNumber = #{sellNumber},
- -- weekSellNumber = #{weekSellNumber},
- beforeValidFlag = #{beforeValidFlag},
- validFlag = #{validFlag},
- favoriteTimes = #{favoriteTimes},
- commentScore = #{commentScore},
- commentTimes = #{commentTimes},
- -- selfRecommendFlag = #{selfRecommendFlag},
- -- sysRecommendFlag = #{sysRecommendFlag},
- sortIndex = #{sortIndex},
- featuredFlag = #{featuredFlag},
- featuredSortIndex = #{featuredSortIndex},
- productCode = #{productCode},
- -- synToERPFlag = #{synToERPFlag},
- allAreaFlag = #{allAreaFlag},
- provinceIDs = #{provinceIDs},
- serviceNumber = #{serviceNumber},
- packageCount = #{packageCount},
- byFlag = #{byFlag},
- normalProductFlag = #{normalProductFlag},
- -- wholeSaleProductFlag = #{wholeSaleProductFlag},
- -- promotionProductFlag = #{promotionProductFlag},
- -- groupBuyProductFlag = #{groupBuyProductFlag},
- step = #{step},
- actFlag = #{actFlag},
- actType = #{actType},
- onlineTime = #{onlineTime},
- downlineTime = #{downlineTime},
- freePostFlag = #{freePostFlag},
- -- precisehKey = #{precisehKey},
- actSort = #{actSort},
- newProductType=#{newProductType}
- WHERE productID = #{id}
- </update>
- <select id="productList" resultType="com.caimei.modules.product.entity.Product">
- SELECT
- *
- FROM product a
- <where>
- a.newvalidFlag=1
- <if test="productID !=null and productID !=''">
- and a.productID=#{productID}
- </if>
- </where>
- group by a.productID
- </select>
- <select id="newfindProductImage" resultType="com.caimei.modules.product.entity.Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- <include refid="productJoins"/>
- <where>
- <if test="productID !=null">
- AND a.productID=#{productID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name LIKE concat('%',#{shopName},'%')
- </if>
- <if test="showFlag !=null and showFlag !=''">
- AND a.showFlag=#{showFlag}
- </if>
- <if test="ids != null and ids.size() > 0">
- AND a.productID NOT IN
- <foreach collection="ids" close=")" separator="," open="(" item="id">
- #{id}
- </foreach>
- </if>
- AND p.newvalidFlag = 1
- AND p.newProductType=1
- AND copi.validFlag = 2
- # AND p.showFlag!=2
- </where>
- group by a.productID
- # 在设置重点关注时给排序值1000为了让重点关注始终在列表前端
- order by a.sortIndex desc,a.newshowTime DESC
- </select>
- <update id="updateActive">
- UPDATE product
- <set>
- <if test="actFlag != null and actFlag != ''">
- actFlag = #{actFlag},
- </if>
- <if test="actType != null and actType != ''">
- actType = #{actType},
- </if>
- <if test="actSort != null and actSort != ''">
- actSort = #{actSort},
- </if>
- <if test="actCreateTime != null and actCreateTime != ''">
- actCreateTime = #{actCreateTime},
- </if>
- </set>
- WHERE productID = #{productID}
- </update>
- <update id="updatePreferred">
- UPDATE product
- SET preferredFlag = #{preferredFlag}
- WHERE productID = #{productID}
- </update>
- <delete id="delete">
- DELETE
- FROM product
- WHERE id = #{id}
- </delete>
- <update id="deleteProduct">
- UPDATE cm_search_recommend_product
- SET delFlag = #{DateTime}
- WHERE id = #{id}
- </update>
- <select id="getSupplierProductList" resultType="com.caimei.modules.product.entity.Product">
- SELECT
- *
- FROM
- product
- <where>
- <if test="name != null and name != ''">
- AND name LIKE concat('%',#{name},'%')
- </if>
- AND shopID = #{shopID}
- AND (validFlag = 1 or validFlag = 2 or validFlag = 3 or validFlag = 9)
- </where>
- ORDER BY addTime desc
- </select>
- <select id="getGiftProductInfo" parameterType="com.caimei.modules.product.entity.GiftProduct"
- resultType="com.caimei.modules.product.entity.GiftProduct">
- SELECT
- g.id as "id",
- g.fullGiftProductId as "fullGiftProductId",
- g.giftProductId as "giftProductId",
- g.actType as "actType",
- g.giftProductNum as "giftProductNum",
- p.name as "productName"
- FROM
- gift_product g
- left join product p on p.productID = g.giftProductId
- <where>
- g.fullGiftProductId = #{fullGiftProductId}
- AND g.actType = #{actType}
- <if test="giftProductId != null and giftProductId != ''">
- AND g.giftProductId = #{giftProductId}
- </if>
- <if test="delFlag != null and delFlag != ''">
- AND g.delFlag = #{delFlag}
- </if>
- and p.productCategory = 1
- </where>
- </select>
- <select id="findProductBigTypeByProductID" parameterType="java.lang.Integer" resultType="java.lang.String">
- SELECT
- tb.name
- FROM
- bigType AS tb
- INNER JOIN smallType AS ts
- ON tb.bigTypeID = ts.bigTypeID
- INNER JOIN tinyType AS tt
- ON ts.smallTypeID = tt.smallTypeID
- INNER JOIN product AS tp
- ON tt.tinyTypeID = tp.tinyTypeID
- <where>
- tp.productID = #{productId}
- and tp.productCategory = 1
- </where>
- </select>
- <update id="updateGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct">
- update gift_product
- <set>
- <if test="fullGiftProductId != null and !=''">
- fullGiftProductId = #{fullGiftProductId},
- </if>
- <if test="giftProductId != null and !=''">
- giftProductId = #{giftProductId},
- </if>
- <if test="productName != null and !=''">
- productName = #{productName},
- </if>
- <if test="actType != null and !=''">
- actType = #{actType},
- </if>
- <if test="giftProductNum != null and !=''">
- giftProductNum = #{giftProductNum},
- </if>
- <if test="createBy != null and !=''">
- createBy = #{createBy.id},
- </if>
- <if test="createDate != null and !=''">
- createDate = #{createDate},
- </if>
- <if test="updateBy != null and !=''">
- updateBy = #{updateBy.id},
- </if>
- <if test="updateDate != null and !=''">
- updateDate = #{updateDate},
- </if>
- <if test="delFlag != null and !=''">
- delFlag = #{delFlag},
- </if>
- </set>
- where id = #{id}
- </update>
- <insert id="insertGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct" keyProperty="id"
- useGeneratedKeys="true">
- INSERT INTO gift_product(fullGiftProductId,
- giftProductId,
- productName,
- actType,
- giftProductNum,
- createBy,
- createDate,
- updateBy,
- updateDate,
- delFlag)
- VALUES (#{fullGiftProductId},
- #{giftProductId},
- #{productName},
- #{actType},
- #{giftProductNum},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{delFlag})
- </insert>
- <insert id="insertProductPriceRecord" parameterType="com.caimei.modules.product.entity.ProductPriceRecord"
- keyProperty="productPriceRecordID" useGeneratedKeys="true">
- INSERT INTO productpricerecord(`productID`,
- `shopID`,
- `highestUserLevelPrice`,
- `lowestUserLevelPrice`,
- `lowestUserLevelID`,
- `price0`,
- `price1`,
- `updateTime`)
- VALUES (#{productID},
- #{shopID},
- #{highestUserLevelPrice},
- #{lowestUserLevelPrice},
- #{lowestUserLevelID},
- #{price0},
- #{price1},
- #{updateTime})
- </insert>
- <update id="deleteActive">
- UPDATE product a
- SET a.actFlag = 0
- WHERE a.productID = #{id}
- </update>
- <update id="updatePostFlag">
- UPDATE product a SET a.freePostFlag = #{param1}
- WHERE a.productID IN
- <foreach collection="param2" item="id" index="index" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <select id="getBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
- select * from bigtype
- <where>
- validFlag = 1
- <if test="bigTypeID != null and bigTypeID != ''">
- AND bigTypeID = #{bigTypeID}
- </if>
- </where>
- </select>
- <select id="getSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
- select * from smalltype
- <where>
- validFlag = 1
- <if test="bigTypeID != null and bigTypeID != ''">
- AND bigTypeID = #{bigTypeID}
- </if>
- <if test="smallTypeID != null and smallTypeID != ''">
- AND smallTypeID = #{smallTypeID}
- </if>
- </where>
- </select>
- <select id="getTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
- select * from tinytype
- <where>
- validFlag = 1
- <if test="smallTypeID != null and smallTypeID != ''">
- AND smallTypeID = #{smallTypeID}
- </if>
- <if test="smallTypeID != null and smallTypeID != ''">
- AND smallTypeID = #{smallTypeID}
- </if>
- </where>
- </select>
- <select id="getProductTypeNameAndID" resultType="map">
- select b.name AS bigTypeName,
- b.bigTypeID AS bigTypeID,
- s.name AS smallTypeName,
- s.smallTypeID AS smallTypeID,
- t.name AS tinyTypeName,
- t.tinyTypeID AS tinyTypeID
- from tinytype AS t
- join smalltype AS s on t.smallTypeID = s.smallTypeID
- JOIN bigtype AS b on b.bigTypeID = s.bigTypeID
- where t.tinyTypeID = #{tinyTypeID}
- </select>
- <insert id="insertAddProduct">
- INSERT INTO cm_search_recommend_product(productID,
- tinyTypeID,
- sort,
- delFlag)
- VALUES (#{productID},
- #{tinyTypeID},
- 0,
- 0)
- </insert>
- <insert id="insertLadderPrice">
- insert into product_ladder_price (productId, userType, ladderNum,
- buyNum, buyPrice, createBy, createDate, delFlag)
- values (#{productId}, 3, #{ladderNum},
- #{buyNum}, #{buyPrice}, #{createBy},
- now(), '0')
- </insert>
- <insert id="insertProduct" keyColumn="productID" keyProperty="productID"
- parameterType="com.caimei.modules.product.entity.Product" useGeneratedKeys="true">
- INSERT INTO `product` (
- `brandID`,
- `tinyTypeID`,
- <if test="productCategory != null and productCategory != '' ">
- `productCategory`,
- </if>
- `preferredFlag`,
- -- `selfTypeID`,
- `shopID`,
- `name`,
- `aliasName`,
- `searchKey`,
- `productRemarks`,
- `priceFlag`,
- `beautyActFlag`,
- `hasSkuFlag`,
- `mainImage`,
- `propertiesInfo`,
- `addTime`,
- `updateTime`,
- -- `weekSellNumber`,
- `beforeValidFlag`,
- `validFlag`,
- `favoriteTimes`,
- `commentScore`,
- `commentTimes`,
- -- `selfRecommendFlag`,
- -- `sysRecommendFlag`,
- `sortIndex`,
- `featuredFlag`,
- `featuredSortIndex`,
- `productCode`,
- -- `synToERPFlag`,
- `allAreaFlag`,
- `provinceIDs`,
- `serviceNumber`,
- `packageCount`,
- `byFlag`,
- `normalProductFlag`,
- -- `wholeSaleProductFlag`,
- -- `promotionProductFlag`,
- -- `groupBuyProductFlag`,
- `step`,
- `actFlag`,
- `actStatus`,
- `actSort`,
- `actType`,
- `visibility`,
- `onlineTime`,
- `downlineTime`,
- `freePostFlag`,
- -- `precisehKey`,
- `tags`,
- `productType`,
- `machineType`,
- `qualificationImg`,
- `includedTax`,
- `taxPoint`,
- `invoiceType`,
- `recommendType`,
- `combinationID`,
- `combinationSort`,
- announType
- )
- VALUES
- (
- #{brandID},
- #{tinyTypeID},
- <if test="productCategory != null and productCategory != '' ">
- #{productCategory},
- </if>
- #{preferredFlag},
- -- #{selfTypeID},
- #{shopID},
- #{name},
- #{aliasName},
- #{searchKey},
- #{productRemarks},
- #{priceFlag},
- #{beautyActFlag},
- #{hasSkuFlag},
- #{mainImage},
- #{propertiesInfo},
- #{addTime},
- #{updateTime},
- -- #{weekSellNumber},
- #{beforeValidFlag},
- #{validFlag},
- #{favoriteTimes},
- #{commentScore},
- #{commentTimes},
- -- #{selfRecommendFlag},
- -- #{sysRecommendFlag},
- #{sortIndex},
- #{featuredFlag},
- #{featuredSortIndex},
- #{productCode},
- -- #{synToERPFlag},
- #{allAreaFlag},
- #{provinceIDs},
- #{serviceNumber},
- #{packageCount},
- #{byFlag},
- #{normalProductFlag},
- -- #{wholeSaleProductFlag},
- -- #{promotionProductFlag},
- -- #{groupBuyProductFlag},
- #{step},
- #{actFlag},
- #{actStatus},
- #{actSort},
- #{actType},
- #{visibility},
- #{onlineTime},
- #{downlineTime},
- #{freePostFlag},
- -- #{precisehKey},
- #{tags},
- #{productType},
- #{machineType},
- #{qualificationImg},
- #{includedTax},
- #{taxPoint},
- #{invoiceType},
- #{recommendType},
- #{combinationID},
- #{combinationSort},
- #{announType}
- )
- </insert>
- <insert id="insertProductDetailInfo">
- insert into productdetailinfo
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="productID != null">
- `productID`,
- </if>
- <if test="detailInfo != null and detailInfo != ''">
- `detailInfo`,
- </if>
- <if test="serviceInfo != null and serviceInfo != ''">
- `serviceInfo`,
- </if>
- <if test="orderInfo != null and orderInfo != ''">
- `orderInfo`,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="productID != null">
- #{productID},
- </if>
- <if test="detailInfo != null and detailInfo != ''">
- #{detailInfo},
- </if>
- <if test="serviceInfo != null and serviceInfo != ''">
- #{serviceInfo},
- </if>
- <if test="orderInfo != null and orderInfo != ''">
- #{orderInfo},
- </if>
- </trim>
- </insert>
- <insert id="insertSku" keyColumn="skuId" keyProperty="skuId" parameterType="com.caimei.modules.product.entity.CmSku"
- useGeneratedKeys="true">
- insert into cm_sku
- (productId,
- normalPrice,
- price,
- ladderPriceFlag,
- <if test="costPrice != null">
- costprice,
- </if>
- <if test="organizeCostPrice != null">
- organizeCostPrice,
- </if>
- <if test="cmCostPrice != null">
- cmCostPrice,
- </if>
- stock,
- <if test="shopPercent != null">
- shopPercent,
- </if>
- <if test="organizePercent != null">
- organizePercent,
- </if>
- <if test="cmPercent != null">
- cmPercent,
- </if>
- organizeId,
- minBuyNumber,
- unit)
- values (#{productId},
- #{normalPrice},
- #{price},
- #{ladderPriceFlag},
- <if test="costPrice != null">
- #{costPrice},
- </if>
- <if test="organizeCostPrice != null">
- #{organizeCostPrice},
- </if>
- <if test="cmCostPrice != null">
- #{cmCostPrice},
- </if>
- #{stock},
- <if test="shopPercent != null">
- #{shopPercent},
- </if>
- <if test="organizePercent != null">
- #{organizePercent},
- </if>
- <if test="cmPercent != null">
- #{cmPercent},
- </if>
- #{organizeId},
- #{minBuyNumber},
- #{unit})
- </insert>
- <insert id="insertOrganizeSku" keyColumn="id" keyProperty="id"
- parameterType="com.caimei.modules.product.entity.CmSku"
- useGeneratedKeys="true">
- insert into cm_mall_product_sku
- (productId,
- mallProductId,
- normalPrice,
- price,
- stock,
- minBuyNumber,
- unit,
- organizePercent,
- shopPercent,
- cmPercent)
- values (#{productId},
- #{mallProductId},
- #{normalPrice},
- #{price},
- #{stock},
- #{minBuyNumber},
- #{unit},
- #{organizeCostPrice},
- #{cmCostPrice},
- #{organizePercent},
- #{shopPercent},
- #{cmPercent})
- </insert>
- <insert id="insertCmLadderPrice">
- insert into product_ladder_price (skuId, productId, userType, ladderNum,
- buyNum, buyPrice, createBy, createDate, delFlag)
- values (#{skuId}, #{productId}, 3, #{ladderNum},
- #{buyNum}, #{buyPrice}, #{createBy},
- now(), '0')
- </insert>
- <select id="getrecommendProductList" resultType="product">
- select
- a.*,
- csrp.sort AS sort,
- csrp.id AS recommendProductId,
- b.name AS brandName,
- s.name AS shopName
- FROM
- cm_search_recommend_product csrp
- LEFT JOIN product a on a.productID = csrp.productID
- left join cm_organize_product_info copi on copi.productId = a.productID
- LEFT JOIN shop s on s.shopID = a.shopID
- left join cm_brand b on b.id = a.brandID
- WHERE
- csrp.tinyTypeId = #{tinyTypeID}
- <if test="name != null and name != ''">
- AND a.name like concat('%', #{name} ,'%')
- </if>
- <if test="validFlag !=null and validFlag !=''">
- AND copi.validFlag=#{validFlag}
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name like concat('%', #{shopName} ,'%')
- </if>
- <if test="brandName != null and brandName != ''">
- AND b.name like concat('%', #{brandName} ,'%')
- </if>
- and a.productCategory = 1
- AND copi.validFlag != 0
- AND csrp.delFlag =0
- group by a.productID
- ORDER BY csrp.sort DESC
- </select>
- <delete id="deleteLadderPriceByProductId">
- DELETE
- FROM product_ladder_price
- where productId = #{productID}
- </delete>
- <delete id="deleteLadderPriceById">
- DELETE
- FROM product_ladder_price
- where productId = #{productId}
- and skuId = #{skuId}
- </delete>
- <delete id="deleteSkus">
- delete
- from cm_sku
- where productId = #{productID}
- </delete>
- <delete id="deleteProductSkus">
- DELETE
- FROM cm_sku
- WHERE productId = #{productId}
- and skuId not in
- <foreach collection="skuIds" close=")" separator="," open="(" item="id">
- #{id}
- </foreach>
- </delete>
- <delete id="deleteProductOrganizeSkus">
- DELETE
- FROM cm_mall_product_sku
- WHERE productId = #{productId}
- and id not in
- <foreach collection="skuIds" close=")" separator="," open="(" item="id">
- #{id}
- </foreach>
- </delete>
- <delete id="deletePromotionSku">
- DELETE from cm_promotion_sku
- WHERE productId = #{productId}
- and skuId not in
- <foreach collection="skuIds" close=")" separator="," open="(" item="id">
- #{id}
- </foreach>
- </delete>
- <select id="findProductIdBySku" resultType="java.lang.String">
- select productId
- from cm_sku cs
- where skuId = #{productId}
- #暂时写死0
- and cs.organizeId = 0 limit 1
- </select>
- <select id="toAddProductList" resultType="product">
- select
- a.*,
- b.name AS brandName,
- s.name AS shopName
- FROM product a
- left join cm_organize_product_info copi on copi.productId = a.productID
- LEFT JOIN shop s on s.shopID = a.shopID
- left join cm_brand b on b.id = a.brandID
- WHERE
- NOT EXISTS (select * from cm_search_recommend_product csrp where csrp.productID = a.productID and
- csrp.tinyTypeID = #{tinyTypeID} AND csrp.delFlag = 0)
- and copi.validFlag = '2'
- <if test="name != null and name != ''">
- and a.name like concat('%', #{name} ,'%')
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name like concat('%', #{shopName} ,'%')
- </if>
- <if test="brandName != null and brandName != ''">
- AND b.name like concat('%', #{brandName} ,'%')
- </if>
- and a.productCategory = 1
- group by a.productID
- </select>
- <select id="findGroupActivityListPage" resultType="Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- left join cm_organize_product_info copi on copi.productId = a.productID
- <include refid="ActivityJoins"/>
- <where>
- <if test="id !=null and id !=''">
- AND a.productID=#{id}
- </if>
- <if test="tinyTypeID != null and tinyTypeID != ''">
- AND a.tinyTypeID = #{tinyTypeID}
- </if>
- <if test="smallTypeID != null and smallTypeID != ''">
- AND a.smallTypeID = #{smallTypeID}
- </if>
- <if test="bigTypeID != null and bigTypeID != ''">
- AND a.bigTypeID = #{bigTypeID}
- </if>
- <if test="shopID != null and shopID != ''">
- AND a.shopID = #{shopID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name LIKE
- <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
- </if>
- <if test="actFlag !=null and actFlag !=''">
- AND a.actFlag=#{actFlag}
- </if>
- <if test="actStatus != null and actStatus != '' and actStatus == 1">
- AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[ < ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
- </if>
- <if test="actStatus != null and actStatus != '' and actStatus == 2">
- AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[ > ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
- AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[ < ]]> STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
- </if>
- <if test="sqlMap !=null and sqlMap !=''">
- ${sqlMap.dsf}
- </if>
- AND copi.validFlag = 2
- AND ((a.actType != 1 AND a.actType != 2 OR a.`actType` IS NULL) or a.actFlag = 0)
- AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
- and a.productCategory = 1
- </where>
- group by a.productID
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by case WHEN copi.validFlag = 1 then 0 else 1 END asc,a.productID desc
- </otherwise>
- </choose>
- </select>
- <select id="findBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
- SELECT
- *
- FROM bigtype a
- <where>
- <if test="bigTypeID != null and bigTypeID != ''">
- AND a.bigTypeID = #{bigTypeID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- </where>
- </select>
- <select id="findSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
- SELECT
- *
- FROM smalltype a
- <where>
- <if test="smallTypeID != null and smallTypeID != ''">
- AND a.smallTypeID = #{smallTypeID}
- </if>
- <if test="bigTypeID != null and bigTypeID != ''">
- AND a.bigTypeID = #{bigTypeID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- </where>
- </select>
- <select id="findTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
- SELECT
- *
- FROM tinytype a
- <where>
- <if test="tinyTypeID != null and tinyTypeID != ''">
- AND a.tinyTypeID = #{tinyTypeID}
- </if>
- <if test="smallTypeID != null and smallTypeID != ''">
- AND a.smallTypeID = #{smallTypeID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- </where>
- </select>
- <select id="findProductRecommendList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
- select cpr.id AS id,
- cpr.productID AS productID,
- cpr.recommendProductID AS recommendProductID,
- cpr.sort AS sort,
- pro.name AS productName,
- pro.mainImage AS img,
- cpr.shopName AS shopName
- from cm_product_recommend cpr
- join product pro on cpr.recommendProductID = pro.productID
- where cpr.productID = #{productID}
- order by cpr.sort desc
- </select>
- <select id="findProductRecommendCount" resultType="int">
- select count(1)
- from cm_product_recommend cpr
- where cpr.productID = #{productID}
- </select>
- <select id="findProductList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
- select
- a.productID AS productID,
- a.name AS productName,
- a.mainImage AS img,
- s.name AS shopName
- from product a
- <include refid="ActivityJoins"/>
- <where>
- <choose>
- <when test="commodityType != null and commodityType != ''">
- AND a.commodityType = #{commodityType}
- </when>
- <when test="bigTypeID != null and bigTypeID != ''">
- AND a.bigTypeID = #{bigTypeID}
- </when>
- <when test="smallTypeID != null and smallTypeID != ''">
- AND a.smallTypeID = #{smallTypeID}
- </when>
- <when test="tinyTypeID != null and tinyTypeID != ''">
- AND a.tinyTypeID = #{tinyTypeID}
- </when>
- </choose>
- <if test="productName != null and productName != ''">
- and a.name like concat('%', #{productName} ,'%')
- </if>
- <if test="shopName != null and shopName != ''">
- and s.name like concat('%', #{shopName} ,'%')
- </if>
- and a.productCategory = 1
- </where>
- group by a.productID
- <!-- limit 0, 10-->
- </select>
- <update id="updateRecommendType">
- UPDATE product
- SET recommendType = #{recommendType}
- WHERE productID = #{productID}
- </update>
- <update id="updateBrnadId">
- UPDATE product
- set brandID = #{brandID}
- WHERE productID = #{productID}
- </update>
- <update id="updateProductByBrandId">
- UPDATE product
- set brandID = null
- WHERE brandID = #{brandId}
- </update>
- <select id="getProductIdByBrandId" resultType="java.lang.Integer">
- SELECT productID
- FROM product
- WHERE brandID = #{brandId}
- </select>
- <update id="updateTinyType">
- UPDATE product
- set tinyTypeID = #{tinyTypeID}
- WHERE productID = #{productID}
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
- update product
- <set>
- <if test="productDescribe != null and productDescribe != ''">
- productDescribe = #{productDescribe},
- </if>
- <if test="groundMall != null and groundMall != ''">
- groundMall = #{groundMall},
- </if>
- <if test="productDetail != null and productDetail != ''">
- productDetail = #{productDetail},
- </if>
- <if test="brandID != null and brandID != ''">
- brandID = #{brandID},
- </if>
- <if test="bigTypeID != null and bigTypeID !=''">
- bigTypeID = #{bigTypeID},
- smallTypeID = #{smallTypeID},
- tinyTypeID = #{tinyTypeID},
- </if>
- <if test="preferredFlag != null and preferredFlag !=''">
- preferredFlag = #{preferredFlag},
- </if>
- <if test="shopID != null and shopID !=''">
- shopID = #{shopID},
- </if>
- <if test="name != null and name !=''">
- `name` = #{name},
- </if>
- <if test="aliasName != null and aliasName !=''">
- aliasName = #{aliasName},
- </if>
- <if test="searchKey != null and searchKey !=''">
- searchKey = #{searchKey},
- </if>
- <if test="productRemarks != null and productRemarks !=''">
- productRemarks = #{productRemarks},
- </if>
- <if test="combinationID != null and combinationID !=''">
- combinationID = #{combinationID},
- </if>
- <if test="priceFlag != null and priceFlag !=''">
- priceFlag = #{priceFlag},
- </if>
- <if test="beautyActFlag != null and beautyActFlag !=''">
- beautyActFlag = #{beautyActFlag},
- </if>
- <if test="hasSkuFlag != null and hasSkuFlag !=''">
- hasSkuFlag = #{hasSkuFlag},
- </if>
- <if test="mainImage != null and mainImage !=''">
- mainImage = #{mainImage},
- </if>
- <if test="propertiesInfo != null and propertiesInfo !=''">
- propertiesInfo = #{propertiesInfo},
- </if>
- <if test="addTime != null and addTime !=''">
- addTime = #{addTime},
- </if>
- <if test="updateTime != null and updateTime !=''">
- updateTime = #{updateTime},
- </if>
- <!-- <if test="weekSellNumber != null and weekSellNumber !=''">-->
- <!-- weekSellNumber = #{weekSellNumber},-->
- <!-- </if>-->
- <if test="beforeValidFlag != null and beforeValidFlag !=''">
- beforeValidFlag = #{beforeValidFlag},
- </if>
- <!-- <if test="validFlag != null and validFlag !=''">-->
- <!-- validFlag = #{validFlag},-->
- <!-- </if>-->
- <if test="favoriteTimes != null and favoriteTimes !=''">
- favoriteTimes = #{favoriteTimes},
- </if>
- <if test="commentScore != null and commentScore !=''">
- commentScore = #{commentScore},
- </if>
- <if test="commentTimes != null and commentTimes !=''">
- commentTimes = #{commentTimes},
- </if>
- <!-- <if test="selfRecommendFlag != null and selfRecommendFlag !=''">-->
- <!-- selfRecommendFlag = #{selfRecommendFlag},-->
- <!-- </if>-->
- <!-- <if test="sysRecommendFlag != null and sysRecommendFlag !=''">-->
- <!-- sysRecommendFlag = #{sysRecommendFlag},-->
- <!-- </if>-->
- <if test="sortIndex != null and sortIndex != ''">
- sortIndex = #{sortIndex},
- </if>
- <if test="featuredFlag != null and featuredFlag !=''">
- featuredFlag = #{featuredFlag},
- </if>
- <if test="featuredSortIndex != null and featuredSortIndex !=''">
- featuredSortIndex = #{featuredSortIndex},
- </if>
- <if test="productCode != null and productCode !=''">
- productCode = #{productCode},
- </if>
- <!-- <if test="synToERPFlag != null and synToERPFlag !=''">-->
- <!-- synToERPFlag = #{synToERPFlag},-->
- <!-- </if>-->
- <if test="allAreaFlag != null and allAreaFlag !=''">
- allAreaFlag = #{allAreaFlag},
- </if>
- <if test="provinceIDs != null and provinceIDs !=''">
- provinceIDs = #{provinceIDs},
- </if>
- <if test="serviceNumber != null and serviceNumber !=''">
- serviceNumber = #{serviceNumber},
- </if>
- <if test="packageCount != null and packageCount !=''">
- packageCount = #{packageCount},
- </if>
- <if test="byFlag != null and byFlag !=''">
- byFlag = #{byFlag},
- </if>
- <if test="normalProductFlag != null and normalProductFlag !=''">
- normalProductFlag = #{normalProductFlag},
- </if>
- <!-- <if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">-->
- <!-- wholeSaleProductFlag = #{wholeSaleProductFlag},-->
- <!-- </if>-->
- <!-- <if test="promotionProductFlag != null and promotionProductFlag !=''">-->
- <!-- promotionProductFlag = #{promotionProductFlag},-->
- <!-- </if>-->
- <!-- <if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">-->
- <!-- groupBuyProductFlag = #{groupBuyProductFlag},-->
- <!-- </if>-->
- <if test="step != null and step !=''">
- step = #{step},
- </if>
- <if test="actFlag != null and actFlag !=''">
- actFlag = #{actFlag},
- </if>
- <if test="actSort != null and actSort !=''">
- actSort = #{actSort},
- </if>
- <if test="actType != null and actType !=''">
- actType = #{actType},
- </if>
- <if test="onlineTime != null and onlineTime !=''">
- onlineTime = #{onlineTime},
- </if>
- <if test="downlineTime != null and downlineTime !=''">
- downlineTime = #{downlineTime},
- </if>
- <if test="freePostFlag != null and freePostFlag !=''">
- freePostFlag = #{freePostFlag},
- </if>
- <!-- <if test="precisehKey != null and precisehKey !=''">-->
- <!-- precisehKey = #{precisehKey},-->
- <!-- </if>-->
- <if test="visibility != null and visibility !=''">
- visibility = #{visibility},
- </if>
- <if test="commodityDetailsFlag != null and commodityDetailsFlag != ''">
- commodityDetailsFlag = #{commodityDetailsFlag},
- </if>
- <if test="productType != null and productType !=''">
- productType = #{productType},
- </if>
- <if test="qualificationImg != null and qualificationImg !=''">
- qualificationImg = #{qualificationImg},
- </if>
- <if test="qualificationImg != null and qualificationImg !=''">
- qualificationImg = #{qualificationImg},
- </if>
- <if test="invoiceType != null and invoiceType !=''">
- invoiceType = #{invoiceType},
- </if>
- <if test="taxPoint != null and taxPoint !=''">
- taxPoint = #{taxPoint},
- </if>
- <if test="supplierTaxPoint != null and supplierTaxPoint !=''">
- supplierTaxPoint = #{supplierTaxPoint},
- </if>
- <if test="endTimeStr != null and endTimeStr !=''">
- endTimeStr = #{endTimeStr},
- </if>
- <if test="tags != null and tags !=''">
- tags = #{tags},
- </if>
- <if test="recommendType != null and recommendType !=''">
- recommendType = #{recommendType},
- </if>
- <if test="machineType != null and machineType !=''">
- machineType = #{machineType},
- </if>
- <if test="includedTax != null and includedTax !=''">
- includedTax = #{includedTax},
- </if>
- <if test="invoiceType != null and invoiceType !=''">
- invoiceType = #{invoiceType},
- </if>
- <if test="commodityType != null and commodityType != ''">
- commodityType = #{commodityType},
- </if>
- <if test="trainingMethod != null">
- trainingMethod = #{trainingMethod},
- </if>
- <if test="trainingType != null">
- trainingType = #{trainingType},
- </if>
- <if test="trainingFee != null">
- trainingFee = #{trainingFee},
- </if>
- <if test="qualificationNo !=null and qualificationNo != ''">
- qualificationNo=#{qualificationNo},
- </if>
- <if test="productName !=null and productName !=''">
- productName=#{productName},
- </if>
- <if test="qualificationTime !=null and qualificationTime!=''">
- qualificationTime=#{qualificationTime},
- </if>
- <if test="qualificationLink !=null and qualificationLink!=''">
- qualificationLink=#{qualificationLink},
- </if>
- labelIds=#{labelIds},
- relatedLabels=#{relatedLabels},
- newProductType=#{newProductType},
- showFlag=#{showFlag},
- announType=#{announType},
- splitCode = #{splitCode},
- returnGoodsStutas=#{returnGoodsStutas}
- </set>
- where productID = #{productID}
- </update>
- <update id="updateproductDetailInfo" parameterType="com.caimei.modules.product.entity.ProductDetailInfo">
- update productdetailinfo
- <set>
- <if test="propValueAlias != null and propValueAlias != ''">
- propValueAlias = #{propValueAlias},
- </if>
- <if test="propValueImages != null and propValueImages !=''">
- propValueImages = #{propValueImages},
- </if>
- <if test="detailInfo != null">
- detailInfo = #{detailInfo},
- </if>
- <if test="commonDetailInfo != null">
- commonDetailInfo = #{commonDetailInfo},
- </if>
- <if test="detailInfoTxt != null">
- detailInfoTxt = #{detailInfoTxt},
- </if>
- <if test="seoTitle != null and seoTitle !=''">
- seoTitle = #{seoTitle},
- </if>
- <if test="seoKeyword != null and seoKeyword !=''">
- seoKeyword = #{seoKeyword},
- </if>
- <if test="seoDes != null and seoDes !=''">
- seoDes = #{seoDes},
- </if>
- <if test="serviceInfo != null ">
- serviceInfo = #{serviceInfo},
- </if>
- <if test="orderInfo != null ">
- orderInfo = #{orderInfo},
- </if>
- </set>
- where productID = #{productID}
- </update>
- <update id="updateLadderPrice">
- update product_ladder_price
- set productId = #{productId},
- ladderNum = #{ladderNum},
- buyNum = #{buyNum},
- buyPrice = #{buyPrice},
- updateBy = #{updateBy},
- updateDate = #{updateDate},
- delFlag = #{delFlag}
- where id = #{id}
- </update>
- <update id="updateMainImage">
- update product
- set mainImage =#{mainImage}
- where productID = #{productID}
- </update>
- <update id="updateCmSku">
- update cm_sku
- set productId=#{productId},
- ladderPriceFlag=#{ladderPriceFlag},
- normalPrice=#{normalPrice},
- price=#{price},
- organizeId=#{organizeId},
- <if test="shopPercent != null">
- shopPercent=#{shopPercent},
- </if>
- <if test="organizePercent != null">
- organizePercent=#{organizePercent},
- </if>
- <if test="cmPercent != null">
- cmPercent=#{cmPercent},
- </if>
- <if test="costPrice != null">
- costPrice=#{costPrice},
- </if>
- <if test="organizeCostPrice != null">
- organizeCostPrice = #{organizeCostPrice},
- </if>
- <if test="cmCostPrice != null">
- cmCostPrice = #{cmCostPrice},
- </if>
- stock=#{stock},
- unit=#{unit},
- minBuyNumber=#{minBuyNumber}
- where skuId = #{skuId}
- </update>
- <update id="updateOrganizeSku">
- update cm_mall_product_sku
- set productId=#{productId},
- normalPrice=#{normalPrice},
- price=#{price},
- costPrice=#{costPrice},
- stock=#{stock},
- unit=#{unit},
- minBuyNumber=#{minBuyNumber},
- organizePercent=#{organizePercent},
- shopPercent=#{shopPercent},
- cmPercent=#{cmPercent}
- where id = #{skuId}
- </update>
- <select id="getProductByTypeName" resultType="com.caimei.modules.brand.entity.BrandAndProductType">
- select b.name AS "bigTypeName",
- b.bigTypeID,
- s.`name` AS "smallTypeName",
- s.smalltypeID,
- t.name AS "tinyTypeName",
- t.tinytypeID
- from tinytype t
- LEFT JOIN smalltype s on t.smallTypeID = s.smallTypeID
- LEFT JOIN bigtype b ON b.bigTypeID = s.bigTypeID
- where b.`name` = #{name}
- AND s.`name` = #{name1}
- AND t.name = #{name2}
- </select>
- <select id="findRecommendBySys" resultType="com.caimei.modules.product.entity.CmProductRecommend">
- select p.productID AS recommendProductID,
- p.name AS productName,
- p.mainImage AS img,
- s.name AS shopName
- from product p
- left join shop s on s.shopID = p.shopID
- where p.tinyTypeID = #{tinyTypeID}
- and p.productCategory = 1
- order by p.sellNumber
- desc
- limit 0, 7
- </select>
- <select id="getSecondHandRecommend" resultType="CmSecondHandRecommendVo">
- select p.productID AS id,
- 1 AS type,
- p.name AS name,
- p.mainImage AS img,
- s.name AS shopName,
- p.productCategory as "productCategory"
- from product p
- left join shop s on s.shopID = p.shopID
- left join cm_organize_product_info copi on copi.productId = p.productID
- where p.productID = #{productID}
- AND copi.validFlag = '2'
- </select>
- <select id="querySecondHandRecommend" resultType="CmSecondHandRecommendVo">
- select
- p.productID AS id,
- 1 AS type,
- p.name AS name,
- p.mainImage AS img,
- s.name AS shopName,
- p.productCategory as "productCategory"
- from product p
- left join cm_organize_product_info copi on copi.productId = p.productID
- left join shop s on s.shopID = p.shopID
- <where>
- <if test="productID != null and productID != ''">
- p.productID = #{productID}
- </if>
- <if test="productName != null and productName != ''">
- and p.name like concat('%', #{productName} ,'%')
- </if>
- AND copi.validFlag = '2'
- and p.productCategory = #{queryProductType}
- </where>
- limit 0, 10
- </select>
- <select id="queryProductDetailInfo" resultType="com.caimei.modules.product.entity.ProductDetailInfo">
- SELECT *
- FROM productdetailinfo
- where productID = #{productID}
- </select>
- <select id="shopKeyword" resultType="java.lang.String">
- SELECT DISTINCT cusf.keyword
- FROM cm_user_search_frequency cusf
- LEFT JOIN cm_shop_label csl ON csl.keywordId = cusf.Id
- LEFT JOIN cm_shop_relevance csr ON csr.id = csl.relevanceId
- LEFT JOIN shop s ON s.shopID = csr.shopID
- LEFT JOIN product p ON p.shopID = s.shopID
- WHERE csl.delFlag = 0
- AND csr.delFlag = 0
- AND p.productID = #{productID}
- </select>
- <select id="qualification" resultType="com.caimei.modules.product.entity.Product">
- SELECT qualificationNo, productName, qualificationTime, qualificationLink
- FROM product
- where productID = #{productID}
- </select>
- <select id="findProductLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
- SELECT *
- FROM product_ladder_price
- WHERE productId = #{productId}
- AND userType = #{userType}
- AND buyNum is NOT null
- AND buyPrice is NOT null
- AND delFlag = 0
- ORDER BY ladderNum ASC
- </select>
- <select id="findActList" resultType="com.caimei.modules.product.entity.Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- <include refid="productJoins"/>
- <where>
- <if test="id !=null and id !=''">
- AND a.productID=#{id}
- </if>
- <if test="shopID != null and shopID != ''">
- AND a.shopID = #{shopID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name LIKE
- <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
- </if>
- <if test="validFlag !=null and validFlag !=''">
- AND copi.validFlag=#{validFlag}
- </if>
- <if test="actFlag !=null and actFlag !=''">
- AND a.actFlag=#{actFlag}
- </if>
- <if test="actType !=null and actType !=''">
- AND a.actType=#{actType}
- </if>
- AND a.actStatus = 1
- and a.productCategory = 1
- </where>
- group by a.productID
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by case WHEN copi.validFlag = 1 then 0 else 1 END asc,a.productID desc
- </otherwise>
- </choose>
- </select>
- <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
- select p.productID,p.mainImage,p.name,s.name as shopName
- from product p
- left join cm_organize_product_info copi on copi.productId = p.productID
- left join shop s on p.shopID = s.shopID
- <where>
- (p.actFlag=0 or p.actType is null) and copi.validFlag = 2 and p.productCategory = 1
- <if test="productIds != null and productIds != '' ">
- and p.productID != #{productIds}
- </if>
- <if test="productID != null and productID != ''">
- and p.productID = #{productID}
- </if>
- <if test="name != null and name != ''">
- and p.name like concat('%',#{name},'%')
- </if>
- <if test="shopName != null and shopName != ''">
- and s.name like concat('%',#{shopName},'%')
- </if>
- </where>
- order by productID asc
- </select>
- <select id="findProductImage" resultType="com.caimei.modules.product.entity.Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- <include refid="productJoins"/>
- <where>
- <if test="productID !=null">
- AND a.productID=#{productID}
- </if>
- <if test="shopID != null and shopID != ''">
- AND a.shopID = #{shopID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name LIKE concat('%',#{shopName},'%')
- </if>
- <if test="validFlag !=null and validFlag !=''">
- AND copi.validFlag=#{validFlag}
- </if>
- <if test="productCategory !=null and productCategory !=''">
- AND a.productCategory=#{productCategory}
- </if>
- <if test="ids != null and ids.size() > 0">
- AND a.productID NOT IN
- <foreach collection="ids" close=")" separator="," open="(" item="id">
- #{id}
- </foreach>
- </if>
- </where>
- group by a.productID
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by a.productID asc
- </otherwise>
- </choose>
- </select>
- <select id="findProductDetail" resultType="java.lang.String">
- select productDetail
- from product
- where productID = #{productID}
- </select>
- <select id="findProductDescribe" resultType="java.lang.String">
- select productDescribe
- from product
- where productID = #{productID}
- </select>
- <select id="findSepcialShopList" resultType="com.caimei.modules.product.entity.CmShop">
- select name, shopID
- from shop
- where shopType = 2
- </select>
- <select id="getSplitCodeByProductId" resultType="java.lang.String">
- select splitCode
- from product
- where productID = #{productID}
- </select>
- <select id="findSplitCodesByShopId" resultType="com.caimei.modules.product.entity.CmSplitCode">
- select shopId, commercialCode as splitCode, codeDetail as codeName, email
- from cm_shop_splitcode
- where shopId = #{shopID}
- </select>
- <select id="findSkuList" resultType="com.caimei.modules.product.entity.CmSku">
- select cs.skuId,
- cs.productId,
- cs.organizeId,
- unit,
- normalPrice,
- stock,
- (select costCheckFlag
- from cm_organize_product_info
- where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
- shopPercent,
- costPrice,
- price,
- ladderPriceFlag,
- minBuyNumber,
- cps.touchPrice,
- csps.discount,
- csps.discountPrice,
- csps.priceType
- from cm_sku cs
- left join cm_promotion_sku cps on cs.skuId = cps.skuId
- left join cm_svip_product_sku csps on cs.skuId = csps.skuId
- where cs.productId = #{productID}
- and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = #{productID})
- </select>
- <select id="getCostCheckFlag" resultType="java.lang.Integer">
- select costCheckFlag
- from cm_organize_product_info
- where productId = #{productId}
- and organizeId = #{organizeId}
- </select>
- <select id="findSkuListProduct" resultType="com.caimei.modules.product.entity.CmSku">
- select cs.skuId,
- cs.productId,
- cs.organizeId,
- unit,
- normalPrice,
- stock,
- (select costCheckFlag
- from cm_organize_product_info
- where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
- shopPercent,
- organizePercent,
- cmPercent,
- costPrice,
- organizeCostPrice,
- cmCostPrice,
- price,
- ladderPriceFlag,
- minBuyNumber,
- csps.discount,
- csps.discountPrice,
- csps.priceType
- from cm_sku cs
- left join cm_svip_product_sku csps on cs.skuId = csps.skuId
- where cs.organizeId = 0
- and cs.productId = #{productID}
- order by cs.price asc
- </select>
- <select id="findSkuOrganizeList" resultType="com.caimei.modules.product.entity.CmSku">
- select cs.skuId,
- cs.productId,
- cs.organizeId,
- cs.unit,
- cs.normalPrice,
- cs.stock,
- (select costCheckFlag
- from cm_organize_product_info
- where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
- cs.shopPercent as shopPercent,
- cs.costPrice,
- cs.organizeCostPrice,
- cs.cmCostPrice,
- cs.price,
- cs.minBuyNumber,
- cs.organizePercent,
- cs.shopPercent,
- cs.cmPercent
- from cm_sku cs
- where cs.organizeId = 4
- and cs.productId = #{productID}
- </select>
- <select id="findLadderPriceBySku" resultType="com.caimei.modules.product.entity.CmLadderPrice">
- select skuId, productId, userType, ladderNum, buyNum, buyPrice, delFlag
- FROM product_ladder_price
- WHERE userType = 3
- AND skuId = #{skuId}
- AND buyNum is NOT null
- AND buyPrice is NOT null
- AND delFlag = 0
- ORDER BY buyNum ASC
- </select>
- <select id="findLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
- select skuId, productId, userType, ladderNum, buyNum, buyPrice, delFlag
- FROM product_ladder_price
- WHERE userType = 3
- AND skuId = #{skuId}
- AND buyNum is NOT null
- AND buyPrice is NOT null
- AND delFlag = 0
- ORDER BY buyNum ASC
- </select>
- <select id="getBySku" resultType="com.caimei.modules.product.entity.Product">
- SELECT
- <include refid="productColumns"/>
- ,cs.unit
- ,cs.skuId
- ,cs.organizeId
- FROM product a
- <include refid="productJoins"/>
- left join cm_sku cs on cs.productId=a.productID and copi.organizeId= cs.organizeId
- WHERE cs.skuId = #{skuId} and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE
- productID=cs.productId)
- </select>
- <select id="findHeHeSku" resultType="com.caimei.modules.product.entity.CmSku">
- select cs.skuId,
- cs.productId,
- cs.organizeId,
- cs.unit,
- cs.stock,
- (select costCheckFlag
- from cm_organize_product_info
- where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
- cs.costPrice,
- ifnull(cs.shopPercent, 0) as shopPercent,
- ifnull(cs.organizePercent, 0) as organizePercent,
- ifnull(cs.cmPercent, 0) as cmPercent,
- chs.price
- from cm_sku cs
- left join cm_hehe_sku chs on cs.skuId = chs.skuId
- where cs.productId = #{productID}
- and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
- </select>
- <select id="findSkuId" resultType="java.lang.Integer">
- select skuId
- from cm_sku
- where productId = #{productId}
- </select>
- <select id="findSku" resultType="com.caimei.modules.product.entity.CmSku">
- select cs.price,
- ifnull(cs.costPrice, 0) as costPrice,
- (select costCheckFlag
- from cm_organize_product_info
- where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
- cs.shopPercent,
- cs.normalPrice
- from cm_sku cs
- where cs.productId = #{productId}
- and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
- order by cs.price asc
- limit 1
- </select>
- <select id="findOrganizeSku" resultType="com.caimei.modules.product.entity.CmSku">
- SELECT cs.price,
- ifnull(cs.costPrice, 0),
- (select costCheckFlag
- from cm_organize_product_info
- where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
- cs.shopPercent AS shopPercent,
- cs.normalPrice,
- cs.organizeId
- FROM cm_sku cs
- WHERE cs.productId = #{productId}
- and cs.organizeId = 4
- ORDER BY cs.price ASC
- LIMIT 1
- </select>
- <select id="findSkuById" resultType="com.caimei.modules.product.entity.CmSku">
- select cs.skuId,
- cs.price,
- cs.costPrice,
- (select costCheckFlag
- from cm_organize_product_info
- where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
- cs.shopPercent,
- cs.unit,
- cs.organizeId
- from cm_sku cs
- where cs.skuId = #{skuId}
- and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
- </select>
- <select id="findSkuIdByPromotionsId" resultType="java.lang.Integer">
- select skuId
- from cm_promotions_gift
- where promotionsId = #{promotionsId}
- </select>
- <select id="getTouchPriceBySku" resultType="java.lang.Double">
- select touchPrice
- from cm_promotion_sku
- where skuId = #{skuId}
- </select>
- <select id="findSkuByPromotion" resultType="com.caimei.modules.product.entity.CmSku">
- SELECT cs.price
- , cps.skuId
- , cps.touchPrice
- , cs.unit
- , cs.organizeId
- FROM cm_promotion_sku cps
- LEFT JOIN cm_sku cs ON cps.skuId = cs.skuId
- WHERE promotionId = #{id}
- and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
- </select>
- <select id="getSkuByPromotionId" resultType="com.caimei.modules.product.entity.CmSku">
- SELECT cs.price, cpp.productId, cs.skuId, cs.unit
- FROM cm_promotions_product cpp
- LEFT JOIN cm_sku cs ON cpp.productId = cs.productId
- WHERE promotionsId = #{id}
- and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
- </select>
- </mapper>
|