123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373 |
- <?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.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.normalPrice AS "normalPrice",
- a.price AS "price",
- a.highestUserLevelPrice AS "highestUserLevelPrice",
- a.lowestUserLevelPrice AS "lowestUserLevelPrice",
- a.lowestUserLevelID AS "lowestUserLevelID",
- a.price0 AS "price0",
- a.price0Text AS "price0Text",
- a.price0TextFlag AS "price0TextFlag",
- a.price1 AS "price1",
- a.price1Text AS "price1Text",
- a.price1TextFlag AS "price1TextFlag",
- a.price8 AS "price8",
- a.price8Text AS "price8Text",
- a.price8TextFlag AS "price8TextFlag",
- a.ladderPriceFlag AS "ladderPriceFlag",
- a.price2 AS "price2",
- a.price3 AS "price3",
- a.price4 AS "price4",
- a.price5 AS "price5",
- a.price6 AS "price6",
- a.price7 AS "price7",
- a.fee AS "fee",
- a.stock AS "stock",
- 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",
- a.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.rate1 AS "rate1",
- a.rate2 AS "rate2",
- a.unit AS "unit",
- a.synToERPFlag AS "synToERPFlag",
- a.allAreaFlag AS "allAreaFlag",
- a.provinceIDs AS "provinceIDs",
- a.serviceNumber AS "serviceNumber",
- a.maxBuyNumber AS "maxBuyNumber",
- a.virtualFlag AS "virtualFlag",
- a.minBuyNumber AS "minBuyNumber",
- 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.speCommisionFlag AS "speCommisionFlag",
- a.speCommision AS "speCommision",
- a.videourl AS "videourl",
- a.props AS "props",
- a.providers AS "providers",
- a.serviceCommissionRatio AS "serviceCommissionRatio",
- a.reCommissionRatio AS "reCommissionRatio",
- a.pushToERPName AS "pushToERPName",
- a.prodBeans AS "prodBeans",
- a.useBeansFlag AS "useBeansFlag",
- a.privateFlag AS "privateFlag",
- a.invisibleServiceProviderIDs AS "invisibleServiceProviderIDs",
- a.displayOnCRMFlag AS "displayOnCRMFlag",
- a.needServiceFlag AS "needServiceFlag",
- a.actStatus AS "actStatus",
- a.actPrice0 AS "actPrice0",
- a.actPrice1 AS "actPrice1",
- a.actPrice2 AS "actPrice2",
- a.actPrice3 AS "actPrice3",
- a.actPrice4 AS "actPrice4",
- a.actPrice5 AS "actPrice5",
- a.actPrice6 AS "actPrice6",
- a.actPrice7 AS "actPrice7",
- a.beginTime AS "beginTime",
- a.endTime AS "endTime",
- a.actFlag AS "actFlag",
- a.actType AS "actType",
- a.actFullReduceAmount AS "actFullReduceAmount",
- a.actReduceAmount AS "actReduceAmount",
- a.actFullGiftAmount AS "actFullGiftAmount",
- a.actBuyGiftNum AS "actBuyGiftNum",
- a.onlineTime AS "onlineTime",
- a.downlineTime AS "downlineTime",
- a.shopIndexModuleID AS "shopIndexModuleID",
- a.freePostFlag AS "freePostFlag",
- a.crmBigTypeId AS "crmBigTypeId",
- a.crmSmallTypeId AS "crmSmallTypeId",
- a.costPrice AS "costPrice",
- a.costProportional AS "costProportional",
- a.costCheckFlag AS "costCheckFlag",
- a.precisehKey AS "precisehKey",
- a.docBoost AS "docBoost",
- a.cmbeanFlag AS "cmbeanFlag",
- a.cmbeanPrice AS "cmbeanPrice",
- a.cmbeanSort AS "cmbeanSort",
- s.name AS "shopName",
- a.actSort AS "actSort",
- a.actCreateTime AS "actCreateTime",
- a.recommendType AS "recommendType",
- a.aliasName as "aliasName",
- a.price0Grade as "price0Grade",
- a.price1Grade as "price1Grade",
- a.price8Grade as "price8Grade",
- a.visibility as "visibility",
- a.surplusTime as "surplusTime",
- a.productType as "productType",
- a.qualificationImg as "qualificationImg",
- a.includedTax as "includedTax",
- a.invoiceType as "invoiceType",
- a.taxPoint as "taxPoint",
- a.priceType as "priceType",
- a.tags as "tags",
- a.machineType as "machineType"
- </sql>
- <sql id="productJoins">
- LEFT JOIN shop s on s.shopID = a.shopID
- </sql>
- <sql id="ActivityJoins">
- LEFT JOIN shop s on s.shopID = a.shopID
- INNER JOIN tinytype AS b ON a.`tinyTypeID` = b.`tinyTypeID`
- INNER JOIN smalltype AS c ON a.`smallTypeID` = c.`smallTypeID`
- INNER JOIN bigtype AS d ON a.`bigTypeID` = d.`bigTypeID`
- </sql>
- <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"/>
- FROM product a
- <include refid="productJoins"/>
- WHERE a.productID = #{id}
- </select>
- <select id="getAllExistsProductList" resultType="Integer">
- SELECT
- a.productID
- FROM cm_mall_organize_products a
- WHERE a.delFlag = 0 and a.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="cmbeanFlag != null and cmbeanFlag != ''">
- AND a.cmbeanFlag = #{cmbeanFlag}
- </if>
- <if test="validFlag !=null and validFlag !=''">
- AND a.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 a.validFlag != 0
- AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
- and a.productCategory = 1
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by case WHEN a.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="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 a.validFlag in (2,3,9)
- and a.productCategory = 1
- </where>
- <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="cmbeanFlag != null and cmbeanFlag != ''">
- AND a.cmbeanFlag = #{cmbeanFlag}
- </if>
- <if test="validFlag !=null and validFlag !=''">
- AND a.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 a.validFlag != 0
- AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
- and a.productCategory = 1
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by case WHEN a.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>
- <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="id" useGeneratedKeys="true">
- INSERT INTO product(
- productID,
- brandID,
- bigTypeID,
- smallTypeID,
- tinyTypeID,
- selfTypeID,
- shopID,
- name,
- searchKey,
- normalPrice,
- price,
- highestUserLevelPrice,
- lowestUserLevelPrice,
- lowestUserLevelID,
- price0,
- price0Text,
- price0TextFlag,
- price1,
- price1Text,
- price1TextFlag,
- price8,
- price8Text,
- price8TextFlag,
- ladderPriceFlag,
- price2,
- price3,
- price4,
- price5,
- price6,
- price7,
- fee,
- stock,
- hasSkuFlag,
- mainImage,
- propertiesInfo,
- addTime,
- updateTime,
- weekSellNumber,
- beforeValidFlag,
- validFlag,
- favoriteTimes,
- commentScore,
- commentTimes,
- selfRecommendFlag,
- sysRecommendFlag,
- sortIndex,
- featuredFlag,
- featuredSortIndex,
- productCode,
- rate1,
- rate2,
- unit,
- synToERPFlag,
- allAreaFlag,
- provinceIDs,
- serviceNumber,
- maxBuyNumber,
- virtualFlag,
- minBuyNumber,
- packageCount,
- byFlag,
- normalProductFlag,
- wholeSaleProductFlag,
- promotionProductFlag,
- groupBuyProductFlag,
- step,
- speCommisionFlag,
- speCommision,
- videourl,
- props,
- providers,
- serviceCommissionRatio,
- reCommissionRatio,
- pushToERPName,
- prodBeans,
- useBeansFlag,
- privateFlag,
- invisibleServiceProviderIDs,
- displayOnCRMFlag,
- needServiceFlag,
- actPrice0,
- actPrice1,
- actPrice2,
- actPrice3,
- actPrice4,
- actPrice5,
- actPrice6,
- actPrice7,
- beginTime,
- endTime,
- actFlag,
- actType,
- actFullReduceAmount,
- actReduceAmount,
- actFullGiftAmount,
- actBuyGiftNum,
- onlineTime,
- downlineTime,
- shopIndexModuleID,
- freePostFlag,
- crmBigTypeId,
- crmSmallTypeId,
- costPrice,
- costProportional,
- costCheckFlag,
- precisehKey,
- docBoost,
- cmbeanFlag,
- cmbeanPrice,
- cmbeanSort
- ) VALUES (
- #{id},
- #{brandID},
- #{bigTypeID},
- #{smallTypeID},
- #{tinyTypeID},
- #{selfTypeID},
- #{shopID},
- #{name},
- #{searchKey},
- #{normalPrice},
- #{price},
- #{highestUserLevelPrice},
- #{lowestUserLevelPrice},
- #{lowestUserLevelID},
- #{price0},
- #{price0Text},
- #{price0TextFlag},
- #{price1},
- #{price1Text},
- #{price1TextFlag},
- #{price8},
- #{price8Text},
- #{price8TextFlag},
- #{ladderPriceFlag},
- #{price2},
- #{price3},
- #{price4},
- #{price5},
- #{price6},
- #{price7},
- #{fee},
- #{stock},
- #{hasSkuFlag},
- #{mainImage},
- #{propertiesInfo},
- #{addTime},
- #{updateTime},
- #{weekSellNumber},
- #{beforeValidFlag},
- #{validFlag},
- #{favoriteTimes},
- #{commentScore},
- #{commentTimes},
- #{selfRecommendFlag},
- #{sysRecommendFlag},
- #{sortIndex},
- #{featuredFlag},
- #{featuredSortIndex},
- #{productCode},
- #{rate1},
- #{rate2},
- #{unit},
- #{synToERPFlag},
- #{allAreaFlag},
- #{provinceIDs},
- #{serviceNumber},
- #{maxBuyNumber},
- #{virtualFlag},
- #{minBuyNumber},
- #{packageCount},
- #{byFlag},
- #{normalProductFlag},
- #{wholeSaleProductFlag},
- #{promotionProductFlag},
- #{groupBuyProductFlag},
- #{step},
- #{speCommisionFlag},
- #{speCommision},
- #{videourl},
- #{props},
- #{providers},
- #{serviceCommissionRatio},
- #{reCommissionRatio},
- #{pushToERPName},
- #{prodBeans},
- #{useBeansFlag},
- #{privateFlag},
- #{invisibleServiceProviderIDs},
- #{displayOnCRMFlag},
- #{needServiceFlag},
- #{actPrice0},
- #{actPrice1},
- #{actPrice2},
- #{actPrice3},
- #{actPrice4},
- #{actPrice5},
- #{actPrice6},
- #{actPrice7},
- #{beginTime},
- #{endTime},
- #{actFlag},
- #{actType},
- #{actFullReduceAmount},
- #{actReduceAmount},
- #{actFullGiftAmount},
- #{actBuyGiftNum},
- #{onlineTime},
- #{downlineTime},
- #{shopIndexModuleID},
- #{freePostFlag},
- #{crmBigTypeId},
- #{crmSmallTypeId},
- #{costPrice},
- #{costProportional},
- #{costCheckFlag},
- #{precisehKey},
- #{docBoost},
- #{cmbeanFlag},
- #{cmbeanPrice},
- #{cmbeanSort}
- )
- </insert>
- <update id="update">
- UPDATE product SET
- productID = #{id},
- brandID = #{brandID},
- tinyTypeID = #{tinyTypeID},
- selfTypeID = #{selfTypeID},
- shopID = #{shopID},
- name = #{name},
- searchKey = #{searchKey},
- normalPrice = #{normalPrice},
- price = #{price},
- highestUserLevelPrice = #{highestUserLevelPrice},
- lowestUserLevelPrice = #{lowestUserLevelPrice},
- lowestUserLevelID = #{lowestUserLevelID},
- price0 = #{price0},
- price0Text = #{price0Text},
- price0TextFlag = #{price0TextFlag},
- price1 = #{price1},
- price1Text = #{price1Text},
- price1TextFlag = #{price1TextFlag},
- price8 = #{price8},
- price8Text = #{price8Text},
- price8TextFlag = #{price8TextFlag},
- ladderPriceFlag = #{ladderPriceFlag},
- price2 = #{price2},
- price3 = #{price3},
- price4 = #{price4},
- price5 = #{price5},
- price6 = #{price6},
- price7 = #{price7},
- fee = #{fee},
- stock = #{stock},
- 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},
- rate1 = #{rate1},
- rate2 = #{rate2},
- unit = #{unit},
- synToERPFlag = #{synToERPFlag},
- allAreaFlag = #{allAreaFlag},
- provinceIDs = #{provinceIDs},
- serviceNumber = #{serviceNumber},
- maxBuyNumber = #{maxBuyNumber},
- virtualFlag = #{virtualFlag},
- minBuyNumber = #{minBuyNumber},
- packageCount = #{packageCount},
- byFlag = #{byFlag},
- normalProductFlag = #{normalProductFlag},
- wholeSaleProductFlag = #{wholeSaleProductFlag},
- promotionProductFlag = #{promotionProductFlag},
- groupBuyProductFlag = #{groupBuyProductFlag},
- step = #{step},
- speCommisionFlag = #{speCommisionFlag},
- speCommision = #{speCommision},
- videourl = #{videourl},
- props = #{props},
- providers = #{providers},
- serviceCommissionRatio = #{serviceCommissionRatio},
- reCommissionRatio = #{reCommissionRatio},
- pushToERPName = #{pushToERPName},
- prodBeans = #{prodBeans},
- useBeansFlag = #{useBeansFlag},
- privateFlag = #{privateFlag},
- invisibleServiceProviderIDs = #{invisibleServiceProviderIDs},
- displayOnCRMFlag = #{displayOnCRMFlag},
- needServiceFlag = #{needServiceFlag},
- actPrice0 = #{actPrice0},
- actPrice1 = #{actPrice1},
- actPrice2 = #{actPrice2},
- actPrice3 = #{actPrice3},
- actPrice4 = #{actPrice4},
- actPrice5 = #{actPrice5},
- actPrice6 = #{actPrice6},
- actPrice7 = #{actPrice7},
- beginTime = #{beginTime},
- endTime = #{endTime},
- actFlag = #{actFlag},
- actType = #{actType},
- actFullReduceAmount = #{actFullReduceAmount},
- actReduceAmount = #{actReduceAmount},
- actFullGiftAmount = #{actFullGiftAmount},
- actBuyGiftNum = #{actBuyGiftNum},
- onlineTime = #{onlineTime},
- downlineTime = #{downlineTime},
- shopIndexModuleID = #{shopIndexModuleID},
- freePostFlag = #{freePostFlag},
- crmBigTypeId = #{crmBigTypeId},
- crmSmallTypeId = #{crmSmallTypeId},
- costPrice = #{costPrice},
- costProportional = #{costProportional},
- costCheckFlag = #{costCheckFlag},
- precisehKey = #{precisehKey},
- docBoost = #{docBoost},
- cmbeanFlag = #{cmbeanFlag},
- cmbeanPrice = #{cmbeanPrice},
- cmbeanSort = #{cmbeanSort},
- actSort = #{actSort},
- actCreateTime = #{actCreateTime}
- WHERE productID = #{id}
- </update>
- <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="getAllActType" resultType="com.caimei.po.ActType">
- SELECT
- *
- FROM acttype
- where validFlag = 1
- </select>
- <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="getProductSku" resultType="com.caimei.modules.product.entity.Sku">
- SELECT
- *
- FROM
- sku
- <where>
- productID = #{productId}
- AND validFlag = 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="updateCRMFlag">
- UPDATE product a SET a.displayOnCRMFlag = #{param1}
- WHERE a.productID IN
- <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
- #{id}
- </foreach>
- </update>
- <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>
- <delete id="deleteCustomClassification">
- delete from product_custom_classification
- where productID = #{productID}
- </delete>
- <insert id="insertCustomClassification" parameterType="com.caimei.modules.product.entity.ProductCustomClassification" keyProperty="userId" useGeneratedKeys="true">
- INSERT INTO product_custom_classification(
- productID,
- bigTypeID,
- smallTypeID,
- tinyTypeID,
- createDate,
- updateDate
- ) VALUES (
- #{productID},
- #{bigTypeID},
- #{smallTypeID},
- #{tinyTypeID},
- #{createDate},
- #{updateDate}
- )
- </insert>
- <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},
- #{createDate},'0')
- </insert>
- <insert id="insertProduct" keyColumn="productID" keyProperty="productID" parameterType="com.caimei.modules.product.entity.Product" useGeneratedKeys="true">
- INSERT INTO `product` (
- `brandID`,
- `tinyTypeID`,
- `classifyId`,
- <if test="productCategory != null and productCategory != '' ">
- `productCategory`,
- </if>
- `preferredFlag`,
- `selfTypeID`,
- `shopID`,
- `name`,
- `aliasName`,
- `searchKey`,
- `productRemarks`,
- `normalPrice`,
- `price`,
- `highestUserLevelPrice`,
- `lowestUserLevelPrice`,
- `lowestUserLevelID`,
- `price0`,
- `price0Grade`,
- `price0Text`,
- `price0TextFlag`,
- `price1`,
- `price1Grade`,
- `price1Text`,
- `price1TextFlag`,
- `price8`,
- `price8Grade`,
- `price8Text`,
- `price8TextFlag`,
- `ladderPriceFlag`,
- `price2`,
- `price3`,
- `price4`,
- `price5`,
- `price6`,
- `price7`,
- `fee`,
- `stock`,
- `hasSkuFlag`,
- `mainImage`,
- `propertiesInfo`,
- `addTime`,
- `updateTime`,
- `classifyAddTime`,
- `weekSellNumber`,
- `beforeValidFlag`,
- `validFlag`,
- `favoriteTimes`,
- `commentScore`,
- `commentTimes`,
- `selfRecommendFlag`,
- `sysRecommendFlag`,
- `sortIndex`,
- `featuredFlag`,
- `featuredSortIndex`,
- `productCode`,
- `rate1`,
- `rate2`,
- `unit`,
- `synToERPFlag`,
- `allAreaFlag`,
- `provinceIDs`,
- `serviceNumber`,
- `maxBuyNumber`,
- `virtualFlag`,
- `minBuyNumber`,
- `packageCount`,
- `byFlag`,
- `normalProductFlag`,
- `wholeSaleProductFlag`,
- `promotionProductFlag`,
- `groupBuyProductFlag`,
- `step`,
- `speCommisionFlag`,
- `speCommision`,
- `videourl`,
- `props`,
- `providers`,
- `serviceCommissionRatio`,
- `reCommissionRatio`,
- `pushToERPName`,
- `prodBeans`,
- `useBeansFlag`,
- `privateFlag`,
- `invisibleServiceProviderIDs`,
- `displayOnCRMFlag`,
- `needServiceFlag`,
- `actFlag`,
- `actStatus`,
- `actSort`,
- `actPrice0`,
- `actPrice1`,
- `actPrice2`,
- `actPrice3`,
- `actPrice4`,
- `actPrice5`,
- `actPrice6`,
- `actPrice7`,
- `actType`,
- `actCreateTime`,
- `actFullReduceAmount`,
- `actReduceAmount`,
- `visibility`,
- `actFullGiftAmount`,
- `actBuyGiftNum`,
- `beginTime`,
- `endTime`,
- `shopIndexModuleID`,
- `onlineTime`,
- `downlineTime`,
- `freePostFlag`,
- `crmBigTypeId`,
- `crmSmallTypeId`,
- `costPrice`,
- `costProportional`,
- `costCheckFlag`,
- `precisehKey`,
- `docBoost`,
- `cmbeanFlag`,
- `cmbeanPrice`,
- `cmbeanSort`,
- `tags`,
- `surplusTime`,
- `productType`,
- `machineType`,
- `qualificationImg`,
- `includedTax`,
- `taxPoint`,
- `invoiceType`,
- `recommendType`,
- `priceType`,
- `combinationID`,
- `combinationSort`
- )
- VALUES
- (
- #{brandID},
- #{tinyTypeID},
- #{classifyId},
- <if test="productCategory != null and productCategory != '' ">
- #{productCategory},
- </if>
- #{preferredFlag},
- #{selfTypeID},
- #{shopID},
- #{name},
- #{aliasName},
- #{searchKey},
- #{productRemarks},
- #{normalPrice},
- #{price},
- #{highestUserLevelPrice},
- #{lowestUserLevelPrice},
- #{lowestUserLevelID},
- #{price0},
- #{price0Grade},
- #{price0Text},
- #{price0TextFlag},
- #{price1},
- #{price1Grade},
- #{price1Text},
- #{price1TextFlag},
- #{price8},
- #{price8Grade},
- #{price8Text},
- #{price8TextFlag},
- #{ladderPriceFlag},
- #{price2},
- #{price3},
- #{price4},
- #{price5},
- #{price6},
- #{price7},
- #{fee},
- #{stock},
- #{hasSkuFlag},
- #{mainImage},
- #{propertiesInfo},
- #{addTime},
- #{updateTime},
- #{classifyAddTime},
- #{weekSellNumber},
- #{beforeValidFlag},
- #{validFlag},
- #{favoriteTimes},
- #{commentScore},
- #{commentTimes},
- #{selfRecommendFlag},
- #{sysRecommendFlag},
- #{sortIndex},
- #{featuredFlag},
- #{featuredSortIndex},
- #{productCode},
- #{rate1},
- #{rate2},
- #{unit},
- #{synToERPFlag},
- #{allAreaFlag},
- #{provinceIDs},
- #{serviceNumber},
- #{maxBuyNumber},
- #{virtualFlag},
- #{minBuyNumber},
- #{packageCount},
- #{byFlag},
- #{normalProductFlag},
- #{wholeSaleProductFlag},
- #{promotionProductFlag},
- #{groupBuyProductFlag},
- #{step},
- #{speCommisionFlag},
- #{speCommision},
- #{videourl},
- #{props},
- #{providers},
- #{serviceCommissionRatio},
- #{reCommissionRatio},
- #{pushToERPName},
- #{prodBeans},
- #{useBeansFlag},
- #{privateFlag},
- #{invisibleServiceProviderIDs},
- #{displayOnCRMFlag},
- #{needServiceFlag},
- #{actFlag},
- #{actStatus},
- #{actSort},
- #{actPrice0},
- #{actPrice1},
- #{actPrice2},
- #{actPrice3},
- #{actPrice4},
- #{actPrice5},
- #{actPrice6},
- #{actPrice7},
- #{actType},
- #{actCreateTime},
- #{actFullReduceAmount},
- #{actReduceAmount},
- #{visibility},
- #{actFullGiftAmount},
- #{actBuyGiftNum},
- #{beginTime},
- #{endTime},
- #{shopIndexModuleID},
- #{onlineTime},
- #{downlineTime},
- #{freePostFlag},
- #{crmBigTypeId},
- #{crmSmallTypeId},
- #{costPrice},
- #{costProportional},
- #{costCheckFlag},
- #{precisehKey},
- #{docBoost},
- #{cmbeanFlag},
- #{cmbeanPrice},
- #{cmbeanSort},
- #{tags},
- #{surplusTime},
- #{productType},
- #{machineType},
- #{qualificationImg},
- #{includedTax},
- #{taxPoint},
- #{invoiceType},
- #{recommendType},
- #{priceType},
- #{combinationID},
- #{combinationSort}
- )
- </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>
- <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 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 a.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 a.validFlag != 0
- AND csrp.delFlag =0
- ORDER BY csrp.sort DESC
- </select>
- <select id="relatedProductList" resultType="product">
- select
- <include refid="productColumns"/>,
- b.name AS brandName,
- (case when a.tinyTypeID = #{tinyTypeID} then '1' else '0' end) AS defaultType
- FROM product a
- <include refid="productJoins"/>
- left join brand b on b.brandID = a.brandID
- WHERE (a.productID
- IN (select productID from product_custom_classification where tinyTypeID = #{tinyTypeID})
- OR a.tinyTypeID = #{tinyTypeID})
- <if test="name != null and name != ''">
- AND a.name like concat('%', #{name} ,'%')
- </if>
- <if test="validFlag !=null and validFlag !=''">
- AND a.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.validFlag != 0
- and a.productCategory = 1
- </select>
- <delete id="deleteProductCustomClassification">
- delete from product_custom_classification
- where productID = #{productID} and tinyTypeID = #{tinyTypeID}
- </delete>
- <delete id="deleteLadderPriceByProductId">
- DELETE FROM product_ladder_price where productId = #{productID}
- </delete>
- <delete id="deleteLadderPriceById">
- DELETE FROM product_ladder_price where id = #{id}
- </delete>
- <select id="toAddProductCustomClassificationList" resultType="product">
- select
- <include refid="productColumns"/>,
- b.name AS brandName
- FROM product a
- <include refid="productJoins"/>
- left join cm_brand b on b.id = a.brandID
- WHERE a.tinyTypeID != #{tinyTypeID}
- and not exists
- (select pcc.id from product_custom_classification pcc where pcc.productID = a.productID and pcc.tinyTypeID = #{tinyTypeID})
- and a.validFlag = '2'
- and (select count(id) from product_custom_classification pcc where pcc.productID = a.productID) <![CDATA[ < ]]> 5
- <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>
- </select>
- <select id="toAddProductList" resultType="product">
- select
- a.*,
- b.name AS brandName,
- s.name AS shopName
- FROM product a
- 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 a.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
- </select>
- <select id="getProductTypes" resultType="com.caimei.modules.product.entity.ProductCustomClassification">
- select *
- from product_custom_classification where productID = #{productID}
- </select>
- <select id="findRecommendActivityListPage" resultType="Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- <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="cmbeanFlag != null and cmbeanFlag != ''">
- AND a.cmbeanFlag = #{cmbeanFlag}
- </if>
- <if test="actFlag !=null and actFlag !=''">
- AND a.actFlag=#{actFlag}
- </if>
- <if test="sqlMap !=null and sqlMap !=''">
- ${sqlMap.dsf}
- </if>
- AND a.validFlag = 2
- AND (a.actType != 3 or a.`actType` IS NULL or (a.actType = 3 and STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i') <![CDATA[ < ]]> STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i')))
- AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
- and a.productCategory = 1
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
- </otherwise>
- </choose>
- </select>
- <select id="findGroupActivityListPage" resultType="Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- <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="cmbeanFlag != null and cmbeanFlag != ''">
- AND a.cmbeanFlag = #{cmbeanFlag}
- </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 a.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>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by case WHEN a.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.unit AS unit,
- 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.unit AS unit,
- 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>
- limit 0, 10
- </select>
- <update id="updateRecommendType">
- UPDATE product SET
- recommendType = #{recommendType}
- WHERE productID = #{productID}
- </update>
- <update id="updateBrnadId">
- UPDATE product_new
- set brandID = #{brandID}
- WHERE productID = #{productID}
- </update>
- <update id="updateProductByBrandId">
- UPDATE product
- set brandID = null
- WHERE brandID = #{brandId}
- </update>
- <update id="updateTinyType">
- UPDATE product_new
- set tinyTypeID = #{tinyTypeID}
- WHERE productID = #{productID}
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
- update product
- <set>
- <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="selfTypeID != null and selfTypeID !=''">
- selfTypeID = #{selfTypeID},
- </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="normalPrice != null and normalPrice !=''">
- normalPrice = #{normalPrice},
- </if>
- <if test="price != null and price !=''">
- price = #{price},
- </if>
- <if test="highestUserLevelPrice != null and highestUserLevelPrice !=''">
- highestUserLevelPrice = #{highestUserLevelPrice},
- </if>
- <if test="lowestUserLevelPrice != null and lowestUserLevelPrice !=''">
- lowestUserLevelPrice = #{lowestUserLevelPrice},
- </if>
- <if test="lowestUserLevelID != null and lowestUserLevelID !=''">
- lowestUserLevelID = #{lowestUserLevelID},
- </if>
- <if test="price0 != null and price0 !=''">
- price0 = #{price0},
- </if>
- <if test="price0Grade != null and price0Grade !=''">
- price0Grade = #{price0Grade},
- </if>
- <if test="price0Text != null and price0Text !=''">
- price0Text = #{price0Text},
- </if>
- <if test="price0TextFlag != null and price0TextFlag !=''">
- price0TextFlag = #{price0TextFlag},
- </if>
- <if test="price1 != null and price1 !=''">
- price1 = #{price1},
- </if>
- <if test="price1Grade != null and price1Grade !=''">
- price1Grade = #{price1Grade},
- </if>
- <if test="price1Text != null and price1Text !=''">
- price1Text = #{price1Text},
- </if>
- <if test="price1TextFlag != null and price1TextFlag !=''">
- price1TextFlag = #{price1TextFlag},
- </if>
- <if test="price8 != null and price8 !=''">
- price8 = #{price8},
- </if>
- <if test="price8Grade != null and price8Grade !=''">
- price8Grade = #{price8Grade},
- </if>
- <if test="price8Text != null and price8Text !=''">
- price8Text = #{price8Text},
- </if>
- <if test="price8TextFlag != null and price8TextFlag !=''">
- price8TextFlag = #{price8TextFlag},
- </if>
- <if test="ladderPriceFlag != null and ladderPriceFlag !=''">
- ladderPriceFlag = #{ladderPriceFlag},
- </if>
- <if test="price2 != null and price2 !=''">
- price2 = #{price2},
- </if>
- <if test="price3 != null and price3 !=''">
- price3 = #{price3},
- </if>
- <if test="price4 != null and price4 !=''">
- price4 = #{price4},
- </if>
- <if test="price5 != null and price5 !=''">
- price5 = #{price5},
- </if>
- <if test="price6 != null and price6 !=''">
- price6 = #{price6},
- </if>
- <if test="price7 != null and price7 !=''">
- price7 = #{price7},
- </if>
- <if test="fee != null and fee !=''">
- fee = #{fee},
- </if>
- <if test="stock != null and stock !=''">
- stock = #{stock},
- </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="rate1 != null and rate1 !=''">
- rate1 = #{rate1},
- </if>
- <if test="rate2 != null and rate2 !=''">
- rate2 = #{rate2},
- </if>
- <if test="unit != null and unit !=''">
- unit = #{unit},
- </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="maxBuyNumber != null and maxBuyNumber !=''">
- maxBuyNumber = #{maxBuyNumber},
- </if>
- <if test="virtualFlag != null and virtualFlag !=''">
- virtualFlag = #{virtualFlag},
- </if>
- <if test="minBuyNumber != null and minBuyNumber !=''">
- minBuyNumber = #{minBuyNumber},
- </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="speCommisionFlag != null and speCommisionFlag !=''">
- speCommisionFlag = #{speCommisionFlag},
- </if>
- <if test="speCommision != null and speCommision !=''">
- speCommision = #{speCommision},
- </if>
- <if test="videourl != null and videourl !=''">
- videourl = #{videourl},
- </if>
- <if test="props != null and props !=''">
- props = #{props},
- </if>
- <if test="providers != null and providers !=''">
- providers = #{providers},
- </if>
- <if test="serviceCommissionRatio != null and serviceCommissionRatio !=''">
- serviceCommissionRatio = #{serviceCommissionRatio},
- </if>
- <if test="reCommissionRatio != null and reCommissionRatio !=''">
- reCommissionRatio = #{reCommissionRatio},
- </if>
- <if test="pushToERPName != null and pushToERPName !=''">
- pushToERPName = #{pushToERPName},
- </if>
- <if test="prodBeans != null and prodBeans !=''">
- prodBeans = #{prodBeans},
- </if>
- <if test="useBeansFlag != null and useBeansFlag !=''">
- useBeansFlag = #{useBeansFlag},
- </if>
- <if test="privateFlag != null and privateFlag !=''">
- privateFlag = #{privateFlag},
- </if>
- <if test="invisibleServiceProviderIDs != null and invisibleServiceProviderIDs !=''">
- invisibleServiceProviderIDs = #{invisibleServiceProviderIDs},
- </if>
- <if test="displayOnCRMFlag != null and displayOnCRMFlag !=''">
- displayOnCRMFlag = #{displayOnCRMFlag},
- </if>
- <if test="needServiceFlag != null and needServiceFlag !=''">
- needServiceFlag = #{needServiceFlag},
- </if>
- <if test="actFlag != null and actFlag !=''">
- actFlag = #{actFlag},
- </if>
- <if test="actSort != null and actSort !=''">
- actSort = #{actSort},
- </if>
- <if test="actPrice0 != null and actPrice0 !=''">
- actPrice0 = #{actPrice0},
- </if>
- <if test="actPrice1 != null and actPrice1 !=''">
- actPrice1 = #{actPrice1},
- </if>
- <if test="actPrice2 != null and actPrice2 !=''">
- actPrice2 = #{actPrice2},
- </if>
- <if test="actPrice3 != null and actPrice3 !=''">
- actPrice3 = #{actPrice3},
- </if>
- <if test="actPrice4 != null and actPrice4 !=''">
- actPrice4 = #{actPrice4},
- </if>
- <if test="actPrice5 != null and actPrice5 !=''">
- actPrice5 = #{actPrice5},
- </if>
- <if test="actPrice6 != null and actPrice6 !=''">
- actPrice6 = #{actPrice6},
- </if>
- <if test="actPrice7 != null and actPrice7 !=''">
- actPrice7 = #{actPrice7},
- </if>
- <if test="actType != null and actType !=''">
- actType = #{actType},
- </if>
- <if test="actCreateTime != null and actCreateTime !=''">
- actCreateTime = #{actCreateTime},
- </if>
- <if test="beginTime != null and beginTime !=''">
- beginTime = #{beginTime},
- </if>
- <if test="endTime != null and endTime !=''">
- endTime = #{endTime},
- </if>
- <if test="shopIndexModuleID != null and shopIndexModuleID !=''">
- shopIndexModuleID = #{shopIndexModuleID},
- </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="crmBigTypeId != null and crmBigTypeId !=''">
- crmBigTypeId = #{crmBigTypeId},
- </if>
- <if test="crmSmallTypeId != null and crmSmallTypeId !=''">
- crmSmallTypeId = #{crmSmallTypeId},
- </if>
- <if test="costPrice != null and costPrice != ''">
- costPrice = #{costPrice},
- </if>
- <if test="costProportional != null and costProportional !=''">
- costProportional = #{costProportional},
- </if>
- <if test="costCheckFlag != null and costCheckFlag !=''">
- costCheckFlag = #{costCheckFlag},
- </if>
- <if test="precisehKey != null and precisehKey !=''">
- precisehKey = #{precisehKey},
- </if>
- <if test="docBoost != null and docBoost !=''">
- docBoost = #{docBoost},
- </if>
- <if test="cmbeanFlag != null and cmbeanFlag !=''">
- cmbeanFlag = #{cmbeanFlag},
- </if>
- <if test="cmbeanPrice != null and cmbeanPrice !=''">
- cmbeanPrice = #{cmbeanPrice},
- </if>
- <if test="cmbeanSort != null and cmbeanSort !=''">
- cmbeanSort = #{cmbeanSort},
- </if>
- <if test="actBuyGiftNum != null and actBuyGiftNum !=''">
- actBuyGiftNum = #{actBuyGiftNum},
- </if>
- <if test="actFullGiftAmount != null and actFullGiftAmount !=''">
- actFullGiftAmount = #{actFullGiftAmount},
- </if>
- <if test="actFullReduceAmount != null and actFullReduceAmount !=''">
- actFullReduceAmount = #{actFullReduceAmount},
- </if>
- <if test="actReduceAmount != null and actReduceAmount !=''">
- actReduceAmount = #{actReduceAmount},
- </if>
- <if test="visibility != null and visibility !=''">
- visibility = #{visibility},
- </if>
- <if test="surplusTime != null and surplusTime !=''">
- surplusTime = #{surplusTime},
- </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="priceType != null and priceType !=''">
- priceType = #{priceType},
- </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>
- </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="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>
- <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_new t LEFT JOIN smalltype_new s on t.smallTypeID = s.smallTypeID LEFT JOIN bigtype_new 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.unit AS unit,
- 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.unit AS unit,
- p.mainImage AS img,
- s.name AS shopName,
- p.productCategory as "productCategory"
- from product p
- left join shop s on s.shopID = p.shopID
- where p.productID = #{productID}
- AND p.validFlag = '2'
- </select>
- <select id="querySecondHandRecommend" resultType="CmSecondHandRecommendVo">
- select
- p.productID AS id,
- 1 AS type,
- p.name AS name,
- p.unit AS unit,
- p.mainImage AS img,
- s.name AS shopName,
- p.productCategory as "productCategory"
- from product p
- 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 p.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="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 a.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>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by case WHEN a.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 shop s on p.shopID = s.shopID
- <where>
- (p.actFlag=0 or p.actType is null) and p.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 a.validFlag=#{validFlag}
- </if>
- <if test="productCategory !=null and productCategory !=''">
- AND a.productCategory=#{productCategory}
- </if>
- <if test="ids.size() > 0">
- AND a.productID NOT IN
- <foreach collection="ids" close=")" separator="," open="(" item="id">
- #{id}
- </foreach>
- </if>
- </where>
- <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>
- </mapper>
|