|
@@ -0,0 +1,354 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
+<mapper namespace="com.caimei365.manager.dao.product.ProductMapper">
|
|
|
+
|
|
|
+ <insert id="insertProductImage">
|
|
|
+ insert into productimage (productID, shopID, addTime, image, mainFlag, sortIndex)
|
|
|
+ values (#{productId}, ifnull(#{shopId},(select shopId from product where productId=#{productId})), #{addTime}, #{image}, #{mainFlag}, #{sortIndex})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateStatus">
|
|
|
+ update cm_organize_product_info
|
|
|
+ set validFlag = #{validFlag}
|
|
|
+ where productId = #{productId}
|
|
|
+ </update>
|
|
|
+ <update id="updateShop">
|
|
|
+ update product
|
|
|
+ set shopId = #{shopId}
|
|
|
+ where productId = #{productId}
|
|
|
+ </update>
|
|
|
+ <update id="updateSecondDetail">
|
|
|
+ update cm_second_hand_detail
|
|
|
+ set allocateStatus = 2
|
|
|
+ where productId = #{productId}
|
|
|
+ </update>
|
|
|
+ <update id="updateOnlineDate">
|
|
|
+ update cm_second_hand_detail
|
|
|
+ set onLineDate = now()
|
|
|
+ where productId = #{productId}
|
|
|
+ </update>
|
|
|
+ <update id="updateSku">
|
|
|
+ update cm_sku
|
|
|
+ set price = #{price}
|
|
|
+ where productId = #{productId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateSecond">
|
|
|
+ UPDATE cm_second_hand_detail
|
|
|
+ <set>
|
|
|
+ <if test="sold != null and sold != ''">
|
|
|
+ sold = #{sold},
|
|
|
+ </if>
|
|
|
+ <if test="secondHandType != null and secondHandType != ''">
|
|
|
+ secondHandType = #{secondHandType},
|
|
|
+ </if>
|
|
|
+ <if test="instrumentType != null and instrumentType != ''">
|
|
|
+ instrumentType = #{instrumentType},
|
|
|
+ </if>
|
|
|
+ <if test="fixedYears != null and fixedYears != ''">
|
|
|
+ fixedYears = #{fixedYears},
|
|
|
+ </if>
|
|
|
+ <if test="maturityYears != null and maturityYears != ''">
|
|
|
+ maturityYears = #{maturityYears},
|
|
|
+ </if>
|
|
|
+ <if test="detailTalkFlag != null and detailTalkFlag != ''">
|
|
|
+ detailTalkFlag = #{detailTalkFlag},
|
|
|
+ </if>
|
|
|
+ <if test="contactName != null and contactName != ''">
|
|
|
+ contactName = #{contactName},
|
|
|
+ </if>
|
|
|
+ <if test="contactMobile != null and contactMobile != ''">
|
|
|
+ contactMobile = #{contactMobile},
|
|
|
+ </if>
|
|
|
+ <if test="secondProductType != null and secondProductType != ''">
|
|
|
+ secondProductType = #{secondProductType},
|
|
|
+ </if>
|
|
|
+ <if test="provinceCityDistrict != null and provinceCityDistrict != ''">
|
|
|
+ provinceCityDistrict = #{provinceCityDistrict},
|
|
|
+ </if>
|
|
|
+ <if test="townId != null and townId != ''">
|
|
|
+ townId = #{townId},
|
|
|
+ </if>
|
|
|
+ <if test="address != null and address != ''">
|
|
|
+ address = #{address},
|
|
|
+ </if>
|
|
|
+ <if test="productQuality != null and productQuality != ''">
|
|
|
+ productQuality = #{productQuality},
|
|
|
+ </if>
|
|
|
+ <if test="productDetails != null and productDetails != ''">
|
|
|
+ productDetails = #{productDetails},
|
|
|
+ </if>
|
|
|
+ <if test="viewingNum != null and viewingNum != ''">
|
|
|
+ viewingNum = #{viewingNum},
|
|
|
+ </if>
|
|
|
+ <if test="brandName != null and brandName != ''">
|
|
|
+ brandName = #{brandName},
|
|
|
+ </if>
|
|
|
+ <if test="showContactFlag != null and showContactFlag != ''">
|
|
|
+ showContactFlag = #{showContactFlag},
|
|
|
+ </if>
|
|
|
+ <if test="publisher != null and publisher != ''">
|
|
|
+ publisher = #{publisher},
|
|
|
+ </if>
|
|
|
+ <if test="publishIdentity != null and publishIdentity != ''">
|
|
|
+ publishIdentity = #{publishIdentity},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ WHERE productID = #{productId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateMainImage">
|
|
|
+ update product
|
|
|
+ set mainImage = #{mainImage}
|
|
|
+ where productId = #{productId}
|
|
|
+ </update>
|
|
|
+ <update id="updateProduct">
|
|
|
+ update product
|
|
|
+ <set>
|
|
|
+ <if test="name != null and name !=''">
|
|
|
+ name = #{name},
|
|
|
+ </if>
|
|
|
+ <if test="brandId != null and brandId !=''">
|
|
|
+ brandID = #{brandId},
|
|
|
+ </if>
|
|
|
+ <if test="mainImage != null and mainImage !=''">
|
|
|
+ mainImage = #{mainImage}
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where productID = #{productId}
|
|
|
+ </update>
|
|
|
+ <delete id="delProductImages">
|
|
|
+ delete from productimage
|
|
|
+ where productId = #{productId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="findSecondList" resultType="com.caimei365.manager.entity.caimei.product.Product">
|
|
|
+ SELECT
|
|
|
+ a.newvalidFlag,
|
|
|
+ ifnull(a.newProductType,2) as newProductType,
|
|
|
+ ifnull(a.announType,1) as announType,
|
|
|
+ a.productID AS "id",
|
|
|
+ a.productID AS "productID",
|
|
|
+ a.groundMall AS "groundMall",
|
|
|
+ a.brandID AS "brandID",
|
|
|
+ ifnull(a.bigTypeID,0) AS "bigTypeID",
|
|
|
+ ifnull(a.smallTypeID,0) AS "smallTypeID",
|
|
|
+ ifnull(a.tinyTypeID,0) AS "tinyTypeID",
|
|
|
+ a.productCategory AS "productCategory",
|
|
|
+ a.preferredFlag AS "preferredFlag",
|
|
|
+ a.shopID AS "shopID",
|
|
|
+ a.name AS "name",
|
|
|
+ a.searchKey AS "searchKey",
|
|
|
+ a.combinationID AS "combinationID",
|
|
|
+ a.productRemarks AS "productRemarks",
|
|
|
+ a.priceFlag AS "priceFlag",
|
|
|
+ a.beautyActFlag AS "beautyActFlag",
|
|
|
+ a.hasSkuFlag AS "hasSkuFlag",
|
|
|
+ a.mainImage AS "mainImage",
|
|
|
+ a.propertiesInfo AS "propertiesInfo",
|
|
|
+ a.addTime AS "addTime",
|
|
|
+ a.updateTime AS "updateTime",
|
|
|
+ a.sellNumber AS "sellNumber",
|
|
|
+ a.beforeValidFlag AS "beforeValidFlag",
|
|
|
+ copi.validFlag AS "validFlag",
|
|
|
+ a.favoriteTimes AS "favoriteTimes",
|
|
|
+ a.commentScore AS "commentScore",
|
|
|
+ a.commentTimes AS "commentTimes",
|
|
|
+ a.sortIndex AS "sortIndex",
|
|
|
+ a.featuredFlag AS "featuredFlag",
|
|
|
+ a.featuredSortIndex AS "featuredSortIndex",
|
|
|
+ a.productCode AS "productCode",
|
|
|
+ a.allAreaFlag AS "allAreaFlag",
|
|
|
+ a.provinceIDs AS "provinceIDs",
|
|
|
+ a.serviceNumber AS "serviceNumber",
|
|
|
+ a.packageCount AS "packageCount",
|
|
|
+ a.byFlag AS "byFlag",
|
|
|
+ a.normalProductFlag AS "normalProductFlag",
|
|
|
+ a.step AS "step",
|
|
|
+ a.actStatus AS "actStatus",
|
|
|
+ a.actFlag AS "actFlag",
|
|
|
+ a.actType AS "actType",
|
|
|
+ a.onlineTime AS "onlineTime",
|
|
|
+ a.downlineTime AS "downlineTime",
|
|
|
+ a.freePostFlag AS "freePostFlag",
|
|
|
+ s.name AS "shopName",
|
|
|
+ a.actSort AS "actSort",
|
|
|
+ a.recommendType AS "recommendType",
|
|
|
+ a.aliasName as "aliasName",
|
|
|
+ a.visibility as "visibility",
|
|
|
+ a.commodityDetailsFlag as "commodityDetailsFlag",
|
|
|
+ a.productType as "productType",
|
|
|
+ a.qualificationImg as "qualificationImg",
|
|
|
+ a.includedTax as "includedTax",
|
|
|
+ a.invoiceType as "invoiceType",
|
|
|
+ a.taxPoint as "taxPoint",
|
|
|
+ a.supplierTaxPoint as "supplierTaxPoint",
|
|
|
+ a.tags as "tags",
|
|
|
+ a.machineType as "machineType",
|
|
|
+ a.commodityType as "commodityType",
|
|
|
+ a.trainingMethod as "trainingMethod",
|
|
|
+ a.trainingType as "trainingType",
|
|
|
+ a.trainingFee as "trainingFee",
|
|
|
+ a.splitCode as "splitCode",
|
|
|
+ a.productDescribe as "productDescribe",
|
|
|
+ cshd.secondHandType as "secondHandType",
|
|
|
+ cshd.instrumentType as "instrumentType",
|
|
|
+ cshd.sold as "sold",
|
|
|
+ cshd.payStatus as "payStatus",
|
|
|
+ cshd.contactName as "contactName",
|
|
|
+ cshd.originalPrice as "originalPrice",
|
|
|
+ cshd.submitDate AS "submitDate",
|
|
|
+ cshd.reviewedDate AS "reviewedDate",
|
|
|
+ cshd.onLineDate AS "onLineDate",
|
|
|
+ cshd.brandName AS "otherBrandName",
|
|
|
+ cshd.publisher AS "publisher",
|
|
|
+ cshd.source AS "source",
|
|
|
+ cshd.dockingPeopleName AS "dockingPeopleName",
|
|
|
+ cb.name as "brandName",
|
|
|
+ if(csp.id is not null,1,0) as "svipFlag",
|
|
|
+ cshd.companyName as "companyName",
|
|
|
+ cshd.publishIdentity as "publishIdentity",
|
|
|
+ cshd.publishMethod as "publishMethod",
|
|
|
+ cshd.allocateStatus as "allocateStatus",
|
|
|
+ (select ifnull(price,0) from cm_sku where productId = a.productId limit 1) as price,
|
|
|
+ a.qualificationNo,
|
|
|
+ a.productName,
|
|
|
+ a.qualificationTime,
|
|
|
+ a.qualificationLink,
|
|
|
+ a.returnGoodsStutas,
|
|
|
+ a.labelIds
|
|
|
+ FROM product a
|
|
|
+ LEFT JOIN shop s ON s.shopID = a.shopID
|
|
|
+ LEFT JOIN cm_second_hand_detail cshd ON cshd.productID = a.productID
|
|
|
+ LEFT JOIN cm_brand cb ON a.brandID = cb.id
|
|
|
+ LEFT JOIN cm_svip_product csp on a.productID = csp.productId
|
|
|
+ left join cm_organize_product_info copi on copi.productId = a.productID
|
|
|
+ <where>
|
|
|
+ AND a.productCategory = 2 and copi.validFlag != 0
|
|
|
+ <if test="productId !=null and productId !=''">
|
|
|
+ AND a.productId=#{productId}
|
|
|
+ </if>
|
|
|
+ <if test="commodityType != null and commodityType != ''">
|
|
|
+ AND a.commodityType=#{commodityType}
|
|
|
+ </if>
|
|
|
+ <if test="bigTypeID != null and bigTypeID != 0">
|
|
|
+ AND a.bigTypeID = #{bigTypeID}
|
|
|
+ </if>
|
|
|
+ <if test="smallTypeID != null and smallTypeID != 0">
|
|
|
+ AND a.smallTypeID = #{smallTypeID}
|
|
|
+ </if>
|
|
|
+ <if test="tinyTypeID != null and tinyTypeID != 0">
|
|
|
+ AND a.tinyTypeID = #{tinyTypeID}
|
|
|
+ </if>
|
|
|
+ <if test="validFlag != null and validFlag != ''">
|
|
|
+ AND copi.validFlag = #{validFlag}
|
|
|
+ </if>
|
|
|
+ <if test="validFlag == null and validFlag == ''">
|
|
|
+ AND copi.validFlag != '0'
|
|
|
+ </if>
|
|
|
+ <if test="brandID != null and brandID != ''">
|
|
|
+ AND a.brandID = #{brandID}
|
|
|
+ </if>
|
|
|
+ <if test="shopId != null and shopId != ''">
|
|
|
+ AND a.shopId = #{shopId}
|
|
|
+ </if>
|
|
|
+ <if test="productType != null and productType !=''">
|
|
|
+ AND a.productType = #{productType}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND a.name LIKE concat('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="shopName != null and shopName != ''">
|
|
|
+ AND s.name LIKE concat('%',#{shopName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="actFlag !=null and actFlag !=''">
|
|
|
+ AND a.actFlag=#{actFlag}
|
|
|
+ </if>
|
|
|
+ <if test="actType !=null and actType !=''">
|
|
|
+ AND a.actType=#{actType}
|
|
|
+ </if>
|
|
|
+ <if test="secondHandType !=null and secondHandType !=''">
|
|
|
+ AND cshd.secondHandType=#{secondHandType}
|
|
|
+ </if>
|
|
|
+ <if test="instrumentType !=null and instrumentType !=''">
|
|
|
+ AND cshd.instrumentType like concat('%',#{instrumentType},'%')
|
|
|
+ </if>
|
|
|
+ <if test="sold != null and sold != ''">
|
|
|
+ AND cshd.sold=#{sold}
|
|
|
+ </if>
|
|
|
+ <if test="source != null and source != ''">
|
|
|
+ AND cshd.source=#{source}
|
|
|
+ </if>
|
|
|
+ <if test="publishIdentity != null and publishIdentity !=''">
|
|
|
+ AND cshd.publishIdentity = #{publishIdentity}
|
|
|
+ </if>
|
|
|
+ <if test="announType !=null and announType!= '' and productCategory == 2">
|
|
|
+ AND a.announType=#{announType}
|
|
|
+ </if>
|
|
|
+ <if test="contactName !=null and contactName !=''">
|
|
|
+ AND cshd.contactName LIKE concat('%',#{contactName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="isRelevance != null and isRelevance != ''">
|
|
|
+ <if test="isRelevance == 1">
|
|
|
+ AND a.labelIds IS NOT NULL
|
|
|
+ </if>
|
|
|
+ <if test="isRelevance == 2">
|
|
|
+ AND a.labelIds IS NULL
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
|
|
|
+ AND a.productID NOT IN (6060, 6061, 6062, 6063, 6064,6065, 6066, 6067, 6068, 6069)
|
|
|
+ </where>
|
|
|
+ group by a.productID
|
|
|
+ order by a.productID desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="brandList" resultType="com.caimei365.manager.entity.caimei.brand.CmBrand">
|
|
|
+ select id, name
|
|
|
+ from cm_brand
|
|
|
+ where delflag = 0 and status = 1
|
|
|
+ order by sort
|
|
|
+ </select>
|
|
|
+ <select id="findSecondDetail" resultType="com.caimei365.manager.entity.caimei.product.CmSecondHandDetail">
|
|
|
+ select cshd.productId,
|
|
|
+ cshd.sold,
|
|
|
+ cshd.secondHandType,
|
|
|
+ cshd.instrumentType,
|
|
|
+ cshd.fixedYears,
|
|
|
+ cshd.companyName,
|
|
|
+ cshd.detailTalkFlag,
|
|
|
+ cshd.contactName,
|
|
|
+ cshd.contactMobile,
|
|
|
+ cshd.secondProductType,
|
|
|
+ cshd.townId,
|
|
|
+ c.cityId,
|
|
|
+ pv.provinceId,
|
|
|
+ cshd.provinceCityDistrict,
|
|
|
+ cshd.address,
|
|
|
+ cshd.productQuality,
|
|
|
+ cshd.productDetails,
|
|
|
+ cshd.viewingNum,
|
|
|
+ cshd.brandName,
|
|
|
+ cshd.source,
|
|
|
+ cshd.showContactFlag,
|
|
|
+ cshd.publisher,
|
|
|
+ cshd.buyFlag,
|
|
|
+ cshd.publishMethod,
|
|
|
+ p.brandId,
|
|
|
+ p.name,
|
|
|
+ (select ifnull(price,0) from cm_sku where productId = cshd.productId limit 1) as price
|
|
|
+ from cm_second_hand_detail cshd
|
|
|
+ left join town t on t.townID = cshd.townId
|
|
|
+ left join city c on t.cityID = c.cityID
|
|
|
+ left join province pv on c.provinceID = pv.provinceID
|
|
|
+ left join product p on cshd.productID = p.productID
|
|
|
+ where cshd.productId = #{productId}
|
|
|
+ </select>
|
|
|
+ <select id="findProductImages" resultType="java.lang.String">
|
|
|
+ select image
|
|
|
+ from productimage
|
|
|
+ where productID = #{productId}
|
|
|
+ and mainFlag in (0,1)
|
|
|
+ order by mainFlag desc
|
|
|
+ </select>
|
|
|
+</mapper>
|