plf 4 년 전
부모
커밋
a10a9a6702

+ 16 - 0
src/main/java/com/caimei/www/controller/ClassificationController.java

@@ -1,11 +1,16 @@
 package com.caimei.www.controller;
 
 import com.caimei.www.mapper.ProductDao;
+import com.caimei.www.pojo.JsonModel;
+import com.caimei.www.pojo.classify.Bigtype;
+import com.caimei.www.pojo.classify.SmallType;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 /**
  * Description
@@ -23,4 +28,15 @@ public class ClassificationController extends BaseController {
     public String selectUp() {
         return "help/select";
     }
+
+    @GetMapping("bigTypeData")
+    @ResponseBody
+    public JsonModel bigTypeData(){
+        List<Bigtype> bigtypeList = productDao.findBigtype();
+        bigtypeList.forEach((bigtype)->{
+            List<SmallType> smallTypes = productDao.findSmalltype();
+            bigtype.setSmallTypes(smallTypes);
+        });
+        return JsonModel.success(bigtypeList);
+    }
 }

+ 17 - 1
src/main/java/com/caimei/www/mapper/ProductDao.java

@@ -1,9 +1,11 @@
 package com.caimei.www.mapper;
 
+import com.caimei.www.pojo.classify.Bigtype;
+import com.caimei.www.pojo.classify.SmallType;
 import com.caimei.www.pojo.order.CartItem;
+import com.caimei.www.pojo.page.Parameter;
 import com.caimei.www.pojo.page.ProductDetail;
 import com.caimei.www.pojo.page.ProductList;
-import com.caimei.www.pojo.page.Parameter;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -18,6 +20,7 @@ import java.util.List;
 public interface ProductDao {
     /**
      * 根据商品Id获取详情
+     *
      * @param productId
      * @return
      */
@@ -25,14 +28,17 @@ public interface ProductDao {
 
     /**
      * 详情-相关推荐
+     *
      * @param productId
      * @return
      */
     List<ProductList> getProductRecommendsById(Integer productId);
+
     List<ProductList> getAutoProductRecommends(Integer productId);
 
     /**
      * 详情-相关参数
+     *
      * @param productId
      * @return
      */
@@ -40,6 +46,7 @@ public interface ProductDao {
 
     /**
      * 详情-图片
+     *
      * @param productId
      * @return
      */
@@ -47,8 +54,17 @@ public interface ProductDao {
 
     /**
      * 详情-价格
+     *
      * @param productId
      * @return
      */
     CartItem getPriceItemById(Integer productId);
+
+
+    /**
+     * 下面的用完即删
+     */
+    List<Bigtype> findBigtype();
+
+    List<SmallType> findSmalltype();
 }

+ 19 - 0
src/main/java/com/caimei/www/pojo/classify/Bigtype.java

@@ -0,0 +1,19 @@
+package com.caimei.www.pojo.classify;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : plf
+ * @date : 2020/12/23
+ */
+@Data
+public class Bigtype implements Serializable {
+    private  Integer bigTypeID;
+    private  String name;
+    private  List<SmallType> smallTypes;
+}

+ 15 - 0
src/main/java/com/caimei/www/pojo/classify/SmallType.java

@@ -0,0 +1,15 @@
+package com.caimei.www.pojo.classify;
+
+import lombok.Data;
+
+/**
+ * Description
+ *
+ * @author : plf
+ * @date : 2020/12/23
+ */
+@Data
+public class SmallType {
+    private  Integer smallTypeID;
+    private  String name;
+}

+ 9 - 0
src/main/resources/mapper/ProductMapper.xml

@@ -110,4 +110,13 @@
 	</select>
 
 
+	<select id="findBigtype" resultType="com.caimei.www.pojo.classify.Bigtype">
+		SELECT bigTypeID, name FROM bigtype ORDER BY sortIndex
+	</select>
+
+	<select id="findSmalltype" resultType="com.caimei.www.pojo.classify.SmallType">
+		SELECT smallTypeID,name FROM smalltype ORDER BY sortIndex
+	</select>
+
+
 </mapper>