ProductMapper.xml 68 KB

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