chao před 4 roky
rodič
revize
9ad563055d

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

@@ -97,7 +97,6 @@ public class ProductShopApi {
      *                   taxPoint	     开票税点
      *                   tinyTypeId	     三级分类id
      *                   unit	         包装规格
-     *                   userId	         用户Id
      *                   }
      */
     @ApiOperation("供应商-发布商品(旧:/supplier/releaseProduct)")

+ 30 - 0
src/main/java/com/caimei365/commodity/mapper/ShopMapper.java

@@ -1,5 +1,7 @@
 package com.caimei365.commodity.mapper;
 
+import com.caimei365.commodity.model.po.ProductImagePo;
+import com.caimei365.commodity.model.po.ProductPo;
 import com.caimei365.commodity.model.search.ProductListVo;
 import com.caimei365.commodity.model.vo.ProductItemVo;
 import org.apache.ibatis.annotations.Mapper;
@@ -35,4 +37,32 @@ public interface ShopMapper {
      * 根据供应商Id获取userId
      */
     Integer getUserIdByshopId(Integer shopId);
+    /**
+     * 根据分类获取商品货号
+     */
+    String getCodeByTypeId(Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId);
+    /**
+     * 发布商品
+     */
+    void insertProduct(ProductPo product);
+    /**
+     * 编辑商品
+     */
+    void updateProduct(ProductPo product);
+    /**
+     * 获取商品图片
+     */
+    List<ProductImagePo> getImageByProductId(Integer productId);
+    /**
+     * 新增商品图片
+     */
+    void insertProductImage(ProductImagePo productImage);
+    /**
+     * 更新商品图片
+     */
+    void updateProductImage(ProductImagePo productImage);
+    /**
+     * 删除商品图片
+     */
+    void deleteProductImage(Integer id);
 }

+ 12 - 7
src/main/java/com/caimei365/commodity/model/dto/ProductDto.java

@@ -16,16 +16,16 @@ import java.io.Serializable;
 @Data
 public class ProductDto implements Serializable {
     private static final long serialVersionUID = 1L;
-    /**
-     * 用户Id
-     */
-    @ApiModelProperty("用户Id")
-    private Integer userId;
     /**
      * 供应商id
      */
     @ApiModelProperty("供应商id")
     private Integer shopId;
+    /**
+     * 商品id
+     */
+    @ApiModelProperty("商品id")
+    private Integer productId;
     /**
      * 名称
      */
@@ -65,7 +65,7 @@ public class ProductDto implements Serializable {
      * 商品类型:0其它类型(默认),1妆字号,2械字号
      */
     @ApiModelProperty("商品类型:0其它,1妆字号,2械字号")
-    private String productType;
+    private Integer productType;
     /**
      * 商品标签用英文逗号隔开,中文逗号或其它一律不作切割
      */
@@ -90,7 +90,7 @@ public class ProductDto implements Serializable {
      * 是否含税:0不含税,1含税,2未知
      */
     @ApiModelProperty("是否含税:0不含税,1含税,2未知")
-    private String includedTax;
+    private Integer includedTax;
     /**
      * 最小购买量
      */
@@ -171,5 +171,10 @@ public class ProductDto implements Serializable {
      */
     @ApiModelProperty("订购方案")
     private String orderInfo;
+    /**
+     * 相关参数与商品图片Json
+     */
+    @ApiModelProperty("相关参数与商品图片Json")
+    private String params;
 
 }

+ 5 - 0
src/main/java/com/caimei365/commodity/model/po/ProductImagePo.java

@@ -13,6 +13,7 @@ import java.io.Serializable;
 @Data
 public class ProductImagePo implements Serializable {
     private static final long serialVersionUID = 1L;
+    private Integer id;
     /** 商品productID */
     private Integer productId;
     /**
@@ -31,4 +32,8 @@ public class ProductImagePo implements Serializable {
      * 是否主图:1是,空或0不是
      */
     private Integer mainFlag;
+    /**
+     * 排序值
+     */
+    private Integer sortIndex;
 }

+ 44 - 0
src/main/java/com/caimei365/commodity/model/po/ProductPo.java

@@ -29,6 +29,14 @@ public class ProductPo implements Serializable {
      * 商品价格
      */
     private Double price;
+    /**
+     * 价格可见度:0公开价格 1不公开价格 2仅对会员机构公开 price1TextFlag
+     */
+    private Integer priceFlag;
+    /**
+     * 商品货号
+     */
+    private String productCode;
     /**
      * 库存
      */
@@ -45,6 +53,22 @@ public class ProductPo implements Serializable {
      * 主图
      */
     private String mainImage;
+    /**
+     * 商品属性:1产品,2仪器
+     */
+    private Integer commodityType;
+    /**
+     * 一级分类id
+     */
+    private Integer bigTypeId;
+    /**
+     * 二级分类id
+     */
+    private Integer smallTypeId;
+    /**
+     * 三级分类Id
+     */
+    private Integer tinyTypeId;
     /**
      * 商品的类别:1正常商品(默认),2二手商品
      */
@@ -121,6 +145,26 @@ public class ProductPo implements Serializable {
      * 是否含税   0不含税,1含税,2未知
      */
     private Integer includedTax;
+    /**
+     * 商品标签用英文逗号隔开,中文逗号或其它一律不作切割
+     */
+    private String tags;
+    /**
+     * 包装规格
+     */
+    private String unit;
+    /**
+     * 最小购买量
+     */
+    private Integer minBuyNumber;
+    /**
+     * 服务起订量
+     */
+    private Integer serviceNumber;
+    /**
+     * 供应商税率:增值专用发票默认13%,增值税普通发票6%取值范围[0-100]
+     */
+    private Double supplierTaxPoint;
     /**
      * 相关推荐类型 0自动选择; 1手动推荐
      */

+ 1 - 0
src/main/java/com/caimei365/commodity/model/po/ProductSecondPo.java

@@ -1,5 +1,6 @@
 package com.caimei365.commodity.model.po;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;

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

@@ -75,7 +75,6 @@ public interface ShopService {
      *                   taxPoint	     开票税点
      *                   tinyTypeId	     三级分类id
      *                   unit	         包装规格
-     *                   userId	         用户Id
      *                   }
      */
     ResponseJson releaseProduct(ProductDto productDto);

+ 2 - 1
src/main/java/com/caimei365/commodity/service/impl/SecondHandServiceImpl.java

@@ -358,7 +358,8 @@ public class SecondHandServiceImpl implements SecondHandService {
         secondPo.setOriginalPrice(secondDto.getOriginalPrice());
         secondPo.setContactName(secondDto.getContactName());
         secondPo.setContactMobile(secondDto.getContactMobile());
-        secondPo.setDockingPeopleMobile(secondDto.getDockingPeopleName());
+        secondPo.setDockingPeopleMobile(secondDto.getContactMobile());
+        secondPo.setDockingPeopleName(secondDto.getDockingPeopleName());
         secondPo.setSecondProductType(secondDto.getSecondProductType());
         secondPo.setAddress(secondDto.getAddress());
         secondPo.setProductQuality(secondDto.getProductQuality());

+ 122 - 2
src/main/java/com/caimei365/commodity/service/impl/ShopServiceImpl.java

@@ -1,9 +1,13 @@
 package com.caimei365.commodity.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.caimei365.commodity.components.PriceUtilService;
 import com.caimei365.commodity.mapper.ShopMapper;
 import com.caimei365.commodity.model.ResponseJson;
 import com.caimei365.commodity.model.dto.ProductDto;
+import com.caimei365.commodity.model.po.ProductImagePo;
+import com.caimei365.commodity.model.po.ProductPo;
 import com.caimei365.commodity.model.search.ProductListVo;
 import com.caimei365.commodity.model.vo.PaginationVo;
 import com.caimei365.commodity.model.vo.ProductItemVo;
@@ -16,6 +20,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
@@ -143,7 +148,6 @@ public class ShopServiceImpl implements ShopService {
      *                   taxPoint	     开票税点
      *                   tinyTypeId	     三级分类id
      *                   unit	         包装规格
-     *                   userId	         用户Id
      *                   }
      */
     @Override
@@ -182,7 +186,7 @@ public class ShopServiceImpl implements ShopService {
         if (null == productDto.getPrice()) {
             return ResponseJson.error("参数异常:机构价格不能为空!", null);
         }
-        if (StringUtils.isBlank(productDto.getIncludedTax())) {
+        if (null == productDto.getIncludedTax()) {
             return ResponseJson.error("参数异常:是否含税不能为空!", null);
         }
         if (null == productDto.getMinBuyNumber()) {
@@ -194,6 +198,122 @@ public class ShopServiceImpl implements ShopService {
         if (StringUtils.isBlank(productDto.getDetailInfo())) {
             return ResponseJson.error("参数异常:商品详情信息不能为空!", null);
         }
+        JSONObject parseObject = JSON.parseObject(productDto.getParams());
+        //图片
+        List<Map<String, String>> imageList = (List<Map<String, String>>) parseObject.get("image");
+        if (null == imageList || imageList.size() == 0) {
+            return ResponseJson.error("请上传商品图片", null);
+        }
+        //相关参数
+        List<Map<String, String>> paramList = (List<Map<String, String>>) parseObject.get("param");
+        // 当前时间
+        String current = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
+        //保存或修改商品
+        ProductPo product = new ProductPo();
+        product.setProductId(productDto.getProductId());
+        product.setShopId(productDto.getShopId());
+        product.setName(productDto.getName());
+        product.setAliasName(productDto.getAliasName());
+        product.setCommodityType(productDto.getCommodityType());
+        product.setBigTypeId(productDto.getBigTypeId());
+        product.setSmallTypeId(productDto.getSmallTypeId());
+        product.setTinyTypeId(productDto.getTinyTypeId());
+        product.setBrandId(productDto.getBrandId());
+        product.setProductType(productDto.getProductType());
+        product.setTags(productDto.getTags());
+        product.setUnit(productDto.getUnit());
+        product.setNormalPrice(productDto.getNormalPrice());
+        product.setPrice(productDto.getPrice());
+        product.setIncludedTax(productDto.getIncludedTax());
+        product.setMinBuyNumber(productDto.getMinBuyNumber());
+        product.setStock(productDto.getStock());
+        product.setUpdateTime(current);
+        product.setValidFlag(1);
+        product.setProductCategory(1);
+        //设置主图
+        for (Map<String, String> map : imageList) {
+            String mainFlag = map.get("mainFlag");
+            String image = map.get("image");
+            if ("1".equals(mainFlag)) {
+                product.setMainImage(image);
+            }
+        }
+        if (null == productDto.getProductId()) {
+            product.setServiceNumber(productDto.getMinBuyNumber());
+            product.setSupplierTaxPoint(productDto.getTaxPoint());
+            product.setAddTime(current);
+            product.setHasSkuFlag(1);
+            product.setSellNumber(0);
+            product.setSortIndex(0);
+            product.setFeaturedFlag(0);
+            product.setCostCheckFlag(1);
+            product.setRecommendType(0);
+            product.setPriceFlag(2);
+            product.setActFlag(0);
+            product.setLadderPriceFlag(0);
+            product.setVisibility(3);
+            if (StringUtils.isBlank(productDto.getProductCode())) {
+                String productCode = shopMapper.getCodeByTypeId(productDto.getBigTypeId(), productDto.getSmallTypeId(), productDto.getTinyTypeId());
+                productCode = productCode + productDto.getProductId();
+                product.setProductCode(productCode);
+            }
+            shopMapper.insertProduct(product);
+        } else {
+            shopMapper.updateProduct(product);
+        }
+        //保存或修改商品图片
+        List<ProductImagePo> productImageList = shopMapper.getImageByProductId(productDto.getProductId());
+        for (Map<String, String> map : imageList) {
+            String mainFlag = map.get("mainFlag");
+            String image = map.get("image");
+            String productImageId = map.get("productImageId");
+            ProductImagePo productImage = new ProductImagePo();
+            productImage.setProductId(productDto.getProductId());
+            productImage.setShopId(productDto.getShopId());
+            productImage.setAddTime(current);
+            productImage.setImage(image);
+            productImage.setMainFlag(Integer.valueOf(mainFlag));
+            if (StringUtils.isBlank(productImageId)) {
+                shopMapper.insertProductImage(productImage);
+            } else {
+                productImage.setId(Integer.valueOf(productImageId));
+                shopMapper.updateProductImage(productImage);
+                productImageList.removeIf(s -> Integer.valueOf(productImageId).equals(s.getId()));
+            }
+        }
+        if (null != productImageList && productImageList.size() > 0) {
+            for (ProductImagePo imageItem : productImageList) {
+                shopMapper.deleteProductImage(imageItem.getId());
+            }
+        }
+//        //保存相关参数
+//        supplierProductDao.deleteParameters(productDto.getProductId());
+//        if (null != paramList && paramList.size() > 0) {
+//            for (Map<String, String> map : paramList) {
+//                String paramsName = map.get("paramsName");
+//                String paramsContent = map.get("paramsContent");
+//                if (StringUtils.isNotBlank(paramsName) && StringUtils.isNotBlank(paramsContent)) {
+//                    RelatedParametersVo parameters = new RelatedParametersVo();
+//                    parameters.setParamsName(paramsName);
+//                    parameters.setParamsContent(paramsContent);
+//                    parameters.setProductId(productDto.getProductId());
+//                    parameters.setDelFlag("0");
+//                    supplierProductDao.insertParameters(parameters);
+//                }
+//            }
+//        }
+//        //保存修改商品详情
+//        product.setDetailInfo(productDto.getDetailInfo());
+//        if (null == productDetail.getProductDetailInfoId()) {
+//            productDetail.setProductId(productDto.getProductId());
+//            supplierProductDao.insertProductDetail(productDetail);
+//        } else {
+//            supplierProductDao.updateProductDetail(productDetail);
+//        }
+//        return JsonModel.newInstance().success();
+
+
+
         return null;
     }
 }

+ 2 - 2
src/main/resources/mapper/SecondHandMapper.xml

@@ -8,7 +8,7 @@
 			townId, brandName, provinceCityDistrict, address, productQuality, productDetails, viewingNum, payStatus,
 			payAmount, payFormData, payType, payDate, submitDate, reviewedDate, onLineDate, source, publisher
 		) values (
-			#{productID}, #{sold}, #{secondHandType}, #{instrumentType}, #{fixedYears}, #{maturityYears}, #{companyName},
+			#{productId}, #{sold}, #{secondHandType}, #{instrumentType}, #{fixedYears}, #{maturityYears}, #{companyName},
 			#{detailTalkFlag}, #{originalPrice}, #{contactName}, #{contactMobile}, #{dockingPeopleName}, #{dockingPeopleMobile},
 			#{secondProductType}, #{townId}, #{brandName}, #{provinceCityDistrict}, #{address}, #{productQuality}, #{productDetails},
 			#{viewingNum}, #{payStatus}, #{payAmount}, #{payFormData}, #{payType}, #{payDate}, #{submitDate}, #{reviewedDate},
@@ -16,7 +16,7 @@
 		)
     </insert>
     <insert id="insertProductImage" parameterType="com.caimei365.commodity.model.po.ProductImagePo">
-        insert into productimage (productID, shopID, ADDTIME, image, mainFlag, sortIndex)
+        insert into productimage (productID, shopID, addTime, image, mainFlag, sortIndex)
         values (#{productId}, #{shopId}, #{addTime}, #{image}, #{mainFlag}, #{sortIndex})
     </insert>
     <insert id="insertProduct" keyColumn="productID" keyProperty="productId" parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">

+ 191 - 0
src/main/resources/mapper/ShopMapper.xml

@@ -1,6 +1,173 @@
 <?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.ShopMapper">
+    <insert id="insertProduct" keyColumn="productID" keyProperty="productId"  parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
+        insert into product (
+            shopID, name, aliasName, commodityType, bigTypeID, smallTypeID, tinyTypeID, mainImage,
+            brandID, productType, tags, unit, normalPrice, price, includedTax, minBuyNumber, stock,
+            <if test="productCategory != null and  productCategory != ''">
+                productCategory,
+            </if>
+            <if test="serviceNumber != null and  serviceNumber != ''">
+                serviceNumber,
+            </if>
+            <if test="supplierTaxPoint != null and  supplierTaxPoint != ''">
+                supplierTaxPoint,
+            </if>
+            <if test="addTime != null and  addTime != ''">
+                addTime,
+            </if>
+            <if test="hasSkuFlag != null and  hasSkuFlag != ''">
+                hasSkuFlag,
+            </if>
+            <if test="sellNumber != null and  sellNumber != ''">
+                sellNumber,
+            </if>
+            <if test="sortIndex != null and  sortIndex != ''">
+                sortIndex,
+            </if>
+            <if test="featuredFlag != null and  featuredFlag != ''">
+                featuredFlag,
+            </if>
+            <if test="costCheckFlag != null and  costCheckFlag != ''">
+                costCheckFlag,
+            </if>
+            <if test="recommendType != null and  recommendType != ''">
+                recommendType,
+            </if>
+            <if test="priceFlag != null and  priceFlag != ''">
+                price1TextFlag,
+            </if>
+            <if test="actFlag != null and  actFlag != ''">
+                actFlag,
+            </if>
+            <if test="ladderPriceFlag != null and  ladderPriceFlag != ''">
+                ladderPriceFlag,
+            </if>
+            <if test="visibility != null and  visibility != ''">
+                visibility,
+            </if>
+            <if test="productCode != null and  productCode != ''">
+                productCode,
+            </if>
+            updateTime, validFlag
+        ) values (
+            #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
+            #{brandId}, #{productType}, #{tags}, #{unit}, #{normalPrice}, #{price}, #{includedTax}, #{minBuyNumber}, #{stock},
+            <if test="productCategory != null and  productCategory != ''">
+                #{productCategory},
+            </if>
+            <if test="serviceNumber != null and  serviceNumber != ''">
+                #{serviceNumber},
+            </if>
+            <if test="supplierTaxPoint != null and  supplierTaxPoint != ''">
+                #{supplierTaxPoint},
+            </if>
+            <if test="addTime != null and  addTime != ''">
+                #{addTime},
+            </if>
+            <if test="hasSkuFlag != null and  hasSkuFlag != ''">
+                #{hasSkuFlag},
+            </if>
+            <if test="sellNumber != null and  sellNumber != ''">
+                #{sellNumber},
+            </if>
+            <if test="sortIndex != null and  sortIndex != ''">
+                #{sortIndex},
+            </if>
+            <if test="featuredFlag != null and  featuredFlag != ''">
+                #{featuredFlag},
+            </if>
+            <if test="costCheckFlag != null and  costCheckFlag != ''">
+                #{costCheckFlag},
+            </if>
+            <if test="recommendType != null and  recommendType != ''">
+                #{recommendType},
+            </if>
+            <if test="priceFlag != null and  priceFlag != ''">
+                #{priceFlag},
+            </if>
+            <if test="actFlag != null and  actFlag != ''">
+                #{actFlag},
+            </if>
+            <if test="ladderPriceFlag != null and  ladderPriceFlag != ''">
+                #{ladderPriceFlag},
+            </if>
+            <if test="visibility != null and  visibility != ''">
+                #{visibility},
+            </if>
+            <if test="productCode != null and  productCode != ''">
+                #{productCode},
+            </if>
+             #{updateTime}, #{validFlag}
+        )
+    </insert>
+    <update id="updateProduct">
+        update product set
+            shopID = #{shopId}, name = #{name}, aliasName = #{aliasName}, commodityType = #{commodityType},
+            bigTypeId = #{bigTypeId}, smallTypeId = #{smallTypeId}, tinyTypeId = #{tinyTypeId}, mainImage = #{mainImage},
+            brandId = #{brandId}, productType = #{productType}, tags = #{tags}, unit = #{unit}, normalPrice = #{normalPrice},
+            price = #{price}, includedTax = #{includedTax}, minBuyNumber = #{minBuyNumber}, stock = #{stock},
+            <if test="productCategory != null and  productCategory != ''">
+                productCategory = #{productCategory},
+            </if>
+            <if test="serviceNumber != null and  serviceNumber != ''">
+                serviceNumber = #{serviceNumber},
+            </if>
+            <if test="supplierTaxPoint != null and  supplierTaxPoint != ''">
+                supplierTaxPoint = #{supplierTaxPoint},
+            </if>
+            <if test="addTime != null and  addTime != ''">
+                addTime = #{addTime},
+            </if>
+            <if test="hasSkuFlag != null and  hasSkuFlag != ''">
+                hasSkuFlag = #{hasSkuFlag},
+            </if>
+            <if test="sellNumber != null and  sellNumber != ''">
+                sellNumber = #{sellNumber},
+            </if>
+            <if test="sortIndex != null and  sortIndex != ''">
+                sortIndex = #{sortIndex},
+            </if>
+            <if test="featuredFlag != null and  featuredFlag != ''">
+                featuredFlag = #{featuredFlag},
+            </if>
+            <if test="costCheckFlag != null and  costCheckFlag != ''">
+                costCheckFlag = #{costCheckFlag},
+            </if>
+            <if test="recommendType != null and  recommendType != ''">
+                recommendType = #{recommendType},
+            </if>
+            <if test="priceFlag != null and  priceFlag != ''">
+                price1TextFlag = #{priceFlag},
+            </if>
+            <if test="actFlag != null and  actFlag != ''">
+                actFlag = #{actFlag},
+            </if>
+            <if test="ladderPriceFlag != null and  ladderPriceFlag != ''">
+                ladderPriceFlag = #{ladderPriceFlag},
+            </if>
+            <if test="visibility != null and  visibility != ''">
+                visibility = #{visibility},
+            </if>
+            <if test="productCode != null and  productCode != ''">
+                productCode = #{productCode},
+            </if>
+            updateTime = #{updateTime}, validFlag = #{validFlag}
+        where productID = #{productId}
+    </update>
+    <insert id="insertProductImage">
+        insert into productimage (productID, shopID, addTime, image, mainFlag, sortIndex)
+        values (#{productId}, #{shopId}, #{addTime}, #{image}, #{mainFlag}, #{sortIndex})
+    </insert>
+    <update id="updateProductImage">
+        update productimage set productID = #{productId}, shopID = #{shopId}, addTime = #{addTime},
+                                image = #{image}, mainFlag = #{mainFlag}, sortIndex = #{sortIndex}
+        where productImageId = #{id}
+    </update>
+    <delete id="deleteProductImage">
+        delete from productimage where productImageID = #{id}
+    </delete>
     <select id="getMainProducts" resultType="com.caimei365.commodity.model.search.ProductListVo">
 		select
 			p.productID as id,
@@ -72,4 +239,28 @@
         select count(*) from  product where shopID = #{shopId}
         and validFlag = '2' and featuredFlag='1' order by productID desc
     </select>
+    <select id="getCodeByTypeId" resultType="java.lang.String">
+        select
+          CONCAT(IFNULL(b.bigTypeCode,''), IFNULL(s.smallTypeCode,''), IFNULL(t.tinyTypeCode,''))
+        from bigtype b
+        left join smalltype s on s.bigTypeID = b.bigTypeID
+        left join tinytype t on t.smallTypeID = s.smallTypeID
+        <where>
+            <if test="bigTypeId != null">
+                b.bigTypeID = #{bigTypeId}
+            </if>
+            <if test="smallTypeId != null">
+                and s.smallTypeID = #{smallTypeId}
+            </if>
+            <if test="tinyTypeId != null">
+                and t.tinyTypeID = #{tinyTypeId}
+            </if>
+        </where>
+    </select>
+    <select id="getImageByProductId" resultType="com.caimei365.commodity.model.po.ProductImagePo">
+        select productImageID as id, productID as productId, shopID as shopId, addTime, image, mainFlag, sortIndex
+        from productimage
+        where productID = #{productId}
+        order by mainFlag DESC
+    </select>
 </mapper>