ProductMapper.xml 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.caimei.modules.product.dao.ProductDao">
  4. <resultMap id="productModelResultMap" type="com.caimei.modules.product.entity.Product">
  5. <id property="id" column="id"/>
  6. <result property="name" column="name"/>
  7. </resultMap>
  8. <sql id="productColumns">
  9. a.productID AS "id",
  10. a.productID AS "productID",
  11. a.brandID AS "brandID",
  12. a.bigTypeID AS "bigTypeID",
  13. ifnull(a.smallTypeID,-1) AS "smallTypeID",
  14. ifnull(a.tinyTypeID,-1) AS "tinyTypeID",
  15. a.selfTypeID AS "selfTypeID",
  16. a.preferredFlag AS "preferredFlag",
  17. a.shopID AS "shopID",
  18. a.name AS "name",
  19. a.searchKey AS "searchKey",
  20. a.combinationID AS "combinationID",
  21. a.productRemarks AS "productRemarks",
  22. a.normalPrice AS "normalPrice",
  23. a.price AS "price",
  24. a.highestUserLevelPrice AS "highestUserLevelPrice",
  25. a.lowestUserLevelPrice AS "lowestUserLevelPrice",
  26. a.lowestUserLevelID AS "lowestUserLevelID",
  27. a.price0 AS "price0",
  28. a.price0Text AS "price0Text",
  29. a.price0TextFlag AS "price0TextFlag",
  30. a.price1 AS "price1",
  31. a.price1Text AS "price1Text",
  32. a.price1TextFlag AS "price1TextFlag",
  33. a.price8 AS "price8",
  34. a.price8Text AS "price8Text",
  35. a.price8TextFlag AS "price8TextFlag",
  36. a.ladderPriceFlag AS "ladderPriceFlag",
  37. a.price2 AS "price2",
  38. a.price3 AS "price3",
  39. a.price4 AS "price4",
  40. a.price5 AS "price5",
  41. a.price6 AS "price6",
  42. a.price7 AS "price7",
  43. a.fee AS "fee",
  44. a.stock AS "stock",
  45. a.hasSkuFlag AS "hasSkuFlag",
  46. a.mainImage AS "mainImage",
  47. a.propertiesInfo AS "propertiesInfo",
  48. a.addTime AS "addTime",
  49. a.updateTime AS "updateTime",
  50. a.sellNumber AS "sellNumber",
  51. a.weekSellNumber AS "weekSellNumber",
  52. a.beforeValidFlag AS "beforeValidFlag",
  53. a.validFlag AS "validFlag",
  54. a.favoriteTimes AS "favoriteTimes",
  55. a.commentScore AS "commentScore",
  56. a.commentTimes AS "commentTimes",
  57. a.selfRecommendFlag AS "selfRecommendFlag",
  58. a.sysRecommendFlag AS "sysRecommendFlag",
  59. a.sortIndex AS "sortIndex",
  60. a.featuredFlag AS "featuredFlag",
  61. a.featuredSortIndex AS "featuredSortIndex",
  62. a.productCode AS "productCode",
  63. a.rate1 AS "rate1",
  64. a.rate2 AS "rate2",
  65. a.unit AS "unit",
  66. a.synToERPFlag AS "synToERPFlag",
  67. a.allAreaFlag AS "allAreaFlag",
  68. a.provinceIDs AS "provinceIDs",
  69. a.serviceNumber AS "serviceNumber",
  70. a.maxBuyNumber AS "maxBuyNumber",
  71. a.virtualFlag AS "virtualFlag",
  72. a.minBuyNumber AS "minBuyNumber",
  73. a.packageCount AS "packageCount",
  74. a.byFlag AS "byFlag",
  75. a.normalProductFlag AS "normalProductFlag",
  76. a.wholeSaleProductFlag AS "wholeSaleProductFlag",
  77. a.promotionProductFlag AS "promotionProductFlag",
  78. a.groupBuyProductFlag AS "groupBuyProductFlag",
  79. a.step AS "step",
  80. a.speCommisionFlag AS "speCommisionFlag",
  81. a.speCommision AS "speCommision",
  82. a.videourl AS "videourl",
  83. a.props AS "props",
  84. a.providers AS "providers",
  85. a.serviceCommissionRatio AS "serviceCommissionRatio",
  86. a.reCommissionRatio AS "reCommissionRatio",
  87. a.pushToERPName AS "pushToERPName",
  88. a.prodBeans AS "prodBeans",
  89. a.useBeansFlag AS "useBeansFlag",
  90. a.privateFlag AS "privateFlag",
  91. a.invisibleServiceProviderIDs AS "invisibleServiceProviderIDs",
  92. a.displayOnCRMFlag AS "displayOnCRMFlag",
  93. a.needServiceFlag AS "needServiceFlag",
  94. a.actStatus AS "actStatus",
  95. a.actPrice0 AS "actPrice0",
  96. a.actPrice1 AS "actPrice1",
  97. a.actPrice2 AS "actPrice2",
  98. a.actPrice3 AS "actPrice3",
  99. a.actPrice4 AS "actPrice4",
  100. a.actPrice5 AS "actPrice5",
  101. a.actPrice6 AS "actPrice6",
  102. a.actPrice7 AS "actPrice7",
  103. a.beginTime AS "beginTime",
  104. a.endTime AS "endTime",
  105. a.actFlag AS "actFlag",
  106. a.actType AS "actType",
  107. a.actFullReduceAmount AS "actFullReduceAmount",
  108. a.actReduceAmount AS "actReduceAmount",
  109. a.actFullGiftAmount AS "actFullGiftAmount",
  110. a.actBuyGiftNum AS "actBuyGiftNum",
  111. a.onlineTime AS "onlineTime",
  112. a.downlineTime AS "downlineTime",
  113. a.shopIndexModuleID AS "shopIndexModuleID",
  114. a.freePostFlag AS "freePostFlag",
  115. a.crmBigTypeId AS "crmBigTypeId",
  116. a.crmSmallTypeId AS "crmSmallTypeId",
  117. a.costPrice AS "costPrice",
  118. a.costProportional AS "costProportional",
  119. a.costCheckFlag AS "costCheckFlag",
  120. a.precisehKey AS "precisehKey",
  121. a.docBoost AS "docBoost",
  122. a.cmbeanFlag AS "cmbeanFlag",
  123. a.cmbeanPrice AS "cmbeanPrice",
  124. a.cmbeanSort AS "cmbeanSort",
  125. s.name AS "shopName",
  126. a.actSort AS "actSort",
  127. a.actCreateTime AS "actCreateTime",
  128. a.recommendType AS "recommendType",
  129. a.aliasName as "aliasName",
  130. a.price0Grade as "price0Grade",
  131. a.price1Grade as "price1Grade",
  132. a.price8Grade as "price8Grade",
  133. a.visibility as "visibility",
  134. a.surplusTime as "surplusTime",
  135. a.productType as "productType",
  136. a.qualificationImg as "qualificationImg",
  137. a.includedTax as "includedTax",
  138. a.invoiceType as "invoiceType",
  139. a.taxPoint as "taxPoint",
  140. a.priceType as "priceType",
  141. a.tags as "tags",
  142. a.machineType as "machineType"
  143. </sql>
  144. <sql id="productJoins">
  145. LEFT JOIN shop s on s.shopID = a.shopID
  146. </sql>
  147. <sql id="ActivityJoins">
  148. LEFT JOIN shop s on s.shopID = a.shopID
  149. INNER JOIN tinytype AS b ON a.`tinyTypeID` = b.`tinyTypeID`
  150. INNER JOIN smalltype AS c ON a.`smallTypeID` = c.`smallTypeID`
  151. INNER JOIN bigtype AS d ON a.`bigTypeID` = d.`bigTypeID`
  152. </sql>
  153. <update id="saveSort">
  154. UPDATE cm_search_recommend_product SET
  155. sort = #{sort}
  156. WHERE id = #{id}
  157. </update>
  158. <select id="findLadderPriceByNum" resultType="Integer">
  159. select IFNULL(buyNum,1)
  160. FROM product_ladder_price
  161. WHERE userType = 3 and ladderNum = 1 and delFlag = 0 and productID = #{productID}
  162. </select>
  163. <select id="get" resultType="Product">
  164. SELECT
  165. <include refid="productColumns"/>
  166. FROM product a
  167. <include refid="productJoins"/>
  168. WHERE a.productID = #{id}
  169. </select>
  170. <select id="getAllExistsProductList" resultType="Integer">
  171. SELECT
  172. a.productID
  173. FROM cm_mall_organize_products a
  174. WHERE a.delFlag = 0 and a.organizeID = #{organizeID}
  175. </select>
  176. <select id="findRecommendPage" resultType="Product">
  177. SELECT
  178. <include refid="productColumns"/>
  179. FROM product a
  180. <include refid="productJoins"/>
  181. <where>
  182. <if test="productID !=null and productID !=''">
  183. AND a.productID=#{productID}
  184. </if>
  185. <if test="tinyTypeID != null and tinyTypeID != ''">
  186. AND a.tinyTypeID = #{tinyTypeID}
  187. </if>
  188. <if test="shopID != null and shopID != ''">
  189. AND a.shopID = #{shopID}
  190. </if>
  191. <if test="name != null and name != ''">
  192. AND a.name LIKE
  193. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  194. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  195. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  196. </if>
  197. <if test="shopName != null and shopName != ''">
  198. AND s.name LIKE
  199. <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
  200. <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
  201. <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
  202. </if>
  203. <if test="cmbeanFlag != null and cmbeanFlag != ''">
  204. AND a.cmbeanFlag = #{cmbeanFlag}
  205. </if>
  206. <if test="validFlag !=null and validFlag !=''">
  207. AND a.validFlag=#{validFlag}
  208. </if>
  209. <if test="actFlag !=null and actFlag !=''">
  210. AND a.actFlag=#{actFlag}
  211. </if>
  212. <if test="speCommisionFlag !=null and speCommisionFlag !=''">
  213. AND a.speCommisionFlag=#{speCommisionFlag}
  214. </if>
  215. <if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
  216. AND a.displayOnCRMFlag=#{displayOnCRMFlag}
  217. </if>
  218. <if test="crmBigTypeId !=null and crmBigTypeId !=''">
  219. AND a.crmBigTypeId=#{crmBigTypeId}
  220. </if>
  221. <if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
  222. AND a.crmSmallTypeId=#{crmSmallTypeId}
  223. </if>
  224. <if test="sqlMap !=null and sqlMap !=''">
  225. ${sqlMap.dsf}
  226. </if>
  227. <choose>
  228. <when test="actType != null and actType != ''">
  229. AND a.actType = #{actType}
  230. </when>
  231. <otherwise>
  232. AND a.actType != 3
  233. </otherwise>
  234. </choose>
  235. AND a.validFlag != 0
  236. AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
  237. and a.productCategory = 1
  238. </where>
  239. <choose>
  240. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  241. ORDER BY ${page.orderBy}
  242. </when>
  243. <otherwise>
  244. order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
  245. </otherwise>
  246. </choose>
  247. </select>
  248. <!--小程序商品获取采美2已上架 3已下架 9已冻结的商品-->
  249. <select id="findListBuyMall" resultType="Product">
  250. SELECT
  251. <include refid="productColumns"/>
  252. FROM product a
  253. <include refid="productJoins"/>
  254. <where>
  255. <if test="productID !=null and productID !=''">
  256. AND a.productID=#{productID}
  257. </if>
  258. <if test="name != null and name != ''">
  259. AND a.name LIKE
  260. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  261. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  262. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  263. </if>
  264. <if test="shopName != null and shopName != ''">
  265. AND s.name LIKE
  266. <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
  267. <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
  268. <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
  269. </if>
  270. AND a.validFlag in (2,3,9)
  271. and a.productCategory = 1
  272. </where>
  273. <choose>
  274. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  275. ORDER BY ${page.orderBy}
  276. </when>
  277. <otherwise>
  278. order by a.productID desc
  279. </otherwise>
  280. </choose>
  281. </select>
  282. <select id="findList" resultType="Product">
  283. SELECT
  284. <include refid="productColumns"/>
  285. FROM product a
  286. <include refid="productJoins"/>
  287. <where>
  288. <if test="id !=null and id !=''">
  289. AND a.productID=#{id}
  290. </if>
  291. <if test="tinyTypeID != null and tinyTypeID != ''">
  292. AND a.tinyTypeID = #{tinyTypeID}
  293. </if>
  294. <if test="shopID != null and shopID != ''">
  295. AND a.shopID = #{shopID}
  296. </if>
  297. <if test="preferredFlag != null and preferredFlag != ''and preferredFlag != 0">
  298. <if test="preferredFlag/100>=1">
  299. AND a.preferredFlag in (100,101,110,111)
  300. </if>
  301. <if test="(preferredFlag%100)/10>=1">
  302. AND a.preferredFlag in (10,11,110,111)
  303. </if>
  304. <if test="preferredFlag%10>=1">
  305. AND a.preferredFlag in (1,11,101,111)
  306. </if>
  307. </if>
  308. <if test="name != null and name != ''">
  309. AND a.name LIKE
  310. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  311. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  312. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  313. </if>
  314. <if test="shopName != null and shopName != ''">
  315. AND s.name LIKE
  316. <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
  317. <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
  318. <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
  319. </if>
  320. <if test="cmbeanFlag != null and cmbeanFlag != ''">
  321. AND a.cmbeanFlag = #{cmbeanFlag}
  322. </if>
  323. <if test="validFlag !=null and validFlag !=''">
  324. AND a.validFlag=#{validFlag}
  325. </if>
  326. <if test="actFlag !=null and actFlag !=''">
  327. AND a.actFlag=#{actFlag}
  328. </if>
  329. <if test="actType !=null and actType !=''">
  330. AND a.actType=#{actType}
  331. </if>
  332. <if test="speCommisionFlag !=null and speCommisionFlag !=''">
  333. AND a.speCommisionFlag=#{speCommisionFlag}
  334. </if>
  335. <if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
  336. AND a.displayOnCRMFlag=#{displayOnCRMFlag}
  337. </if>
  338. <if test="crmBigTypeId !=null and crmBigTypeId !=''">
  339. AND a.crmBigTypeId=#{crmBigTypeId}
  340. </if>
  341. <if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
  342. AND a.crmSmallTypeId=#{crmSmallTypeId}
  343. </if>
  344. <if test="sqlMap !=null and sqlMap !=''">
  345. ${sqlMap.dsf}
  346. </if>
  347. AND a.validFlag != 0
  348. AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
  349. and a.productCategory = 1
  350. </where>
  351. <choose>
  352. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  353. ORDER BY ${page.orderBy}
  354. </when>
  355. <otherwise>
  356. order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
  357. </otherwise>
  358. </choose>
  359. </select>
  360. <select id="findAllList" resultType="Product">
  361. SELECT
  362. <include refid="productColumns"/>
  363. FROM product a
  364. <include refid="productJoins"/>
  365. <where>
  366. a.productCategory = 1
  367. </where>
  368. <choose>
  369. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  370. ORDER BY ${page.orderBy}
  371. </when>
  372. <otherwise>
  373. </otherwise>
  374. </choose>
  375. </select>
  376. <insert id="insert" parameterType="Product" keyProperty="id" useGeneratedKeys="true">
  377. INSERT INTO product(
  378. productID,
  379. brandID,
  380. bigTypeID,
  381. smallTypeID,
  382. tinyTypeID,
  383. selfTypeID,
  384. shopID,
  385. name,
  386. searchKey,
  387. normalPrice,
  388. price,
  389. highestUserLevelPrice,
  390. lowestUserLevelPrice,
  391. lowestUserLevelID,
  392. price0,
  393. price0Text,
  394. price0TextFlag,
  395. price1,
  396. price1Text,
  397. price1TextFlag,
  398. price8,
  399. price8Text,
  400. price8TextFlag,
  401. ladderPriceFlag,
  402. price2,
  403. price3,
  404. price4,
  405. price5,
  406. price6,
  407. price7,
  408. fee,
  409. stock,
  410. hasSkuFlag,
  411. mainImage,
  412. propertiesInfo,
  413. addTime,
  414. updateTime,
  415. weekSellNumber,
  416. beforeValidFlag,
  417. validFlag,
  418. favoriteTimes,
  419. commentScore,
  420. commentTimes,
  421. selfRecommendFlag,
  422. sysRecommendFlag,
  423. sortIndex,
  424. featuredFlag,
  425. featuredSortIndex,
  426. productCode,
  427. rate1,
  428. rate2,
  429. unit,
  430. synToERPFlag,
  431. allAreaFlag,
  432. provinceIDs,
  433. serviceNumber,
  434. maxBuyNumber,
  435. virtualFlag,
  436. minBuyNumber,
  437. packageCount,
  438. byFlag,
  439. normalProductFlag,
  440. wholeSaleProductFlag,
  441. promotionProductFlag,
  442. groupBuyProductFlag,
  443. step,
  444. speCommisionFlag,
  445. speCommision,
  446. videourl,
  447. props,
  448. providers,
  449. serviceCommissionRatio,
  450. reCommissionRatio,
  451. pushToERPName,
  452. prodBeans,
  453. useBeansFlag,
  454. privateFlag,
  455. invisibleServiceProviderIDs,
  456. displayOnCRMFlag,
  457. needServiceFlag,
  458. actPrice0,
  459. actPrice1,
  460. actPrice2,
  461. actPrice3,
  462. actPrice4,
  463. actPrice5,
  464. actPrice6,
  465. actPrice7,
  466. beginTime,
  467. endTime,
  468. actFlag,
  469. actType,
  470. actFullReduceAmount,
  471. actReduceAmount,
  472. actFullGiftAmount,
  473. actBuyGiftNum,
  474. onlineTime,
  475. downlineTime,
  476. shopIndexModuleID,
  477. freePostFlag,
  478. crmBigTypeId,
  479. crmSmallTypeId,
  480. costPrice,
  481. costProportional,
  482. costCheckFlag,
  483. precisehKey,
  484. docBoost,
  485. cmbeanFlag,
  486. cmbeanPrice,
  487. cmbeanSort
  488. ) VALUES (
  489. #{id},
  490. #{brandID},
  491. #{bigTypeID},
  492. #{smallTypeID},
  493. #{tinyTypeID},
  494. #{selfTypeID},
  495. #{shopID},
  496. #{name},
  497. #{searchKey},
  498. #{normalPrice},
  499. #{price},
  500. #{highestUserLevelPrice},
  501. #{lowestUserLevelPrice},
  502. #{lowestUserLevelID},
  503. #{price0},
  504. #{price0Text},
  505. #{price0TextFlag},
  506. #{price1},
  507. #{price1Text},
  508. #{price1TextFlag},
  509. #{price8},
  510. #{price8Text},
  511. #{price8TextFlag},
  512. #{ladderPriceFlag},
  513. #{price2},
  514. #{price3},
  515. #{price4},
  516. #{price5},
  517. #{price6},
  518. #{price7},
  519. #{fee},
  520. #{stock},
  521. #{hasSkuFlag},
  522. #{mainImage},
  523. #{propertiesInfo},
  524. #{addTime},
  525. #{updateTime},
  526. #{weekSellNumber},
  527. #{beforeValidFlag},
  528. #{validFlag},
  529. #{favoriteTimes},
  530. #{commentScore},
  531. #{commentTimes},
  532. #{selfRecommendFlag},
  533. #{sysRecommendFlag},
  534. #{sortIndex},
  535. #{featuredFlag},
  536. #{featuredSortIndex},
  537. #{productCode},
  538. #{rate1},
  539. #{rate2},
  540. #{unit},
  541. #{synToERPFlag},
  542. #{allAreaFlag},
  543. #{provinceIDs},
  544. #{serviceNumber},
  545. #{maxBuyNumber},
  546. #{virtualFlag},
  547. #{minBuyNumber},
  548. #{packageCount},
  549. #{byFlag},
  550. #{normalProductFlag},
  551. #{wholeSaleProductFlag},
  552. #{promotionProductFlag},
  553. #{groupBuyProductFlag},
  554. #{step},
  555. #{speCommisionFlag},
  556. #{speCommision},
  557. #{videourl},
  558. #{props},
  559. #{providers},
  560. #{serviceCommissionRatio},
  561. #{reCommissionRatio},
  562. #{pushToERPName},
  563. #{prodBeans},
  564. #{useBeansFlag},
  565. #{privateFlag},
  566. #{invisibleServiceProviderIDs},
  567. #{displayOnCRMFlag},
  568. #{needServiceFlag},
  569. #{actPrice0},
  570. #{actPrice1},
  571. #{actPrice2},
  572. #{actPrice3},
  573. #{actPrice4},
  574. #{actPrice5},
  575. #{actPrice6},
  576. #{actPrice7},
  577. #{beginTime},
  578. #{endTime},
  579. #{actFlag},
  580. #{actType},
  581. #{actFullReduceAmount},
  582. #{actReduceAmount},
  583. #{actFullGiftAmount},
  584. #{actBuyGiftNum},
  585. #{onlineTime},
  586. #{downlineTime},
  587. #{shopIndexModuleID},
  588. #{freePostFlag},
  589. #{crmBigTypeId},
  590. #{crmSmallTypeId},
  591. #{costPrice},
  592. #{costProportional},
  593. #{costCheckFlag},
  594. #{precisehKey},
  595. #{docBoost},
  596. #{cmbeanFlag},
  597. #{cmbeanPrice},
  598. #{cmbeanSort}
  599. )
  600. </insert>
  601. <update id="update">
  602. UPDATE product SET
  603. productID = #{id},
  604. brandID = #{brandID},
  605. tinyTypeID = #{tinyTypeID},
  606. selfTypeID = #{selfTypeID},
  607. shopID = #{shopID},
  608. name = #{name},
  609. searchKey = #{searchKey},
  610. normalPrice = #{normalPrice},
  611. price = #{price},
  612. highestUserLevelPrice = #{highestUserLevelPrice},
  613. lowestUserLevelPrice = #{lowestUserLevelPrice},
  614. lowestUserLevelID = #{lowestUserLevelID},
  615. price0 = #{price0},
  616. price0Text = #{price0Text},
  617. price0TextFlag = #{price0TextFlag},
  618. price1 = #{price1},
  619. price1Text = #{price1Text},
  620. price1TextFlag = #{price1TextFlag},
  621. price8 = #{price8},
  622. price8Text = #{price8Text},
  623. price8TextFlag = #{price8TextFlag},
  624. ladderPriceFlag = #{ladderPriceFlag},
  625. price2 = #{price2},
  626. price3 = #{price3},
  627. price4 = #{price4},
  628. price5 = #{price5},
  629. price6 = #{price6},
  630. price7 = #{price7},
  631. fee = #{fee},
  632. stock = #{stock},
  633. hasSkuFlag = #{hasSkuFlag},
  634. mainImage = #{mainImage},
  635. propertiesInfo = #{propertiesInfo},
  636. addTime = #{addTime},
  637. updateTime = #{updateTime},
  638. sellNumber = #{sellNumber},
  639. weekSellNumber = #{weekSellNumber},
  640. beforeValidFlag = #{beforeValidFlag},
  641. validFlag = #{validFlag},
  642. favoriteTimes = #{favoriteTimes},
  643. commentScore = #{commentScore},
  644. commentTimes = #{commentTimes},
  645. selfRecommendFlag = #{selfRecommendFlag},
  646. sysRecommendFlag = #{sysRecommendFlag},
  647. sortIndex = #{sortIndex},
  648. featuredFlag = #{featuredFlag},
  649. featuredSortIndex = #{featuredSortIndex},
  650. productCode = #{productCode},
  651. rate1 = #{rate1},
  652. rate2 = #{rate2},
  653. unit = #{unit},
  654. synToERPFlag = #{synToERPFlag},
  655. allAreaFlag = #{allAreaFlag},
  656. provinceIDs = #{provinceIDs},
  657. serviceNumber = #{serviceNumber},
  658. maxBuyNumber = #{maxBuyNumber},
  659. virtualFlag = #{virtualFlag},
  660. minBuyNumber = #{minBuyNumber},
  661. packageCount = #{packageCount},
  662. byFlag = #{byFlag},
  663. normalProductFlag = #{normalProductFlag},
  664. wholeSaleProductFlag = #{wholeSaleProductFlag},
  665. promotionProductFlag = #{promotionProductFlag},
  666. groupBuyProductFlag = #{groupBuyProductFlag},
  667. step = #{step},
  668. speCommisionFlag = #{speCommisionFlag},
  669. speCommision = #{speCommision},
  670. videourl = #{videourl},
  671. props = #{props},
  672. providers = #{providers},
  673. serviceCommissionRatio = #{serviceCommissionRatio},
  674. reCommissionRatio = #{reCommissionRatio},
  675. pushToERPName = #{pushToERPName},
  676. prodBeans = #{prodBeans},
  677. useBeansFlag = #{useBeansFlag},
  678. privateFlag = #{privateFlag},
  679. invisibleServiceProviderIDs = #{invisibleServiceProviderIDs},
  680. displayOnCRMFlag = #{displayOnCRMFlag},
  681. needServiceFlag = #{needServiceFlag},
  682. actPrice0 = #{actPrice0},
  683. actPrice1 = #{actPrice1},
  684. actPrice2 = #{actPrice2},
  685. actPrice3 = #{actPrice3},
  686. actPrice4 = #{actPrice4},
  687. actPrice5 = #{actPrice5},
  688. actPrice6 = #{actPrice6},
  689. actPrice7 = #{actPrice7},
  690. beginTime = #{beginTime},
  691. endTime = #{endTime},
  692. actFlag = #{actFlag},
  693. actType = #{actType},
  694. actFullReduceAmount = #{actFullReduceAmount},
  695. actReduceAmount = #{actReduceAmount},
  696. actFullGiftAmount = #{actFullGiftAmount},
  697. actBuyGiftNum = #{actBuyGiftNum},
  698. onlineTime = #{onlineTime},
  699. downlineTime = #{downlineTime},
  700. shopIndexModuleID = #{shopIndexModuleID},
  701. freePostFlag = #{freePostFlag},
  702. crmBigTypeId = #{crmBigTypeId},
  703. crmSmallTypeId = #{crmSmallTypeId},
  704. costPrice = #{costPrice},
  705. costProportional = #{costProportional},
  706. costCheckFlag = #{costCheckFlag},
  707. precisehKey = #{precisehKey},
  708. docBoost = #{docBoost},
  709. cmbeanFlag = #{cmbeanFlag},
  710. cmbeanPrice = #{cmbeanPrice},
  711. cmbeanSort = #{cmbeanSort},
  712. actSort = #{actSort},
  713. actCreateTime = #{actCreateTime}
  714. WHERE productID = #{id}
  715. </update>
  716. <update id="updateActive">
  717. UPDATE product
  718. <set>
  719. <if test="actFlag != null and actFlag != ''">
  720. actFlag = #{actFlag},
  721. </if>
  722. <if test="actType != null and actType != ''">
  723. actType = #{actType},
  724. </if>
  725. <if test="actSort != null and actSort != ''">
  726. actSort = #{actSort},
  727. </if>
  728. <if test="actCreateTime != null and actCreateTime != ''">
  729. actCreateTime = #{actCreateTime},
  730. </if>
  731. </set>
  732. WHERE productID = #{productID}
  733. </update>
  734. <update id="updatePreferred">
  735. UPDATE product SET preferredFlag = #{preferredFlag}
  736. WHERE productID = #{productID}
  737. </update>
  738. <delete id="delete">
  739. DELETE FROM product
  740. WHERE id = #{id}
  741. </delete>
  742. <update id="deleteProduct">
  743. UPDATE cm_search_recommend_product
  744. SET delFlag = #{DateTime}
  745. WHERE id = #{id}
  746. </update>
  747. <select id="getAllActType" resultType="com.caimei.po.ActType">
  748. SELECT
  749. *
  750. FROM acttype
  751. where validFlag = 1
  752. </select>
  753. <select id="getSupplierProductList" resultType="com.caimei.modules.product.entity.Product">
  754. SELECT
  755. *
  756. FROM
  757. product
  758. <where>
  759. <if test="name != null and name != ''">
  760. AND name LIKE concat('%',#{name},'%')
  761. </if>
  762. AND shopID = #{shopID}
  763. AND (validFlag = 1 or validFlag = 2 or validFlag = 3 or validFlag = 9)
  764. </where>
  765. ORDER BY addTime desc
  766. </select>
  767. <select id="getGiftProductInfo" parameterType="com.caimei.modules.product.entity.GiftProduct" resultType="com.caimei.modules.product.entity.GiftProduct">
  768. SELECT
  769. g.id as "id",
  770. g.fullGiftProductId as "fullGiftProductId",
  771. g.giftProductId as "giftProductId",
  772. g.actType as "actType",
  773. g.giftProductNum as "giftProductNum",
  774. p.name as "productName"
  775. FROM
  776. gift_product g
  777. left join product p on p.productID = g.giftProductId
  778. <where>
  779. g.fullGiftProductId = #{fullGiftProductId}
  780. AND g.actType = #{actType}
  781. <if test="giftProductId != null and giftProductId != ''">
  782. AND g.giftProductId = #{giftProductId}
  783. </if>
  784. <if test="delFlag != null and delFlag != ''">
  785. AND g.delFlag = #{delFlag}
  786. </if>
  787. and p.productCategory = 1
  788. </where>
  789. </select>
  790. <select id="getProductSku" resultType="com.caimei.modules.product.entity.Sku">
  791. SELECT
  792. *
  793. FROM
  794. sku
  795. <where>
  796. productID = #{productId}
  797. AND validFlag = 1
  798. </where>
  799. </select>
  800. <select id="findProductBigTypeByProductID" parameterType="java.lang.Integer" resultType="java.lang.String">
  801. SELECT
  802. tb.name
  803. FROM
  804. bigType AS tb
  805. INNER JOIN smallType AS ts
  806. ON tb.bigTypeID = ts.bigTypeID
  807. INNER JOIN tinyType AS tt
  808. ON ts.smallTypeID = tt.smallTypeID
  809. INNER JOIN product AS tp
  810. ON tt.tinyTypeID = tp.tinyTypeID
  811. <where>
  812. tp.productID = #{productId}
  813. and tp.productCategory = 1
  814. </where>
  815. </select>
  816. <update id="updateGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct">
  817. update gift_product
  818. <set >
  819. <if test="fullGiftProductId != null and !=''" >
  820. fullGiftProductId = #{fullGiftProductId},
  821. </if>
  822. <if test="giftProductId != null and !=''" >
  823. giftProductId = #{giftProductId},
  824. </if>
  825. <if test="productName != null and !=''" >
  826. productName = #{productName},
  827. </if>
  828. <if test="actType != null and !=''" >
  829. actType = #{actType},
  830. </if>
  831. <if test="giftProductNum != null and !=''" >
  832. giftProductNum = #{giftProductNum},
  833. </if>
  834. <if test="createBy != null and !=''" >
  835. createBy = #{createBy.id},
  836. </if>
  837. <if test="createDate != null and !=''" >
  838. createDate = #{createDate},
  839. </if>
  840. <if test="updateBy != null and !=''" >
  841. updateBy = #{updateBy.id},
  842. </if>
  843. <if test="updateDate != null and !=''" >
  844. updateDate = #{updateDate},
  845. </if>
  846. <if test="delFlag != null and !=''" >
  847. delFlag = #{delFlag},
  848. </if>
  849. </set>
  850. where id = #{id}
  851. </update>
  852. <insert id="insertGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct" keyProperty="id" useGeneratedKeys="true">
  853. INSERT INTO gift_product(
  854. fullGiftProductId,
  855. giftProductId,
  856. productName,
  857. actType,
  858. giftProductNum,
  859. createBy,
  860. createDate,
  861. updateBy,
  862. updateDate,
  863. delFlag
  864. ) VALUES (
  865. #{fullGiftProductId},
  866. #{giftProductId},
  867. #{productName},
  868. #{actType},
  869. #{giftProductNum},
  870. #{createBy.id},
  871. #{createDate},
  872. #{updateBy.id},
  873. #{updateDate},
  874. #{delFlag}
  875. )
  876. </insert>
  877. <insert id="insertProductPriceRecord" parameterType="com.caimei.modules.product.entity.ProductPriceRecord" keyProperty="productPriceRecordID" useGeneratedKeys="true">
  878. INSERT INTO productpricerecord(
  879. `productID`,
  880. `shopID`,
  881. `highestUserLevelPrice`,
  882. `lowestUserLevelPrice`,
  883. `lowestUserLevelID`,
  884. `price0`,
  885. `price1`,
  886. `updateTime`
  887. )
  888. VALUES
  889. (
  890. #{productID},
  891. #{shopID},
  892. #{highestUserLevelPrice},
  893. #{lowestUserLevelPrice},
  894. #{lowestUserLevelID},
  895. #{price0},
  896. #{price1},
  897. #{updateTime}
  898. )
  899. </insert>
  900. <update id="updateCRMFlag">
  901. UPDATE product a SET a.displayOnCRMFlag = #{param1}
  902. WHERE a.productID IN
  903. <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
  904. #{id}
  905. </foreach>
  906. </update>
  907. <update id="deleteActive">
  908. UPDATE product a SET a.actFlag = 0
  909. WHERE a.productID = #{id}
  910. </update>
  911. <update id="updatePostFlag">
  912. UPDATE product a SET a.freePostFlag = #{param1}
  913. WHERE a.productID IN
  914. <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
  915. #{id}
  916. </foreach>
  917. </update>
  918. <select id="getBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
  919. select * from bigtype
  920. <where>
  921. validFlag = 1
  922. <if test="bigTypeID != null and bigTypeID != ''">
  923. AND bigTypeID = #{bigTypeID}
  924. </if>
  925. </where>
  926. </select>
  927. <select id="getSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
  928. select * from smalltype
  929. <where>
  930. validFlag = 1
  931. <if test="bigTypeID != null and bigTypeID != ''">
  932. AND bigTypeID = #{bigTypeID}
  933. </if>
  934. <if test="smallTypeID != null and smallTypeID != ''">
  935. AND smallTypeID = #{smallTypeID}
  936. </if>
  937. </where>
  938. </select>
  939. <select id="getTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
  940. select * from tinytype
  941. <where>
  942. validFlag = 1
  943. <if test="smallTypeID != null and smallTypeID != ''">
  944. AND smallTypeID = #{smallTypeID}
  945. </if>
  946. <if test="smallTypeID != null and smallTypeID != ''">
  947. AND smallTypeID = #{smallTypeID}
  948. </if>
  949. </where>
  950. </select>
  951. <select id="getProductTypeNameAndID" resultType="map">
  952. select
  953. b.name AS bigTypeName,
  954. b.bigTypeID AS bigTypeID,
  955. s.name AS smallTypeName,
  956. s.smallTypeID AS smallTypeID,
  957. t.name AS tinyTypeName,
  958. t.tinyTypeID AS tinyTypeID
  959. from tinytype AS t
  960. join smalltype AS s on t.smallTypeID = s.smallTypeID
  961. JOIN bigtype AS b on b.bigTypeID = s.bigTypeID
  962. where t.tinyTypeID = #{tinyTypeID}
  963. </select>
  964. <delete id="deleteCustomClassification">
  965. delete from product_custom_classification
  966. where productID = #{productID}
  967. </delete>
  968. <insert id="insertCustomClassification" parameterType="com.caimei.modules.product.entity.ProductCustomClassification" keyProperty="userId" useGeneratedKeys="true">
  969. INSERT INTO product_custom_classification(
  970. productID,
  971. bigTypeID,
  972. smallTypeID,
  973. tinyTypeID,
  974. createDate,
  975. updateDate
  976. ) VALUES (
  977. #{productID},
  978. #{bigTypeID},
  979. #{smallTypeID},
  980. #{tinyTypeID},
  981. #{createDate},
  982. #{updateDate}
  983. )
  984. </insert>
  985. <insert id="insertAddProduct">
  986. INSERT INTO cm_search_recommend_product(
  987. productID,
  988. tinyTypeID,
  989. sort,
  990. delFlag
  991. ) VALUES (
  992. #{productID},
  993. #{tinyTypeID},
  994. 0,
  995. 0
  996. )
  997. </insert>
  998. <insert id="insertLadderPrice">
  999. insert into product_ladder_price (productId, userType, ladderNum,
  1000. buyNum, buyPrice, createBy, createDate, delFlag)
  1001. values (#{productId}, 3, #{ladderNum},
  1002. #{buyNum}, #{buyPrice}, #{createBy},
  1003. #{createDate},'0')
  1004. </insert>
  1005. <insert id="insertProduct" keyColumn="productID" keyProperty="productID" parameterType="com.caimei.modules.product.entity.Product" useGeneratedKeys="true">
  1006. INSERT INTO `product` (
  1007. `brandID`,
  1008. `tinyTypeID`,
  1009. `classifyId`,
  1010. <if test="productCategory != null and productCategory != '' ">
  1011. `productCategory`,
  1012. </if>
  1013. `preferredFlag`,
  1014. `selfTypeID`,
  1015. `shopID`,
  1016. `name`,
  1017. `aliasName`,
  1018. `searchKey`,
  1019. `productRemarks`,
  1020. `normalPrice`,
  1021. `price`,
  1022. `highestUserLevelPrice`,
  1023. `lowestUserLevelPrice`,
  1024. `lowestUserLevelID`,
  1025. `price0`,
  1026. `price0Grade`,
  1027. `price0Text`,
  1028. `price0TextFlag`,
  1029. `price1`,
  1030. `price1Grade`,
  1031. `price1Text`,
  1032. `price1TextFlag`,
  1033. `price8`,
  1034. `price8Grade`,
  1035. `price8Text`,
  1036. `price8TextFlag`,
  1037. `ladderPriceFlag`,
  1038. `price2`,
  1039. `price3`,
  1040. `price4`,
  1041. `price5`,
  1042. `price6`,
  1043. `price7`,
  1044. `fee`,
  1045. `stock`,
  1046. `hasSkuFlag`,
  1047. `mainImage`,
  1048. `propertiesInfo`,
  1049. `addTime`,
  1050. `updateTime`,
  1051. `classifyAddTime`,
  1052. `weekSellNumber`,
  1053. `beforeValidFlag`,
  1054. `validFlag`,
  1055. `favoriteTimes`,
  1056. `commentScore`,
  1057. `commentTimes`,
  1058. `selfRecommendFlag`,
  1059. `sysRecommendFlag`,
  1060. `sortIndex`,
  1061. `featuredFlag`,
  1062. `featuredSortIndex`,
  1063. `productCode`,
  1064. `rate1`,
  1065. `rate2`,
  1066. `unit`,
  1067. `synToERPFlag`,
  1068. `allAreaFlag`,
  1069. `provinceIDs`,
  1070. `serviceNumber`,
  1071. `maxBuyNumber`,
  1072. `virtualFlag`,
  1073. `minBuyNumber`,
  1074. `packageCount`,
  1075. `byFlag`,
  1076. `normalProductFlag`,
  1077. `wholeSaleProductFlag`,
  1078. `promotionProductFlag`,
  1079. `groupBuyProductFlag`,
  1080. `step`,
  1081. `speCommisionFlag`,
  1082. `speCommision`,
  1083. `videourl`,
  1084. `props`,
  1085. `providers`,
  1086. `serviceCommissionRatio`,
  1087. `reCommissionRatio`,
  1088. `pushToERPName`,
  1089. `prodBeans`,
  1090. `useBeansFlag`,
  1091. `privateFlag`,
  1092. `invisibleServiceProviderIDs`,
  1093. `displayOnCRMFlag`,
  1094. `needServiceFlag`,
  1095. `actFlag`,
  1096. `actStatus`,
  1097. `actSort`,
  1098. `actPrice0`,
  1099. `actPrice1`,
  1100. `actPrice2`,
  1101. `actPrice3`,
  1102. `actPrice4`,
  1103. `actPrice5`,
  1104. `actPrice6`,
  1105. `actPrice7`,
  1106. `actType`,
  1107. `actCreateTime`,
  1108. `actFullReduceAmount`,
  1109. `actReduceAmount`,
  1110. `visibility`,
  1111. `actFullGiftAmount`,
  1112. `actBuyGiftNum`,
  1113. `beginTime`,
  1114. `endTime`,
  1115. `shopIndexModuleID`,
  1116. `onlineTime`,
  1117. `downlineTime`,
  1118. `freePostFlag`,
  1119. `crmBigTypeId`,
  1120. `crmSmallTypeId`,
  1121. `costPrice`,
  1122. `costProportional`,
  1123. `costCheckFlag`,
  1124. `precisehKey`,
  1125. `docBoost`,
  1126. `cmbeanFlag`,
  1127. `cmbeanPrice`,
  1128. `cmbeanSort`,
  1129. `tags`,
  1130. `surplusTime`,
  1131. `productType`,
  1132. `machineType`,
  1133. `qualificationImg`,
  1134. `includedTax`,
  1135. `taxPoint`,
  1136. `invoiceType`,
  1137. `recommendType`,
  1138. `priceType`,
  1139. `combinationID`,
  1140. `combinationSort`
  1141. )
  1142. VALUES
  1143. (
  1144. #{brandID},
  1145. #{tinyTypeID},
  1146. #{classifyId},
  1147. <if test="productCategory != null and productCategory != '' ">
  1148. #{productCategory},
  1149. </if>
  1150. #{preferredFlag},
  1151. #{selfTypeID},
  1152. #{shopID},
  1153. #{name},
  1154. #{aliasName},
  1155. #{searchKey},
  1156. #{productRemarks},
  1157. #{normalPrice},
  1158. #{price},
  1159. #{highestUserLevelPrice},
  1160. #{lowestUserLevelPrice},
  1161. #{lowestUserLevelID},
  1162. #{price0},
  1163. #{price0Grade},
  1164. #{price0Text},
  1165. #{price0TextFlag},
  1166. #{price1},
  1167. #{price1Grade},
  1168. #{price1Text},
  1169. #{price1TextFlag},
  1170. #{price8},
  1171. #{price8Grade},
  1172. #{price8Text},
  1173. #{price8TextFlag},
  1174. #{ladderPriceFlag},
  1175. #{price2},
  1176. #{price3},
  1177. #{price4},
  1178. #{price5},
  1179. #{price6},
  1180. #{price7},
  1181. #{fee},
  1182. #{stock},
  1183. #{hasSkuFlag},
  1184. #{mainImage},
  1185. #{propertiesInfo},
  1186. #{addTime},
  1187. #{updateTime},
  1188. #{classifyAddTime},
  1189. #{weekSellNumber},
  1190. #{beforeValidFlag},
  1191. #{validFlag},
  1192. #{favoriteTimes},
  1193. #{commentScore},
  1194. #{commentTimes},
  1195. #{selfRecommendFlag},
  1196. #{sysRecommendFlag},
  1197. #{sortIndex},
  1198. #{featuredFlag},
  1199. #{featuredSortIndex},
  1200. #{productCode},
  1201. #{rate1},
  1202. #{rate2},
  1203. #{unit},
  1204. #{synToERPFlag},
  1205. #{allAreaFlag},
  1206. #{provinceIDs},
  1207. #{serviceNumber},
  1208. #{maxBuyNumber},
  1209. #{virtualFlag},
  1210. #{minBuyNumber},
  1211. #{packageCount},
  1212. #{byFlag},
  1213. #{normalProductFlag},
  1214. #{wholeSaleProductFlag},
  1215. #{promotionProductFlag},
  1216. #{groupBuyProductFlag},
  1217. #{step},
  1218. #{speCommisionFlag},
  1219. #{speCommision},
  1220. #{videourl},
  1221. #{props},
  1222. #{providers},
  1223. #{serviceCommissionRatio},
  1224. #{reCommissionRatio},
  1225. #{pushToERPName},
  1226. #{prodBeans},
  1227. #{useBeansFlag},
  1228. #{privateFlag},
  1229. #{invisibleServiceProviderIDs},
  1230. #{displayOnCRMFlag},
  1231. #{needServiceFlag},
  1232. #{actFlag},
  1233. #{actStatus},
  1234. #{actSort},
  1235. #{actPrice0},
  1236. #{actPrice1},
  1237. #{actPrice2},
  1238. #{actPrice3},
  1239. #{actPrice4},
  1240. #{actPrice5},
  1241. #{actPrice6},
  1242. #{actPrice7},
  1243. #{actType},
  1244. #{actCreateTime},
  1245. #{actFullReduceAmount},
  1246. #{actReduceAmount},
  1247. #{visibility},
  1248. #{actFullGiftAmount},
  1249. #{actBuyGiftNum},
  1250. #{beginTime},
  1251. #{endTime},
  1252. #{shopIndexModuleID},
  1253. #{onlineTime},
  1254. #{downlineTime},
  1255. #{freePostFlag},
  1256. #{crmBigTypeId},
  1257. #{crmSmallTypeId},
  1258. #{costPrice},
  1259. #{costProportional},
  1260. #{costCheckFlag},
  1261. #{precisehKey},
  1262. #{docBoost},
  1263. #{cmbeanFlag},
  1264. #{cmbeanPrice},
  1265. #{cmbeanSort},
  1266. #{tags},
  1267. #{surplusTime},
  1268. #{productType},
  1269. #{machineType},
  1270. #{qualificationImg},
  1271. #{includedTax},
  1272. #{taxPoint},
  1273. #{invoiceType},
  1274. #{recommendType},
  1275. #{priceType},
  1276. #{combinationID},
  1277. #{combinationSort}
  1278. )
  1279. </insert>
  1280. <insert id="insertProductDetailInfo">
  1281. insert into productdetailinfo
  1282. <trim prefix="(" suffix=")" suffixOverrides=",">
  1283. <if test="productID != null">
  1284. `productID`,
  1285. </if>
  1286. <if test="detailInfo != null and detailInfo != ''">
  1287. `detailInfo`,
  1288. </if>
  1289. <if test="serviceInfo != null and serviceInfo != ''">
  1290. `serviceInfo`,
  1291. </if>
  1292. <if test="orderInfo != null and orderInfo != ''">
  1293. `orderInfo`,
  1294. </if>
  1295. </trim>
  1296. <trim prefix="values (" suffix=")" suffixOverrides=",">
  1297. <if test="productID != null">
  1298. #{productID},
  1299. </if>
  1300. <if test="detailInfo != null and detailInfo != ''">
  1301. #{detailInfo},
  1302. </if>
  1303. <if test="serviceInfo != null and serviceInfo != ''">
  1304. #{serviceInfo},
  1305. </if>
  1306. <if test="orderInfo != null and orderInfo != ''">
  1307. #{orderInfo},
  1308. </if>
  1309. </trim>
  1310. </insert>
  1311. <select id="getrecommendProductList" resultType="product">
  1312. select
  1313. a.*,
  1314. csrp.sort AS sort,
  1315. csrp.id AS recommendProductId,
  1316. b.name AS brandName,
  1317. s.name AS shopName
  1318. FROM
  1319. cm_search_recommend_product csrp
  1320. LEFT JOIN product a on a.productID = csrp.productID
  1321. LEFT JOIN shop s on s.shopID = a.shopID
  1322. left join cm_brand b on b.id = a.brandID
  1323. WHERE
  1324. csrp.tinyTypeId = #{tinyTypeID}
  1325. <if test="name != null and name != ''">
  1326. AND a.name like concat('%', #{name} ,'%')
  1327. </if>
  1328. <if test="validFlag !=null and validFlag !=''">
  1329. AND a.validFlag=#{validFlag}
  1330. </if>
  1331. <if test="shopName != null and shopName != ''">
  1332. AND s.name like concat('%', #{shopName} ,'%')
  1333. </if>
  1334. <if test="brandName != null and brandName != ''">
  1335. AND b.name like concat('%', #{brandName} ,'%')
  1336. </if>
  1337. and a.productCategory = 1
  1338. AND a.validFlag != 0
  1339. AND csrp.delFlag =0
  1340. ORDER BY csrp.sort DESC
  1341. </select>
  1342. <select id="relatedProductList" resultType="product">
  1343. select
  1344. <include refid="productColumns"/>,
  1345. b.name AS brandName,
  1346. (case when a.tinyTypeID = #{tinyTypeID} then '1' else '0' end) AS defaultType
  1347. FROM product a
  1348. <include refid="productJoins"/>
  1349. left join brand b on b.brandID = a.brandID
  1350. WHERE (a.productID
  1351. IN (select productID from product_custom_classification where tinyTypeID = #{tinyTypeID})
  1352. OR a.tinyTypeID = #{tinyTypeID})
  1353. <if test="name != null and name != ''">
  1354. AND a.name like concat('%', #{name} ,'%')
  1355. </if>
  1356. <if test="validFlag !=null and validFlag !=''">
  1357. AND a.validFlag=#{validFlag}
  1358. </if>
  1359. <if test="shopName != null and shopName != ''">
  1360. AND s.name like concat('%', #{shopName} ,'%')
  1361. </if>
  1362. <if test="brandName != null and brandName != ''">
  1363. AND b.name like concat('%', #{brandName} ,'%')
  1364. </if>
  1365. AND a.validFlag != 0
  1366. and a.productCategory = 1
  1367. </select>
  1368. <delete id="deleteProductCustomClassification">
  1369. delete from product_custom_classification
  1370. where productID = #{productID} and tinyTypeID = #{tinyTypeID}
  1371. </delete>
  1372. <delete id="deleteLadderPriceByProductId">
  1373. DELETE FROM product_ladder_price where productId = #{productID}
  1374. </delete>
  1375. <delete id="deleteLadderPriceById">
  1376. DELETE FROM product_ladder_price where id = #{id}
  1377. </delete>
  1378. <select id="toAddProductCustomClassificationList" resultType="product">
  1379. select
  1380. <include refid="productColumns"/>,
  1381. b.name AS brandName
  1382. FROM product a
  1383. <include refid="productJoins"/>
  1384. left join cm_brand b on b.id = a.brandID
  1385. WHERE a.tinyTypeID != #{tinyTypeID}
  1386. and not exists
  1387. (select pcc.id from product_custom_classification pcc where pcc.productID = a.productID and pcc.tinyTypeID = #{tinyTypeID})
  1388. and a.validFlag = '2'
  1389. and (select count(id) from product_custom_classification pcc where pcc.productID = a.productID) <![CDATA[ < ]]> 5
  1390. <if test="name != null and name != ''">
  1391. and a.name like concat('%', #{name} ,'%')
  1392. </if>
  1393. <if test="shopName != null and shopName != ''">
  1394. AND s.name like concat('%', #{shopName} ,'%')
  1395. </if>
  1396. <if test="brandName != null and brandName != ''">
  1397. AND b.name like concat('%', #{brandName} ,'%')
  1398. </if>
  1399. </select>
  1400. <select id="toAddProductList" resultType="product">
  1401. select
  1402. a.*,
  1403. b.name AS brandName,
  1404. s.name AS shopName
  1405. FROM product a
  1406. LEFT JOIN shop s on s.shopID = a.shopID
  1407. left join cm_brand b on b.id = a.brandID
  1408. WHERE
  1409. NOT EXISTS (select * from cm_search_recommend_product csrp where csrp.productID = a.productID and csrp.tinyTypeID = #{tinyTypeID} AND csrp.delFlag = 0)
  1410. and a.validFlag = '2'
  1411. <if test="name != null and name != ''">
  1412. and a.name like concat('%', #{name} ,'%')
  1413. </if>
  1414. <if test="shopName != null and shopName != ''">
  1415. AND s.name like concat('%', #{shopName} ,'%')
  1416. </if>
  1417. <if test="brandName != null and brandName != ''">
  1418. AND b.name like concat('%', #{brandName} ,'%')
  1419. </if>
  1420. and a.productCategory = 1
  1421. </select>
  1422. <select id="getProductTypes" resultType="com.caimei.modules.product.entity.ProductCustomClassification">
  1423. select *
  1424. from product_custom_classification where productID = #{productID}
  1425. </select>
  1426. <select id="findRecommendActivityListPage" resultType="Product">
  1427. SELECT
  1428. <include refid="productColumns"/>
  1429. FROM product a
  1430. <include refid="ActivityJoins"/>
  1431. <where>
  1432. <if test="id !=null and id !=''">
  1433. AND a.productID=#{id}
  1434. </if>
  1435. <if test="tinyTypeID != null and tinyTypeID != ''">
  1436. AND a.tinyTypeID = #{tinyTypeID}
  1437. </if>
  1438. <if test="smallTypeID != null and smallTypeID != ''">
  1439. AND a.smallTypeID = #{smallTypeID}
  1440. </if>
  1441. <if test="bigTypeID != null and bigTypeID != ''">
  1442. AND a.bigTypeID = #{bigTypeID}
  1443. </if>
  1444. <if test="shopID != null and shopID != ''">
  1445. AND a.shopID = #{shopID}
  1446. </if>
  1447. <if test="name != null and name != ''">
  1448. AND a.name LIKE
  1449. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  1450. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  1451. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  1452. </if>
  1453. <if test="shopName != null and shopName != ''">
  1454. AND s.name LIKE
  1455. <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
  1456. <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
  1457. <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
  1458. </if>
  1459. <if test="cmbeanFlag != null and cmbeanFlag != ''">
  1460. AND a.cmbeanFlag = #{cmbeanFlag}
  1461. </if>
  1462. <if test="actFlag !=null and actFlag !=''">
  1463. AND a.actFlag=#{actFlag}
  1464. </if>
  1465. <if test="sqlMap !=null and sqlMap !=''">
  1466. ${sqlMap.dsf}
  1467. </if>
  1468. AND a.validFlag = 2
  1469. 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')))
  1470. AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
  1471. and a.productCategory = 1
  1472. </where>
  1473. <choose>
  1474. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  1475. ORDER BY ${page.orderBy}
  1476. </when>
  1477. <otherwise>
  1478. order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
  1479. </otherwise>
  1480. </choose>
  1481. </select>
  1482. <select id="findGroupActivityListPage" resultType="Product">
  1483. SELECT
  1484. <include refid="productColumns"/>
  1485. FROM product a
  1486. <include refid="ActivityJoins"/>
  1487. <where>
  1488. <if test="id !=null and id !=''">
  1489. AND a.productID=#{id}
  1490. </if>
  1491. <if test="tinyTypeID != null and tinyTypeID != ''">
  1492. AND a.tinyTypeID = #{tinyTypeID}
  1493. </if>
  1494. <if test="smallTypeID != null and smallTypeID != ''">
  1495. AND a.smallTypeID = #{smallTypeID}
  1496. </if>
  1497. <if test="bigTypeID != null and bigTypeID != ''">
  1498. AND a.bigTypeID = #{bigTypeID}
  1499. </if>
  1500. <if test="shopID != null and shopID != ''">
  1501. AND a.shopID = #{shopID}
  1502. </if>
  1503. <if test="name != null and name != ''">
  1504. AND a.name LIKE
  1505. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  1506. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  1507. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  1508. </if>
  1509. <if test="shopName != null and shopName != ''">
  1510. AND s.name LIKE
  1511. <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
  1512. <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
  1513. <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
  1514. </if>
  1515. <if test="cmbeanFlag != null and cmbeanFlag != ''">
  1516. AND a.cmbeanFlag = #{cmbeanFlag}
  1517. </if>
  1518. <if test="actFlag !=null and actFlag !=''">
  1519. AND a.actFlag=#{actFlag}
  1520. </if>
  1521. <if test="actStatus != null and actStatus != '' and actStatus == 1">
  1522. AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[ < ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
  1523. </if>
  1524. <if test="actStatus != null and actStatus != '' and actStatus == 2">
  1525. AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[ > ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
  1526. AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[ < ]]> STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
  1527. </if>
  1528. <if test="sqlMap !=null and sqlMap !=''">
  1529. ${sqlMap.dsf}
  1530. </if>
  1531. AND a.validFlag = 2
  1532. AND ((a.actType != 1 AND a.actType != 2 OR a.`actType` IS NULL) or a.actFlag = 0)
  1533. AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
  1534. and a.productCategory = 1
  1535. </where>
  1536. <choose>
  1537. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  1538. ORDER BY ${page.orderBy}
  1539. </when>
  1540. <otherwise>
  1541. order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
  1542. </otherwise>
  1543. </choose>
  1544. </select>
  1545. <select id="findBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
  1546. SELECT
  1547. *
  1548. FROM bigtype a
  1549. <where>
  1550. <if test="bigTypeID != null and bigTypeID != ''">
  1551. AND a.bigTypeID = #{bigTypeID}
  1552. </if>
  1553. <if test="name != null and name != ''">
  1554. AND a.name LIKE
  1555. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  1556. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  1557. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  1558. </if>
  1559. </where>
  1560. </select>
  1561. <select id="findSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
  1562. SELECT
  1563. *
  1564. FROM smalltype a
  1565. <where>
  1566. <if test="smallTypeID != null and smallTypeID != ''">
  1567. AND a.smallTypeID = #{smallTypeID}
  1568. </if>
  1569. <if test="bigTypeID != null and bigTypeID != ''">
  1570. AND a.bigTypeID = #{bigTypeID}
  1571. </if>
  1572. <if test="name != null and name != ''">
  1573. AND a.name LIKE
  1574. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  1575. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  1576. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  1577. </if>
  1578. </where>
  1579. </select>
  1580. <select id="findTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
  1581. SELECT
  1582. *
  1583. FROM tinytype a
  1584. <where>
  1585. <if test="tinyTypeID != null and tinyTypeID != ''">
  1586. AND a.tinyTypeID = #{tinyTypeID}
  1587. </if>
  1588. <if test="smallTypeID != null and smallTypeID != ''">
  1589. AND a.smallTypeID = #{smallTypeID}
  1590. </if>
  1591. <if test="name != null and name != ''">
  1592. AND a.name LIKE
  1593. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  1594. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  1595. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  1596. </if>
  1597. </where>
  1598. </select>
  1599. <select id="findProductRecommendList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
  1600. select
  1601. cpr.id AS id,
  1602. cpr.productID AS productID,
  1603. cpr.recommendProductID AS recommendProductID,
  1604. cpr.sort AS sort,
  1605. pro.name AS productName,
  1606. pro.unit AS unit,
  1607. pro.mainImage AS img,
  1608. cpr.shopName AS shopName
  1609. from cm_product_recommend cpr
  1610. join product pro on cpr.recommendProductID = pro.productID
  1611. where cpr.productID = #{productID}
  1612. order by cpr.sort desc
  1613. </select>
  1614. <select id="findProductRecommendCount" resultType="int">
  1615. select
  1616. count(1)
  1617. from cm_product_recommend cpr
  1618. where cpr.productID = #{productID}
  1619. </select>
  1620. <select id="findProductList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
  1621. select
  1622. a.productID AS productID,
  1623. a.name AS productName,
  1624. a.unit AS unit,
  1625. a.mainImage AS img,
  1626. s.name AS shopName
  1627. from product a
  1628. <include refid="ActivityJoins"/>
  1629. <where>
  1630. <choose>
  1631. <when test="commodityType != null and commodityType != ''">
  1632. AND a.commodityType = #{commodityType}
  1633. </when>
  1634. <when test="bigTypeID != null and bigTypeID != ''">
  1635. AND a.bigTypeID = #{bigTypeID}
  1636. </when>
  1637. <when test="smallTypeID != null and smallTypeID != ''">
  1638. AND a.smallTypeID = #{smallTypeID}
  1639. </when>
  1640. <when test="tinyTypeID != null and tinyTypeID != ''">
  1641. AND a.tinyTypeID = #{tinyTypeID}
  1642. </when>
  1643. </choose>
  1644. <if test="productName != null and productName != ''">
  1645. and a.name like concat('%', #{productName} ,'%')
  1646. </if>
  1647. <if test="shopName != null and shopName != ''">
  1648. and s.name like concat('%', #{shopName} ,'%')
  1649. </if>
  1650. and a.productCategory = 1
  1651. </where>
  1652. limit 0, 10
  1653. </select>
  1654. <update id="updateRecommendType">
  1655. UPDATE product SET
  1656. recommendType = #{recommendType}
  1657. WHERE productID = #{productID}
  1658. </update>
  1659. <update id="updateBrnadId">
  1660. UPDATE product_new
  1661. set brandID = #{brandID}
  1662. WHERE productID = #{productID}
  1663. </update>
  1664. <update id="updateProductByBrandId">
  1665. UPDATE product
  1666. set brandID = null
  1667. WHERE brandID = #{brandId}
  1668. </update>
  1669. <update id="updateTinyType">
  1670. UPDATE product_new
  1671. set tinyTypeID = #{tinyTypeID}
  1672. WHERE productID = #{productID}
  1673. </update>
  1674. <update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
  1675. update product
  1676. <set>
  1677. <if test="brandID != null and brandID != ''">
  1678. brandID = #{brandID},
  1679. </if>
  1680. <if test="bigTypeID != null and bigTypeID !=''">
  1681. bigTypeID = #{bigTypeID},
  1682. smallTypeID = #{smallTypeID},
  1683. tinyTypeID = #{tinyTypeID},
  1684. </if>
  1685. <if test="preferredFlag != null and preferredFlag !=''">
  1686. preferredFlag = #{preferredFlag},
  1687. </if>
  1688. <if test="selfTypeID != null and selfTypeID !=''">
  1689. selfTypeID = #{selfTypeID},
  1690. </if>
  1691. <if test="shopID != null and shopID !=''">
  1692. shopID = #{shopID},
  1693. </if>
  1694. <if test="name != null and name !=''">
  1695. `name` = #{name},
  1696. </if>
  1697. <if test="aliasName != null and aliasName !=''">
  1698. aliasName = #{aliasName},
  1699. </if>
  1700. <if test="searchKey != null and searchKey !=''">
  1701. searchKey = #{searchKey},
  1702. </if>
  1703. <if test="productRemarks != null and productRemarks !=''">
  1704. productRemarks = #{productRemarks},
  1705. </if>
  1706. <if test="combinationID != null and combinationID !=''">
  1707. combinationID = #{combinationID},
  1708. </if>
  1709. <if test="normalPrice != null and normalPrice !=''">
  1710. normalPrice = #{normalPrice},
  1711. </if>
  1712. <if test="price != null and price !=''">
  1713. price = #{price},
  1714. </if>
  1715. <if test="highestUserLevelPrice != null and highestUserLevelPrice !=''">
  1716. highestUserLevelPrice = #{highestUserLevelPrice},
  1717. </if>
  1718. <if test="lowestUserLevelPrice != null and lowestUserLevelPrice !=''">
  1719. lowestUserLevelPrice = #{lowestUserLevelPrice},
  1720. </if>
  1721. <if test="lowestUserLevelID != null and lowestUserLevelID !=''">
  1722. lowestUserLevelID = #{lowestUserLevelID},
  1723. </if>
  1724. <if test="price0 != null and price0 !=''">
  1725. price0 = #{price0},
  1726. </if>
  1727. <if test="price0Grade != null and price0Grade !=''">
  1728. price0Grade = #{price0Grade},
  1729. </if>
  1730. <if test="price0Text != null and price0Text !=''">
  1731. price0Text = #{price0Text},
  1732. </if>
  1733. <if test="price0TextFlag != null and price0TextFlag !=''">
  1734. price0TextFlag = #{price0TextFlag},
  1735. </if>
  1736. <if test="price1 != null and price1 !=''">
  1737. price1 = #{price1},
  1738. </if>
  1739. <if test="price1Grade != null and price1Grade !=''">
  1740. price1Grade = #{price1Grade},
  1741. </if>
  1742. <if test="price1Text != null and price1Text !=''">
  1743. price1Text = #{price1Text},
  1744. </if>
  1745. <if test="price1TextFlag != null and price1TextFlag !=''">
  1746. price1TextFlag = #{price1TextFlag},
  1747. </if>
  1748. <if test="price8 != null and price8 !=''">
  1749. price8 = #{price8},
  1750. </if>
  1751. <if test="price8Grade != null and price8Grade !=''">
  1752. price8Grade = #{price8Grade},
  1753. </if>
  1754. <if test="price8Text != null and price8Text !=''">
  1755. price8Text = #{price8Text},
  1756. </if>
  1757. <if test="price8TextFlag != null and price8TextFlag !=''">
  1758. price8TextFlag = #{price8TextFlag},
  1759. </if>
  1760. <if test="ladderPriceFlag != null and ladderPriceFlag !=''">
  1761. ladderPriceFlag = #{ladderPriceFlag},
  1762. </if>
  1763. <if test="price2 != null and price2 !=''">
  1764. price2 = #{price2},
  1765. </if>
  1766. <if test="price3 != null and price3 !=''">
  1767. price3 = #{price3},
  1768. </if>
  1769. <if test="price4 != null and price4 !=''">
  1770. price4 = #{price4},
  1771. </if>
  1772. <if test="price5 != null and price5 !=''">
  1773. price5 = #{price5},
  1774. </if>
  1775. <if test="price6 != null and price6 !=''">
  1776. price6 = #{price6},
  1777. </if>
  1778. <if test="price7 != null and price7 !=''">
  1779. price7 = #{price7},
  1780. </if>
  1781. <if test="fee != null and fee !=''">
  1782. fee = #{fee},
  1783. </if>
  1784. <if test="stock != null and stock !=''">
  1785. stock = #{stock},
  1786. </if>
  1787. <if test="hasSkuFlag != null and hasSkuFlag !=''">
  1788. hasSkuFlag = #{hasSkuFlag},
  1789. </if>
  1790. <if test="mainImage != null and mainImage !=''">
  1791. mainImage = #{mainImage},
  1792. </if>
  1793. <if test="propertiesInfo != null and propertiesInfo !=''">
  1794. propertiesInfo = #{propertiesInfo},
  1795. </if>
  1796. <if test="addTime != null and addTime !=''">
  1797. addTime = #{addTime},
  1798. </if>
  1799. <if test="updateTime != null and updateTime !=''">
  1800. updateTime = #{updateTime},
  1801. </if>
  1802. <if test="weekSellNumber != null and weekSellNumber !=''">
  1803. weekSellNumber = #{weekSellNumber},
  1804. </if>
  1805. <if test="beforeValidFlag != null and beforeValidFlag !=''">
  1806. beforeValidFlag = #{beforeValidFlag},
  1807. </if>
  1808. <if test="validFlag != null and validFlag !=''">
  1809. validFlag = #{validFlag},
  1810. </if>
  1811. <if test="favoriteTimes != null and favoriteTimes !=''">
  1812. favoriteTimes = #{favoriteTimes},
  1813. </if>
  1814. <if test="commentScore != null and commentScore !=''">
  1815. commentScore = #{commentScore},
  1816. </if>
  1817. <if test="commentTimes != null and commentTimes !=''">
  1818. commentTimes = #{commentTimes},
  1819. </if>
  1820. <if test="selfRecommendFlag != null and selfRecommendFlag !=''">
  1821. selfRecommendFlag = #{selfRecommendFlag},
  1822. </if>
  1823. <if test="sysRecommendFlag != null and sysRecommendFlag !=''">
  1824. sysRecommendFlag = #{sysRecommendFlag},
  1825. </if>
  1826. <if test="sortIndex != null and sortIndex != ''">
  1827. sortIndex = #{sortIndex},
  1828. </if>
  1829. <if test="featuredFlag != null and featuredFlag !=''">
  1830. featuredFlag = #{featuredFlag},
  1831. </if>
  1832. <if test="featuredSortIndex != null and featuredSortIndex !=''">
  1833. featuredSortIndex = #{featuredSortIndex},
  1834. </if>
  1835. <if test="productCode != null and productCode !=''">
  1836. productCode = #{productCode},
  1837. </if>
  1838. <if test="rate1 != null and rate1 !=''">
  1839. rate1 = #{rate1},
  1840. </if>
  1841. <if test="rate2 != null and rate2 !=''">
  1842. rate2 = #{rate2},
  1843. </if>
  1844. <if test="unit != null and unit !=''">
  1845. unit = #{unit},
  1846. </if>
  1847. <if test="synToERPFlag != null and synToERPFlag !=''">
  1848. synToERPFlag = #{synToERPFlag},
  1849. </if>
  1850. <if test="allAreaFlag != null and allAreaFlag !=''">
  1851. allAreaFlag = #{allAreaFlag},
  1852. </if>
  1853. <if test="provinceIDs != null and provinceIDs !=''">
  1854. provinceIDs = #{provinceIDs},
  1855. </if>
  1856. <if test="serviceNumber != null and serviceNumber !=''">
  1857. serviceNumber = #{serviceNumber},
  1858. </if>
  1859. <if test="maxBuyNumber != null and maxBuyNumber !=''">
  1860. maxBuyNumber = #{maxBuyNumber},
  1861. </if>
  1862. <if test="virtualFlag != null and virtualFlag !=''">
  1863. virtualFlag = #{virtualFlag},
  1864. </if>
  1865. <if test="minBuyNumber != null and minBuyNumber !=''">
  1866. minBuyNumber = #{minBuyNumber},
  1867. </if>
  1868. <if test="packageCount != null and packageCount !=''">
  1869. packageCount = #{packageCount},
  1870. </if>
  1871. <if test="byFlag != null and byFlag !=''">
  1872. byFlag = #{byFlag},
  1873. </if>
  1874. <if test="normalProductFlag != null and normalProductFlag !=''">
  1875. normalProductFlag = #{normalProductFlag},
  1876. </if>
  1877. <if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">
  1878. wholeSaleProductFlag = #{wholeSaleProductFlag},
  1879. </if>
  1880. <if test="promotionProductFlag != null and promotionProductFlag !=''">
  1881. promotionProductFlag = #{promotionProductFlag},
  1882. </if>
  1883. <if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">
  1884. groupBuyProductFlag = #{groupBuyProductFlag},
  1885. </if>
  1886. <if test="step != null and step !=''">
  1887. step = #{step},
  1888. </if>
  1889. <if test="speCommisionFlag != null and speCommisionFlag !=''">
  1890. speCommisionFlag = #{speCommisionFlag},
  1891. </if>
  1892. <if test="speCommision != null and speCommision !=''">
  1893. speCommision = #{speCommision},
  1894. </if>
  1895. <if test="videourl != null and videourl !=''">
  1896. videourl = #{videourl},
  1897. </if>
  1898. <if test="props != null and props !=''">
  1899. props = #{props},
  1900. </if>
  1901. <if test="providers != null and providers !=''">
  1902. providers = #{providers},
  1903. </if>
  1904. <if test="serviceCommissionRatio != null and serviceCommissionRatio !=''">
  1905. serviceCommissionRatio = #{serviceCommissionRatio},
  1906. </if>
  1907. <if test="reCommissionRatio != null and reCommissionRatio !=''">
  1908. reCommissionRatio = #{reCommissionRatio},
  1909. </if>
  1910. <if test="pushToERPName != null and pushToERPName !=''">
  1911. pushToERPName = #{pushToERPName},
  1912. </if>
  1913. <if test="prodBeans != null and prodBeans !=''">
  1914. prodBeans = #{prodBeans},
  1915. </if>
  1916. <if test="useBeansFlag != null and useBeansFlag !=''">
  1917. useBeansFlag = #{useBeansFlag},
  1918. </if>
  1919. <if test="privateFlag != null and privateFlag !=''">
  1920. privateFlag = #{privateFlag},
  1921. </if>
  1922. <if test="invisibleServiceProviderIDs != null and invisibleServiceProviderIDs !=''">
  1923. invisibleServiceProviderIDs = #{invisibleServiceProviderIDs},
  1924. </if>
  1925. <if test="displayOnCRMFlag != null and displayOnCRMFlag !=''">
  1926. displayOnCRMFlag = #{displayOnCRMFlag},
  1927. </if>
  1928. <if test="needServiceFlag != null and needServiceFlag !=''">
  1929. needServiceFlag = #{needServiceFlag},
  1930. </if>
  1931. <if test="actFlag != null and actFlag !=''">
  1932. actFlag = #{actFlag},
  1933. </if>
  1934. <if test="actSort != null and actSort !=''">
  1935. actSort = #{actSort},
  1936. </if>
  1937. <if test="actPrice0 != null and actPrice0 !=''">
  1938. actPrice0 = #{actPrice0},
  1939. </if>
  1940. <if test="actPrice1 != null and actPrice1 !=''">
  1941. actPrice1 = #{actPrice1},
  1942. </if>
  1943. <if test="actPrice2 != null and actPrice2 !=''">
  1944. actPrice2 = #{actPrice2},
  1945. </if>
  1946. <if test="actPrice3 != null and actPrice3 !=''">
  1947. actPrice3 = #{actPrice3},
  1948. </if>
  1949. <if test="actPrice4 != null and actPrice4 !=''">
  1950. actPrice4 = #{actPrice4},
  1951. </if>
  1952. <if test="actPrice5 != null and actPrice5 !=''">
  1953. actPrice5 = #{actPrice5},
  1954. </if>
  1955. <if test="actPrice6 != null and actPrice6 !=''">
  1956. actPrice6 = #{actPrice6},
  1957. </if>
  1958. <if test="actPrice7 != null and actPrice7 !=''">
  1959. actPrice7 = #{actPrice7},
  1960. </if>
  1961. <if test="actType != null and actType !=''">
  1962. actType = #{actType},
  1963. </if>
  1964. <if test="actCreateTime != null and actCreateTime !=''">
  1965. actCreateTime = #{actCreateTime},
  1966. </if>
  1967. <if test="beginTime != null and beginTime !=''">
  1968. beginTime = #{beginTime},
  1969. </if>
  1970. <if test="endTime != null and endTime !=''">
  1971. endTime = #{endTime},
  1972. </if>
  1973. <if test="shopIndexModuleID != null and shopIndexModuleID !=''">
  1974. shopIndexModuleID = #{shopIndexModuleID},
  1975. </if>
  1976. <if test="onlineTime != null and onlineTime !=''">
  1977. onlineTime = #{onlineTime},
  1978. </if>
  1979. <if test="downlineTime != null and downlineTime !=''">
  1980. downlineTime = #{downlineTime},
  1981. </if>
  1982. <if test="freePostFlag != null and freePostFlag !=''">
  1983. freePostFlag = #{freePostFlag},
  1984. </if>
  1985. <if test="crmBigTypeId != null and crmBigTypeId !=''">
  1986. crmBigTypeId = #{crmBigTypeId},
  1987. </if>
  1988. <if test="crmSmallTypeId != null and crmSmallTypeId !=''">
  1989. crmSmallTypeId = #{crmSmallTypeId},
  1990. </if>
  1991. <if test="costPrice != null and costPrice != ''">
  1992. costPrice = #{costPrice},
  1993. </if>
  1994. <if test="costProportional != null and costProportional !=''">
  1995. costProportional = #{costProportional},
  1996. </if>
  1997. <if test="costCheckFlag != null and costCheckFlag !=''">
  1998. costCheckFlag = #{costCheckFlag},
  1999. </if>
  2000. <if test="precisehKey != null and precisehKey !=''">
  2001. precisehKey = #{precisehKey},
  2002. </if>
  2003. <if test="docBoost != null and docBoost !=''">
  2004. docBoost = #{docBoost},
  2005. </if>
  2006. <if test="cmbeanFlag != null and cmbeanFlag !=''">
  2007. cmbeanFlag = #{cmbeanFlag},
  2008. </if>
  2009. <if test="cmbeanPrice != null and cmbeanPrice !=''">
  2010. cmbeanPrice = #{cmbeanPrice},
  2011. </if>
  2012. <if test="cmbeanSort != null and cmbeanSort !=''">
  2013. cmbeanSort = #{cmbeanSort},
  2014. </if>
  2015. <if test="actBuyGiftNum != null and actBuyGiftNum !=''">
  2016. actBuyGiftNum = #{actBuyGiftNum},
  2017. </if>
  2018. <if test="actFullGiftAmount != null and actFullGiftAmount !=''">
  2019. actFullGiftAmount = #{actFullGiftAmount},
  2020. </if>
  2021. <if test="actFullReduceAmount != null and actFullReduceAmount !=''">
  2022. actFullReduceAmount = #{actFullReduceAmount},
  2023. </if>
  2024. <if test="actReduceAmount != null and actReduceAmount !=''">
  2025. actReduceAmount = #{actReduceAmount},
  2026. </if>
  2027. <if test="visibility != null and visibility !=''">
  2028. visibility = #{visibility},
  2029. </if>
  2030. <if test="surplusTime != null and surplusTime !=''">
  2031. surplusTime = #{surplusTime},
  2032. </if>
  2033. <if test="productType != null and productType !=''">
  2034. productType = #{productType},
  2035. </if>
  2036. <if test="qualificationImg != null and qualificationImg !=''">
  2037. qualificationImg = #{qualificationImg},
  2038. </if>
  2039. <if test="qualificationImg != null and qualificationImg !=''">
  2040. qualificationImg = #{qualificationImg},
  2041. </if>
  2042. <if test="invoiceType != null and invoiceType !=''">
  2043. invoiceType = #{invoiceType},
  2044. </if>
  2045. <if test="taxPoint != null and taxPoint !=''">
  2046. taxPoint = #{taxPoint},
  2047. </if>
  2048. <if test="supplierTaxPoint != null and supplierTaxPoint !=''">
  2049. supplierTaxPoint = #{supplierTaxPoint},
  2050. </if>
  2051. <if test="endTimeStr != null and endTimeStr !=''">
  2052. endTimeStr = #{endTimeStr},
  2053. </if>
  2054. <if test="priceType != null and priceType !=''">
  2055. priceType = #{priceType},
  2056. </if>
  2057. <if test="tags != null and tags !=''">
  2058. tags = #{tags},
  2059. </if>
  2060. <if test="recommendType != null and recommendType !=''">
  2061. recommendType = #{recommendType},
  2062. </if>
  2063. <if test="machineType != null and machineType !=''">
  2064. machineType = #{machineType},
  2065. </if>
  2066. <if test="includedTax != null and includedTax !=''">
  2067. includedTax = #{includedTax},
  2068. </if>
  2069. <if test="invoiceType != null and invoiceType !=''">
  2070. invoiceType = #{invoiceType},
  2071. </if>
  2072. <if test="commodityType != null and commodityType != ''">
  2073. commodityType = #{commodityType},
  2074. </if>
  2075. </set>
  2076. where productID = #{productID}
  2077. </update>
  2078. <update id="updateproductDetailInfo" parameterType="com.caimei.modules.product.entity.ProductDetailInfo">
  2079. update productdetailinfo
  2080. <set>
  2081. <if test="propValueAlias != null and propValueAlias != ''">
  2082. propValueAlias = #{propValueAlias},
  2083. </if>
  2084. <if test="propValueImages != null and propValueImages !=''">
  2085. propValueImages = #{propValueImages},
  2086. </if>
  2087. <if test="detailInfo != null">
  2088. detailInfo = #{detailInfo},
  2089. </if>
  2090. <if test="detailInfoTxt != null">
  2091. detailInfoTxt = #{detailInfoTxt},
  2092. </if>
  2093. <if test="seoTitle != null and seoTitle !=''">
  2094. seoTitle = #{seoTitle},
  2095. </if>
  2096. <if test="seoKeyword != null and seoKeyword !=''">
  2097. seoKeyword = #{seoKeyword},
  2098. </if>
  2099. <if test="seoDes != null and seoDes !=''">
  2100. seoDes = #{seoDes},
  2101. </if>
  2102. <if test="serviceInfo != null ">
  2103. serviceInfo = #{serviceInfo},
  2104. </if>
  2105. <if test="orderInfo != null ">
  2106. orderInfo = #{orderInfo},
  2107. </if>
  2108. </set>
  2109. where productID = #{productID}
  2110. </update>
  2111. <update id="updateLadderPrice">
  2112. update product_ladder_price
  2113. set productId = #{productId},
  2114. ladderNum = #{ladderNum},
  2115. buyNum = #{buyNum},
  2116. buyPrice = #{buyPrice},
  2117. updateBy = #{updateBy},
  2118. updateDate = #{updateDate},
  2119. delFlag = #{delFlag}
  2120. where id = #{id}
  2121. </update>
  2122. <select id="getProductByTypeName" resultType="com.caimei.modules.brand.entity.BrandAndProductType">
  2123. select
  2124. b.name AS "bigTypeName",b.bigTypeID,s.`name` AS "smallTypeName",s.smalltypeID,t.name AS "tinyTypeName" ,t.tinytypeID
  2125. from tinytype_new t LEFT JOIN smalltype_new s on t.smallTypeID = s.smallTypeID LEFT JOIN bigtype_new b ON b.bigTypeID = s.bigTypeID
  2126. where b.`name` = #{name} AND s.`name` = #{name1} AND t.name = #{name2}
  2127. </select>
  2128. <select id="findRecommendBySys" resultType="com.caimei.modules.product.entity.CmProductRecommend">
  2129. select
  2130. p.productID AS recommendProductID,
  2131. p.name AS productName,
  2132. p.unit AS unit,
  2133. p.mainImage AS img,
  2134. s.name AS shopName
  2135. from product p
  2136. left join shop s on s.shopID = p.shopID
  2137. where p.tinyTypeID = #{tinyTypeID} and p.productCategory = 1
  2138. order by p.sellNumber
  2139. desc limit 0, 7
  2140. </select>
  2141. <select id="getSecondHandRecommend" resultType="CmSecondHandRecommendVo">
  2142. select p.productID AS id,
  2143. 1 AS type,
  2144. p.name AS name,
  2145. p.unit AS unit,
  2146. p.mainImage AS img,
  2147. s.name AS shopName,
  2148. p.productCategory as "productCategory"
  2149. from product p
  2150. left join shop s on s.shopID = p.shopID
  2151. where p.productID = #{productID}
  2152. AND p.validFlag = '2'
  2153. </select>
  2154. <select id="querySecondHandRecommend" resultType="CmSecondHandRecommendVo">
  2155. select
  2156. p.productID AS id,
  2157. 1 AS type,
  2158. p.name AS name,
  2159. p.unit AS unit,
  2160. p.mainImage AS img,
  2161. s.name AS shopName,
  2162. p.productCategory as "productCategory"
  2163. from product p
  2164. left join shop s on s.shopID = p.shopID
  2165. <where>
  2166. <if test="productID != null and productID != ''">
  2167. p.productID = #{productID}
  2168. </if>
  2169. <if test="productName != null and productName != ''">
  2170. and p.name like concat('%', #{productName} ,'%')
  2171. </if>
  2172. AND p.validFlag = '2'
  2173. and p.productCategory = #{queryProductType}
  2174. </where>
  2175. limit 0, 10
  2176. </select>
  2177. <select id="queryProductDetailInfo" resultType="com.caimei.modules.product.entity.ProductDetailInfo">
  2178. SELECT * FROM
  2179. productdetailinfo
  2180. where productID = #{productID}
  2181. </select>
  2182. <select id="findProductLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
  2183. SELECT *
  2184. FROM product_ladder_price
  2185. WHERE
  2186. productId = #{productId}
  2187. AND userType = #{userType}
  2188. AND buyNum is NOT null
  2189. AND buyPrice is NOT null
  2190. AND delFlag = 0
  2191. ORDER BY ladderNum ASC
  2192. </select>
  2193. <select id="findActList" resultType="com.caimei.modules.product.entity.Product">
  2194. SELECT
  2195. <include refid="productColumns"/>
  2196. FROM product a
  2197. <include refid="productJoins"/>
  2198. <where>
  2199. <if test="id !=null and id !=''">
  2200. AND a.productID=#{id}
  2201. </if>
  2202. <if test="shopID != null and shopID != ''">
  2203. AND a.shopID = #{shopID}
  2204. </if>
  2205. <if test="name != null and name != ''">
  2206. AND a.name LIKE
  2207. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  2208. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  2209. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  2210. </if>
  2211. <if test="shopName != null and shopName != ''">
  2212. AND s.name LIKE
  2213. <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
  2214. <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
  2215. <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
  2216. </if>
  2217. <if test="validFlag !=null and validFlag !=''">
  2218. AND a.validFlag=#{validFlag}
  2219. </if>
  2220. <if test="actFlag !=null and actFlag !=''">
  2221. AND a.actFlag=#{actFlag}
  2222. </if>
  2223. <if test="actType !=null and actType !=''">
  2224. AND a.actType=#{actType}
  2225. </if>
  2226. AND a.actStatus = 1
  2227. and a.productCategory = 1
  2228. </where>
  2229. <choose>
  2230. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  2231. ORDER BY ${page.orderBy}
  2232. </when>
  2233. <otherwise>
  2234. order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
  2235. </otherwise>
  2236. </choose>
  2237. </select>
  2238. <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
  2239. select p.productID,p.mainImage,p.name,s.name as shopName from product p left join shop s on p.shopID = s.shopID
  2240. <where>
  2241. (p.actFlag=0 or p.actType is null) and p.validFlag = 2 and p.productCategory = 1
  2242. <if test="productIds != null and productIds != '' ">
  2243. and p.productID != #{productIds}
  2244. </if>
  2245. <if test="productID != null and productID != ''">
  2246. and p.productID = #{productID}
  2247. </if>
  2248. <if test="name != null and name != ''">
  2249. and p.name like concat('%',#{name},'%')
  2250. </if>
  2251. <if test="shopName != null and shopName != ''">
  2252. and s.name like concat('%',#{shopName},'%')
  2253. </if>
  2254. </where>
  2255. order by productID asc
  2256. </select>
  2257. <select id="findProductImage" resultType="com.caimei.modules.product.entity.Product">
  2258. SELECT
  2259. <include refid="productColumns"/>
  2260. FROM product a
  2261. <include refid="productJoins"/>
  2262. <where>
  2263. <if test="productID !=null">
  2264. AND a.productID=#{productID}
  2265. </if>
  2266. <if test="shopID != null and shopID != ''">
  2267. AND a.shopID = #{shopID}
  2268. </if>
  2269. <if test="name != null and name != ''">
  2270. AND a.name LIKE concat('%',#{name},'%')
  2271. </if>
  2272. <if test="shopName != null and shopName != ''">
  2273. AND s.name LIKE concat('%',#{shopName},'%')
  2274. </if>
  2275. <if test="validFlag !=null and validFlag !=''">
  2276. AND a.validFlag=#{validFlag}
  2277. </if>
  2278. <if test="productCategory !=null and productCategory !=''">
  2279. AND a.productCategory=#{productCategory}
  2280. </if>
  2281. <if test="ids.size() > 0">
  2282. AND a.productID NOT IN
  2283. <foreach collection="ids" close=")" separator="," open="(" item="id">
  2284. #{id}
  2285. </foreach>
  2286. </if>
  2287. </where>
  2288. <choose>
  2289. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  2290. ORDER BY ${page.orderBy}
  2291. </when>
  2292. <otherwise>
  2293. order by a.productID asc
  2294. </otherwise>
  2295. </choose>
  2296. </select>
  2297. </mapper>