chao %!s(int64=4) %!d(string=hai) anos
pai
achega
1f46eb3f08

+ 1 - 0
src/main/java/com/caimei365/commodity/components/PriceUtilService.java

@@ -33,6 +33,7 @@ public class PriceUtilService {
      */
      */
     public Integer getPriceGrade(Double price){
     public Integer getPriceGrade(Double price){
         int grade = 1;
         int grade = 1;
+        price = price != null ? price : 0d;
         if (price > 50 * 10000) {
         if (price > 50 * 10000) {
             grade = 5;
             grade = 5;
         } else if (price > 25 * 10000) {
         } else if (price > 25 * 10000) {

+ 1 - 1
src/main/java/com/caimei365/commodity/controller/ProductPageApi.java

@@ -41,7 +41,7 @@ public class ProductPageApi {
         @ApiImplicitParam(required = false, name = "source", value = "请求来源:www,crm")
         @ApiImplicitParam(required = false, name = "source", value = "请求来源:www,crm")
     })
     })
     @GetMapping("/classify")
     @GetMapping("/classify")
-    public ResponseJson<List<BigTypeVo>> getClassify(String typeSort, String source) {
+    public ResponseJson<List<BigTypeVo>> getClassify(Integer typeSort, String source) {
         return pageService.getClassify(typeSort, source);
         return pageService.getClassify(typeSort, source);
     }
     }
 
 

+ 0 - 1
src/main/java/com/caimei365/commodity/controller/ProductShopApi.java

@@ -6,7 +6,6 @@ import com.caimei365.commodity.model.search.ProductListVo;
 import com.caimei365.commodity.service.ShopService;
 import com.caimei365.commodity.service.ShopService;
 import io.swagger.annotations.*;
 import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
-import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import java.util.List;
 import java.util.List;

+ 86 - 0
src/main/java/com/caimei365/commodity/controller/ProductTypeApi.java

@@ -0,0 +1,86 @@
+package com.caimei365.commodity.controller;
+
+import com.caimei365.commodity.model.ResponseJson;
+import com.caimei365.commodity.model.vo.BigTypeVo;
+import com.caimei365.commodity.model.vo.SmallTypeVo;
+import com.caimei365.commodity.model.vo.TinyTypeVo;
+import com.caimei365.commodity.service.ProductTypeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/4/22
+ */
+@Api(tags="商品分类API")
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/commodity/type")
+public class ProductTypeApi {
+    private final ProductTypeService productTypeService;
+
+    /**
+     * 根据商品属性获取一级分类下拉
+     *
+     * @param typeSort 分类类型,1产品,2仪器
+     */
+    @ApiOperation("获取一级分类下拉列表(旧:/supplier/primaryClassification)")
+    @ApiImplicitParam(required = true, name = "typeSort", value = "类型,1产品,2仪器")
+    @GetMapping("/first")
+    public ResponseJson<List<BigTypeVo>> getBigTypeSelect(Integer typeSort) {
+        return productTypeService.getBigTypeSelect(typeSort);
+    }
+
+    /**
+     * 获取二级分类下拉列表
+     *
+     * @param bigTypeId 一级分类Id
+     */
+    @ApiOperation("获取二级分类下拉列表(旧:/supplier/secondaryClassification)")
+    @ApiImplicitParam(required = true, name = "bigTypeId", value = "一级分类Id")
+    @GetMapping("/second")
+    public ResponseJson<List<SmallTypeVo>> getSmallTypeSelect(Integer bigTypeId) {
+        return productTypeService.getSmallTypeSelect(bigTypeId);
+    }
+
+    /**
+     * 获取三级分类下拉列表
+     *
+     * @param smallTypeId 二级分类Id
+     */
+    @ApiOperation("获取三级分类下拉列表(旧:/supplier/threeLevelClassification)")
+    @ApiImplicitParam(required = true, name = "smallTypeId", value = "二级分类Id")
+    @GetMapping("/third")
+    public ResponseJson<List<TinyTypeVo>> getTinyTypeSelect(Integer smallTypeId) {
+        return productTypeService.getTinyTypeSelect(smallTypeId);
+    }
+
+    /**
+     * 根据Id获取分类(小程序)
+     *
+     * @param typeId  分类Id
+     * @param idType  typeId类型:1:bigType,2:smallType,3:tinyType
+     * @param source  请求来源:www,crm
+     */
+    @ApiOperation("根据Id获取分类(小程序)(旧:/product/typeId/classify)")
+    @ApiImplicitParams({
+        @ApiImplicitParam(required = true, name = "typeId", value = "分类Id"),
+        @ApiImplicitParam(required = true, name = "idType", value = "typeId类型:1:bigType,2:smallType,3:tinyType"),
+        @ApiImplicitParam(required = false, name = "source", value = "请求来源:www,crm")
+    })
+    @GetMapping("/id")
+    public ResponseJson<BigTypeVo> getTypeById(Integer typeId, Integer idType, String source) {
+        return productTypeService.getTypeById(typeId, idType, source);
+    }
+
+}

+ 0 - 18
src/main/java/com/caimei365/commodity/mapper/PageMapper.java

@@ -13,24 +13,6 @@ import java.util.List;
  */
  */
 @Mapper
 @Mapper
 public interface PageMapper {
 public interface PageMapper {
-    /**
-     * 获取大分类
-     * @param typeSort 分类类型:1产品,2仪器
-     * @param source   请求来源:www,crm
-     */
-    List<BigTypeVo> getBigTypeList(String typeSort, String source);
-    /**
-     * 根据大分类Id获取二级分类
-     * @param bigTypeId 大分类Id
-     * @param source   请求来源:www,crm
-     */
-    List<SmallTypeVo> getSmallTypeList(Integer bigTypeId, String source);
-    /**
-     * 根据二级分类Id获取三级分类
-     * @param smallTypeId 二级分类Id
-     * @param source      请求来源:www,crm
-     */
-    List<TinyTypeVo> getTinyTypeList(Integer smallTypeId, String source);
     /**
     /**
      * 查询页面信息
      * 查询页面信息
      * @param pageId 页面Id
      * @param pageId 页面Id

+ 47 - 0
src/main/java/com/caimei365/commodity/mapper/ProductTypeMapper.java

@@ -0,0 +1,47 @@
+package com.caimei365.commodity.mapper;
+
+import com.caimei365.commodity.model.vo.BigTypeVo;
+import com.caimei365.commodity.model.vo.SmallTypeVo;
+import com.caimei365.commodity.model.vo.TinyTypeVo;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/4/22
+ */
+@Mapper
+public interface ProductTypeMapper {
+    /**
+     * 获取大分类
+     * @param typeSort 分类类型:1产品,2仪器
+     * @param source   请求来源:www,crm
+     */
+    List<BigTypeVo> getBigTypeList(Integer typeSort, String source);
+    /**
+     * 根据大分类Id获取二级分类
+     * @param bigTypeId 大分类Id
+     * @param source   请求来源:www,crm
+     */
+    List<SmallTypeVo> getSmallTypeList(Integer bigTypeId, String source);
+    /**
+     * 根据二级分类Id获取三级分类
+     * @param smallTypeId 二级分类Id
+     * @param source      请求来源:www,crm
+     */
+    List<TinyTypeVo> getTinyTypeList(Integer smallTypeId, String source);
+    /**
+     * 获取一级分类Id
+     * @param typeId
+     */
+    Integer getBigTypeIdBySmallTypeId(Integer typeId);
+    Integer getBigTypeIdByTinyTypeId(Integer typeId);
+    /**
+     * 获取一级分类
+     * @param bigTypeId
+     */
+    BigTypeVo getBigTypeBId(Integer bigTypeId);
+}

+ 1 - 1
src/main/java/com/caimei365/commodity/service/PageService.java

@@ -20,7 +20,7 @@ public interface PageService {
      * @param typeSort 分类类型:1产品,2仪器
      * @param typeSort 分类类型:1产品,2仪器
      * @param source   请求来源:www,crm
      * @param source   请求来源:www,crm
      */
      */
-    ResponseJson<List<BigTypeVo>> getClassify(String typeSort, String source);
+    ResponseJson<List<BigTypeVo>> getClassify(Integer typeSort, String source);
 
 
     /**
     /**
      * 产品/仪器页面数据
      * 产品/仪器页面数据

+ 43 - 0
src/main/java/com/caimei365/commodity/service/ProductTypeService.java

@@ -0,0 +1,43 @@
+package com.caimei365.commodity.service;
+
+import com.caimei365.commodity.model.ResponseJson;
+import com.caimei365.commodity.model.vo.BigTypeVo;
+import com.caimei365.commodity.model.vo.SmallTypeVo;
+import com.caimei365.commodity.model.vo.TinyTypeVo;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/4/22
+ */
+public interface ProductTypeService {
+    /**
+     * 根据商品属性获取一级分类下拉
+     *
+     * @param typeSort 分类类型,1产品,2仪器
+     */
+    ResponseJson<List<BigTypeVo>> getBigTypeSelect(Integer typeSort);
+    /**
+     * 获取二级分类下拉列表
+     *
+     * @param bigTypeId 一级分类Id
+     */
+    ResponseJson<List<SmallTypeVo>> getSmallTypeSelect(Integer bigTypeId);
+    /**
+     * 获取三级分类下拉列表
+     *
+     * @param smallTypeId 二级分类Id
+     */
+    ResponseJson<List<TinyTypeVo>> getTinyTypeSelect(Integer smallTypeId);
+    /**
+     * 根据Id获取分类(小程序)
+     *
+     * @param typeId  分类Id
+     * @param idType  typeId类型:1:bigType,2:smallType,3:tinyType
+     * @param source  请求来源:www,crm
+     */
+    ResponseJson<BigTypeVo> getTypeById(Integer typeId, Integer idType, String source);
+}

+ 7 - 5
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -1,6 +1,7 @@
 package com.caimei365.commodity.service.impl;
 package com.caimei365.commodity.service.impl;
 
 
 import com.caimei365.commodity.mapper.PageMapper;
 import com.caimei365.commodity.mapper.PageMapper;
+import com.caimei365.commodity.mapper.ProductTypeMapper;
 import com.caimei365.commodity.model.ResponseJson;
 import com.caimei365.commodity.model.ResponseJson;
 import com.caimei365.commodity.model.vo.*;
 import com.caimei365.commodity.model.vo.*;
 import com.caimei365.commodity.service.PageService;
 import com.caimei365.commodity.service.PageService;
@@ -35,7 +36,8 @@ public class PageServiceImpl implements PageService {
     private PageMapper pageMapper;
     private PageMapper pageMapper;
     @Resource
     @Resource
     private PriceUtilService priceUtilService;
     private PriceUtilService priceUtilService;
-
+    @Resource
+    private ProductTypeMapper productTypeMapper;
     /**
     /**
      * 获取分类列表
      * 获取分类列表
      *
      *
@@ -44,18 +46,18 @@ public class PageServiceImpl implements PageService {
      */
      */
     @Override
     @Override
     // @Cacheable(value = "getClassify", key = "#typeSort +'-'+ #source", unless = "#result == null")
     // @Cacheable(value = "getClassify", key = "#typeSort +'-'+ #source", unless = "#result == null")
-    public ResponseJson<List<BigTypeVo>> getClassify(String typeSort, String source) {
-        List<BigTypeVo> bigTypeList = pageMapper.getBigTypeList(typeSort,source);
+    public ResponseJson<List<BigTypeVo>> getClassify(Integer typeSort, String source) {
+        List<BigTypeVo> bigTypeList = productTypeMapper.getBigTypeList(typeSort,source);
         bigTypeList.forEach(bigType -> {
         bigTypeList.forEach(bigType -> {
             String caiMeiImage = ImageUtils.getImageURL("caiMeiImage", null, 0, domain);
             String caiMeiImage = ImageUtils.getImageURL("caiMeiImage", null, 0, domain);
             bigType.setWwwIcon(StringUtils.isEmpty(bigType.getWwwIcon())?caiMeiImage:bigType.getWwwIcon());
             bigType.setWwwIcon(StringUtils.isEmpty(bigType.getWwwIcon())?caiMeiImage:bigType.getWwwIcon());
             bigType.setCrmIcon(StringUtils.isEmpty(bigType.getCrmIcon())?caiMeiImage:bigType.getCrmIcon());
             bigType.setCrmIcon(StringUtils.isEmpty(bigType.getCrmIcon())?caiMeiImage:bigType.getCrmIcon());
-            List<SmallTypeVo> smallTypeList = pageMapper.getSmallTypeList(bigType.getBigTypeId(), source);
+            List<SmallTypeVo> smallTypeList = productTypeMapper.getSmallTypeList(bigType.getBigTypeId(), source);
             if (!CollectionUtils.isEmpty(smallTypeList)) {
             if (!CollectionUtils.isEmpty(smallTypeList)) {
                 smallTypeList.forEach(smallType -> {
                 smallTypeList.forEach(smallType -> {
                     smallType.setWwwIcon(StringUtils.isEmpty(smallType.getWwwIcon())?caiMeiImage:smallType.getWwwIcon());
                     smallType.setWwwIcon(StringUtils.isEmpty(smallType.getWwwIcon())?caiMeiImage:smallType.getWwwIcon());
                     smallType.setCrmIcon(StringUtils.isEmpty(smallType.getCrmIcon())?caiMeiImage:smallType.getCrmIcon());
                     smallType.setCrmIcon(StringUtils.isEmpty(smallType.getCrmIcon())?caiMeiImage:smallType.getCrmIcon());
-                    List<TinyTypeVo> tinyTypeList = pageMapper.getTinyTypeList(smallType.getSmallTypeId(), source);
+                    List<TinyTypeVo> tinyTypeList = productTypeMapper.getTinyTypeList(smallType.getSmallTypeId(), source);
                     if (!CollectionUtils.isEmpty(tinyTypeList)) {
                     if (!CollectionUtils.isEmpty(tinyTypeList)) {
                         tinyTypeList.forEach(tinyType -> {
                         tinyTypeList.forEach(tinyType -> {
                             tinyType.setWwwIcon(StringUtils.isEmpty(tinyType.getWwwIcon())?caiMeiImage:tinyType.getWwwIcon());
                             tinyType.setWwwIcon(StringUtils.isEmpty(tinyType.getWwwIcon())?caiMeiImage:tinyType.getWwwIcon());

+ 112 - 0
src/main/java/com/caimei365/commodity/service/impl/ProductTypeServiceImpl.java

@@ -0,0 +1,112 @@
+package com.caimei365.commodity.service.impl;
+
+import com.caimei365.commodity.mapper.ProductTypeMapper;
+import com.caimei365.commodity.model.ResponseJson;
+import com.caimei365.commodity.model.vo.BigTypeVo;
+import com.caimei365.commodity.model.vo.SmallTypeVo;
+import com.caimei365.commodity.model.vo.TinyTypeVo;
+import com.caimei365.commodity.service.ProductTypeService;
+import com.caimei365.commodity.utils.ImageUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/4/22
+ */
+@Slf4j
+@Service
+public class ProductTypeServiceImpl implements ProductTypeService {
+    @Value("${caimei.wwwDomain}")
+    private String domain;
+    @Resource
+    private ProductTypeMapper productTypeMapper;
+
+    /**
+     * 根据商品属性获取一级分类下拉
+     *
+     * @param typeSort 分类类型,1产品,2仪器
+     */
+    @Override
+    public ResponseJson<List<BigTypeVo>> getBigTypeSelect(Integer typeSort) {
+        List<BigTypeVo> bigTypeList = productTypeMapper.getBigTypeList(typeSort,"www");
+        return ResponseJson.success(bigTypeList);
+    }
+
+    /**
+     * 获取二级分类下拉列表
+     *
+     * @param bigTypeId 一级分类Id
+     */
+    @Override
+    public ResponseJson<List<SmallTypeVo>> getSmallTypeSelect(Integer bigTypeId) {
+        List<SmallTypeVo> smallTypeList = productTypeMapper.getSmallTypeList(bigTypeId, "www");
+        return ResponseJson.success(smallTypeList);
+    }
+
+    /**
+     * 获取三级分类下拉列表
+     *
+     * @param smallTypeId 二级分类Id
+     */
+    @Override
+    public ResponseJson<List<TinyTypeVo>> getTinyTypeSelect(Integer smallTypeId) {
+        List<TinyTypeVo> tinyTypeList = productTypeMapper.getTinyTypeList(smallTypeId, "www");
+        return ResponseJson.success(tinyTypeList);
+    }
+
+    /**
+     * 根据Id获取分类(小程序)
+     *
+     * @param typeId 分类Id
+     * @param idType typeId类型:1:bigType,2:smallType,3:tinyType
+     * @param source 请求来源:www,crm
+     */
+    @Override
+    public ResponseJson<BigTypeVo> getTypeById(Integer typeId, Integer idType, String source) {
+        if (typeId == null || typeId == 0) {
+            return ResponseJson.error("请输入分类Id", null);
+        }
+        if (idType == null || idType == 0) {
+            return ResponseJson.error("请输入分类Id类型", null);
+        }
+        Integer bigTypeId = 0;
+        if (idType == 1) {
+            bigTypeId = typeId;
+        } else if (idType == 2 ) {
+            bigTypeId = productTypeMapper.getBigTypeIdBySmallTypeId(typeId);
+        } else if (idType == 3 ) {
+            bigTypeId = productTypeMapper.getBigTypeIdByTinyTypeId(typeId);
+        }
+        BigTypeVo bigType = productTypeMapper.getBigTypeBId(bigTypeId);
+        bigType.setIsChecked(false);
+        String caiMeiImage = ImageUtils.getImageURL("caiMeiImage", null, 0, domain);
+        bigType.setWwwIcon(org.apache.commons.lang.StringUtils.isEmpty(bigType.getWwwIcon())?caiMeiImage:bigType.getWwwIcon());
+        bigType.setCrmIcon(org.apache.commons.lang.StringUtils.isEmpty(bigType.getCrmIcon())?caiMeiImage:bigType.getCrmIcon());
+        List<SmallTypeVo> smallTypeList = productTypeMapper.getSmallTypeList(bigType.getBigTypeId(), source);
+        if (!CollectionUtils.isEmpty(smallTypeList)) {
+            smallTypeList.forEach(smallType -> {
+                smallType.setWwwIcon(org.apache.commons.lang.StringUtils.isEmpty(smallType.getWwwIcon())?caiMeiImage:smallType.getWwwIcon());
+                smallType.setCrmIcon(org.apache.commons.lang.StringUtils.isEmpty(smallType.getCrmIcon())?caiMeiImage:smallType.getCrmIcon());
+                List<TinyTypeVo> tinyTypeList = productTypeMapper.getTinyTypeList(smallType.getSmallTypeId(), source);
+                if (!CollectionUtils.isEmpty(tinyTypeList)) {
+                    tinyTypeList.forEach(tinyType -> {
+                        tinyType.setWwwIcon(org.apache.commons.lang.StringUtils.isEmpty(tinyType.getWwwIcon())?caiMeiImage:tinyType.getWwwIcon());
+                        tinyType.setCrmIcon(org.apache.commons.lang.StringUtils.isEmpty(tinyType.getCrmIcon())?caiMeiImage:tinyType.getCrmIcon());
+                    });
+                    smallType.setTinyTypeList(tinyTypeList);
+                }
+            });
+            bigType.setSmallTypeList(smallTypeList);
+        }
+        return ResponseJson.success(bigType);
+    }
+}

+ 0 - 40
src/main/resources/mapper/PageMapper.xml

@@ -1,46 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?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">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.commodity.mapper.PageMapper">
 <mapper namespace="com.caimei365.commodity.mapper.PageMapper">
-    <select id="getBigTypeList" resultType="com.caimei365.commodity.model.vo.BigTypeVo">
-        select
-            bigTypeID as bigTypeId, typeSort, `name`, bigTypeCode, wwwValidFlag, crmValidFlag, wwwIcon, crmIcon, addTime, sortIndex
-        from bigtype
-        where
-            typeSort = #{typeSort}
-            <if test="source == 'www'.toString()">
-                and wwwValidFlag = '1'
-            </if>
-            <if test="source == 'crm'.toString()">
-                and crmValidFlag = '1'
-            </if>
-        order by ifnull(sortIndex,10000) , addTime DESC
-    </select>
-    <select id="getSmallTypeList" resultType="com.caimei365.commodity.model.vo.SmallTypeVo">
-        select
-            smallTypeID as smallTypeId, bigTypeID as bigTypeId, `name`, smallTypeCode, wwwValidFlag, crmValidFlag, wwwIcon, crmIcon, addTime, sortIndex
-        from smalltype
-        where bigTypeID = #{bigTypeId}
-        <if test="source == 'www'.toString()">
-            and wwwValidFlag = '1'
-        </if>
-        <if test="source == 'crm'.toString()">
-            and crmValidFlag = '1'
-        </if>
-        order by ifnull(sortIndex,10000), addTime DESC
-    </select>
-    <select id="getTinyTypeList" resultType="com.caimei365.commodity.model.vo.TinyTypeVo">
-        select
-            tinyTypeID as tinyTypeId, smallTypeID as smallTypeId, `name`, tinyTypeCode, wwwValidFlag, crmValidFlag, wwwIcon, crmIcon, addTime, sortIndex
-        from tinytype
-        where smallTypeID = #{smallTypeId}
-        <if test="source == 'www'.toString()">
-            and wwwValidFlag = '1'
-        </if>
-        <if test="source == 'crm'.toString()">
-            and crmValidFlag = '1'
-        </if>
-        order by ifnull(sortIndex,10000), addTime DESC
-    </select>
     <select id="getPageTypeSort" resultType="java.lang.Integer">
     <select id="getPageTypeSort" resultType="java.lang.Integer">
         select typeSort from cm_page
         select typeSort from cm_page
         where id = #{pageId} and enabledStatus = '1'
         where id = #{pageId} and enabledStatus = '1'

+ 60 - 0
src/main/resources/mapper/ProductTypeMapper.xml

@@ -0,0 +1,60 @@
+<?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.commodity.mapper.ProductTypeMapper">
+    <select id="getBigTypeList" resultType="com.caimei365.commodity.model.vo.BigTypeVo">
+        select
+            bigTypeID as bigTypeId, typeSort, `name`, bigTypeCode, wwwValidFlag, crmValidFlag, wwwIcon, crmIcon, addTime, sortIndex
+        from bigtype
+        where
+            typeSort = #{typeSort}
+            <if test="source == 'www'.toString()">
+                and wwwValidFlag = '1'
+            </if>
+            <if test="source == 'crm'.toString()">
+                and crmValidFlag = '1'
+            </if>
+        order by ifnull(sortIndex,10000) , addTime DESC
+    </select>
+    <select id="getSmallTypeList" resultType="com.caimei365.commodity.model.vo.SmallTypeVo">
+        select
+            smallTypeID as smallTypeId, bigTypeID as bigTypeId, `name`, smallTypeCode, wwwValidFlag, crmValidFlag, wwwIcon, crmIcon, addTime, sortIndex
+        from smalltype
+        where bigTypeID = #{bigTypeId}
+        <if test="source == 'www'.toString()">
+            and wwwValidFlag = '1'
+        </if>
+        <if test="source == 'crm'.toString()">
+            and crmValidFlag = '1'
+        </if>
+        order by ifnull(sortIndex,10000), addTime DESC
+    </select>
+    <select id="getTinyTypeList" resultType="com.caimei365.commodity.model.vo.TinyTypeVo">
+        select
+            tinyTypeID as tinyTypeId, smallTypeID as smallTypeId, `name`, tinyTypeCode, wwwValidFlag, crmValidFlag, wwwIcon, crmIcon, addTime, sortIndex
+        from tinytype
+        where smallTypeID = #{smallTypeId}
+        <if test="source == 'www'.toString()">
+            and wwwValidFlag = '1'
+        </if>
+        <if test="source == 'crm'.toString()">
+            and crmValidFlag = '1'
+        </if>
+        order by ifnull(sortIndex,10000), addTime DESC
+    </select>
+    <select id="getBigTypeIdBySmallTypeId" resultType="java.lang.Integer">
+        select bigTypeID from smalltype where smallTypeID = #{typeId}
+    </select>
+    <select id="getBigTypeIdByTinyTypeId" resultType="java.lang.Integer">
+        select bigTypeID from smalltype
+        where smallTypeID =
+        (select smallTypeID from  tinytype where  tinyTypeID = #{typeId})
+    </select>
+    <select id="getBigTypeBId" resultType="com.caimei365.commodity.model.vo.BigTypeVo">
+        select
+            bigTypeID as bigTypeId, typeSort, `name`, bigTypeCode, wwwValidFlag, crmValidFlag, wwwIcon, crmIcon, addTime, sortIndex
+        from bigtype
+        where bigTypeID = #{bigTypeID}
+    </select>
+
+
+</mapper>

+ 3 - 3
src/main/resources/mapper/ShopMapper.xml

@@ -4,7 +4,7 @@
     <insert id="insertProduct" keyColumn="productID" keyProperty="productId"  parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
     <insert id="insertProduct" keyColumn="productID" keyProperty="productId"  parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
         insert into product (
         insert into product (
             shopID, name, aliasName, commodityType, bigTypeID, smallTypeID, tinyTypeID, mainImage,
             shopID, name, aliasName, commodityType, bigTypeID, smallTypeID, tinyTypeID, mainImage,
-            brandID, productType, tags, unit, normalPrice, price, includedTax, minBuyNumber, stock,
+            brandID, productType, tags, unit, normalPrice, price, price1, includedTax, minBuyNumber, stock,
             <if test="productCategory != null and  productCategory != ''">
             <if test="productCategory != null and  productCategory != ''">
                 productCategory,
                 productCategory,
             </if>
             </if>
@@ -53,7 +53,7 @@
             updateTime, validFlag
             updateTime, validFlag
         ) values (
         ) values (
             #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
             #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
-            #{brandId}, #{productType}, #{tags}, #{unit}, #{normalPrice}, #{price}, #{includedTax}, #{minBuyNumber}, #{stock},
+            #{brandId}, #{productType}, #{tags}, #{unit}, #{normalPrice}, #{price}, #{price}, #{includedTax}, #{minBuyNumber}, #{stock},
             <if test="productCategory != null and  productCategory != ''">
             <if test="productCategory != null and  productCategory != ''">
                 #{productCategory},
                 #{productCategory},
             </if>
             </if>
@@ -224,7 +224,7 @@
     </select>
     </select>
     <select id="getShopProductsSelect" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
     <select id="getShopProductsSelect" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
         select
         select
-            p.productID as productId, p.name, p.aliasName, p.price, p.normalPrice, p.mainImage, p.ladderPriceFlag as ladderPriceFlag,
+            p.productID as productId, p.name, p.aliasName, p.price1 as price, p.normalPrice, p.mainImage, p.ladderPriceFlag as ladderPriceFlag,
             p.validFlag, p.featuredFlag, p.productCode, p.commodityType as commodityType,
             p.validFlag, p.featuredFlag, p.productCode, p.commodityType as commodityType,
             p.bigTypeID as bigTypeId, p.smallTypeID as smallTypeId, p.tinyTypeID as tinyTypeId
             p.bigTypeID as bigTypeId, p.smallTypeID as smallTypeId, p.tinyTypeID as tinyTypeId
         from product p
         from product p