|
@@ -27,7 +27,7 @@
|
|
|
</insert>
|
|
|
<insert id="insertProductImage" parameterType="com.caimei365.commodity.model.po.ProductImagePo">
|
|
|
insert into productimage (productID, shopID, addTime, image, mainFlag, sortIndex)
|
|
|
- values (#{productId}, #{shopId}, #{addTime}, #{image}, #{mainFlag}, #{sortIndex})
|
|
|
+ values (#{productId}, ifnull(#{shopId},(select shopId from product where productId=#{productId})), #{addTime}, #{image}, #{mainFlag}, #{sortIndex})
|
|
|
</insert>
|
|
|
<insert id="insertProduct" keyColumn="productID" keyProperty="productId"
|
|
|
parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
|
|
@@ -133,6 +133,10 @@
|
|
|
</set>
|
|
|
where productId = #{productId}
|
|
|
</update>
|
|
|
+ <update id="updateSecondHandStatus">
|
|
|
+ update cm_organize_product_info set validFlag = 3
|
|
|
+ where productId = #{productId}
|
|
|
+ </update>
|
|
|
<delete id="deleteFileTypes">
|
|
|
delete from cm_second_file_type
|
|
|
where productId = #{productId}
|
|
@@ -180,56 +184,60 @@
|
|
|
order by cshd.sold, cshd.onLineDate desc
|
|
|
</select>
|
|
|
<select id="getSecondHandDetail" resultType="com.caimei365.commodity.model.vo.SecondDetailVo">
|
|
|
- select p.productID as productId,
|
|
|
- p.actStatus,
|
|
|
- p.`name` as name,
|
|
|
- p.mainImage as image,
|
|
|
- cs.price,
|
|
|
- cs.normalPrice,
|
|
|
- p.productType,
|
|
|
- cs.stock,
|
|
|
- p.shopId,
|
|
|
- p.brandID as brandId,
|
|
|
- p.visibility as visibility,
|
|
|
- IF(p.brandID != 161, cb.name, cshd.brandName) as "brandName",
|
|
|
- cb.description as "brandInfo",
|
|
|
- cshd.originalPrice,
|
|
|
- cshd.sold,
|
|
|
- cshd.detailTalkFlag,
|
|
|
- cshd.onLineDate,
|
|
|
- cshd.viewingNum,
|
|
|
- cshd.provinceCityDistrict,
|
|
|
- cshd.productDetails,
|
|
|
- cshd.productQuality,
|
|
|
- cshd.secondHandType,
|
|
|
- ifnull(cshd.instrumentType, 0) as instrumentType,
|
|
|
- cshd.showContactFlag,
|
|
|
- cshd.contactMobile,
|
|
|
- cshd.contactName,
|
|
|
- cshd.fixedYears,
|
|
|
- cshd.address,
|
|
|
- cshd.townId,
|
|
|
- cshd.maturityYears,
|
|
|
- cshd.publishIdentity,
|
|
|
- cshd.publishMethod,
|
|
|
- cshd.companyName,
|
|
|
- cshd.submitDate,
|
|
|
- cshd.secondProductType,
|
|
|
- cshd.userId as publishUserId,
|
|
|
- cshd.buyFlag,
|
|
|
- copi.validFlag,
|
|
|
- cpl.userLike,
|
|
|
- GROUP_CONCAT(csft.fileType SEPARATOR ',') AS fileTypes
|
|
|
+ select p.productID as productId,
|
|
|
+ p.actStatus,
|
|
|
+ p.`name` as name,
|
|
|
+ p.mainImage as image,
|
|
|
+ cs.price,
|
|
|
+ cs.normalPrice,
|
|
|
+ p.productType,
|
|
|
+ cs.stock,
|
|
|
+ p.shopId,
|
|
|
+ p.brandID as brandId,
|
|
|
+ p.visibility as visibility,
|
|
|
+ cshd.brandName as "brandName",
|
|
|
+ cb.description as "brandInfo",
|
|
|
+ cshd.originalPrice,
|
|
|
+ cshd.sold,
|
|
|
+ cshd.detailTalkFlag,
|
|
|
+ cshd.onLineDate,
|
|
|
+ cshd.viewingNum,
|
|
|
+ cshd.provinceCityDistrict,
|
|
|
+ cshd.productDetails,
|
|
|
+ cshd.productQuality,
|
|
|
+ cshd.secondHandType,
|
|
|
+ ifnull(cshd.instrumentType, 0) as instrumentType,
|
|
|
+ cshd.showContactFlag,
|
|
|
+ if(publishMethod=2,s.contractMobile,cshd.contactMobile) as contactMobile,
|
|
|
+ if(publishMethod=2,s.name,cshd.contactName) as contactName,
|
|
|
+ cshd.fixedYears,
|
|
|
+ cshd.address,
|
|
|
+ cshd.townId,
|
|
|
+ cshd.maturityYears,
|
|
|
+ cshd.publishIdentity,
|
|
|
+ cshd.publishMethod,
|
|
|
+ cshd.companyName,
|
|
|
+ cshd.submitDate,
|
|
|
+ cshd.secondProductType,
|
|
|
+ cshd.userId as publishUserId,
|
|
|
+ cshd.buyFlag,
|
|
|
+ copi.validFlag,
|
|
|
+ ifnull(cpl.userLike,0) as userLike,
|
|
|
+ GROUP_CONCAT(csft.fileType SEPARATOR ',') AS fileTypes
|
|
|
from product p
|
|
|
- left join cm_sku cs on p.productID = cs.productId
|
|
|
- left join cm_second_hand_detail cshd on p.productID = cshd.productID
|
|
|
- left join cm_organize_product_info copi on p.productId = copi.productId
|
|
|
- left join cm_brand cb on cb.id = p.brandID
|
|
|
- LEFT JOIN cm_product_userlike cpl ON p.productID = cpl.productID
|
|
|
- LEFT JOIN cm_second_file_type csft ON cshd.id = csft.secondId
|
|
|
+ left join shop s on p.shopId = s.shopId
|
|
|
+ left join cm_sku cs on p.productID = cs.productId
|
|
|
+ left join cm_second_hand_detail cshd on p.productID = cshd.productID
|
|
|
+ left join cm_organize_product_info copi on p.productId = copi.productId
|
|
|
+ left join cm_brand cb on cb.id = p.brandID
|
|
|
+ LEFT JOIN cm_product_userlike cpl ON p.productID = cpl.productID
|
|
|
+ <if test="userId != null and userId !=''">
|
|
|
+ and cpl.userId = #{userId}
|
|
|
+ </if>
|
|
|
+ LEFT JOIN cm_second_file_type csft ON p.productId = csft.productId
|
|
|
where p.productCategory = 2
|
|
|
- and p.productID = #{productId}
|
|
|
- and cs.organizeId in (0, 5)
|
|
|
+ and p.productID = #{productId}
|
|
|
+ and cs.organizeId in (0, 5)
|
|
|
</select>
|
|
|
<select id="getImageByProductId" resultType="java.lang.String">
|
|
|
select image
|
|
@@ -382,6 +390,7 @@
|
|
|
left join cm_brand cb on cb.id = p.brandID
|
|
|
where
|
|
|
p.productCategory = 2 and copi.validFlag in(1,2,3,8)
|
|
|
+ and if(cshd.publishMethod = 1,cshd.payStatus=2,1=1)
|
|
|
<if test="buyFlag != null and buyFlag != ''">
|
|
|
and cshd.buyFlag = #{buyFlag}
|
|
|
</if>
|
|
@@ -411,7 +420,7 @@
|
|
|
cshd.submitDate,
|
|
|
copi.validFlag
|
|
|
from product p
|
|
|
- left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
|
|
|
+ left join cm_organize_product_info copi on copi.productId = p.productID
|
|
|
left join cm_sku cs on p.productID=cs.productId
|
|
|
left join cm_second_hand_detail cshd on p.productID = cshd.productID
|
|
|
left join cm_brand cb on cb.id = p.brandID
|
|
@@ -422,7 +431,7 @@
|
|
|
<if test="shopId != null and shopId != ''">
|
|
|
and p.shopId = #{shopId}
|
|
|
</if>
|
|
|
- order by cshd.sold, cshd.onLineDate desc
|
|
|
+ order by cshd.submitDate desc,cshd.sold
|
|
|
</select>
|
|
|
|
|
|
<select id="getImagePos" resultType="com.caimei365.commodity.model.po.ProductImagePo">
|