ソースを参照

二手商品小程序接口

jun.li@caimei365.com 4 年 前
コミット
d3ce5e2273

+ 47 - 1
base-module/src/main/java/com/caimei/module/base/entity/po/SeconHandProduct.java

@@ -3,7 +3,6 @@ package com.caimei.module.base.entity.po;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -121,6 +120,10 @@ public class SeconHandProduct extends Product implements Serializable {
          * 上架时间(审核时上架变化、自动下架后再上架变化、手动下架后上架如果不在有效期内才变化)
          */
     private Date onLineDate;
+    /**
+     * 上架时间字符串(年月日)
+      */
+    private String onLineDateStr;
     /**
      * 商品图片信息
      */
@@ -164,4 +167,47 @@ public class SeconHandProduct extends Product implements Serializable {
      */
     private String typeStr;
 
+    @Override
+    public String toString() {
+        return "SeconHandProduct{" +
+                "sold='" + sold + '\'' +
+                ", secondHandType='" + secondHandType + '\'' +
+                ", instrumentType='" + instrumentType + '\'' +
+                ", fixedYears='" + fixedYears + '\'' +
+                ", maturityYears='" + maturityYears + '\'' +
+                ", companyName='" + companyName + '\'' +
+                ", detailTalkFlag='" + detailTalkFlag + '\'' +
+                ", originalPrice=" + originalPrice +
+                ", originalPriceStr='" + originalPriceStr + '\'' +
+                ", price1Str='" + price1Str + '\'' +
+                ", normalPriceStr='" + normalPriceStr + '\'' +
+                ", contactName='" + contactName + '\'' +
+                ", contactMobile='" + contactMobile + '\'' +
+                ", secondProductType='" + secondProductType + '\'' +
+                ", provinceCityDistrict='" + provinceCityDistrict + '\'' +
+                ", address='" + address + '\'' +
+                ", productQuality='" + productQuality + '\'' +
+                ", payStatus='" + payStatus + '\'' +
+                ", payAmount=" + payAmount +
+                ", payFormData='" + payFormData + '\'' +
+                ", payType='" + payType + '\'' +
+                ", payDate=" + payDate +
+                ", submitDate=" + submitDate +
+                ", reviewedDate=" + reviewedDate +
+                ", onLineDate=" + onLineDate +
+                ", onLineDateStr='" + onLineDateStr + '\'' +
+                ", image1='" + image1 + '\'' +
+                ", image2='" + image2 + '\'' +
+                ", image3='" + image3 + '\'' +
+                ", image4='" + image4 + '\'' +
+                ", image5='" + image5 + '\'' +
+                ", productDetails='" + productDetails + '\'' +
+                ", townId=" + townId +
+                ", viewingNum=" + viewingNum +
+                ", newAdded='" + newAdded + '\'' +
+                ", imageList=" + imageList +
+                ", brandName='" + brandName + '\'' +
+                ", typeStr='" + typeStr + '\'' +
+                '}';
+    }
 }

+ 6 - 0
product/src/main/java/com/caimei/module/product/dao/ProductModuleDao.java

@@ -68,9 +68,15 @@ public interface ProductModuleDao {
 
     List<SeconHandProduct> getSeconHandProductList(SeconHandProduct seconHandProduct);
 
+    List<SeconHandProduct> getSeconHandProductByLimit(String secondHandType);
+
     SeconHandProduct getSencondHandProductDetail(Integer productId);
 
     List<CmBrand> getBrandList();
 
     void updateViewingNum(SeconHandProduct sencondHandProductDetail);
+
+    List<SeconHandProduct> getSecondHandProductRecommend(Integer productId);
+
+    List<SeconHandProduct>  getOrderSecondHandProductList(@Param("searchKeyword")String searchKeyword, @Param("secondHandType")String secondHandType, @Param("instrumentType")String instrumentType);
 }

+ 41 - 2
product/src/main/resources/com-caimei-module-product/ProductModuleMapper.xml

@@ -386,10 +386,10 @@
     </select>
     <select id="getSencondHandProductDetail" resultType="com.caimei.module.base.entity.po.SeconHandProduct">
         SELECT
-	        *,cb.name as "brandName"
+            *,cb.name as "brandName"
         FROM
             product p
-        LEFT JOIN cm_second_hand_detail cshd ON p.productID = cshd.productID
+            LEFT JOIN cm_second_hand_detail cshd ON p.productID = cshd.productID
         left join cm_brand cb on cb.id = p.brandID
         WHERE
             p.productCategory = 2
@@ -400,4 +400,43 @@
 		where b.status = '1' and b.delFlag = '0' and b.description is not null and b.description != '' and b.id not in (161)
 		order by b.sort
     </select>
+
+    <select id="getSecondHandProductRecommend" resultType="com.caimei.module.base.entity.po.SeconHandProduct">
+        select * from cm_second_hand_recommend cshr LEFT JOIN product p on cshr.secondHandProductID = p.productID where cshr.delFlag = 0 and p.validFlag = 2 and  cshr.secondHandProductID = #{productId};
+    </select>
+
+    <select id="getOrderSecondHandProductList" resultType="com.caimei.module.base.entity.po.SeconHandProduct">
+        SELECT
+            *
+        FROM
+            product p
+        LEFT JOIN cm_second_hand_detail cshd ON cshd.productID = p.productID
+        WHERE
+            p.productCategory = 2 and p.validFlag = 2
+            <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="searchKeyword != null and searchKeyword != ''">
+            and p.name like CONCAT('%',#{searchKeyword},'%')
+            </if>
+            ORDER BY cshd.onLineDate DESC
+    </select>
+    <select id="getSeconHandProductByLimit" resultType="com.caimei.module.base.entity.po.SeconHandProduct">
+        SELECT
+	        *
+        FROM
+            product p
+        LEFT JOIN cm_second_hand_detail cshd ON p.productID = cshd.productID
+        WHERE
+            p.productCategory = 2
+        AND p.validFlag = 2
+        <if test="secondHandType != null and secondHandType != ''">
+            and cshd.secondHandType = #{secondHandType}
+        </if>
+        ORDER BY cshd.onLineDate DESC
+        limit 10
+    </select>
 </mapper>