通用型产品发布解决方案(SpringBoot+SpringCloud+Spring CloudAlibaba+Vue+ ...

打印 上一主题 下一主题

主题 1942|帖子 1942|积分 5826

通用型产品发布解决方案(基于分布式微服务技能栈:SpringBoot+SpringCloud+Spring CloudAlibaba+Vue+ElementUI+MyBatis-Plus+MySQL+Git+Maven+Linux+Docker+Nginx - 《03》

@
目录

Mybatis-plus 分页插件

增补:renren 的分页插件
  1.     /**
  2.      * 列表
  3.      * 说明:
  4.      * 1. 根据业务需求,增加根据分类(第3级分类) + 查询条件+ 分页的API接口/方法
  5.      */
  6.     @RequestMapping("/list/{categoryId}")
  7.     //@RequiresPermissions("commodity:attrgroup:list")
  8.     public R list(@RequestParam Map<String, Object> params, @PathVariable("categoryId") Long categoryId){
  9.         PageUtils page = attrgroupService.queryPage(params,categoryId);
  10.         return R.ok().put("page", page);
  11.     }
复制代码
  1.   /**
  2.      * 增加根据家居分类(第三级的)+查询条件+分页 API接口
  3.      * 可以通过 debug来查看后台的 SQL语句,一目了然
  4.      *
  5.      * @param params
  6.      * @param categoryId
  7.      * @return
  8.      */
  9.     @Override
  10.     public PageUtils queryPage(Map<String, Object> params, Long categoryId) {
  11.         // 获取用户进行查询时的关键字
  12.         String key = (String) params.get("key");
  13.         //  QueryWrapper是 renren相关提供的,是用于封装查询条件 /参数
  14.         QueryWrapper<AttrgroupEntity> wrapper =
  15. <el-upload
  16.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  17.       :data="dataObj"
  18.       :list-type="listType"
  19.       :file-list="fileList"
  20.       :before-upload="beforeUpload"
  21.       :on-remove="handleRemove"
  22.       :on-success="handleUploadSuccess"
  23.       :on-preview="handlePreview"
  24.       :limit="maxCount"
  25.       :on-exceed="handleExceed"
  26.       :show-file-list="showFile"
  27.     >
  28.       <i ></i>
  29.     </el-upload>      new QueryWrapper<AttrgroupEntity>();
  30.         //如果是带条件查询,将条件分组到 wrapper,
  31.         //这里的 id和 name是指的 commodity_attrgroup表的字段
  32.         // 判断 key 是否携带的有查询条件
  33.         //if (!StringUtils.isEmpty(key)) {
  34.         //    wrapper.and((obj) -> {
  35.         //        obj.eq("id", key).or().like("name", key);
  36.         //    });
  37.         //}
  38.         // 判断 key 是否携带的有查询添加-希望他是一组独立检索条件。
  39.         if (!StringUtils.isEmpty(key)) {
  40. <el-upload
  41.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  42.       :data="dataObj"
  43.       :list-type="listType"
  44.       :file-list="fileList"
  45.       :before-upload="beforeUpload"
  46.       :on-remove="handleRemove"
  47.       :on-success="handleUploadSuccess"
  48.       :on-preview="handlePreview"
  49.       :limit="maxCount"
  50.       :on-exceed="handleExceed"
  51.       :show-file-list="showFile"
  52.     >
  53.       <i ></i>
  54.     </el-upload>  wrapper.and((obj) -> {
  55. <el-upload
  56.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  57.       :data="dataObj"
  58.       :list-type="listType"
  59.       :file-list="fileList"
  60.       :before-upload="beforeUpload"
  61.       :on-remove="handleRemove"
  62.       :on-success="handleUploadSuccess"
  63.       :on-preview="handlePreview"
  64.       :limit="maxCount"
  65.       :on-exceed="handleExceed"
  66.       :show-file-list="showFile"
  67.     >
  68.       <i ></i>
  69.     </el-upload>      obj.eq("id", key).or().like("name", key);
  70. <el-upload
  71.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  72.       :data="dataObj"
  73.       :list-type="listType"
  74.       :file-list="fileList"
  75.       :before-upload="beforeUpload"
  76.       :on-remove="handleRemove"
  77.       :on-success="handleUploadSuccess"
  78.       :on-preview="handlePreview"
  79.       :limit="maxCount"
  80.       :on-exceed="handleExceed"
  81.       :show-file-list="showFile"
  82.     >
  83.       <i ></i>
  84.     </el-upload>  });
  85.         }
  86.         // IPage是 renren提供的工具类,用于分页查询
  87.         //categoryId为 0表示,查询分类属性组时,不加入 categoryId
  88.         //(是我设置的业务逻辑,目前调用,传的 categoryId都不为 0)
  89.         // 否则就加入 And categoryId = xxx
  90.         if (categoryId != 0) {
  91. <el-upload
  92.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  93.       :data="dataObj"
  94.       :list-type="listType"
  95.       :file-list="fileList"
  96.       :before-upload="beforeUpload"
  97.       :on-remove="handleRemove"
  98.       :on-success="handleUploadSuccess"
  99.       :on-preview="handlePreview"
  100.       :limit="maxCount"
  101.       :on-exceed="handleExceed"
  102.       :show-file-list="showFile"
  103.     >
  104.       <i ></i>
  105.     </el-upload>  wrapper.eq("category_id", categoryId);
  106.         }
  107.         IPage<AttrgroupEntity> page = this.page(
  108. <el-upload
  109.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  110.       :data="dataObj"
  111.       :list-type="listType"
  112.       :file-list="fileList"
  113.       :before-upload="beforeUpload"
  114.       :on-remove="handleRemove"
  115.       :on-success="handleUploadSuccess"
  116.       :on-preview="handlePreview"
  117.       :limit="maxCount"
  118.       :on-exceed="handleExceed"
  119.       :show-file-list="showFile"
  120.     >
  121.       <i ></i>
  122.     </el-upload>      new Query<AttrgroupEntity>().getPage(params),
  123. <el-upload
  124.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  125.       :data="dataObj"
  126.       :list-type="listType"
  127.       :file-list="fileList"
  128.       :before-upload="beforeUpload"
  129.       :on-remove="handleRemove"
  130.       :on-success="handleUploadSuccess"
  131.       :on-preview="handlePreview"
  132.       :limit="maxCount"
  133.       :on-exceed="handleExceed"
  134.       :show-file-list="showFile"
  135.     >
  136.       <i ></i>
  137.     </el-upload>      wrapper
  138.         );
  139.         return new PageUtils(page);
  140.     }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;import com.alibaba.cloud.context.utils.StringUtils;import org.springframework.stereotype.Service;import java.util.Map;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;import com.baomidou.mybatisplus.core.metadata.IPage;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;import com.rainbowsea.common.utils.PageUtils;import com.rainbowsea.common.utils.Query;import com.rainbowsea.rainbowsealiving.commodity.dao.AttrgroupDao;import com.rainbowsea.rainbowsealiving.commodity.entity.AttrgroupEntity;import com.rainbowsea.rainbowsealiving.commodity.service.AttrgroupService;@Service("attrgroupService")public class AttrgroupServiceImpl extends ServiceImpl implements AttrgroupService {    @Override    public PageUtils queryPage(Map params) {        IPage page = this.page(<el-upload
  2.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  3.       :data="dataObj"
  4.       :list-type="listType"
  5.       :file-list="fileList"
  6.       :before-upload="beforeUpload"
  7.       :on-remove="handleRemove"
  8.       :on-success="handleUploadSuccess"
  9.       :on-preview="handlePreview"
  10.       :limit="maxCount"
  11.       :on-exceed="handleExceed"
  12.       :show-file-list="showFile"
  13.     >
  14.       <i ></i>
  15.     </el-upload>      new Query().getPage(params),<el-upload
  16.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  17.       :data="dataObj"
  18.       :list-type="listType"
  19.       :file-list="fileList"
  20.       :before-upload="beforeUpload"
  21.       :on-remove="handleRemove"
  22.       :on-success="handleUploadSuccess"
  23.       :on-preview="handlePreview"
  24.       :limit="maxCount"
  25.       :on-exceed="handleExceed"
  26.       :show-file-list="showFile"
  27.     >
  28.       <i ></i>
  29.     </el-upload>      new QueryWrapper()        );        return new PageUtils(page);    }    /**
  30.      * 增加根据家居分类(第三级的)+查询条件+分页 API接口
  31.      * 可以通过 debug来查看后台的 SQL语句,一目了然
  32.      *
  33.      * @param params
  34.      * @param categoryId
  35.      * @return
  36.      */
  37.     @Override
  38.     public PageUtils queryPage(Map<String, Object> params, Long categoryId) {
  39.         // 获取用户进行查询时的关键字
  40.         String key = (String) params.get("key");
  41.         //  QueryWrapper是 renren相关提供的,是用于封装查询条件 /参数
  42.         QueryWrapper<AttrgroupEntity> wrapper =
  43. <el-upload
  44.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  45.       :data="dataObj"
  46.       :list-type="listType"
  47.       :file-list="fileList"
  48.       :before-upload="beforeUpload"
  49.       :on-remove="handleRemove"
  50.       :on-success="handleUploadSuccess"
  51.       :on-preview="handlePreview"
  52.       :limit="maxCount"
  53.       :on-exceed="handleExceed"
  54.       :show-file-list="showFile"
  55.     >
  56.       <i ></i>
  57.     </el-upload>      new QueryWrapper<AttrgroupEntity>();
  58.         //如果是带条件查询,将条件分组到 wrapper,
  59.         //这里的 id和 name是指的 commodity_attrgroup表的字段
  60.         // 判断 key 是否携带的有查询条件
  61.         //if (!StringUtils.isEmpty(key)) {
  62.         //    wrapper.and((obj) -> {
  63.         //        obj.eq("id", key).or().like("name", key);
  64.         //    });
  65.         //}
  66.         // 判断 key 是否携带的有查询添加-希望他是一组独立检索条件。
  67.         if (!StringUtils.isEmpty(key)) {
  68. <el-upload
  69.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  70.       :data="dataObj"
  71.       :list-type="listType"
  72.       :file-list="fileList"
  73.       :before-upload="beforeUpload"
  74.       :on-remove="handleRemove"
  75.       :on-success="handleUploadSuccess"
  76.       :on-preview="handlePreview"
  77.       :limit="maxCount"
  78.       :on-exceed="handleExceed"
  79.       :show-file-list="showFile"
  80.     >
  81.       <i ></i>
  82.     </el-upload>  wrapper.and((obj) -> {
  83. <el-upload
  84.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  85.       :data="dataObj"
  86.       :list-type="listType"
  87.       :file-list="fileList"
  88.       :before-upload="beforeUpload"
  89.       :on-remove="handleRemove"
  90.       :on-success="handleUploadSuccess"
  91.       :on-preview="handlePreview"
  92.       :limit="maxCount"
  93.       :on-exceed="handleExceed"
  94.       :show-file-list="showFile"
  95.     >
  96.       <i ></i>
  97.     </el-upload>      obj.eq("id", key).or().like("name", key);
  98. <el-upload
  99.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  100.       :data="dataObj"
  101.       :list-type="listType"
  102.       :file-list="fileList"
  103.       :before-upload="beforeUpload"
  104.       :on-remove="handleRemove"
  105.       :on-success="handleUploadSuccess"
  106.       :on-preview="handlePreview"
  107.       :limit="maxCount"
  108.       :on-exceed="handleExceed"
  109.       :show-file-list="showFile"
  110.     >
  111.       <i ></i>
  112.     </el-upload>  });
  113.         }
  114.         // IPage是 renren提供的工具类,用于分页查询
  115.         //categoryId为 0表示,查询分类属性组时,不加入 categoryId
  116.         //(是我设置的业务逻辑,目前调用,传的 categoryId都不为 0)
  117.         // 否则就加入 And categoryId = xxx
  118.         if (categoryId != 0) {
  119. <el-upload
  120.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  121.       :data="dataObj"
  122.       :list-type="listType"
  123.       :file-list="fileList"
  124.       :before-upload="beforeUpload"
  125.       :on-remove="handleRemove"
  126.       :on-success="handleUploadSuccess"
  127.       :on-preview="handlePreview"
  128.       :limit="maxCount"
  129.       :on-exceed="handleExceed"
  130.       :show-file-list="showFile"
  131.     >
  132.       <i ></i>
  133.     </el-upload>  wrapper.eq("category_id", categoryId);
  134.         }
  135.         IPage<AttrgroupEntity> page = this.page(
  136. <el-upload
  137.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  138.       :data="dataObj"
  139.       :list-type="listType"
  140.       :file-list="fileList"
  141.       :before-upload="beforeUpload"
  142.       :on-remove="handleRemove"
  143.       :on-success="handleUploadSuccess"
  144.       :on-preview="handlePreview"
  145.       :limit="maxCount"
  146.       :on-exceed="handleExceed"
  147.       :show-file-list="showFile"
  148.     >
  149.       <i ></i>
  150.     </el-upload>      new Query<AttrgroupEntity>().getPage(params),
  151. <el-upload
  152.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  153.       :data="dataObj"
  154.       :list-type="listType"
  155.       :file-list="fileList"
  156.       :before-upload="beforeUpload"
  157.       :on-remove="handleRemove"
  158.       :on-success="handleUploadSuccess"
  159.       :on-preview="handlePreview"
  160.       :limit="maxCount"
  161.       :on-exceed="handleExceed"
  162.       :show-file-list="showFile"
  163.     >
  164.       <i ></i>
  165.     </el-upload>      wrapper
  166.         );
  167.         return new PageUtils(page);
  168.     }}
复制代码
打括号的查询提供,分组,括号查询
  1.        if (!StringUtils.isEmpty(key)) {
  2. <el-upload
  3.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  4.       :data="dataObj"
  5.       :list-type="listType"
  6.       :file-list="fileList"
  7.       :before-upload="beforeUpload"
  8.       :on-remove="handleRemove"
  9.       :on-success="handleUploadSuccess"
  10.       :on-preview="handlePreview"
  11.       :limit="maxCount"
  12.       :on-exceed="handleExceed"
  13.       :show-file-list="showFile"
  14.     >
  15.       <i ></i>
  16.     </el-upload>  wrapper.and((obj) -> {
  17. <el-upload
  18.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  19.       :data="dataObj"
  20.       :list-type="listType"
  21.       :file-list="fileList"
  22.       :before-upload="beforeUpload"
  23.       :on-remove="handleRemove"
  24.       :on-success="handleUploadSuccess"
  25.       :on-preview="handlePreview"
  26.       :limit="maxCount"
  27.       :on-exceed="handleExceed"
  28.       :show-file-list="showFile"
  29.     >
  30.       <i ></i>
  31.     </el-upload>      obj.eq("id", key).or().like("name", key);
  32. <el-upload
  33.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  34.       :data="dataObj"
  35.       :list-type="listType"
  36.       :file-list="fileList"
  37.       :before-upload="beforeUpload"
  38.       :on-remove="handleRemove"
  39.       :on-success="handleUploadSuccess"
  40.       :on-preview="handlePreview"
  41.       :limit="maxCount"
  42.       :on-exceed="handleExceed"
  43.       :show-file-list="showFile"
  44.     >
  45.       <i ></i>
  46.     </el-upload>  });
  47.         }
复制代码

  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;import com.alibaba.cloud.context.utils.StringUtils;import org.springframework.stereotype.Service;import java.util.Map;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;import com.baomidou.mybatisplus.core.metadata.IPage;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;import com.rainbowsea.common.utils.PageUtils;import com.rainbowsea.common.utils.Query;import com.rainbowsea.rainbowsealiving.commodity.dao.AttrgroupDao;import com.rainbowsea.rainbowsealiving.commodity.entity.AttrgroupEntity;import com.rainbowsea.rainbowsealiving.commodity.service.AttrgroupService;@Service("attrgroupService")public class AttrgroupServiceImpl extends ServiceImpl implements AttrgroupService {    @Override    public PageUtils queryPage(Map params) {        IPage page = this.page(<el-upload
  2.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  3.       :data="dataObj"
  4.       :list-type="listType"
  5.       :file-list="fileList"
  6.       :before-upload="beforeUpload"
  7.       :on-remove="handleRemove"
  8.       :on-success="handleUploadSuccess"
  9.       :on-preview="handlePreview"
  10.       :limit="maxCount"
  11.       :on-exceed="handleExceed"
  12.       :show-file-list="showFile"
  13.     >
  14.       <i ></i>
  15.     </el-upload>      new Query().getPage(params),<el-upload
  16.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  17.       :data="dataObj"
  18.       :list-type="listType"
  19.       :file-list="fileList"
  20.       :before-upload="beforeUpload"
  21.       :on-remove="handleRemove"
  22.       :on-success="handleUploadSuccess"
  23.       :on-preview="handlePreview"
  24.       :limit="maxCount"
  25.       :on-exceed="handleExceed"
  26.       :show-file-list="showFile"
  27.     >
  28.       <i ></i>
  29.     </el-upload>      new QueryWrapper()        );        return new PageUtils(page);    }    /**     * 增加根据家居分类(第三级的)+查询条件+分页 API接口     * 可以通过 debug来查看后台的 SQL语句,一目了然     *     * @param params     * @param categoryId     * @return     */    @Override    public PageUtils queryPage(Map params, Long categoryId) {        // 获取用户进行查询时的关键字        String key = (String) params.get("key");        //  QueryWrapper是 renren相关提供的,是用于封装查询条件 /参数        QueryWrapper wrapper =<el-upload
  30.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  31.       :data="dataObj"
  32.       :list-type="listType"
  33.       :file-list="fileList"
  34.       :before-upload="beforeUpload"
  35.       :on-remove="handleRemove"
  36.       :on-success="handleUploadSuccess"
  37.       :on-preview="handlePreview"
  38.       :limit="maxCount"
  39.       :on-exceed="handleExceed"
  40.       :show-file-list="showFile"
  41.     >
  42.       <i ></i>
  43.     </el-upload>      new QueryWrapper();        //如果是带条件查询,将条件分组到 wrapper,        //这里的 id和 name是指的 commodity_attrgroup表的字段        // 判断 key 是否携带的有查询条件        //if (!StringUtils.isEmpty(key)) {        //    wrapper.and((obj) -> {        //        obj.eq("id", key).or().like("name", key);        //    });        //}        if (!StringUtils.isEmpty(key)) {
  44. <el-upload
  45.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  46.       :data="dataObj"
  47.       :list-type="listType"
  48.       :file-list="fileList"
  49.       :before-upload="beforeUpload"
  50.       :on-remove="handleRemove"
  51.       :on-success="handleUploadSuccess"
  52.       :on-preview="handlePreview"
  53.       :limit="maxCount"
  54.       :on-exceed="handleExceed"
  55.       :show-file-list="showFile"
  56.     >
  57.       <i ></i>
  58.     </el-upload>  wrapper.and((obj) -> {
  59. <el-upload
  60.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  61.       :data="dataObj"
  62.       :list-type="listType"
  63.       :file-list="fileList"
  64.       :before-upload="beforeUpload"
  65.       :on-remove="handleRemove"
  66.       :on-success="handleUploadSuccess"
  67.       :on-preview="handlePreview"
  68.       :limit="maxCount"
  69.       :on-exceed="handleExceed"
  70.       :show-file-list="showFile"
  71.     >
  72.       <i ></i>
  73.     </el-upload>      obj.eq("id", key).or().like("name", key);
  74. <el-upload
  75.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  76.       :data="dataObj"
  77.       :list-type="listType"
  78.       :file-list="fileList"
  79.       :before-upload="beforeUpload"
  80.       :on-remove="handleRemove"
  81.       :on-success="handleUploadSuccess"
  82.       :on-preview="handlePreview"
  83.       :limit="maxCount"
  84.       :on-exceed="handleExceed"
  85.       :show-file-list="showFile"
  86.     >
  87.       <i ></i>
  88.     </el-upload>  });
  89.         }        // IPage是 renren提供的工具类,用于分页查询        //categoryId为 0表示,查询分类属性组时,不参加 categoryId        //(是我设置的业务逻辑,目前调用,传的 categoryId都不为 0)        // 否则就参加 And categoryId = xxx        if (categoryId != 0) {<el-upload
  90.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  91.       :data="dataObj"
  92.       :list-type="listType"
  93.       :file-list="fileList"
  94.       :before-upload="beforeUpload"
  95.       :on-remove="handleRemove"
  96.       :on-success="handleUploadSuccess"
  97.       :on-preview="handlePreview"
  98.       :limit="maxCount"
  99.       :on-exceed="handleExceed"
  100.       :show-file-list="showFile"
  101.     >
  102.       <i ></i>
  103.     </el-upload>  wrapper.eq("category_id", categoryId);        }        IPage page = this.page(<el-upload
  104.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  105.       :data="dataObj"
  106.       :list-type="listType"
  107.       :file-list="fileList"
  108.       :before-upload="beforeUpload"
  109.       :on-remove="handleRemove"
  110.       :on-success="handleUploadSuccess"
  111.       :on-preview="handlePreview"
  112.       :limit="maxCount"
  113.       :on-exceed="handleExceed"
  114.       :show-file-list="showFile"
  115.     >
  116.       <i ></i>
  117.     </el-upload>      new Query().getPage(params),<el-upload
  118.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  119.       :data="dataObj"
  120.       :list-type="listType"
  121.       :file-list="fileList"
  122.       :before-upload="beforeUpload"
  123.       :on-remove="handleRemove"
  124.       :on-success="handleUploadSuccess"
  125.       :on-preview="handlePreview"
  126.       :limit="maxCount"
  127.       :on-exceed="handleExceed"
  128.       :show-file-list="showFile"
  129.     >
  130.       <i ></i>
  131.     </el-upload>      wrapper        );        return new PageUtils(page);    }}
复制代码
设置类(引入分页插件)
在对应项目,或者微服务当中的 config 设置目录下创建,MyB
atisConfig.java,MyBatis-plus 的分页插件的设置类
  1. package com.rainbowsea.rainbowsealiving.commodity.config;
  2. import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
  3. import org.mybatis.spring.annotation.MapperScan;
  4. import org.springframework.context.annotation.Bean;
  5. import org.springframework.context.annotation.Configuration;
  6. import org.springframework.transaction.annotation.EnableTransactionManagement;
  7. @Configuration  // 标识是一个配置类
  8. @EnableTransactionManagement //开启事务
  9. @MapperScan("com.rainbowsea.rainbowsealiving.commodity.dao")  // 扫描的 dao 目录包位置
  10. public class MyBatisConfig {
  11.     // 引入分页插件
  12.     @Bean
  13.     public PaginationInterceptor paginationInterceptor() {
  14.         PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
  15.         // 设置请求的页面大于最大页后操作,
  16.         // true 调回到首页,false 继续请求 默认 false
  17.         paginationInterceptor.setOverflow(true);
  18.         //设置最大单页限制数量,默认 500条,-1不受限制
  19.         paginationInterceptor.setLimit(100);
  20.         return paginationInterceptor;
  21.     }
  22. }
复制代码
层级定位

可以省略
前端搜索检索功能

可以省略
关联表-而不是使用外键


BeanUtils 的使用
  1. BeanUtils.copyProperties(test1,test2); // 将 test1对象属性拷贝大宋  test2 当中
复制代码
SPU 和 SKU 的概念和实现

SPU 的概述

  • SPU((Stock keeping Unit):标准化产品单元
  • 用简单的话来说就是一类商品,比如:手机里的一种牌子,如:小米,苹果,都是一类。然后,参加具体的类型,如:小米 15,苹果 16 等等。那么它就是一个 spu
SKU 的概述:

  • SKU(Stock keeping Unit):库存保有单位。
  • SKU 简单的来说就是在 spu 原有的基础上参加具体的类型,如(小米 15,白色,8+252G) 。组合起来就是一个完整地 SKU,所以 SKU 就是一类商品的各种样式的组合。
  • SKU 的组合会影响该商品的代价。


SPU 和 SKU 的关系:

  • SPU 和 SKU 就是上下级关系,没有 SPU 就没有 SKU,因为假如没有这一类商品,就没法谈这件商品具体的颜色尺寸。
  • 如下图:假如没有选择任何类型那么他就是一个单独的 SPU,但是当它选择了具体的颜色,版本,购买方式等等,那么他就是一个 SKU。



  • 保存商品  spu 信息
  • 1 个 spu 信息可能对于多个 sku
  • 1 个 spu + 1 个 sku 就是一个商品的组合关系()


JSON 转换为 Java 实体类

写,特别的
P550
P564

  • 当目前的实体类/对象,格式不能满足我们的需求时,可以使用上 VO**View  Object**** 对象。VO 可以根据需求组合已有**的实体类的字段,或者增加,或者删除一些字段。
  • 如果返回的 JSON 数据的当前实体类,不能满足需求,则定义一个 VO(View Object) 对象,在该对象,可以根据需求组合实体类字段,或者增加,或者删除一些字段。
  1. submitSkus() {
  2. console.log("要提交保存的商品信息(spu=) " , JSON.stringify(this.spu)); //将 json 对象转
  3. 成字符串输出
  4. this.$confirm("将要提交商品数据, 是否继续?", "提示", {
  5. confirmButtonText: "确定", cancelButtonText: "取消",
  6. type: "warning"
  7. })//其它
复制代码
  1. <el-button type="success" @click="submitSkus">下一步:保存商品信息</el-button>
  2. submitSkus() {
  3.       console.log("要提交保存的商品信息(spu=) " , JSON.stringify(this.spu))
  4.       this.$confirm("将要提交商品数据,需要一小段时间,是否继续?", "提示", {
  5.         confirmButtonText: "确定",
  6.         cancelButtonText: "取消",
  7.         type: "warning"
  8.       })
  9.         .then(() => {
  10. <el-upload
  11.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  12.       :data="dataObj"
  13.       :list-type="listType"
  14.       :file-list="fileList"
  15.       :before-upload="beforeUpload"
  16.       :on-remove="handleRemove"
  17.       :on-success="handleUploadSuccess"
  18.       :on-preview="handlePreview"
  19.       :limit="maxCount"
  20.       :on-exceed="handleExceed"
  21.       :show-file-list="showFile"
  22.     >
  23.       <i ></i>
  24.     </el-upload>this.$http({
  25. <el-upload
  26.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  27.       :data="dataObj"
  28.       :list-type="listType"
  29.       :file-list="fileList"
  30.       :before-upload="beforeUpload"
  31.       :on-remove="handleRemove"
  32.       :on-success="handleUploadSuccess"
  33.       :on-preview="handlePreview"
  34.       :limit="maxCount"
  35.       :on-exceed="handleExceed"
  36.       :show-file-list="showFile"
  37.     >
  38.       <i ></i>
  39.     </el-upload>  //url: "http://localhost:9090/commodity/spuinfo/save",
  40. <el-upload
  41.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  42.       :data="dataObj"
  43.       :list-type="listType"
  44.       :file-list="fileList"
  45.       :before-upload="beforeUpload"
  46.       :on-remove="handleRemove"
  47.       :on-success="handleUploadSuccess"
  48.       :on-preview="handlePreview"
  49.       :limit="maxCount"
  50.       :on-exceed="handleExceed"
  51.       :show-file-list="showFile"
  52.     >
  53.       <i ></i>
  54.     </el-upload>  url: this.$http.adornUrl("/commodity/spuinfo/save"),
  55. <el-upload
  56.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  57.       :data="dataObj"
  58.       :list-type="listType"
  59.       :file-list="fileList"
  60.       :before-upload="beforeUpload"
  61.       :on-remove="handleRemove"
  62.       :on-success="handleUploadSuccess"
  63.       :on-preview="handlePreview"
  64.       :limit="maxCount"
  65.       :on-exceed="handleExceed"
  66.       :show-file-list="showFile"
  67.     >
  68.       <i ></i>
  69.     </el-upload>  method: "post",
  70. <el-upload
  71.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  72.       :data="dataObj"
  73.       :list-type="listType"
  74.       :file-list="fileList"
  75.       :before-upload="beforeUpload"
  76.       :on-remove="handleRemove"
  77.       :on-success="handleUploadSuccess"
  78.       :on-preview="handlePreview"
  79.       :limit="maxCount"
  80.       :on-exceed="handleExceed"
  81.       :show-file-list="showFile"
  82.     >
  83.       <i ></i>
  84.     </el-upload>  data: this.$http.adornData(this.spu, false)
  85. <el-upload
  86.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  87.       :data="dataObj"
  88.       :list-type="listType"
  89.       :file-list="fileList"
  90.       :before-upload="beforeUpload"
  91.       :on-remove="handleRemove"
  92.       :on-success="handleUploadSuccess"
  93.       :on-preview="handlePreview"
  94.       :limit="maxCount"
  95.       :on-exceed="handleExceed"
  96.       :show-file-list="showFile"
  97.     >
  98.       <i ></i>
  99.     </el-upload>}).then(({data}) => {
  100. <el-upload
  101.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  102.       :data="dataObj"
  103.       :list-type="listType"
  104.       :file-list="fileList"
  105.       :before-upload="beforeUpload"
  106.       :on-remove="handleRemove"
  107.       :on-success="handleUploadSuccess"
  108.       :on-preview="handlePreview"
  109.       :limit="maxCount"
  110.       :on-exceed="handleExceed"
  111.       :show-file-list="showFile"
  112.     >
  113.       <i ></i>
  114.     </el-upload>  if (data.code == 0) {
  115. <el-upload
  116.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  117.       :data="dataObj"
  118.       :list-type="listType"
  119.       :file-list="fileList"
  120.       :before-upload="beforeUpload"
  121.       :on-remove="handleRemove"
  122.       :on-success="handleUploadSuccess"
  123.       :on-preview="handlePreview"
  124.       :limit="maxCount"
  125.       :on-exceed="handleExceed"
  126.       :show-file-list="showFile"
  127.     >
  128.       <i ></i>
  129.     </el-upload>    this.$message({
  130. <el-upload
  131.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  132.       :data="dataObj"
  133.       :list-type="listType"
  134.       :file-list="fileList"
  135.       :before-upload="beforeUpload"
  136.       :on-remove="handleRemove"
  137.       :on-success="handleUploadSuccess"
  138.       :on-preview="handlePreview"
  139.       :limit="maxCount"
  140.       :on-exceed="handleExceed"
  141.       :show-file-list="showFile"
  142.     >
  143.       <i ></i>
  144.     </el-upload>      type: "success",
  145. <el-upload
  146.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  147.       :data="dataObj"
  148.       :list-type="listType"
  149.       :file-list="fileList"
  150.       :before-upload="beforeUpload"
  151.       :on-remove="handleRemove"
  152.       :on-success="handleUploadSuccess"
  153.       :on-preview="handlePreview"
  154.       :limit="maxCount"
  155.       :on-exceed="handleExceed"
  156.       :show-file-list="showFile"
  157.     >
  158.       <i ></i>
  159.     </el-upload>      message: "新增商品成功!"
  160. <el-upload
  161.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  162.       :data="dataObj"
  163.       :list-type="listType"
  164.       :file-list="fileList"
  165.       :before-upload="beforeUpload"
  166.       :on-remove="handleRemove"
  167.       :on-success="handleUploadSuccess"
  168.       :on-preview="handlePreview"
  169.       :limit="maxCount"
  170.       :on-exceed="handleExceed"
  171.       :show-file-list="showFile"
  172.     >
  173.       <i ></i>
  174.     </el-upload>    });
  175. <el-upload
  176.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  177.       :data="dataObj"
  178.       :list-type="listType"
  179.       :file-list="fileList"
  180.       :before-upload="beforeUpload"
  181.       :on-remove="handleRemove"
  182.       :on-success="handleUploadSuccess"
  183.       :on-preview="handlePreview"
  184.       :limit="maxCount"
  185.       :on-exceed="handleExceed"
  186.       :show-file-list="showFile"
  187.     >
  188.       <i ></i>
  189.     </el-upload>    this.step = 4;
  190. <el-upload
  191.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  192.       :data="dataObj"
  193.       :list-type="listType"
  194.       :file-list="fileList"
  195.       :before-upload="beforeUpload"
  196.       :on-remove="handleRemove"
  197.       :on-success="handleUploadSuccess"
  198.       :on-preview="handlePreview"
  199.       :limit="maxCount"
  200.       :on-exceed="handleExceed"
  201.       :show-file-list="showFile"
  202.     >
  203.       <i ></i>
  204.     </el-upload>  } else {
  205. <el-upload
  206.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  207.       :data="dataObj"
  208.       :list-type="listType"
  209.       :file-list="fileList"
  210.       :before-upload="beforeUpload"
  211.       :on-remove="handleRemove"
  212.       :on-success="handleUploadSuccess"
  213.       :on-preview="handlePreview"
  214.       :limit="maxCount"
  215.       :on-exceed="handleExceed"
  216.       :show-file-list="showFile"
  217.     >
  218.       <i ></i>
  219.     </el-upload>    this.$message({
  220. <el-upload
  221.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  222.       :data="dataObj"
  223.       :list-type="listType"
  224.       :file-list="fileList"
  225.       :before-upload="beforeUpload"
  226.       :on-remove="handleRemove"
  227.       :on-success="handleUploadSuccess"
  228.       :on-preview="handlePreview"
  229.       :limit="maxCount"
  230.       :on-exceed="handleExceed"
  231.       :show-file-list="showFile"
  232.     >
  233.       <i ></i>
  234.     </el-upload>      type: "error",
  235. <el-upload
  236.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  237.       :data="dataObj"
  238.       :list-type="listType"
  239.       :file-list="fileList"
  240.       :before-upload="beforeUpload"
  241.       :on-remove="handleRemove"
  242.       :on-success="handleUploadSuccess"
  243.       :on-preview="handlePreview"
  244.       :limit="maxCount"
  245.       :on-exceed="handleExceed"
  246.       :show-file-list="showFile"
  247.     >
  248.       <i ></i>
  249.     </el-upload>      message: "保存失败,原因【" + data.msg + "】"
  250. <el-upload
  251.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  252.       :data="dataObj"
  253.       :list-type="listType"
  254.       :file-list="fileList"
  255.       :before-upload="beforeUpload"
  256.       :on-remove="handleRemove"
  257.       :on-success="handleUploadSuccess"
  258.       :on-preview="handlePreview"
  259.       :limit="maxCount"
  260.       :on-exceed="handleExceed"
  261.       :show-file-list="showFile"
  262.     >
  263.       <i ></i>
  264.     </el-upload>    });
  265. <el-upload
  266.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  267.       :data="dataObj"
  268.       :list-type="listType"
  269.       :file-list="fileList"
  270.       :before-upload="beforeUpload"
  271.       :on-remove="handleRemove"
  272.       :on-success="handleUploadSuccess"
  273.       :on-preview="handlePreview"
  274.       :limit="maxCount"
  275.       :on-exceed="handleExceed"
  276.       :show-file-list="showFile"
  277.     >
  278.       <i ></i>
  279.     </el-upload>  }
  280. <el-upload
  281.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  282.       :data="dataObj"
  283.       :list-type="listType"
  284.       :file-list="fileList"
  285.       :before-upload="beforeUpload"
  286.       :on-remove="handleRemove"
  287.       :on-success="handleUploadSuccess"
  288.       :on-preview="handlePreview"
  289.       :limit="maxCount"
  290.       :on-exceed="handleExceed"
  291.       :show-file-list="showFile"
  292.     >
  293.       <i ></i>
  294.     </el-upload>});
  295.         })
  296.         .catch(e => {
  297. <el-upload
  298.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  299.       :data="dataObj"
  300.       :list-type="listType"
  301.       :file-list="fileList"
  302.       :before-upload="beforeUpload"
  303.       :on-remove="handleRemove"
  304.       :on-success="handleUploadSuccess"
  305.       :on-preview="handlePreview"
  306.       :limit="maxCount"
  307.       :on-exceed="handleExceed"
  308.       :show-file-list="showFile"
  309.     >
  310.       <i ></i>
  311.     </el-upload>console.log(e);
  312. <el-upload
  313.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  314.       :data="dataObj"
  315.       :list-type="listType"
  316.       :file-list="fileList"
  317.       :before-upload="beforeUpload"
  318.       :on-remove="handleRemove"
  319.       :on-success="handleUploadSuccess"
  320.       :on-preview="handlePreview"
  321.       :limit="maxCount"
  322.       :on-exceed="handleExceed"
  323.       :show-file-list="showFile"
  324.     >
  325.       <i ></i>
  326.     </el-upload>this.$message({
  327. <el-upload
  328.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  329.       :data="dataObj"
  330.       :list-type="listType"
  331.       :file-list="fileList"
  332.       :before-upload="beforeUpload"
  333.       :on-remove="handleRemove"
  334.       :on-success="handleUploadSuccess"
  335.       :on-preview="handlePreview"
  336.       :limit="maxCount"
  337.       :on-exceed="handleExceed"
  338.       :show-file-list="showFile"
  339.     >
  340.       <i ></i>
  341.     </el-upload>  type: "info",
  342. <el-upload
  343.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  344.       :data="dataObj"
  345.       :list-type="listType"
  346.       :file-list="fileList"
  347.       :before-upload="beforeUpload"
  348.       :on-remove="handleRemove"
  349.       :on-success="handleUploadSuccess"
  350.       :on-preview="handlePreview"
  351.       :limit="maxCount"
  352.       :on-exceed="handleExceed"
  353.       :show-file-list="showFile"
  354.     >
  355.       <i ></i>
  356.     </el-upload>  message: "已取消"
  357. <el-upload
  358.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  359.       :data="dataObj"
  360.       :list-type="listType"
  361.       :file-list="fileList"
  362.       :before-upload="beforeUpload"
  363.       :on-remove="handleRemove"
  364.       :on-success="handleUploadSuccess"
  365.       :on-preview="handlePreview"
  366.       :limit="maxCount"
  367.       :on-exceed="handleExceed"
  368.       :show-file-list="showFile"
  369.     >
  370.       <i ></i>
  371.     </el-upload>});
  372.         });
  373.     },
复制代码
分析一个 JSON 格式内容,将 console 输出的 json 字符串,格式化一下好看: https://www.json.cn/
为了可以或许在服务端接收提交的数据,我们使用 json 在线工具,转成 entity 对象(实际是一组),作为 VO实体类

  • 点击 JSON 天生 Java 实体
  • 把 console 输出的 JSON 字符串拷贝到左侧。


  • 指定类名,包名,点击天生即可。

把天生好的 VO 实体类(我已经改好了, 可以直接使用(在资料文件夹))
留意:编写对应的 Cotroller 当中的编码信息。
分 析 一 下 json 格 式 内 容 ,  将 console 输 出 的 json 字 符 串 , 格 式 化 一 下 好 看 https://www.json.cn/

  • 为了可以或许在服务端接收提交的数据,我们使用 json 在线工具,转成 entity 对象(实际是 一组),  作为 VO 实体类
  • 点击 JSON  天生 JAVA 实体

对天生好的 VO 实体类进行简化和定制,比如 int 改成 Long , double 改成 BigDecimal
如许更符合我们的要求, 我已经改好了, 可以直接使用(在资料文件夹),并增加了两个 VO
类 , Images.java 和 MemberPrice.java, 直接替换一下即可

  • 增加 Images.java 和 MemberPrice.java
  • 修改 int —> long,double ——>BigDecimal
  • 使用 @Data 注解  简化 entity 类
梳理 VO 实体类和提交的 Json 数据关系


  • 保存商品  spu 信息
  • 1 个 spu 信息可能对于多个 sku
  • 1 个 spu + 1 个 sku 就是一个商品的组合关系()
保存商品信息,涉及到的表非常多,不是一个 SpulnfoEntityh 实体类能包括的,将 SpulnfoEntity 改成我们前面天生的 SpuSaveVo 包罗了 JSON 提交全部信息。
我们这里是通过一个定制的方法  saveSpulnfo 来完成。
保存 SKU 的图片信息表的设置

  1. package com.rainbowsea.rainbowsealiving.commodity.entity;
  2. import com.baomidou.mybatisplus.annotation.IdType;
  3. import com.baomidou.mybatisplus.annotation.TableId;
  4. import com.baomidou.mybatisplus.annotation.TableName;
  5. import java.io.Serializable;
  6. import java.util.Date;
  7. import lombok.Data;
  8. /**
  9. * 商品 spu 信息介绍
  10. *
  11. * @author rainbowsea
  12. * @email rainbowsea@gmail.com
  13. * @date 2025-03-24 20:46:13
  14. */
  15. @Data
  16. @TableName("commodity_spu_info_desc")
  17. public class SpuInfoDescEntity implements Serializable {
  18.         private static final long serialVersionUID = 1L;
  19.         /**
  20.          * 商品 id
  21.          * 因为 commodity_spu_info_desc 表的 id 不是自增长的,而是我们指定的
  22.          * 因此,我们这里给 spuId 标识上 @TableId(type = IdType.INPUT)
  23.          * , 否则底层的 sql 语句时不会生成添加 supId 的 sql 语句(可以通过日志输出看看)
  24.          */
  25.         @TableId(type = IdType.INPUT)
  26.         private Long spuId;
  27.         /**
  28.          * 商品介绍图片
  29.          */
  30.         private String decript;
  31. }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service;
  2. import com.baomidou.mybatisplus.extension.service.IService;
  3. import com.rainbowsea.common.utils.PageUtils;
  4. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoEntity;
  5. import com.rainbowsea.rainbowsealiving.commodity.vo.SpuSaveVO;
  6. import java.util.Map;
  7. /**
  8. * 商品 spu 信息
  9. *
  10. * @author rainbowsea
  11. * @email rainbowsea@gmail.com
  12. * @date 2025-03-24 20:31:43
  13. */
  14. public interface SpuInfoService extends IService<SpuInfoEntity> {
  15.     PageUtils queryPage(Map<String, Object> params);
  16.     void saveSpuInfo(SpuSaveVO spuSaveVO);
  17.     void saveBaseSpuInfo(SpuInfoEntity spuInfoEntity);
  18. }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;
  2. import org.springframework.stereotype.Service;
  3. import java.util.Map;
  4. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5. import com.baomidou.mybatisplus.core.metadata.IPage;
  6. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  7. import com.rainbowsea.common.utils.PageUtils;
  8. import com.rainbowsea.common.utils.Query;
  9. import com.rainbowsea.rainbowsealiving.commodity.dao.SpuInfoDescDao;
  10. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoDescEntity;
  11. import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoDescService;
  12. @Service("spuInfoDescService")
  13. public class SpuInfoDescServiceImpl extends ServiceImpl<SpuInfoDescDao, SpuInfoDescEntity> implements SpuInfoDescService {
  14.     @Override
  15.     public void saveSpuInfoDesc(SpuInfoDescEntity spuInfoDescEntity) {
  16.         this.baseMapper.insert(spuInfoDescEntity);
  17.     }
  18.     @Override
  19.     public PageUtils queryPage(Map<String, Object> params) {
  20.         IPage<SpuInfoDescEntity> page = this.page(
  21. <el-upload
  22.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  23.       :data="dataObj"
  24.       :list-type="listType"
  25.       :file-list="fileList"
  26.       :before-upload="beforeUpload"
  27.       :on-remove="handleRemove"
  28.       :on-success="handleUploadSuccess"
  29.       :on-preview="handlePreview"
  30.       :limit="maxCount"
  31.       :on-exceed="handleExceed"
  32.       :show-file-list="showFile"
  33.     >
  34.       <i ></i>
  35.     </el-upload>      new Query<SpuInfoDescEntity>().getPage(params),
  36. <el-upload
  37.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  38.       :data="dataObj"
  39.       :list-type="listType"
  40.       :file-list="fileList"
  41.       :before-upload="beforeUpload"
  42.       :on-remove="handleRemove"
  43.       :on-success="handleUploadSuccess"
  44.       :on-preview="handlePreview"
  45.       :limit="maxCount"
  46.       :on-exceed="handleExceed"
  47.       :show-file-list="showFile"
  48.     >
  49.       <i ></i>
  50.     </el-upload>      new QueryWrapper<SpuInfoDescEntity>()
  51.         );
  52.         return new PageUtils(page);
  53.     }
  54. }
复制代码

  1. package com.rainbowsea.rainbowsealiving.commodity.controller;
  2. import java.util.Arrays;
  3. import java.util.Map;
  4. //import org.apache.shiro.authz.annotation.RequiresPermissions;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.PathVariable;
  7. import org.springframework.web.bind.annotation.RequestBody;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RequestParam;
  10. import org.springframework.web.bind.annotation.RestController;
  11. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoDescEntity;
  12. import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoDescService;
  13. import com.rainbowsea.common.utils.PageUtils;
  14. import com.rainbowsea.common.utils.R;
  15. /**
  16. * 商品 spu 信息介绍
  17. *
  18. * @author rainbowsea
  19. * @email rainbowsea@gmail.com
  20. * @date 2025-03-24 20:46:13
  21. */
  22. @RestController
  23. @RequestMapping("commodity/spuinfodesc")
  24. public class SpuInfoDescController {
  25.     @Autowired
  26.     private SpuInfoDescService spuInfoDescService;
  27.     /**
  28.      * 列表
  29.      */
  30.     @RequestMapping("/list")
  31.     //@RequiresPermissions("commodity:spuinfodesc:list")
  32.     public R list(@RequestParam Map<String, Object> params){
  33.         PageUtils page = spuInfoDescService.queryPage(params);
  34.         return R.ok().put("page", page);
  35.     }
  36.     /**
  37.      * 信息
  38.      */
  39.     @RequestMapping("/info/{spuId}")
  40.     //@RequiresPermissions("commodity:spuinfodesc:info")
  41.     public R info(@PathVariable("spuId") Long spuId){
  42.                 SpuInfoDescEntity spuInfoDesc = spuInfoDescService.getById(spuId);
  43.         return R.ok().put("spuInfoDesc", spuInfoDesc);
  44.     }
  45.     /**
  46.      * 保存
  47.      */
  48.     @RequestMapping("/save")
  49.     //@RequiresPermissions("commodity:spuinfodesc:save")
  50.     public R save(@RequestBody SpuInfoDescEntity spuInfoDesc){
  51.                 spuInfoDescService.save(spuInfoDesc);
  52.         return R.ok();
  53.     }
  54.     /**
  55.      * 修改
  56.      */
  57.     @RequestMapping("/update")
  58.     //@RequiresPermissions("commodity:spuinfodesc:update")
  59.     public R update(@RequestBody SpuInfoDescEntity spuInfoDesc){
  60.                 spuInfoDescService.updateById(spuInfoDesc);
  61.         return R.ok();
  62.     }
  63.     /**
  64.      * 删除
  65.      */
  66.     @RequestMapping("/delete")
  67.     //@RequiresPermissions("commodity:spuinfodesc:delete")
  68.     public R delete(@RequestBody Long[] spuIds){
  69.                 spuInfoDescService.removeByIds(Arrays.asList(spuIds));
  70.         return R.ok();
  71.     }
  72. }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;
  2. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoDescEntity;
  3. import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoDescService;
  4. import com.rainbowsea.rainbowsealiving.commodity.vo.SpuSaveVO;
  5. import org.springframework.beans.BeanUtils;
  6. import org.springframework.stereotype.Service;
  7. import java.util.Date;
  8. import java.util.List;
  9. import java.util.Map;
  10. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  11. import com.baomidou.mybatisplus.core.metadata.IPage;
  12. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  13. import com.rainbowsea.common.utils.PageUtils;
  14. import com.rainbowsea.common.utils.Query;
  15. import com.rainbowsea.rainbowsealiving.commodity.dao.SpuInfoDao;
  16. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoEntity;
  17. import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoService;
  18. import org.springframework.transaction.annotation.Transactional;
  19. import javax.annotation.Resource;
  20. @Service("spuInfoService")
  21. public class SpuInfoServiceImpl extends ServiceImpl<SpuInfoDao, SpuInfoEntity> implements SpuInfoService {
  22.     @Resource
  23.     SpuInfoDescService spuInfoDescService;
  24.     //因为有多个添加操作,使用事务控制
  25.     @Transactional
  26.     @Override
  27.     public void saveSpuInfo(SpuSaveVO spuSaveVO) {
  28. //1、保存 spu 基本信息 , 对应的表 commodity_spu_info
  29.         SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
  30.         BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);
  31.         spuInfoEntity.setCreateTime(new Date());
  32.         spuInfoEntity.setUpdateTime(new Date());
  33. //SpuInfoEntity 信息保存到 commodity_spu_info
  34.         this.saveBaseSpuInfo(spuInfoEntity);
  35. //2、保存 Spu 的描述图片路径 commodity_spu_info_desc
  36.         List<String> decript = spuSaveVO.getDecript();
  37.         SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();
  38. //获取到刚刚保存的 spu 基本信息对应的 id
  39.         spuInfoDescEntity.setSpuId(spuInfoEntity.getId());
  40. //注意:这里有可能没有图片, 可以设置一个默认图片
  41.         if(decript.size() == 0) {
  42. <el-upload
  43.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  44.       :data="dataObj"
  45.       :list-type="listType"
  46.       :file-list="fileList"
  47.       :before-upload="beforeUpload"
  48.       :on-remove="handleRemove"
  49.       :on-success="handleUploadSuccess"
  50.       :on-preview="handlePreview"
  51.       :limit="maxCount"
  52.       :on-exceed="handleExceed"
  53.       :show-file-list="showFile"
  54.     >
  55.       <i ></i>
  56.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");
  57.         }else {
  58. <el-upload
  59.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  60.       :data="dataObj"
  61.       :list-type="listType"
  62.       :file-list="fileList"
  63.       :before-upload="beforeUpload"
  64.       :on-remove="handleRemove"
  65.       :on-success="handleUploadSuccess"
  66.       :on-preview="handlePreview"
  67.       :limit="maxCount"
  68.       :on-exceed="handleExceed"
  69.       :show-file-list="showFile"
  70.     >
  71.       <i ></i>
  72.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));
  73.         }
  74. //保存到 commodity_spu_info_desc, 这个方法时我们完成
  75.         spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);
  76.     }
  77.     @Override
  78.     public PageUtils queryPage(Map<String, Object> params) {
  79.         IPage<SpuInfoEntity> page = this.page(
  80. <el-upload
  81.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  82.       :data="dataObj"
  83.       :list-type="listType"
  84.       :file-list="fileList"
  85.       :before-upload="beforeUpload"
  86.       :on-remove="handleRemove"
  87.       :on-success="handleUploadSuccess"
  88.       :on-preview="handlePreview"
  89.       :limit="maxCount"
  90.       :on-exceed="handleExceed"
  91.       :show-file-list="showFile"
  92.     >
  93.       <i ></i>
  94.     </el-upload>      new Query<SpuInfoEntity>().getPage(params),
  95. <el-upload
  96.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  97.       :data="dataObj"
  98.       :list-type="listType"
  99.       :file-list="fileList"
  100.       :before-upload="beforeUpload"
  101.       :on-remove="handleRemove"
  102.       :on-success="handleUploadSuccess"
  103.       :on-preview="handlePreview"
  104.       :limit="maxCount"
  105.       :on-exceed="handleExceed"
  106.       :show-file-list="showFile"
  107.     >
  108.       <i ></i>
  109.     </el-upload>      new QueryWrapper<SpuInfoEntity>()
  110.         );
  111.         return new PageUtils(page);
  112.     }
  113.     /**
  114.      * 保存 spu 的基本信息到 commodity_spu_info
  115.      * @param spuInfoEntity
  116.      */
  117.     @Override
  118.     public void saveBaseSpuInfo(SpuInfoEntity spuInfoEntity) {
  119.         this.baseMapper.insert(spuInfoEntity);
  120.     }
  121. //    @Override
  122. //    public void saveSpuInfo(SpuSaveVO spuSaveVO) {
  123. ////1、保存 spu 基本信息 , 对应的表 commodity_spu_info
  124. //        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
  125. //        BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);
  126. //        spuInfoEntity.setCreateTime(new Date());
  127. //        spuInfoEntity.setUpdateTime(new Date());
  128. ////2. 将 SpuInfoEntity 信息保存到 commodity_spu_info
  129. //        this.saveBaseSpuInfo(spuInfoEntity);
  130. //    }
  131. }
复制代码
完成功能说明: 提示: 这里我们先临时不选择图片, 紧张测试 保存默认图片信息
是否能记录到 commodity_spu_images 表(后面操作批量保存图片到阿里云)
保存到阿里云操作:具体代码实现:
  1. /*======================================================*/
  2. /* 1. 保存商品 spu 的介绍图片集, 就是商品最前面的按一组图片来展示图片的集合 , 点
  3. 击可以切换图片
  4. /*======================================================*/
  5. USE hspliving_commodity
  6. CREATE TABLE commodity_spu_images
  7. (
  8. id BIGINT NOT NULL AUTO_INCREMENT COMMENT 'id', spu_id BIGINT COMMENT 'spu_id',
  9. img_name VARCHAR(200) COMMENT '图片名',
  10. img_url VARCHAR(255) COMMENT '图片地址',
  11. img_sort INT COMMENT '顺序', default_img TINYINT COMMENT '是否默认图', PRIMARY KEY (id)
  12. )CHARSET=utf8mb4 COMMENT='spu 图片集';
  13. SELECT * FROM commodity_spu_images
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;
  2. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoDescEntity;
  3. import com.rainbowsea.rainbowsealiving.commodity.service.SpuImagesService;
  4. import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoDescService;
  5. import com.rainbowsea.rainbowsealiving.commodity.vo.SpuSaveVO;
  6. import org.springframework.beans.BeanUtils;
  7. import org.springframework.stereotype.Service;
  8. import java.util.Date;
  9. import java.util.List;
  10. import java.util.Map;
  11. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  12. import com.baomidou.mybatisplus.core.metadata.IPage;
  13. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  14. import com.rainbowsea.common.utils.PageUtils;
  15. import com.rainbowsea.common.utils.Query;
  16. import com.rainbowsea.rainbowsealiving.commodity.dao.SpuInfoDao;
  17. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoEntity;
  18. import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoService;
  19. import org.springframework.transaction.annotation.Transactional;
  20. import javax.annotation.Resource;
  21. @Service("spuInfoService")
  22. public class SpuInfoServiceImpl extends ServiceImpl<SpuInfoDao, SpuInfoEntity> implements SpuInfoService {
  23.     @Resource
  24.     SpuImagesService imagesService;
  25.     @Resource
  26.     SpuInfoDescService spuInfoDescService;
  27.     //因为有多个添加操作,使用事务控制
  28.     @Transactional
  29.     @Override
  30.     public void saveSpuInfo(SpuSaveVO spuSaveVO) {
  31. //1、保存 spu 基本信息 , 对应的表 commodity_spu_info
  32.         SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
  33.         BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);
  34.         spuInfoEntity.setCreateTime(new Date());
  35.         spuInfoEntity.setUpdateTime(new Date());
  36. //SpuInfoEntity 信息保存到 commodity_spu_info
  37.         this.saveBaseSpuInfo(spuInfoEntity);
  38. //2、保存 Spu 的描述图片路径 commodity_spu_info_desc
  39.         List<String> decript = spuSaveVO.getDecript();
  40.         SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();
  41. //获取到刚刚保存的 spu 基本信息对应的 id
  42.         spuInfoDescEntity.setSpuId(spuInfoEntity.getId());
  43. //注意:这里有可能没有图片, 可以设置一个默认图片
  44.         if(decript.size() == 0) {
  45. <el-upload
  46.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  47.       :data="dataObj"
  48.       :list-type="listType"
  49.       :file-list="fileList"
  50.       :before-upload="beforeUpload"
  51.       :on-remove="handleRemove"
  52.       :on-success="handleUploadSuccess"
  53.       :on-preview="handlePreview"
  54.       :limit="maxCount"
  55.       :on-exceed="handleExceed"
  56.       :show-file-list="showFile"
  57.     >
  58.       <i ></i>
  59.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");
  60.         }else {
  61. <el-upload
  62.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  63.       :data="dataObj"
  64.       :list-type="listType"
  65.       :file-list="fileList"
  66.       :before-upload="beforeUpload"
  67.       :on-remove="handleRemove"
  68.       :on-success="handleUploadSuccess"
  69.       :on-preview="handlePreview"
  70.       :limit="maxCount"
  71.       :on-exceed="handleExceed"
  72.       :show-file-list="showFile"
  73.     >
  74.       <i ></i>
  75.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));
  76.         }
  77. //保存到 commodity_spu_info_desc, 这个方法时我们完成
  78.         spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);
  79.         //3、保存 spu 的图片集 commodity_spu_images
  80.         List<String> images = spuSaveVO.getImages();
  81. //获取到刚刚保存的 spu 基本信息对应的 id
  82.         imagesService.saveImages(spuInfoEntity.getId(), images);
  83.     }
  84.     @Override
  85.     public PageUtils queryPage(Map<String, Object> params) {
  86.         IPage<SpuInfoEntity> page = this.page(
  87. <el-upload
  88.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  89.       :data="dataObj"
  90.       :list-type="listType"
  91.       :file-list="fileList"
  92.       :before-upload="beforeUpload"
  93.       :on-remove="handleRemove"
  94.       :on-success="handleUploadSuccess"
  95.       :on-preview="handlePreview"
  96.       :limit="maxCount"
  97.       :on-exceed="handleExceed"
  98.       :show-file-list="showFile"
  99.     >
  100.       <i ></i>
  101.     </el-upload>      new Query<SpuInfoEntity>().getPage(params),
  102. <el-upload
  103.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  104.       :data="dataObj"
  105.       :list-type="listType"
  106.       :file-list="fileList"
  107.       :before-upload="beforeUpload"
  108.       :on-remove="handleRemove"
  109.       :on-success="handleUploadSuccess"
  110.       :on-preview="handlePreview"
  111.       :limit="maxCount"
  112.       :on-exceed="handleExceed"
  113.       :show-file-list="showFile"
  114.     >
  115.       <i ></i>
  116.     </el-upload>      new QueryWrapper<SpuInfoEntity>()
  117.         );
  118.         return new PageUtils(page);
  119.     }
  120.     /**
  121.      * 保存 spu 的基本信息到 commodity_spu_info
  122.      * @param spuInfoEntity
  123.      */
  124.     @Override
  125.     public void saveBaseSpuInfo(SpuInfoEntity spuInfoEntity) {
  126.         this.baseMapper.insert(spuInfoEntity);
  127.     }
  128. }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service;
  2. import com.baomidou.mybatisplus.extension.service.IService;
  3. import com.rainbowsea.common.utils.PageUtils;
  4. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuImagesEntity;
  5. import java.util.List;
  6. import java.util.Map;
  7. /**
  8. * spu 图片集
  9. *
  10. * @author rainbowsea
  11. * @email rainbowsea@gmail.com
  12. * @date 2025-03-24 21:02:53
  13. */
  14. public interface SpuImagesService extends IService<SpuImagesEntity> {
  15.     PageUtils queryPage(Map<String, Object> params);
  16.     void saveImages(Long id, List<String> images);
  17. }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;
  2. import org.springframework.stereotype.Service;
  3. import java.util.List;
  4. import java.util.Map;
  5. import java.util.stream.Collectors;
  6. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  7. import com.baomidou.mybatisplus.core.metadata.IPage;
  8. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  9. import com.rainbowsea.common.utils.PageUtils;
  10. import com.rainbowsea.common.utils.Query;
  11. import com.rainbowsea.rainbowsealiving.commodity.dao.SpuImagesDao;
  12. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuImagesEntity;
  13. import com.rainbowsea.rainbowsealiving.commodity.service.SpuImagesService;
  14. import javax.annotation.Resource;
  15. @Service("spuImagesService")
  16. public class SpuImagesServiceImpl extends ServiceImpl<SpuImagesDao, SpuImagesEntity> implements SpuImagesService {
  17.     @Resource
  18.     SpuImagesService imagesService;
  19.     /**
  20.      * 保存某个 spu 的图片集,就是商品最前面的按一组图片来展示图片的集合
  21.      * @param id
  22.      * @param images
  23.      */
  24.     @Override
  25.     public void saveImages(Long id, List<String> images) {
  26.         System.out.println("saveImage...");
  27.         if(images == null || images.size() == 0){//设置默认图片集
  28. <el-upload
  29.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  30.       :data="dataObj"
  31.       :list-type="listType"
  32.       :file-list="fileList"
  33.       :before-upload="beforeUpload"
  34.       :on-remove="handleRemove"
  35.       :on-success="handleUploadSuccess"
  36.       :on-preview="handlePreview"
  37.       :limit="maxCount"
  38.       :on-exceed="handleExceed"
  39.       :show-file-list="showFile"
  40.     >
  41.       <i ></i>
  42.     </el-upload>  SpuImagesEntity spuImagesEntity = new SpuImagesEntity();
  43. <el-upload
  44.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  45.       :data="dataObj"
  46.       :list-type="listType"
  47.       :file-list="fileList"
  48.       :before-upload="beforeUpload"
  49.       :on-remove="handleRemove"
  50.       :on-success="handleUploadSuccess"
  51.       :on-preview="handlePreview"
  52.       :limit="maxCount"
  53.       :on-exceed="handleExceed"
  54.       :show-file-list="showFile"
  55.     >
  56.       <i ></i>
  57.     </el-upload>  spuImagesEntity.setSpuId(id);
  58. <el-upload
  59.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  60.       :data="dataObj"
  61.       :list-type="listType"
  62.       :file-list="fileList"
  63.       :before-upload="beforeUpload"
  64.       :on-remove="handleRemove"
  65.       :on-success="handleUploadSuccess"
  66.       :on-preview="handlePreview"
  67.       :limit="maxCount"
  68.       :on-exceed="handleExceed"
  69.       :show-file-list="showFile"
  70.     >
  71.       <i ></i>
  72.     </el-upload>  spuImagesEntity.setImgUrl("default1.jpg");
  73. <el-upload
  74.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  75.       :data="dataObj"
  76.       :list-type="listType"
  77.       :file-list="fileList"
  78.       :before-upload="beforeUpload"
  79.       :on-remove="handleRemove"
  80.       :on-success="handleUploadSuccess"
  81.       :on-preview="handlePreview"
  82.       :limit="maxCount"
  83.       :on-exceed="handleExceed"
  84.       :show-file-list="showFile"
  85.     >
  86.       <i ></i>
  87.     </el-upload>  spuImagesEntity.setDefaultImg(1);
  88. <el-upload
  89.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  90.       :data="dataObj"
  91.       :list-type="listType"
  92.       :file-list="fileList"
  93.       :before-upload="beforeUpload"
  94.       :on-remove="handleRemove"
  95.       :on-success="handleUploadSuccess"
  96.       :on-preview="handlePreview"
  97.       :limit="maxCount"
  98.       :on-exceed="handleExceed"
  99.       :show-file-list="showFile"
  100.     >
  101.       <i ></i>
  102.     </el-upload>  this.save(spuImagesEntity);
  103.         } else { //如果有,就遍历,批量添加即可
  104. <el-upload
  105.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  106.       :data="dataObj"
  107.       :list-type="listType"
  108.       :file-list="fileList"
  109.       :before-upload="beforeUpload"
  110.       :on-remove="handleRemove"
  111.       :on-success="handleUploadSuccess"
  112.       :on-preview="handlePreview"
  113.       :limit="maxCount"
  114.       :on-exceed="handleExceed"
  115.       :show-file-list="showFile"
  116.     >
  117.       <i ></i>
  118.     </el-upload>  List<SpuImagesEntity> collect = images.stream().map(img -> {
  119. <el-upload
  120.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  121.       :data="dataObj"
  122.       :list-type="listType"
  123.       :file-list="fileList"
  124.       :before-upload="beforeUpload"
  125.       :on-remove="handleRemove"
  126.       :on-success="handleUploadSuccess"
  127.       :on-preview="handlePreview"
  128.       :limit="maxCount"
  129.       :on-exceed="handleExceed"
  130.       :show-file-list="showFile"
  131.     >
  132.       <i ></i>
  133.     </el-upload>      SpuImagesEntity spuImagesEntity = new SpuImagesEntity();
  134. <el-upload
  135.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  136.       :data="dataObj"
  137.       :list-type="listType"
  138.       :file-list="fileList"
  139.       :before-upload="beforeUpload"
  140.       :on-remove="handleRemove"
  141.       :on-success="handleUploadSuccess"
  142.       :on-preview="handlePreview"
  143.       :limit="maxCount"
  144.       :on-exceed="handleExceed"
  145.       :show-file-list="showFile"
  146.     >
  147.       <i ></i>
  148.     </el-upload>      spuImagesEntity.setSpuId(id);
  149. <el-upload
  150.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  151.       :data="dataObj"
  152.       :list-type="listType"
  153.       :file-list="fileList"
  154.       :before-upload="beforeUpload"
  155.       :on-remove="handleRemove"
  156.       :on-success="handleUploadSuccess"
  157.       :on-preview="handlePreview"
  158.       :limit="maxCount"
  159.       :on-exceed="handleExceed"
  160.       :show-file-list="showFile"
  161.     >
  162.       <i ></i>
  163.     </el-upload>      spuImagesEntity.setImgUrl(img);
  164. <el-upload
  165.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  166.       :data="dataObj"
  167.       :list-type="listType"
  168.       :file-list="fileList"
  169.       :before-upload="beforeUpload"
  170.       :on-remove="handleRemove"
  171.       :on-success="handleUploadSuccess"
  172.       :on-preview="handlePreview"
  173.       :limit="maxCount"
  174.       :on-exceed="handleExceed"
  175.       :show-file-list="showFile"
  176.     >
  177.       <i ></i>
  178.     </el-upload>      return spuImagesEntity;
  179. <el-upload
  180.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  181.       :data="dataObj"
  182.       :list-type="listType"
  183.       :file-list="fileList"
  184.       :before-upload="beforeUpload"
  185.       :on-remove="handleRemove"
  186.       :on-success="handleUploadSuccess"
  187.       :on-preview="handlePreview"
  188.       :limit="maxCount"
  189.       :on-exceed="handleExceed"
  190.       :show-file-list="showFile"
  191.     >
  192.       <i ></i>
  193.     </el-upload>  }).collect(Collectors.toList());
  194. <el-upload
  195.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  196.       :data="dataObj"
  197.       :list-type="listType"
  198.       :file-list="fileList"
  199.       :before-upload="beforeUpload"
  200.       :on-remove="handleRemove"
  201.       :on-success="handleUploadSuccess"
  202.       :on-preview="handlePreview"
  203.       :limit="maxCount"
  204.       :on-exceed="handleExceed"
  205.       :show-file-list="showFile"
  206.     >
  207.       <i ></i>
  208.     </el-upload>  this.saveBatch(collect);
  209.         }
  210.     }
  211.     @Override
  212.     public PageUtils queryPage(Map<String, Object> params) {
  213.         IPage<SpuImagesEntity> page = this.page(
  214. <el-upload
  215.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  216.       :data="dataObj"
  217.       :list-type="listType"
  218.       :file-list="fileList"
  219.       :before-upload="beforeUpload"
  220.       :on-remove="handleRemove"
  221.       :on-success="handleUploadSuccess"
  222.       :on-preview="handlePreview"
  223.       :limit="maxCount"
  224.       :on-exceed="handleExceed"
  225.       :show-file-list="showFile"
  226.     >
  227.       <i ></i>
  228.     </el-upload>      new Query<SpuImagesEntity>().getPage(params),
  229. <el-upload
  230.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  231.       :data="dataObj"
  232.       :list-type="listType"
  233.       :file-list="fileList"
  234.       :before-upload="beforeUpload"
  235.       :on-remove="handleRemove"
  236.       :on-success="handleUploadSuccess"
  237.       :on-preview="handlePreview"
  238.       :limit="maxCount"
  239.       :on-exceed="handleExceed"
  240.       :show-file-list="showFile"
  241.     >
  242.       <i ></i>
  243.     </el-upload>      new QueryWrapper<SpuImagesEntity>()
  244.         );
  245.         return new PageUtils(page);
  246.     }
  247. }
复制代码
保存 spu 的基本属性/规格参数

创建保存 spu 的基本属性/规格参数的表
  1. /*====================================================*/
  2. /* 1. 保存商品 spu 基本属性值, 有多个
  3. /*====================================================*/
  4. USE hspliving_commodity
  5. CREATE TABLE commodity_product_attr_value
  6. (
  7. id BIGINT NOT NULL AUTO_INCREMENT COMMENT 'id',
  8. spu_id BIGINT COMMENT '商品 id',
  9. attr_id BIGINT COMMENT '属性 id',
  10. attr_name VARCHAR(200) COMMENT '属性名',
  11. attr_value VARCHAR(200) COMMENT '属性值',
  12. attr_sort INT COMMENT '顺序',
  13. quick_show TINYINT COMMENT '快速展示【是否展示在介绍上;0-否 1-是】',
  14. PRIMARY KEY (id)
  15. )CHARSET=utf8mb4 COMMENT='spu 基本属性值';
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service;
  2. import com.baomidou.mybatisplus.extension.service.IService;
  3. import com.rainbowsea.common.utils.PageUtils;
  4. import com.rainbowsea.rainbowsealiving.commodity.entity.ProductAttrValueEntity;
  5. import java.util.List;
  6. import java.util.Map;
  7. /**
  8. * spu 基本属性值
  9. *
  10. * @author rainbowsea
  11. * @email rainbowsea@gmail.com
  12. * @date 2025-03-24 21:40:59
  13. */
  14. public interface ProductAttrValueService extends IService<ProductAttrValueEntity> {
  15.     PageUtils queryPage(Map<String, Object> params);
  16.     void saveProductAttr(List<ProductAttrValueEntity> collect);
  17. }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.entity;
  2. import com.baomidou.mybatisplus.annotation.TableId;
  3. import com.baomidou.mybatisplus.annotation.TableName;
  4. import java.io.Serializable;
  5. import java.util.Date;
  6. import lombok.Data;
  7. /**
  8. * spu 基本属性值
  9. *
  10. * @author rainbowsea
  11. * @email rainbowsea@gmail.com
  12. * @date 2025-03-24 21:40:59
  13. */
  14. @Data
  15. @TableName("commodity_product_attr_value")
  16. public class ProductAttrValueEntity implements Serializable {
  17.         private static final long serialVersionUID = 1L;
  18.         /**
  19.          * id
  20.          */
  21.         @TableId
  22.         private Long id;
  23.         /**
  24.          * 商品 id
  25.          */
  26.         private Long spuId;
  27.         /**
  28.          * 属性 id
  29.          */
  30.         private Long attrId;
  31.         /**
  32.          * 属性名
  33.          */
  34.         private String attrName;
  35.         /**
  36.          * 属性值
  37.          */
  38.         private String attrValue;
  39.         /**
  40.          * 顺序
  41.          */
  42.         private Integer attrSort;
  43.         /**
  44.          * 快速展示【是否展示在介绍上;0-否 1-是】
  45.          */
  46.         private Integer quickShow;
  47. }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;
  2. import org.springframework.stereotype.Service;
  3. import java.util.List;
  4. import java.util.Map;
  5. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  6. import com.baomidou.mybatisplus.core.metadata.IPage;
  7. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  8. import com.rainbowsea.common.utils.PageUtils;
  9. import com.rainbowsea.common.utils.Query;
  10. import com.rainbowsea.rainbowsealiving.commodity.dao.ProductAttrValueDao;
  11. import com.rainbowsea.rainbowsealiving.commodity.entity.ProductAttrValueEntity;
  12. import com.rainbowsea.rainbowsealiving.commodity.service.ProductAttrValueService;
  13. @Service("productAttrValueService")
  14. public class ProductAttrValueServiceImpl extends ServiceImpl<ProductAttrValueDao, ProductAttrValueEntity> implements ProductAttrValueService {
  15.     @Override
  16.     public void saveProductAttr(List<ProductAttrValueEntity> collect) {
  17.         this.saveBatch(collect);
  18.     }
  19.     @Override
  20.     public PageUtils queryPage(Map<String, Object> params) {
  21.         IPage<ProductAttrValueEntity> page = this.page(
  22. <el-upload
  23.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  24.       :data="dataObj"
  25.       :list-type="listType"
  26.       :file-list="fileList"
  27.       :before-upload="beforeUpload"
  28.       :on-remove="handleRemove"
  29.       :on-success="handleUploadSuccess"
  30.       :on-preview="handlePreview"
  31.       :limit="maxCount"
  32.       :on-exceed="handleExceed"
  33.       :show-file-list="showFile"
  34.     >
  35.       <i ></i>
  36.     </el-upload>      new Query<ProductAttrValueEntity>().getPage(params),
  37. <el-upload
  38.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  39.       :data="dataObj"
  40.       :list-type="listType"
  41.       :file-list="fileList"
  42.       :before-upload="beforeUpload"
  43.       :on-remove="handleRemove"
  44.       :on-success="handleUploadSuccess"
  45.       :on-preview="handlePreview"
  46.       :limit="maxCount"
  47.       :on-exceed="handleExceed"
  48.       :show-file-list="showFile"
  49.     >
  50.       <i ></i>
  51.     </el-upload>      new QueryWrapper<ProductAttrValueEntity>()
  52.         );
  53.         return new PageUtils(page);
  54.     }
  55. }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;
  2. import com.rainbowsea.rainbowsealiving.commodity.entity.AttrEntity;
  3. import com.rainbowsea.rainbowsealiving.commodity.entity.ProductAttrValueEntity;
  4. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoDescEntity;
  5. import com.rainbowsea.rainbowsealiving.commodity.service.AttrService;
  6. import com.rainbowsea.rainbowsealiving.commodity.service.ProductAttrValueService;
  7. import com.rainbowsea.rainbowsealiving.commodity.service.SpuImagesService;
  8. import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoDescService;
  9. import com.rainbowsea.rainbowsealiving.commodity.vo.BaseAttrs;
  10. import com.rainbowsea.rainbowsealiving.commodity.vo.SpuSaveVO;
  11. import org.springframework.beans.BeanUtils;
  12. import org.springframework.stereotype.Service;
  13. import java.util.Date;
  14. import java.util.List;
  15. import java.util.Map;
  16. import java.util.stream.Collectors;
  17. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  18. import com.baomidou.mybatisplus.core.metadata.IPage;
  19. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  20. import com.rainbowsea.common.utils.PageUtils;
  21. import com.rainbowsea.common.utils.Query;
  22. import com.rainbowsea.rainbowsealiving.commodity.dao.SpuInfoDao;
  23. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoEntity;
  24. import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoService;
  25. import org.springframework.transaction.annotation.Transactional;
  26. import javax.annotation.Resource;
  27. @Service("spuInfoService")
  28. public class SpuInfoServiceImpl extends ServiceImpl<SpuInfoDao, SpuInfoEntity> implements SpuInfoService {
  29.     @Resource
  30.     AttrService attrService;
  31.     @Resource
  32.     ProductAttrValueService productAttrValueService;
  33.     @Transactional
  34.     @Override
  35.     public void saveSpuInfo(SpuSaveVO spuSaveVO) {
  36.         //1、保存 spu 基本信息 , 对应的表 commodity_spu_info
  37.         SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
  38.         BeanUtils.copyProperties(spuSaveVO, spuInfoEntity);
  39.         spuInfoEntity.setCreateTime(new Date());
  40.         spuInfoEntity.setUpdateTime(new Date());
  41. //SpuInfoEntity 信息保存到 commodity_spu_info
  42.         this.saveBaseSpuInfo(spuInfoEntity);
  43. //2、保存 Spu 的描述图片路径 commodity_spu_info_desc
  44.         List<String> decript = spuSaveVO.getDecript();
  45.         SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();
  46. //获取到刚刚保存的 spu 基本信息对应的 id
  47.         spuInfoDescEntity.setSpuId(spuInfoEntity.getId());
  48. //注意:这里有可能没有图片, 可以设置一个默认图片
  49.         if (decript.size() == 0) {
  50. <el-upload
  51.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  52.       :data="dataObj"
  53.       :list-type="listType"
  54.       :file-list="fileList"
  55.       :before-upload="beforeUpload"
  56.       :on-remove="handleRemove"
  57.       :on-success="handleUploadSuccess"
  58.       :on-preview="handlePreview"
  59.       :limit="maxCount"
  60.       :on-exceed="handleExceed"
  61.       :show-file-list="showFile"
  62.     >
  63.       <i ></i>
  64.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");
  65.         } else {
  66. <el-upload
  67.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  68.       :data="dataObj"
  69.       :list-type="listType"
  70.       :file-list="fileList"
  71.       :before-upload="beforeUpload"
  72.       :on-remove="handleRemove"
  73.       :on-success="handleUploadSuccess"
  74.       :on-preview="handlePreview"
  75.       :limit="maxCount"
  76.       :on-exceed="handleExceed"
  77.       :show-file-list="showFile"
  78.     >
  79.       <i ></i>
  80.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));
  81.         }
  82. //保存到 commodity_spu_info_desc, 这个方法时我们完成
  83.         spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);
  84.         //3、保存 spu 的图片集 commodity_spu_images
  85.         List<String> images = spuSaveVO.getImages();
  86. //获取到刚刚保存的 spu 基本信息对应的 id
  87.         imagesService.saveImages(spuInfoEntity.getId(), images);
  88. //4、保存 spu 的基本属性(一个 spu 可以有多个基本属性/规格参数):
  89. // commodity_product_attr_value
  90.         List<BaseAttrs> baseAttrs = spuSaveVO.getBaseAttrs();
  91.         List<ProductAttrValueEntity> collect = baseAttrs.stream().map(attr -> {
  92. <el-upload
  93.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  94.       :data="dataObj"
  95.       :list-type="listType"
  96.       :file-list="fileList"
  97.       :before-upload="beforeUpload"
  98.       :on-remove="handleRemove"
  99.       :on-success="handleUploadSuccess"
  100.       :on-preview="handlePreview"
  101.       :limit="maxCount"
  102.       :on-exceed="handleExceed"
  103.       :show-file-list="showFile"
  104.     >
  105.       <i ></i>
  106.     </el-upload>  ProductAttrValueEntity valueEntity = new ProductAttrValueEntity();
  107. <el-upload
  108.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  109.       :data="dataObj"
  110.       :list-type="listType"
  111.       :file-list="fileList"
  112.       :before-upload="beforeUpload"
  113.       :on-remove="handleRemove"
  114.       :on-success="handleUploadSuccess"
  115.       :on-preview="handlePreview"
  116.       :limit="maxCount"
  117.       :on-exceed="handleExceed"
  118.       :show-file-list="showFile"
  119.     >
  120.       <i ></i>
  121.     </el-upload>  valueEntity.setAttrId(attr.getAttrId());
  122. <el-upload
  123.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  124.       :data="dataObj"
  125.       :list-type="listType"
  126.       :file-list="fileList"
  127.       :before-upload="beforeUpload"
  128.       :on-remove="handleRemove"
  129.       :on-success="handleUploadSuccess"
  130.       :on-preview="handlePreview"
  131.       :limit="maxCount"
  132.       :on-exceed="handleExceed"
  133.       :show-file-list="showFile"
  134.     >
  135.       <i ></i>
  136.     </el-upload>  AttrEntity id = attrService.getById(attr.getAttrId());
  137. <el-upload
  138.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  139.       :data="dataObj"
  140.       :list-type="listType"
  141.       :file-list="fileList"
  142.       :before-upload="beforeUpload"
  143.       :on-remove="handleRemove"
  144.       :on-success="handleUploadSuccess"
  145.       :on-preview="handlePreview"
  146.       :limit="maxCount"
  147.       :on-exceed="handleExceed"
  148.       :show-file-list="showFile"
  149.     >
  150.       <i ></i>
  151.     </el-upload>  valueEntity.setAttrName(id.getAttrName());
  152. <el-upload
  153.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  154.       :data="dataObj"
  155.       :list-type="listType"
  156.       :file-list="fileList"
  157.       :before-upload="beforeUpload"
  158.       :on-remove="handleRemove"
  159.       :on-success="handleUploadSuccess"
  160.       :on-preview="handlePreview"
  161.       :limit="maxCount"
  162.       :on-exceed="handleExceed"
  163.       :show-file-list="showFile"
  164.     >
  165.       <i ></i>
  166.     </el-upload>  valueEntity.setAttrValue(attr.getAttrValues());
  167. <el-upload
  168.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  169.       :data="dataObj"
  170.       :list-type="listType"
  171.       :file-list="fileList"
  172.       :before-upload="beforeUpload"
  173.       :on-remove="handleRemove"
  174.       :on-success="handleUploadSuccess"
  175.       :on-preview="handlePreview"
  176.       :limit="maxCount"
  177.       :on-exceed="handleExceed"
  178.       :show-file-list="showFile"
  179.     >
  180.       <i ></i>
  181.     </el-upload>  valueEntity.setQuickShow(attr.getShowDesc());
  182. <el-upload
  183.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  184.       :data="dataObj"
  185.       :list-type="listType"
  186.       :file-list="fileList"
  187.       :before-upload="beforeUpload"
  188.       :on-remove="handleRemove"
  189.       :on-success="handleUploadSuccess"
  190.       :on-preview="handlePreview"
  191.       :limit="maxCount"
  192.       :on-exceed="handleExceed"
  193.       :show-file-list="showFile"
  194.     >
  195.       <i ></i>
  196.     </el-upload>  valueEntity.setSpuId(spuInfoEntity.getId());
  197. <el-upload
  198.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  199.       :data="dataObj"
  200.       :list-type="listType"
  201.       :file-list="fileList"
  202.       :before-upload="beforeUpload"
  203.       :on-remove="handleRemove"
  204.       :on-success="handleUploadSuccess"
  205.       :on-preview="handlePreview"
  206.       :limit="maxCount"
  207.       :on-exceed="handleExceed"
  208.       :show-file-list="showFile"
  209.     >
  210.       <i ></i>
  211.     </el-upload>  return valueEntity;
  212.         }).collect(Collectors.toList());
  213.         productAttrValueService.saveProductAttr(collect);
  214.     }
  215.     @Resource
  216.     SpuImagesService imagesService;
  217.     @Resource
  218.     SpuInfoDescService spuInfoDescService;
  219.     //因为有多个添加操作,使用事务控制
  220. //    @Transactional
  221. //    @Override
  222. //    public void saveSpuInfo(SpuSaveVO spuSaveVO) {
  223. ////1、保存 spu 基本信息 , 对应的表 commodity_spu_info
  224. //        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
  225. //        BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);
  226. //        spuInfoEntity.setCreateTime(new Date());
  227. //        spuInfoEntity.setUpdateTime(new Date());
  228. ////SpuInfoEntity 信息保存到 commodity_spu_info
  229. //        this.saveBaseSpuInfo(spuInfoEntity);
  230. ////2、保存 Spu 的描述图片路径 commodity_spu_info_desc
  231. //        List<String> decript = spuSaveVO.getDecript();
  232. //        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();
  233. ////获取到刚刚保存的 spu 基本信息对应的 id
  234. //        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());
  235. ////注意:这里有可能没有图片, 可以设置一个默认图片
  236. //        if(decript.size() == 0) {
  237. //<el-upload
  238.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  239.       :data="dataObj"
  240.       :list-type="listType"
  241.       :file-list="fileList"
  242.       :before-upload="beforeUpload"
  243.       :on-remove="handleRemove"
  244.       :on-success="handleUploadSuccess"
  245.       :on-preview="handlePreview"
  246.       :limit="maxCount"
  247.       :on-exceed="handleExceed"
  248.       :show-file-list="showFile"
  249.     >
  250.       <i ></i>
  251.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");
  252. //        }else {
  253. //<el-upload
  254.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  255.       :data="dataObj"
  256.       :list-type="listType"
  257.       :file-list="fileList"
  258.       :before-upload="beforeUpload"
  259.       :on-remove="handleRemove"
  260.       :on-success="handleUploadSuccess"
  261.       :on-preview="handlePreview"
  262.       :limit="maxCount"
  263.       :on-exceed="handleExceed"
  264.       :show-file-list="showFile"
  265.     >
  266.       <i ></i>
  267.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));
  268. //        }
  269. ////保存到 commodity_spu_info_desc, 这个方法时我们完成
  270. //        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);
  271. //
  272. //        //3、保存 spu 的图片集 commodity_spu_images
  273. //        List<String> images = spuSaveVO.getImages();
  274. ////获取到刚刚保存的 spu 基本信息对应的 id
  275. //        imagesService.saveImages(spuInfoEntity.getId(), images);
  276. //    }
  277.     @Override
  278.     public PageUtils queryPage(Map<String, Object> params) {
  279.         IPage<SpuInfoEntity> page = this.page(
  280. <el-upload
  281.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  282.       :data="dataObj"
  283.       :list-type="listType"
  284.       :file-list="fileList"
  285.       :before-upload="beforeUpload"
  286.       :on-remove="handleRemove"
  287.       :on-success="handleUploadSuccess"
  288.       :on-preview="handlePreview"
  289.       :limit="maxCount"
  290.       :on-exceed="handleExceed"
  291.       :show-file-list="showFile"
  292.     >
  293.       <i ></i>
  294.     </el-upload>      new Query<SpuInfoEntity>().getPage(params),
  295. <el-upload
  296.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  297.       :data="dataObj"
  298.       :list-type="listType"
  299.       :file-list="fileList"
  300.       :before-upload="beforeUpload"
  301.       :on-remove="handleRemove"
  302.       :on-success="handleUploadSuccess"
  303.       :on-preview="handlePreview"
  304.       :limit="maxCount"
  305.       :on-exceed="handleExceed"
  306.       :show-file-list="showFile"
  307.     >
  308.       <i ></i>
  309.     </el-upload>      new QueryWrapper<SpuInfoEntity>()
  310.         );
  311.         return new PageUtils(page);
  312.     }
  313.     /**
  314.      * 保存 spu 的基本信息到 commodity_spu_info
  315.      * @param spuInfoEntity
  316.      */
  317.     @Override
  318.     public void saveBaseSpuInfo(SpuInfoEntity spuInfoEntity) {
  319.         this.baseMapper.insert(spuInfoEntity);
  320.     }
  321. //    @Override
  322. //    public void saveSpuInfo(SpuSaveVO spuSaveVO) {
  323. ////1、保存 spu 基本信息 , 对应的表 commodity_spu_info
  324. //        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
  325. //        BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);
  326. //        spuInfoEntity.setCreateTime(new Date());
  327. //        spuInfoEntity.setUpdateTime(new Date());
  328. ////2. 将 SpuInfoEntity 信息保存到 commodity_spu_info
  329. //        this.saveBaseSpuInfo(spuInfoEntity);
  330. //    }
  331. }
复制代码
保存 SKU 的基本信息

完成保存商品信息功能-有难度-比较综合-涉及解决方案
解决方案分析:

  • 因为在保存商品信息时,涉及到的信息很多。
  • 可以通过拆解,创建多个 VO 层的 JavaBean,将商品信息保存到对应的各个表中。
  • 梳理下(紧张!开发中,前端和后端是配合的,有时我们后端职员必要根据前端的业务需求来设计程序)
整理上面的图:
分析前端发送的 JSON(很复杂)—> 创建 VO 对象/类(多个,可能还有组合/包罗关系)——> 创建对应的数据表,保存数据(入库)。

  • 可以理解成是一种通用的设计和解决方案。
  • 这个功能的业务相对比较繁琐,这个必要耐心。
先分析要提交的 json 数据
创建数据表-根据自己的业务设计[考虑前端的要求]
  1. USE hspliving_commodity
  2. CREATE TABLE commodity_sku_info
  3. (
  4. sku_id BIGINT NOT NULL AUTO_INCREMENT COMMENT 'skuId',
  5. spu_id BIGINT COMMENT 'spuId',
  6. sku_name VARCHAR(255) COMMENT 'sku 名称',
  7. sku_desc VARCHAR(2000) COMMENT 'sku 介绍描述',
  8. catalog_id BIGINT COMMENT '所属分类 id',
  9. brand_id BIGINT COMMENT '品牌 id',
  10. sku_default_img VARCHAR(255) COMMENT '默认图片',
  11. sku_title VARCHAR(255) COMMENT '标题',
  12. sku_subtitle VARCHAR(2000) COMMENT '副标题',
  13. price DECIMAL(18,4) COMMENT '价格',
  14. sale_count BIGINT COMMENT '销量', PRIMARY KEY (sku_id)
  15. )CHARSET=utf8mb4 COMMENT='sku 信息';
  16. SELECT * FROM commodity_sku_info
复制代码
仍 然 使 用 renren-generator 逆 向 工 程 生 成 对 应 的 代 码 (CRUD) , 并 拷 贝 到
hspliving-commodity, 这个我们已经做过好频频了,请自己完成

  1. package com.rainbowsea.rainbowsealiving.commodity.service;
  2. import com.baomidou.mybatisplus.extension.service.IService;
  3. import com.rainbowsea.common.utils.PageUtils;
  4. import com.rainbowsea.rainbowsealiving.commodity.entity.SkuInfoEntity;
  5. import java.util.Map;
  6. /**
  7. * sku 信息
  8. *
  9. * @author rainbowsea
  10. * @email rainbowsea@gmail.com
  11. * @date 2025-03-24 22:01:45
  12. */
  13. public interface SkuInfoService extends IService<SkuInfoEntity> {
  14.     PageUtils queryPage(Map<String, Object> params);
  15.     void saveSkuInfo(SkuInfoEntity skuInfoEntity);
  16. }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;
  2. import org.springframework.stereotype.Service;
  3. import java.util.Map;
  4. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5. import com.baomidou.mybatisplus.core.metadata.IPage;
  6. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  7. import com.rainbowsea.common.utils.PageUtils;
  8. import com.rainbowsea.common.utils.Query;
  9. import com.rainbowsea.rainbowsealiving.commodity.dao.SkuInfoDao;
  10. import com.rainbowsea.rainbowsealiving.commodity.entity.SkuInfoEntity;
  11. import com.rainbowsea.rainbowsealiving.commodity.service.SkuInfoService;
  12. @Service("skuInfoService")
  13. public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoDao, SkuInfoEntity> implements SkuInfoService {
  14.     @Override
  15.     public void saveSkuInfo(SkuInfoEntity skuInfoEntity) {
  16.         this.baseMapper.insert(skuInfoEntity);
  17.     }
  18.     @Override
  19.     public PageUtils queryPage(Map<String, Object> params) {
  20.         IPage<SkuInfoEntity> page = this.page(
  21. <el-upload
  22.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  23.       :data="dataObj"
  24.       :list-type="listType"
  25.       :file-list="fileList"
  26.       :before-upload="beforeUpload"
  27.       :on-remove="handleRemove"
  28.       :on-success="handleUploadSuccess"
  29.       :on-preview="handlePreview"
  30.       :limit="maxCount"
  31.       :on-exceed="handleExceed"
  32.       :show-file-list="showFile"
  33.     >
  34.       <i ></i>
  35.     </el-upload>      new Query<SkuInfoEntity>().getPage(params),
  36. <el-upload
  37.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  38.       :data="dataObj"
  39.       :list-type="listType"
  40.       :file-list="fileList"
  41.       :before-upload="beforeUpload"
  42.       :on-remove="handleRemove"
  43.       :on-success="handleUploadSuccess"
  44.       :on-preview="handlePreview"
  45.       :limit="maxCount"
  46.       :on-exceed="handleExceed"
  47.       :show-file-list="showFile"
  48.     >
  49.       <i ></i>
  50.     </el-upload>      new QueryWrapper<SkuInfoEntity>()
  51.         );
  52.         return new PageUtils(page);
  53.     }
  54. }
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;
  2. import com.rainbowsea.rainbowsealiving.commodity.entity.AttrEntity;
  3. import com.rainbowsea.rainbowsealiving.commodity.entity.ProductAttrValueEntity;
  4. import com.rainbowsea.rainbowsealiving.commodity.entity.SkuInfoEntity;
  5. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoDescEntity;
  6. import com.rainbowsea.rainbowsealiving.commodity.service.AttrService;
  7. import com.rainbowsea.rainbowsealiving.commodity.service.ProductAttrValueService;
  8. import com.rainbowsea.rainbowsealiving.commodity.service.SkuInfoService;
  9. import com.rainbowsea.rainbowsealiving.commodity.service.SpuImagesService;
  10. import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoDescService;
  11. import com.rainbowsea.rainbowsealiving.commodity.vo.BaseAttrs;
  12. import com.rainbowsea.rainbowsealiving.commodity.vo.Images;
  13. import com.rainbowsea.rainbowsealiving.commodity.vo.Skus;
  14. import com.rainbowsea.rainbowsealiving.commodity.vo.SpuSaveVO;
  15. import org.springframework.beans.BeanUtils;
  16. import org.springframework.stereotype.Service;
  17. import java.util.Date;
  18. import java.util.List;
  19. import java.util.Map;
  20. import java.util.stream.Collectors;
  21. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  22. import com.baomidou.mybatisplus.core.metadata.IPage;
  23. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  24. import com.rainbowsea.common.utils.PageUtils;
  25. import com.rainbowsea.common.utils.Query;
  26. import com.rainbowsea.rainbowsealiving.commodity.dao.SpuInfoDao;
  27. import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoEntity;
  28. import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoService;
  29. import org.springframework.transaction.annotation.Transactional;
  30. import javax.annotation.Resource;
  31. @Service("spuInfoService")
  32. public class SpuInfoServiceImpl extends ServiceImpl<SpuInfoDao, SpuInfoEntity> implements SpuInfoService {
  33.     @Resource
  34.     AttrService attrService;
  35.     @Resource
  36.     ProductAttrValueService productAttrValueService;
  37.     @Resource
  38.     SkuInfoService skuInfoService;
  39.     @Transactional
  40.     @Override
  41.     public void saveSpuInfo(SpuSaveVO spuSaveVO) {
  42.         //1、保存 spu 基本信息 , 对应的表 commodity_spu_info
  43.         SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
  44.         BeanUtils.copyProperties(spuSaveVO, spuInfoEntity);
  45.         spuInfoEntity.setCreateTime(new Date());
  46.         spuInfoEntity.setUpdateTime(new Date());
  47. //SpuInfoEntity 信息保存到 commodity_spu_info
  48.         this.saveBaseSpuInfo(spuInfoEntity);
  49. //2、保存 Spu 的描述图片路径 commodity_spu_info_desc
  50.         List<String> decript = spuSaveVO.getDecript();
  51.         SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();
  52. //获取到刚刚保存的 spu 基本信息对应的 id
  53.         spuInfoDescEntity.setSpuId(spuInfoEntity.getId());
  54. //注意:这里有可能没有图片, 可以设置一个默认图片
  55.         if (decript.size() == 0) {
  56. <el-upload
  57.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  58.       :data="dataObj"
  59.       :list-type="listType"
  60.       :file-list="fileList"
  61.       :before-upload="beforeUpload"
  62.       :on-remove="handleRemove"
  63.       :on-success="handleUploadSuccess"
  64.       :on-preview="handlePreview"
  65.       :limit="maxCount"
  66.       :on-exceed="handleExceed"
  67.       :show-file-list="showFile"
  68.     >
  69.       <i ></i>
  70.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");
  71.         } else {
  72. <el-upload
  73.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  74.       :data="dataObj"
  75.       :list-type="listType"
  76.       :file-list="fileList"
  77.       :before-upload="beforeUpload"
  78.       :on-remove="handleRemove"
  79.       :on-success="handleUploadSuccess"
  80.       :on-preview="handlePreview"
  81.       :limit="maxCount"
  82.       :on-exceed="handleExceed"
  83.       :show-file-list="showFile"
  84.     >
  85.       <i ></i>
  86.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));
  87.         }
  88. //保存到 commodity_spu_info_desc, 这个方法时我们完成
  89.         spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);
  90.         //3、保存 spu 的图片集 commodity_spu_images
  91.         List<String> images = spuSaveVO.getImages();
  92. //获取到刚刚保存的 spu 基本信息对应的 id
  93.         imagesService.saveImages(spuInfoEntity.getId(), images);
  94. //4、保存 spu 的基本属性(一个 spu 可以有多个基本属性/规格参数):
  95. // commodity_product_attr_value
  96.         List<BaseAttrs> baseAttrs = spuSaveVO.getBaseAttrs();
  97.         List<ProductAttrValueEntity> collect = baseAttrs.stream().map(attr -> {
  98. <el-upload
  99.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  100.       :data="dataObj"
  101.       :list-type="listType"
  102.       :file-list="fileList"
  103.       :before-upload="beforeUpload"
  104.       :on-remove="handleRemove"
  105.       :on-success="handleUploadSuccess"
  106.       :on-preview="handlePreview"
  107.       :limit="maxCount"
  108.       :on-exceed="handleExceed"
  109.       :show-file-list="showFile"
  110.     >
  111.       <i ></i>
  112.     </el-upload>  ProductAttrValueEntity valueEntity = new ProductAttrValueEntity();
  113. <el-upload
  114.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  115.       :data="dataObj"
  116.       :list-type="listType"
  117.       :file-list="fileList"
  118.       :before-upload="beforeUpload"
  119.       :on-remove="handleRemove"
  120.       :on-success="handleUploadSuccess"
  121.       :on-preview="handlePreview"
  122.       :limit="maxCount"
  123.       :on-exceed="handleExceed"
  124.       :show-file-list="showFile"
  125.     >
  126.       <i ></i>
  127.     </el-upload>  valueEntity.setAttrId(attr.getAttrId());
  128. <el-upload
  129.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  130.       :data="dataObj"
  131.       :list-type="listType"
  132.       :file-list="fileList"
  133.       :before-upload="beforeUpload"
  134.       :on-remove="handleRemove"
  135.       :on-success="handleUploadSuccess"
  136.       :on-preview="handlePreview"
  137.       :limit="maxCount"
  138.       :on-exceed="handleExceed"
  139.       :show-file-list="showFile"
  140.     >
  141.       <i ></i>
  142.     </el-upload>  AttrEntity id = attrService.getById(attr.getAttrId());
  143. <el-upload
  144.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  145.       :data="dataObj"
  146.       :list-type="listType"
  147.       :file-list="fileList"
  148.       :before-upload="beforeUpload"
  149.       :on-remove="handleRemove"
  150.       :on-success="handleUploadSuccess"
  151.       :on-preview="handlePreview"
  152.       :limit="maxCount"
  153.       :on-exceed="handleExceed"
  154.       :show-file-list="showFile"
  155.     >
  156.       <i ></i>
  157.     </el-upload>  valueEntity.setAttrName(id.getAttrName());
  158. <el-upload
  159.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  160.       :data="dataObj"
  161.       :list-type="listType"
  162.       :file-list="fileList"
  163.       :before-upload="beforeUpload"
  164.       :on-remove="handleRemove"
  165.       :on-success="handleUploadSuccess"
  166.       :on-preview="handlePreview"
  167.       :limit="maxCount"
  168.       :on-exceed="handleExceed"
  169.       :show-file-list="showFile"
  170.     >
  171.       <i ></i>
  172.     </el-upload>  valueEntity.setAttrValue(attr.getAttrValues());
  173. <el-upload
  174.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  175.       :data="dataObj"
  176.       :list-type="listType"
  177.       :file-list="fileList"
  178.       :before-upload="beforeUpload"
  179.       :on-remove="handleRemove"
  180.       :on-success="handleUploadSuccess"
  181.       :on-preview="handlePreview"
  182.       :limit="maxCount"
  183.       :on-exceed="handleExceed"
  184.       :show-file-list="showFile"
  185.     >
  186.       <i ></i>
  187.     </el-upload>  valueEntity.setQuickShow(attr.getShowDesc());
  188. <el-upload
  189.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  190.       :data="dataObj"
  191.       :list-type="listType"
  192.       :file-list="fileList"
  193.       :before-upload="beforeUpload"
  194.       :on-remove="handleRemove"
  195.       :on-success="handleUploadSuccess"
  196.       :on-preview="handlePreview"
  197.       :limit="maxCount"
  198.       :on-exceed="handleExceed"
  199.       :show-file-list="showFile"
  200.     >
  201.       <i ></i>
  202.     </el-upload>  valueEntity.setSpuId(spuInfoEntity.getId());
  203. <el-upload
  204.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  205.       :data="dataObj"
  206.       :list-type="listType"
  207.       :file-list="fileList"
  208.       :before-upload="beforeUpload"
  209.       :on-remove="handleRemove"
  210.       :on-success="handleUploadSuccess"
  211.       :on-preview="handlePreview"
  212.       :limit="maxCount"
  213.       :on-exceed="handleExceed"
  214.       :show-file-list="showFile"
  215.     >
  216.       <i ></i>
  217.     </el-upload>  return valueEntity;
  218.         }).collect(Collectors.toList());
  219.         productAttrValueService.saveProductAttr(collect);
  220.         //5、保存当前 spu 对应的所有 sku 信息;一个 spu 可以 对应多个 sku,
  221. // 组成一个可以销售的商品信息
  222. //注意 Images 类在 vo 包下, 确保有@Data 修饰
  223.         List<Skus> skus = spuSaveVO.getSkus();
  224.         if(skus!=null && skus.size()>0){
  225. <el-upload
  226.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  227.       :data="dataObj"
  228.       :list-type="listType"
  229.       :file-list="fileList"
  230.       :before-upload="beforeUpload"
  231.       :on-remove="handleRemove"
  232.       :on-success="handleUploadSuccess"
  233.       :on-preview="handlePreview"
  234.       :limit="maxCount"
  235.       :on-exceed="handleExceed"
  236.       :show-file-list="showFile"
  237.     >
  238.       <i ></i>
  239.     </el-upload>  skus.forEach(item->{
  240. <el-upload
  241.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  242.       :data="dataObj"
  243.       :list-type="listType"
  244.       :file-list="fileList"
  245.       :before-upload="beforeUpload"
  246.       :on-remove="handleRemove"
  247.       :on-success="handleUploadSuccess"
  248.       :on-preview="handlePreview"
  249.       :limit="maxCount"
  250.       :on-exceed="handleExceed"
  251.       :show-file-list="showFile"
  252.     >
  253.       <i ></i>
  254.     </el-upload>      String defaultImg = "default.jpg";
  255. //json 会提交很多图片,如果是当前这个 sku 的默认图片就先保存下 url
  256. <el-upload
  257.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  258.       :data="dataObj"
  259.       :list-type="listType"
  260.       :file-list="fileList"
  261.       :before-upload="beforeUpload"
  262.       :on-remove="handleRemove"
  263.       :on-success="handleUploadSuccess"
  264.       :on-preview="handlePreview"
  265.       :limit="maxCount"
  266.       :on-exceed="handleExceed"
  267.       :show-file-list="showFile"
  268.     >
  269.       <i ></i>
  270.     </el-upload>      for (Images image : item.getImages()) {
  271. <el-upload
  272.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  273.       :data="dataObj"
  274.       :list-type="listType"
  275.       :file-list="fileList"
  276.       :before-upload="beforeUpload"
  277.       :on-remove="handleRemove"
  278.       :on-success="handleUploadSuccess"
  279.       :on-preview="handlePreview"
  280.       :limit="maxCount"
  281.       :on-exceed="handleExceed"
  282.       :show-file-list="showFile"
  283.     >
  284.       <i ></i>
  285.     </el-upload><el-upload
  286.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  287.       :data="dataObj"
  288.       :list-type="listType"
  289.       :file-list="fileList"
  290.       :before-upload="beforeUpload"
  291.       :on-remove="handleRemove"
  292.       :on-success="handleUploadSuccess"
  293.       :on-preview="handlePreview"
  294.       :limit="maxCount"
  295.       :on-exceed="handleExceed"
  296.       :show-file-list="showFile"
  297.     >
  298.       <i ></i>
  299.     </el-upload>if(image.getDefaultImg() == 1){
  300. <el-upload
  301.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  302.       :data="dataObj"
  303.       :list-type="listType"
  304.       :file-list="fileList"
  305.       :before-upload="beforeUpload"
  306.       :on-remove="handleRemove"
  307.       :on-success="handleUploadSuccess"
  308.       :on-preview="handlePreview"
  309.       :limit="maxCount"
  310.       :on-exceed="handleExceed"
  311.       :show-file-list="showFile"
  312.     >
  313.       <i ></i>
  314.     </el-upload><el-upload
  315.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  316.       :data="dataObj"
  317.       :list-type="listType"
  318.       :file-list="fileList"
  319.       :before-upload="beforeUpload"
  320.       :on-remove="handleRemove"
  321.       :on-success="handleUploadSuccess"
  322.       :on-preview="handlePreview"
  323.       :limit="maxCount"
  324.       :on-exceed="handleExceed"
  325.       :show-file-list="showFile"
  326.     >
  327.       <i ></i>
  328.     </el-upload>    defaultImg = image.getImgUrl();
  329. <el-upload
  330.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  331.       :data="dataObj"
  332.       :list-type="listType"
  333.       :file-list="fileList"
  334.       :before-upload="beforeUpload"
  335.       :on-remove="handleRemove"
  336.       :on-success="handleUploadSuccess"
  337.       :on-preview="handlePreview"
  338.       :limit="maxCount"
  339.       :on-exceed="handleExceed"
  340.       :show-file-list="showFile"
  341.     >
  342.       <i ></i>
  343.     </el-upload><el-upload
  344.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  345.       :data="dataObj"
  346.       :list-type="listType"
  347.       :file-list="fileList"
  348.       :before-upload="beforeUpload"
  349.       :on-remove="handleRemove"
  350.       :on-success="handleUploadSuccess"
  351.       :on-preview="handlePreview"
  352.       :limit="maxCount"
  353.       :on-exceed="handleExceed"
  354.       :show-file-list="showFile"
  355.     >
  356.       <i ></i>
  357.     </el-upload>}
  358. <el-upload
  359.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  360.       :data="dataObj"
  361.       :list-type="listType"
  362.       :file-list="fileList"
  363.       :before-upload="beforeUpload"
  364.       :on-remove="handleRemove"
  365.       :on-success="handleUploadSuccess"
  366.       :on-preview="handlePreview"
  367.       :limit="maxCount"
  368.       :on-exceed="handleExceed"
  369.       :show-file-list="showFile"
  370.     >
  371.       <i ></i>
  372.     </el-upload>      }
  373. <el-upload
  374.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  375.       :data="dataObj"
  376.       :list-type="listType"
  377.       :file-list="fileList"
  378.       :before-upload="beforeUpload"
  379.       :on-remove="handleRemove"
  380.       :on-success="handleUploadSuccess"
  381.       :on-preview="handlePreview"
  382.       :limit="maxCount"
  383.       :on-exceed="handleExceed"
  384.       :show-file-list="showFile"
  385.     >
  386.       <i ></i>
  387.     </el-upload>      SkuInfoEntity skuInfoEntity = new SkuInfoEntity();
  388. //把 item 中的信息拷贝给 skuInfoEntity
  389. <el-upload
  390.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  391.       :data="dataObj"
  392.       :list-type="listType"
  393.       :file-list="fileList"
  394.       :before-upload="beforeUpload"
  395.       :on-remove="handleRemove"
  396.       :on-success="handleUploadSuccess"
  397.       :on-preview="handlePreview"
  398.       :limit="maxCount"
  399.       :on-exceed="handleExceed"
  400.       :show-file-list="showFile"
  401.     >
  402.       <i ></i>
  403.     </el-upload>      BeanUtils.copyProperties(item,skuInfoEntity);
  404. //item 中没有信息,但是 skuInfoEntity 需要的信息,
  405. //可以从 spuInfoEntity 中获取
  406. <el-upload
  407.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  408.       :data="dataObj"
  409.       :list-type="listType"
  410.       :file-list="fileList"
  411.       :before-upload="beforeUpload"
  412.       :on-remove="handleRemove"
  413.       :on-success="handleUploadSuccess"
  414.       :on-preview="handlePreview"
  415.       :limit="maxCount"
  416.       :on-exceed="handleExceed"
  417.       :show-file-list="showFile"
  418.     >
  419.       <i ></i>
  420.     </el-upload>      skuInfoEntity.setBrandId(spuInfoEntity.getBrandId());
  421. <el-upload
  422.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  423.       :data="dataObj"
  424.       :list-type="listType"
  425.       :file-list="fileList"
  426.       :before-upload="beforeUpload"
  427.       :on-remove="handleRemove"
  428.       :on-success="handleUploadSuccess"
  429.       :on-preview="handlePreview"
  430.       :limit="maxCount"
  431.       :on-exceed="handleExceed"
  432.       :show-file-list="showFile"
  433.     >
  434.       <i ></i>
  435.     </el-upload>      skuInfoEntity.setCatalogId(spuInfoEntity.getCatalogId());
  436. <el-upload
  437.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  438.       :data="dataObj"
  439.       :list-type="listType"
  440.       :file-list="fileList"
  441.       :before-upload="beforeUpload"
  442.       :on-remove="handleRemove"
  443.       :on-success="handleUploadSuccess"
  444.       :on-preview="handlePreview"
  445.       :limit="maxCount"
  446.       :on-exceed="handleExceed"
  447.       :show-file-list="showFile"
  448.     >
  449.       <i ></i>
  450.     </el-upload>      skuInfoEntity.setSaleCount(0L);//初始化销量为 0
  451. <el-upload
  452.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  453.       :data="dataObj"
  454.       :list-type="listType"
  455.       :file-list="fileList"
  456.       :before-upload="beforeUpload"
  457.       :on-remove="handleRemove"
  458.       :on-success="handleUploadSuccess"
  459.       :on-preview="handlePreview"
  460.       :limit="maxCount"
  461.       :on-exceed="handleExceed"
  462.       :show-file-list="showFile"
  463.     >
  464.       <i ></i>
  465.     </el-upload>      skuInfoEntity.setSpuId(spuInfoEntity.getId());
  466. <el-upload
  467.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  468.       :data="dataObj"
  469.       :list-type="listType"
  470.       :file-list="fileList"
  471.       :before-upload="beforeUpload"
  472.       :on-remove="handleRemove"
  473.       :on-success="handleUploadSuccess"
  474.       :on-preview="handlePreview"
  475.       :limit="maxCount"
  476.       :on-exceed="handleExceed"
  477.       :show-file-list="showFile"
  478.     >
  479.       <i ></i>
  480.     </el-upload>      skuInfoEntity.setSkuDefaultImg(defaultImg);
  481. //1)、保存 sku 的基本信息;到 commodity_sku_info
  482. <el-upload
  483.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  484.       :data="dataObj"
  485.       :list-type="listType"
  486.       :file-list="fileList"
  487.       :before-upload="beforeUpload"
  488.       :on-remove="handleRemove"
  489.       :on-success="handleUploadSuccess"
  490.       :on-preview="handlePreview"
  491.       :limit="maxCount"
  492.       :on-exceed="handleExceed"
  493.       :show-file-list="showFile"
  494.     >
  495.       <i ></i>
  496.     </el-upload>      skuInfoService.saveSkuInfo(skuInfoEntity);
  497. <el-upload
  498.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  499.       :data="dataObj"
  500.       :list-type="listType"
  501.       :file-list="fileList"
  502.       :before-upload="beforeUpload"
  503.       :on-remove="handleRemove"
  504.       :on-success="handleUploadSuccess"
  505.       :on-preview="handlePreview"
  506.       :limit="maxCount"
  507.       :on-exceed="handleExceed"
  508.       :show-file-list="showFile"
  509.     >
  510.       <i ></i>
  511.     </el-upload>  });
  512.         }
  513.     }
  514. //    @Transactional
  515. //    @Override
  516. //    public void saveSpuInfo(SpuSaveVO spuSaveVO) {
  517. //        //1、保存 spu 基本信息 , 对应的表 commodity_spu_info
  518. //        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
  519. //        BeanUtils.copyProperties(spuSaveVO, spuInfoEntity);
  520. //        spuInfoEntity.setCreateTime(new Date());
  521. //        spuInfoEntity.setUpdateTime(new Date());
  522. ////SpuInfoEntity 信息保存到 commodity_spu_info
  523. //        this.saveBaseSpuInfo(spuInfoEntity);
  524. ////2、保存 Spu 的描述图片路径 commodity_spu_info_desc
  525. //        List<String> decript = spuSaveVO.getDecript();
  526. //        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();
  527. ////获取到刚刚保存的 spu 基本信息对应的 id
  528. //        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());
  529. ////注意:这里有可能没有图片, 可以设置一个默认图片
  530. //        if (decript.size() == 0) {
  531. //<el-upload
  532.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  533.       :data="dataObj"
  534.       :list-type="listType"
  535.       :file-list="fileList"
  536.       :before-upload="beforeUpload"
  537.       :on-remove="handleRemove"
  538.       :on-success="handleUploadSuccess"
  539.       :on-preview="handlePreview"
  540.       :limit="maxCount"
  541.       :on-exceed="handleExceed"
  542.       :show-file-list="showFile"
  543.     >
  544.       <i ></i>
  545.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");
  546. //        } else {
  547. //<el-upload
  548.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  549.       :data="dataObj"
  550.       :list-type="listType"
  551.       :file-list="fileList"
  552.       :before-upload="beforeUpload"
  553.       :on-remove="handleRemove"
  554.       :on-success="handleUploadSuccess"
  555.       :on-preview="handlePreview"
  556.       :limit="maxCount"
  557.       :on-exceed="handleExceed"
  558.       :show-file-list="showFile"
  559.     >
  560.       <i ></i>
  561.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));
  562. //        }
  563. ////保存到 commodity_spu_info_desc, 这个方法时我们完成
  564. //        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);
  565. //        //3、保存 spu 的图片集 commodity_spu_images
  566. //        List<String> images = spuSaveVO.getImages();
  567. ////获取到刚刚保存的 spu 基本信息对应的 id
  568. //        imagesService.saveImages(spuInfoEntity.getId(), images);
  569. ////4、保存 spu 的基本属性(一个 spu 可以有多个基本属性/规格参数):
  570. //// commodity_product_attr_value
  571. //        List<BaseAttrs> baseAttrs = spuSaveVO.getBaseAttrs();
  572. //        List<ProductAttrValueEntity> collect = baseAttrs.stream().map(attr -> {
  573. //<el-upload
  574.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  575.       :data="dataObj"
  576.       :list-type="listType"
  577.       :file-list="fileList"
  578.       :before-upload="beforeUpload"
  579.       :on-remove="handleRemove"
  580.       :on-success="handleUploadSuccess"
  581.       :on-preview="handlePreview"
  582.       :limit="maxCount"
  583.       :on-exceed="handleExceed"
  584.       :show-file-list="showFile"
  585.     >
  586.       <i ></i>
  587.     </el-upload>  ProductAttrValueEntity valueEntity = new ProductAttrValueEntity();
  588. //<el-upload
  589.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  590.       :data="dataObj"
  591.       :list-type="listType"
  592.       :file-list="fileList"
  593.       :before-upload="beforeUpload"
  594.       :on-remove="handleRemove"
  595.       :on-success="handleUploadSuccess"
  596.       :on-preview="handlePreview"
  597.       :limit="maxCount"
  598.       :on-exceed="handleExceed"
  599.       :show-file-list="showFile"
  600.     >
  601.       <i ></i>
  602.     </el-upload>  valueEntity.setAttrId(attr.getAttrId());
  603. //<el-upload
  604.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  605.       :data="dataObj"
  606.       :list-type="listType"
  607.       :file-list="fileList"
  608.       :before-upload="beforeUpload"
  609.       :on-remove="handleRemove"
  610.       :on-success="handleUploadSuccess"
  611.       :on-preview="handlePreview"
  612.       :limit="maxCount"
  613.       :on-exceed="handleExceed"
  614.       :show-file-list="showFile"
  615.     >
  616.       <i ></i>
  617.     </el-upload>  AttrEntity id = attrService.getById(attr.getAttrId());
  618. //<el-upload
  619.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  620.       :data="dataObj"
  621.       :list-type="listType"
  622.       :file-list="fileList"
  623.       :before-upload="beforeUpload"
  624.       :on-remove="handleRemove"
  625.       :on-success="handleUploadSuccess"
  626.       :on-preview="handlePreview"
  627.       :limit="maxCount"
  628.       :on-exceed="handleExceed"
  629.       :show-file-list="showFile"
  630.     >
  631.       <i ></i>
  632.     </el-upload>  valueEntity.setAttrName(id.getAttrName());
  633. //<el-upload
  634.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  635.       :data="dataObj"
  636.       :list-type="listType"
  637.       :file-list="fileList"
  638.       :before-upload="beforeUpload"
  639.       :on-remove="handleRemove"
  640.       :on-success="handleUploadSuccess"
  641.       :on-preview="handlePreview"
  642.       :limit="maxCount"
  643.       :on-exceed="handleExceed"
  644.       :show-file-list="showFile"
  645.     >
  646.       <i ></i>
  647.     </el-upload>  valueEntity.setAttrValue(attr.getAttrValues());
  648. //<el-upload
  649.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  650.       :data="dataObj"
  651.       :list-type="listType"
  652.       :file-list="fileList"
  653.       :before-upload="beforeUpload"
  654.       :on-remove="handleRemove"
  655.       :on-success="handleUploadSuccess"
  656.       :on-preview="handlePreview"
  657.       :limit="maxCount"
  658.       :on-exceed="handleExceed"
  659.       :show-file-list="showFile"
  660.     >
  661.       <i ></i>
  662.     </el-upload>  valueEntity.setQuickShow(attr.getShowDesc());
  663. //<el-upload
  664.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  665.       :data="dataObj"
  666.       :list-type="listType"
  667.       :file-list="fileList"
  668.       :before-upload="beforeUpload"
  669.       :on-remove="handleRemove"
  670.       :on-success="handleUploadSuccess"
  671.       :on-preview="handlePreview"
  672.       :limit="maxCount"
  673.       :on-exceed="handleExceed"
  674.       :show-file-list="showFile"
  675.     >
  676.       <i ></i>
  677.     </el-upload>  valueEntity.setSpuId(spuInfoEntity.getId());
  678. //<el-upload
  679.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  680.       :data="dataObj"
  681.       :list-type="listType"
  682.       :file-list="fileList"
  683.       :before-upload="beforeUpload"
  684.       :on-remove="handleRemove"
  685.       :on-success="handleUploadSuccess"
  686.       :on-preview="handlePreview"
  687.       :limit="maxCount"
  688.       :on-exceed="handleExceed"
  689.       :show-file-list="showFile"
  690.     >
  691.       <i ></i>
  692.     </el-upload>  return valueEntity;
  693. //        }).collect(Collectors.toList());
  694. //        productAttrValueService.saveProductAttr(collect);
  695. //    }
  696.     @Resource
  697.     SpuImagesService imagesService;
  698.     @Resource
  699.     SpuInfoDescService spuInfoDescService;
  700.     //因为有多个添加操作,使用事务控制
  701. //    @Transactional
  702. //    @Override
  703. //    public void saveSpuInfo(SpuSaveVO spuSaveVO) {
  704. ////1、保存 spu 基本信息 , 对应的表 commodity_spu_info
  705. //        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
  706. //        BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);
  707. //        spuInfoEntity.setCreateTime(new Date());
  708. //        spuInfoEntity.setUpdateTime(new Date());
  709. ////SpuInfoEntity 信息保存到 commodity_spu_info
  710. //        this.saveBaseSpuInfo(spuInfoEntity);
  711. ////2、保存 Spu 的描述图片路径 commodity_spu_info_desc
  712. //        List<String> decript = spuSaveVO.getDecript();
  713. //        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();
  714. ////获取到刚刚保存的 spu 基本信息对应的 id
  715. //        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());
  716. ////注意:这里有可能没有图片, 可以设置一个默认图片
  717. //        if(decript.size() == 0) {
  718. //<el-upload
  719.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  720.       :data="dataObj"
  721.       :list-type="listType"
  722.       :file-list="fileList"
  723.       :before-upload="beforeUpload"
  724.       :on-remove="handleRemove"
  725.       :on-success="handleUploadSuccess"
  726.       :on-preview="handlePreview"
  727.       :limit="maxCount"
  728.       :on-exceed="handleExceed"
  729.       :show-file-list="showFile"
  730.     >
  731.       <i ></i>
  732.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");
  733. //        }else {
  734. //<el-upload
  735.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  736.       :data="dataObj"
  737.       :list-type="listType"
  738.       :file-list="fileList"
  739.       :before-upload="beforeUpload"
  740.       :on-remove="handleRemove"
  741.       :on-success="handleUploadSuccess"
  742.       :on-preview="handlePreview"
  743.       :limit="maxCount"
  744.       :on-exceed="handleExceed"
  745.       :show-file-list="showFile"
  746.     >
  747.       <i ></i>
  748.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));
  749. //        }
  750. ////保存到 commodity_spu_info_desc, 这个方法时我们完成
  751. //        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);
  752. //
  753. //        //3、保存 spu 的图片集 commodity_spu_images
  754. //        List<String> images = spuSaveVO.getImages();
  755. ////获取到刚刚保存的 spu 基本信息对应的 id
  756. //        imagesService.saveImages(spuInfoEntity.getId(), images);
  757. //    }
  758.     @Override
  759.     public PageUtils queryPage(Map<String, Object> params) {
  760.         IPage<SpuInfoEntity> page = this.page(
  761. <el-upload
  762.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  763.       :data="dataObj"
  764.       :list-type="listType"
  765.       :file-list="fileList"
  766.       :before-upload="beforeUpload"
  767.       :on-remove="handleRemove"
  768.       :on-success="handleUploadSuccess"
  769.       :on-preview="handlePreview"
  770.       :limit="maxCount"
  771.       :on-exceed="handleExceed"
  772.       :show-file-list="showFile"
  773.     >
  774.       <i ></i>
  775.     </el-upload>      new Query<SpuInfoEntity>().getPage(params),
  776. <el-upload
  777.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  778.       :data="dataObj"
  779.       :list-type="listType"
  780.       :file-list="fileList"
  781.       :before-upload="beforeUpload"
  782.       :on-remove="handleRemove"
  783.       :on-success="handleUploadSuccess"
  784.       :on-preview="handlePreview"
  785.       :limit="maxCount"
  786.       :on-exceed="handleExceed"
  787.       :show-file-list="showFile"
  788.     >
  789.       <i ></i>
  790.     </el-upload>      new QueryWrapper<SpuInfoEntity>()
  791.         );
  792.         return new PageUtils(page);
  793.     }
  794.     /**
  795.      * 保存 spu 的基本信息到 commodity_spu_info
  796.      * @param spuInfoEntity
  797.      */
  798.     @Override
  799.     public void saveBaseSpuInfo(SpuInfoEntity spuInfoEntity) {
  800.         this.baseMapper.insert(spuInfoEntity);
  801.     }
  802. //    @Override
  803. //    public void saveSpuInfo(SpuSaveVO spuSaveVO) {
  804. ////1、保存 spu 基本信息 , 对应的表 commodity_spu_info
  805. //        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
  806. //        BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);
  807. //        spuInfoEntity.setCreateTime(new Date());
  808. //        spuInfoEntity.setUpdateTime(new Date());
  809. ////2. 将 SpuInfoEntity 信息保存到 commodity_spu_info
  810. //        this.saveBaseSpuInfo(spuInfoEntity);
  811. //    }
  812. }
复制代码
保存 spu 和 sku 的 图片信息

可 以 添 加 spu 和 sku 图 片 信 息 保 存 到 了 对 应 的 表 中 , 比 如 :
commodity_sku_images(一步一步来)

完成功能: 只测试是否可以添加 spu 的基本信息到 commodity_spu_info (一步一步来****),
提示****: 如果运行过程中, 提示找不到 VO, Rebuild Project 即可
  1. /*==============================================================*/
  2. /* 1. 保存 某一个 sku 对应的图片[1 个 sku 可能有多个图片]
  3. /*=====================================================*/
  4. USE hspliving_commodity
  5. CREATE TABLE commodity_sku_images
  6. (
  7. id BIGINT NOT NULL AUTO_INCREMENT COMMENT 'id',
  8. sku_id BIGINT COMMENT 'sku_id',
  9. img_url VARCHAR(255) COMMENT '图片地址',
  10. img_sort INT COMMENT '排序',
  11. default_img INT COMMENT '默认图[0 - 不是默认图,1 - 是默认图]',
  12. PRIMARY KEY (id)
  13. )CHARSET=utf8mb4 COMMENT='sku 图片';
  14. SELECT * FROM commodity_sku_images
复制代码
  1. <el-upload
  2.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  3.       :data="dataObj"
  4.       :list-type="listType"
  5.       :file-list="fileList"
  6.       :before-upload="beforeUpload"
  7.       :on-remove="handleRemove"
  8.       :on-success="handleUploadSuccess"
  9.       :on-preview="handlePreview"
  10.       :limit="maxCount"
  11.       :on-exceed="handleExceed"
  12.       :show-file-list="showFile"
  13.     >
  14.       <i ></i>
  15.     </el-upload>
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;import com.rainbowsea.rainbowsealiving.commodity.entity.AttrEntity;import com.rainbowsea.rainbowsealiving.commodity.entity.ProductAttrValueEntity;import com.rainbowsea.rainbowsealiving.commodity.entity.SkuImagesEntity;import com.rainbowsea.rainbowsealiving.commodity.entity.SkuInfoEntity;import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoDescEntity;import com.rainbowsea.rainbowsealiving.commodity.service.AttrService;import com.rainbowsea.rainbowsealiving.commodity.service.ProductAttrValueService;import com.rainbowsea.rainbowsealiving.commodity.service.SkuImagesService;import com.rainbowsea.rainbowsealiving.commodity.service.SkuInfoService;import com.rainbowsea.rainbowsealiving.commodity.service.SpuImagesService;import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoDescService;import com.rainbowsea.rainbowsealiving.commodity.vo.BaseAttrs;import com.rainbowsea.rainbowsealiving.commodity.vo.Images;import com.rainbowsea.rainbowsealiving.commodity.vo.Skus;import com.rainbowsea.rainbowsealiving.commodity.vo.SpuSaveVO;import org.apache.commons.lang.StringUtils;import org.springframework.beans.BeanUtils;import org.springframework.stereotype.Service;import java.util.Date;import java.util.List;import java.util.Map;import java.util.stream.Collectors;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;import com.baomidou.mybatisplus.core.metadata.IPage;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;import com.rainbowsea.common.utils.PageUtils;import com.rainbowsea.common.utils.Query;import com.rainbowsea.rainbowsealiving.commodity.dao.SpuInfoDao;import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoEntity;import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoService;import org.springframework.transaction.annotation.Transactional;import javax.annotation.Resource;@Service("spuInfoService")public class SpuInfoServiceImpl extends ServiceImpl implements SpuInfoService {    @Resource    AttrService attrService;    @Resource    ProductAttrValueService productAttrValueService;    @Resource    SkuInfoService skuInfoService;    @Resource    SkuImagesService skuImagesService;    @Resource    SpuImagesService imagesService;    @Resource    SpuInfoDescService spuInfoDescService;    @Transactional    @Override    public void saveSpuInfo(SpuSaveVO spuSaveVO) {        //1、保存 spu 基本信息 , 对应的表 commodity_spu_info        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();        BeanUtils.copyProperties(spuSaveVO, spuInfoEntity);        spuInfoEntity.setCreateTime(new Date());        spuInfoEntity.setUpdateTime(new Date());//SpuInfoEntity 信息保存到 commodity_spu_info        this.saveBaseSpuInfo(spuInfoEntity);//2、保存 Spu 的描述图片路径 commodity_spu_info_desc        List decript = spuSaveVO.getDecript();        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();//获取到刚刚保存的 spu 基本信息对应的 id        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());//留意:这里有可能没有图片, 可以设置一个默认图片        if (decript.size() == 0) {<el-upload
  2.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  3.       :data="dataObj"
  4.       :list-type="listType"
  5.       :file-list="fileList"
  6.       :before-upload="beforeUpload"
  7.       :on-remove="handleRemove"
  8.       :on-success="handleUploadSuccess"
  9.       :on-preview="handlePreview"
  10.       :limit="maxCount"
  11.       :on-exceed="handleExceed"
  12.       :show-file-list="showFile"
  13.     >
  14.       <i ></i>
  15.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");        } else {<el-upload
  16.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  17.       :data="dataObj"
  18.       :list-type="listType"
  19.       :file-list="fileList"
  20.       :before-upload="beforeUpload"
  21.       :on-remove="handleRemove"
  22.       :on-success="handleUploadSuccess"
  23.       :on-preview="handlePreview"
  24.       :limit="maxCount"
  25.       :on-exceed="handleExceed"
  26.       :show-file-list="showFile"
  27.     >
  28.       <i ></i>
  29.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));        }//保存到 commodity_spu_info_desc, 这个方法时我们完成        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);        //3、保存 spu 的图片集 commodity_spu_images        List images = spuSaveVO.getImages();//获取到刚刚保存的 spu 基本信息对应的 id        imagesService.saveImages(spuInfoEntity.getId(), images);//4 、 保 存 spu 的 基 本 属 性 ( 一 个 spu 可 以 有 多 个 基 本 属 性 / 规 格 参 数 ):commodity_product_attr_value        List baseAttrs = spuSaveVO.getBaseAttrs();        List collect = baseAttrs.stream().map(attr -> {<el-upload
  30.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  31.       :data="dataObj"
  32.       :list-type="listType"
  33.       :file-list="fileList"
  34.       :before-upload="beforeUpload"
  35.       :on-remove="handleRemove"
  36.       :on-success="handleUploadSuccess"
  37.       :on-preview="handlePreview"
  38.       :limit="maxCount"
  39.       :on-exceed="handleExceed"
  40.       :show-file-list="showFile"
  41.     >
  42.       <i ></i>
  43.     </el-upload>  ProductAttrValueEntity valueEntity = new ProductAttrValueEntity();<el-upload
  44.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  45.       :data="dataObj"
  46.       :list-type="listType"
  47.       :file-list="fileList"
  48.       :before-upload="beforeUpload"
  49.       :on-remove="handleRemove"
  50.       :on-success="handleUploadSuccess"
  51.       :on-preview="handlePreview"
  52.       :limit="maxCount"
  53.       :on-exceed="handleExceed"
  54.       :show-file-list="showFile"
  55.     >
  56.       <i ></i>
  57.     </el-upload>  valueEntity.setAttrId(attr.getAttrId());<el-upload
  58.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  59.       :data="dataObj"
  60.       :list-type="listType"
  61.       :file-list="fileList"
  62.       :before-upload="beforeUpload"
  63.       :on-remove="handleRemove"
  64.       :on-success="handleUploadSuccess"
  65.       :on-preview="handlePreview"
  66.       :limit="maxCount"
  67.       :on-exceed="handleExceed"
  68.       :show-file-list="showFile"
  69.     >
  70.       <i ></i>
  71.     </el-upload>  AttrEntity id = attrService.getById(attr.getAttrId());<el-upload
  72.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  73.       :data="dataObj"
  74.       :list-type="listType"
  75.       :file-list="fileList"
  76.       :before-upload="beforeUpload"
  77.       :on-remove="handleRemove"
  78.       :on-success="handleUploadSuccess"
  79.       :on-preview="handlePreview"
  80.       :limit="maxCount"
  81.       :on-exceed="handleExceed"
  82.       :show-file-list="showFile"
  83.     >
  84.       <i ></i>
  85.     </el-upload>  valueEntity.setAttrName(id.getAttrName());<el-upload
  86.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  87.       :data="dataObj"
  88.       :list-type="listType"
  89.       :file-list="fileList"
  90.       :before-upload="beforeUpload"
  91.       :on-remove="handleRemove"
  92.       :on-success="handleUploadSuccess"
  93.       :on-preview="handlePreview"
  94.       :limit="maxCount"
  95.       :on-exceed="handleExceed"
  96.       :show-file-list="showFile"
  97.     >
  98.       <i ></i>
  99.     </el-upload>  valueEntity.setAttrValue(attr.getAttrValues());<el-upload
  100.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  101.       :data="dataObj"
  102.       :list-type="listType"
  103.       :file-list="fileList"
  104.       :before-upload="beforeUpload"
  105.       :on-remove="handleRemove"
  106.       :on-success="handleUploadSuccess"
  107.       :on-preview="handlePreview"
  108.       :limit="maxCount"
  109.       :on-exceed="handleExceed"
  110.       :show-file-list="showFile"
  111.     >
  112.       <i ></i>
  113.     </el-upload>  valueEntity.setQuickShow(attr.getShowDesc());<el-upload
  114.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  115.       :data="dataObj"
  116.       :list-type="listType"
  117.       :file-list="fileList"
  118.       :before-upload="beforeUpload"
  119.       :on-remove="handleRemove"
  120.       :on-success="handleUploadSuccess"
  121.       :on-preview="handlePreview"
  122.       :limit="maxCount"
  123.       :on-exceed="handleExceed"
  124.       :show-file-list="showFile"
  125.     >
  126.       <i ></i>
  127.     </el-upload>  valueEntity.setSpuId(spuInfoEntity.getId());<el-upload
  128.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  129.       :data="dataObj"
  130.       :list-type="listType"
  131.       :file-list="fileList"
  132.       :before-upload="beforeUpload"
  133.       :on-remove="handleRemove"
  134.       :on-success="handleUploadSuccess"
  135.       :on-preview="handlePreview"
  136.       :limit="maxCount"
  137.       :on-exceed="handleExceed"
  138.       :show-file-list="showFile"
  139.     >
  140.       <i ></i>
  141.     </el-upload>  return valueEntity;        }).collect(Collectors.toList());        productAttrValueService.saveProductAttr(collect);        //5、保存当前 spu 对应的全部 sku 信息;一个 spu 可以 对应多个 sku, 组成一个可以销售的商品信息.        List skus = spuSaveVO.getSkus();        if (skus != null && skus.size() > 0) {<el-upload
  142.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  143.       :data="dataObj"
  144.       :list-type="listType"
  145.       :file-list="fileList"
  146.       :before-upload="beforeUpload"
  147.       :on-remove="handleRemove"
  148.       :on-success="handleUploadSuccess"
  149.       :on-preview="handlePreview"
  150.       :limit="maxCount"
  151.       :on-exceed="handleExceed"
  152.       :show-file-list="showFile"
  153.     >
  154.       <i ></i>
  155.     </el-upload>  skus.forEach(item -> {<el-upload
  156.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  157.       :data="dataObj"
  158.       :list-type="listType"
  159.       :file-list="fileList"
  160.       :before-upload="beforeUpload"
  161.       :on-remove="handleRemove"
  162.       :on-success="handleUploadSuccess"
  163.       :on-preview="handlePreview"
  164.       :limit="maxCount"
  165.       :on-exceed="handleExceed"
  166.       :show-file-list="showFile"
  167.     >
  168.       <i ></i>
  169.     </el-upload>      String defaultImg = "default.jpg";//json 会提交很多图片,如果是当前这个 sku 的默认图片就先保存下 url<el-upload
  170.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  171.       :data="dataObj"
  172.       :list-type="listType"
  173.       :file-list="fileList"
  174.       :before-upload="beforeUpload"
  175.       :on-remove="handleRemove"
  176.       :on-success="handleUploadSuccess"
  177.       :on-preview="handlePreview"
  178.       :limit="maxCount"
  179.       :on-exceed="handleExceed"
  180.       :show-file-list="showFile"
  181.     >
  182.       <i ></i>
  183.     </el-upload>      for (Images image : item.getImages()) {<el-upload
  184.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  185.       :data="dataObj"
  186.       :list-type="listType"
  187.       :file-list="fileList"
  188.       :before-upload="beforeUpload"
  189.       :on-remove="handleRemove"
  190.       :on-success="handleUploadSuccess"
  191.       :on-preview="handlePreview"
  192.       :limit="maxCount"
  193.       :on-exceed="handleExceed"
  194.       :show-file-list="showFile"
  195.     >
  196.       <i ></i>
  197.     </el-upload><el-upload
  198.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  199.       :data="dataObj"
  200.       :list-type="listType"
  201.       :file-list="fileList"
  202.       :before-upload="beforeUpload"
  203.       :on-remove="handleRemove"
  204.       :on-success="handleUploadSuccess"
  205.       :on-preview="handlePreview"
  206.       :limit="maxCount"
  207.       :on-exceed="handleExceed"
  208.       :show-file-list="showFile"
  209.     >
  210.       <i ></i>
  211.     </el-upload>if (image.getDefaultImg() == 1) {<el-upload
  212.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  213.       :data="dataObj"
  214.       :list-type="listType"
  215.       :file-list="fileList"
  216.       :before-upload="beforeUpload"
  217.       :on-remove="handleRemove"
  218.       :on-success="handleUploadSuccess"
  219.       :on-preview="handlePreview"
  220.       :limit="maxCount"
  221.       :on-exceed="handleExceed"
  222.       :show-file-list="showFile"
  223.     >
  224.       <i ></i>
  225.     </el-upload><el-upload
  226.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  227.       :data="dataObj"
  228.       :list-type="listType"
  229.       :file-list="fileList"
  230.       :before-upload="beforeUpload"
  231.       :on-remove="handleRemove"
  232.       :on-success="handleUploadSuccess"
  233.       :on-preview="handlePreview"
  234.       :limit="maxCount"
  235.       :on-exceed="handleExceed"
  236.       :show-file-list="showFile"
  237.     >
  238.       <i ></i>
  239.     </el-upload>    defaultImg = image.getImgUrl();<el-upload
  240.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  241.       :data="dataObj"
  242.       :list-type="listType"
  243.       :file-list="fileList"
  244.       :before-upload="beforeUpload"
  245.       :on-remove="handleRemove"
  246.       :on-success="handleUploadSuccess"
  247.       :on-preview="handlePreview"
  248.       :limit="maxCount"
  249.       :on-exceed="handleExceed"
  250.       :show-file-list="showFile"
  251.     >
  252.       <i ></i>
  253.     </el-upload><el-upload
  254.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  255.       :data="dataObj"
  256.       :list-type="listType"
  257.       :file-list="fileList"
  258.       :before-upload="beforeUpload"
  259.       :on-remove="handleRemove"
  260.       :on-success="handleUploadSuccess"
  261.       :on-preview="handlePreview"
  262.       :limit="maxCount"
  263.       :on-exceed="handleExceed"
  264.       :show-file-list="showFile"
  265.     >
  266.       <i ></i>
  267.     </el-upload>}<el-upload
  268.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  269.       :data="dataObj"
  270.       :list-type="listType"
  271.       :file-list="fileList"
  272.       :before-upload="beforeUpload"
  273.       :on-remove="handleRemove"
  274.       :on-success="handleUploadSuccess"
  275.       :on-preview="handlePreview"
  276.       :limit="maxCount"
  277.       :on-exceed="handleExceed"
  278.       :show-file-list="showFile"
  279.     >
  280.       <i ></i>
  281.     </el-upload>      }//保存 sku 的基本信息;到 commodity_sku_info start<el-upload
  282.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  283.       :data="dataObj"
  284.       :list-type="listType"
  285.       :file-list="fileList"
  286.       :before-upload="beforeUpload"
  287.       :on-remove="handleRemove"
  288.       :on-success="handleUploadSuccess"
  289.       :on-preview="handlePreview"
  290.       :limit="maxCount"
  291.       :on-exceed="handleExceed"
  292.       :show-file-list="showFile"
  293.     >
  294.       <i ></i>
  295.     </el-upload>      SkuInfoEntity skuInfoEntity = new SkuInfoEntity();//把 item 中的信息拷贝给 skuInfoEntity<el-upload
  296.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  297.       :data="dataObj"
  298.       :list-type="listType"
  299.       :file-list="fileList"
  300.       :before-upload="beforeUpload"
  301.       :on-remove="handleRemove"
  302.       :on-success="handleUploadSuccess"
  303.       :on-preview="handlePreview"
  304.       :limit="maxCount"
  305.       :on-exceed="handleExceed"
  306.       :show-file-list="showFile"
  307.     >
  308.       <i ></i>
  309.     </el-upload>      BeanUtils.copyProperties(item, skuInfoEntity);//item 中没有信息,但是 skuInfoEntity 必要的信息,可以从 spuInfoEntity 中获取<el-upload
  310.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  311.       :data="dataObj"
  312.       :list-type="listType"
  313.       :file-list="fileList"
  314.       :before-upload="beforeUpload"
  315.       :on-remove="handleRemove"
  316.       :on-success="handleUploadSuccess"
  317.       :on-preview="handlePreview"
  318.       :limit="maxCount"
  319.       :on-exceed="handleExceed"
  320.       :show-file-list="showFile"
  321.     >
  322.       <i ></i>
  323.     </el-upload>      skuInfoEntity.setBrandId(spuInfoEntity.getBrandId());<el-upload
  324.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  325.       :data="dataObj"
  326.       :list-type="listType"
  327.       :file-list="fileList"
  328.       :before-upload="beforeUpload"
  329.       :on-remove="handleRemove"
  330.       :on-success="handleUploadSuccess"
  331.       :on-preview="handlePreview"
  332.       :limit="maxCount"
  333.       :on-exceed="handleExceed"
  334.       :show-file-list="showFile"
  335.     >
  336.       <i ></i>
  337.     </el-upload>      skuInfoEntity.setCatalogId(spuInfoEntity.getCatalogId());<el-upload
  338.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  339.       :data="dataObj"
  340.       :list-type="listType"
  341.       :file-list="fileList"
  342.       :before-upload="beforeUpload"
  343.       :on-remove="handleRemove"
  344.       :on-success="handleUploadSuccess"
  345.       :on-preview="handlePreview"
  346.       :limit="maxCount"
  347.       :on-exceed="handleExceed"
  348.       :show-file-list="showFile"
  349.     >
  350.       <i ></i>
  351.     </el-upload>      skuInfoEntity.setSaleCount(0L);//初始化销量为 0<el-upload
  352.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  353.       :data="dataObj"
  354.       :list-type="listType"
  355.       :file-list="fileList"
  356.       :before-upload="beforeUpload"
  357.       :on-remove="handleRemove"
  358.       :on-success="handleUploadSuccess"
  359.       :on-preview="handlePreview"
  360.       :limit="maxCount"
  361.       :on-exceed="handleExceed"
  362.       :show-file-list="showFile"
  363.     >
  364.       <i ></i>
  365.     </el-upload>      skuInfoEntity.setSpuId(spuInfoEntity.getId());<el-upload
  366.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  367.       :data="dataObj"
  368.       :list-type="listType"
  369.       :file-list="fileList"
  370.       :before-upload="beforeUpload"
  371.       :on-remove="handleRemove"
  372.       :on-success="handleUploadSuccess"
  373.       :on-preview="handlePreview"
  374.       :limit="maxCount"
  375.       :on-exceed="handleExceed"
  376.       :show-file-list="showFile"
  377.     >
  378.       <i ></i>
  379.     </el-upload>      skuInfoEntity.setSkuDefaultImg(defaultImg);<el-upload
  380.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  381.       :data="dataObj"
  382.       :list-type="listType"
  383.       :file-list="fileList"
  384.       :before-upload="beforeUpload"
  385.       :on-remove="handleRemove"
  386.       :on-success="handleUploadSuccess"
  387.       :on-preview="handlePreview"
  388.       :limit="maxCount"
  389.       :on-exceed="handleExceed"
  390.       :show-file-list="showFile"
  391.     >
  392.       <i ></i>
  393.     </el-upload>      skuInfoService.saveSkuInfo(skuInfoEntity);//保存 sku 的基本信息;到 commodity_sku_info end//保存 sku 的图片信息;到 commodity_sku_images start//一个 sku 可以有多张图片<el-upload
  394.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  395.       :data="dataObj"
  396.       :list-type="listType"
  397.       :file-list="fileList"
  398.       :before-upload="beforeUpload"
  399.       :on-remove="handleRemove"
  400.       :on-success="handleUploadSuccess"
  401.       :on-preview="handlePreview"
  402.       :limit="maxCount"
  403.       :on-exceed="handleExceed"
  404.       :show-file-list="showFile"
  405.     >
  406.       <i ></i>
  407.     </el-upload>      Long skuId = skuInfoEntity.getSkuId();<el-upload
  408.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  409.       :data="dataObj"
  410.       :list-type="listType"
  411.       :file-list="fileList"
  412.       :before-upload="beforeUpload"
  413.       :on-remove="handleRemove"
  414.       :on-success="handleUploadSuccess"
  415.       :on-preview="handlePreview"
  416.       :limit="maxCount"
  417.       :on-exceed="handleExceed"
  418.       :show-file-list="showFile"
  419.     >
  420.       <i ></i>
  421.     </el-upload>      List imagesEntities =<el-upload
  422.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  423.       :data="dataObj"
  424.       :list-type="listType"
  425.       :file-list="fileList"
  426.       :before-upload="beforeUpload"
  427.       :on-remove="handleRemove"
  428.       :on-success="handleUploadSuccess"
  429.       :on-preview="handlePreview"
  430.       :limit="maxCount"
  431.       :on-exceed="handleExceed"
  432.       :show-file-list="showFile"
  433.     >
  434.       <i ></i>
  435.     </el-upload><el-upload
  436.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  437.       :data="dataObj"
  438.       :list-type="listType"
  439.       :file-list="fileList"
  440.       :before-upload="beforeUpload"
  441.       :on-remove="handleRemove"
  442.       :on-success="handleUploadSuccess"
  443.       :on-preview="handlePreview"
  444.       :limit="maxCount"
  445.       :on-exceed="handleExceed"
  446.       :show-file-list="showFile"
  447.     >
  448.       <i ></i>
  449.     </el-upload>    item.getImages().stream().map(img -> {//取出当前 item (就是一个 spk)的信息,组装成 一个 SkuImagesEntity, 进行保存<el-upload
  450.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  451.       :data="dataObj"
  452.       :list-type="listType"
  453.       :file-list="fileList"
  454.       :before-upload="beforeUpload"
  455.       :on-remove="handleRemove"
  456.       :on-success="handleUploadSuccess"
  457.       :on-preview="handlePreview"
  458.       :limit="maxCount"
  459.       :on-exceed="handleExceed"
  460.       :show-file-list="showFile"
  461.     >
  462.       <i ></i>
  463.     </el-upload><el-upload
  464.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  465.       :data="dataObj"
  466.       :list-type="listType"
  467.       :file-list="fileList"
  468.       :before-upload="beforeUpload"
  469.       :on-remove="handleRemove"
  470.       :on-success="handleUploadSuccess"
  471.       :on-preview="handlePreview"
  472.       :limit="maxCount"
  473.       :on-exceed="handleExceed"
  474.       :show-file-list="showFile"
  475.     >
  476.       <i ></i>
  477.     </el-upload>        SkuImagesEntity skuImagesEntity = new SkuImagesEntity();<el-upload
  478.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  479.       :data="dataObj"
  480.       :list-type="listType"
  481.       :file-list="fileList"
  482.       :before-upload="beforeUpload"
  483.       :on-remove="handleRemove"
  484.       :on-success="handleUploadSuccess"
  485.       :on-preview="handlePreview"
  486.       :limit="maxCount"
  487.       :on-exceed="handleExceed"
  488.       :show-file-list="showFile"
  489.     >
  490.       <i ></i>
  491.     </el-upload><el-upload
  492.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  493.       :data="dataObj"
  494.       :list-type="listType"
  495.       :file-list="fileList"
  496.       :before-upload="beforeUpload"
  497.       :on-remove="handleRemove"
  498.       :on-success="handleUploadSuccess"
  499.       :on-preview="handlePreview"
  500.       :limit="maxCount"
  501.       :on-exceed="handleExceed"
  502.       :show-file-list="showFile"
  503.     >
  504.       <i ></i>
  505.     </el-upload>        skuImagesEntity.setSkuId(skuId);<el-upload
  506.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  507.       :data="dataObj"
  508.       :list-type="listType"
  509.       :file-list="fileList"
  510.       :before-upload="beforeUpload"
  511.       :on-remove="handleRemove"
  512.       :on-success="handleUploadSuccess"
  513.       :on-preview="handlePreview"
  514.       :limit="maxCount"
  515.       :on-exceed="handleExceed"
  516.       :show-file-list="showFile"
  517.     >
  518.       <i ></i>
  519.     </el-upload><el-upload
  520.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  521.       :data="dataObj"
  522.       :list-type="listType"
  523.       :file-list="fileList"
  524.       :before-upload="beforeUpload"
  525.       :on-remove="handleRemove"
  526.       :on-success="handleUploadSuccess"
  527.       :on-preview="handlePreview"
  528.       :limit="maxCount"
  529.       :on-exceed="handleExceed"
  530.       :show-file-list="showFile"
  531.     >
  532.       <i ></i>
  533.     </el-upload>        skuImagesEntity.setImgUrl(img.getImgUrl());<el-upload
  534.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  535.       :data="dataObj"
  536.       :list-type="listType"
  537.       :file-list="fileList"
  538.       :before-upload="beforeUpload"
  539.       :on-remove="handleRemove"
  540.       :on-success="handleUploadSuccess"
  541.       :on-preview="handlePreview"
  542.       :limit="maxCount"
  543.       :on-exceed="handleExceed"
  544.       :show-file-list="showFile"
  545.     >
  546.       <i ></i>
  547.     </el-upload><el-upload
  548.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  549.       :data="dataObj"
  550.       :list-type="listType"
  551.       :file-list="fileList"
  552.       :before-upload="beforeUpload"
  553.       :on-remove="handleRemove"
  554.       :on-success="handleUploadSuccess"
  555.       :on-preview="handlePreview"
  556.       :limit="maxCount"
  557.       :on-exceed="handleExceed"
  558.       :show-file-list="showFile"
  559.     >
  560.       <i ></i>
  561.     </el-upload>        skuImagesEntity.setDefaultImg(img.getDefaultImg());<el-upload
  562.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  563.       :data="dataObj"
  564.       :list-type="listType"
  565.       :file-list="fileList"
  566.       :before-upload="beforeUpload"
  567.       :on-remove="handleRemove"
  568.       :on-success="handleUploadSuccess"
  569.       :on-preview="handlePreview"
  570.       :limit="maxCount"
  571.       :on-exceed="handleExceed"
  572.       :show-file-list="showFile"
  573.     >
  574.       <i ></i>
  575.     </el-upload><el-upload
  576.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  577.       :data="dataObj"
  578.       :list-type="listType"
  579.       :file-list="fileList"
  580.       :before-upload="beforeUpload"
  581.       :on-remove="handleRemove"
  582.       :on-success="handleUploadSuccess"
  583.       :on-preview="handlePreview"
  584.       :limit="maxCount"
  585.       :on-exceed="handleExceed"
  586.       :show-file-list="showFile"
  587.     >
  588.       <i ></i>
  589.     </el-upload>        return skuImagesEntity;<el-upload
  590.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  591.       :data="dataObj"
  592.       :list-type="listType"
  593.       :file-list="fileList"
  594.       :before-upload="beforeUpload"
  595.       :on-remove="handleRemove"
  596.       :on-success="handleUploadSuccess"
  597.       :on-preview="handlePreview"
  598.       :limit="maxCount"
  599.       :on-exceed="handleExceed"
  600.       :show-file-list="showFile"
  601.     >
  602.       <i ></i>
  603.     </el-upload><el-upload
  604.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  605.       :data="dataObj"
  606.       :list-type="listType"
  607.       :file-list="fileList"
  608.       :before-upload="beforeUpload"
  609.       :on-remove="handleRemove"
  610.       :on-success="handleUploadSuccess"
  611.       :on-preview="handlePreview"
  612.       :limit="maxCount"
  613.       :on-exceed="handleExceed"
  614.       :show-file-list="showFile"
  615.     >
  616.       <i ></i>
  617.     </el-upload>    }).filter(entity -> {//如果 image 为 empty ,就不过滤掉, 返回 true 就是必要,false 就是剔除<el-upload
  618.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  619.       :data="dataObj"
  620.       :list-type="listType"
  621.       :file-list="fileList"
  622.       :before-upload="beforeUpload"
  623.       :on-remove="handleRemove"
  624.       :on-success="handleUploadSuccess"
  625.       :on-preview="handlePreview"
  626.       :limit="maxCount"
  627.       :on-exceed="handleExceed"
  628.       :show-file-list="showFile"
  629.     >
  630.       <i ></i>
  631.     </el-upload><el-upload
  632.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  633.       :data="dataObj"
  634.       :list-type="listType"
  635.       :file-list="fileList"
  636.       :before-upload="beforeUpload"
  637.       :on-remove="handleRemove"
  638.       :on-success="handleUploadSuccess"
  639.       :on-preview="handlePreview"
  640.       :limit="maxCount"
  641.       :on-exceed="handleExceed"
  642.       :show-file-list="showFile"
  643.     >
  644.       <i ></i>
  645.     </el-upload>        return !StringUtils.isEmpty(entity.getImgUrl());<el-upload
  646.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  647.       :data="dataObj"
  648.       :list-type="listType"
  649.       :file-list="fileList"
  650.       :before-upload="beforeUpload"
  651.       :on-remove="handleRemove"
  652.       :on-success="handleUploadSuccess"
  653.       :on-preview="handlePreview"
  654.       :limit="maxCount"
  655.       :on-exceed="handleExceed"
  656.       :show-file-list="showFile"
  657.     >
  658.       <i ></i>
  659.     </el-upload><el-upload
  660.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  661.       :data="dataObj"
  662.       :list-type="listType"
  663.       :file-list="fileList"
  664.       :before-upload="beforeUpload"
  665.       :on-remove="handleRemove"
  666.       :on-success="handleUploadSuccess"
  667.       :on-preview="handlePreview"
  668.       :limit="maxCount"
  669.       :on-exceed="handleExceed"
  670.       :show-file-list="showFile"
  671.     >
  672.       <i ></i>
  673.     </el-upload>    }).collect(Collectors.toList());<el-upload
  674.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  675.       :data="dataObj"
  676.       :list-type="listType"
  677.       :file-list="fileList"
  678.       :before-upload="beforeUpload"
  679.       :on-remove="handleRemove"
  680.       :on-success="handleUploadSuccess"
  681.       :on-preview="handlePreview"
  682.       :limit="maxCount"
  683.       :on-exceed="handleExceed"
  684.       :show-file-list="showFile"
  685.     >
  686.       <i ></i>
  687.     </el-upload>      skuImagesService.saveBatch(imagesEntities);//保存 sku 的图片信息;到 commodity_sku_images end<el-upload
  688.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  689.       :data="dataObj"
  690.       :list-type="listType"
  691.       :file-list="fileList"
  692.       :before-upload="beforeUpload"
  693.       :on-remove="handleRemove"
  694.       :on-success="handleUploadSuccess"
  695.       :on-preview="handlePreview"
  696.       :limit="maxCount"
  697.       :on-exceed="handleExceed"
  698.       :show-file-list="showFile"
  699.     >
  700.       <i ></i>
  701.     </el-upload>  });        }    }//    @Transactional//    @Override//    public void saveSpuInfo(SpuSaveVO spuSaveVO) {//        //1、保存 spu 基本信息 , 对应的表 commodity_spu_info//        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();//        BeanUtils.copyProperties(spuSaveVO, spuInfoEntity);//        spuInfoEntity.setCreateTime(new Date());//        spuInfoEntity.setUpdateTime(new Date());////SpuInfoEntity 信息保存到 commodity_spu_info//        this.saveBaseSpuInfo(spuInfoEntity);////2、保存 Spu 的描述图片路径 commodity_spu_info_desc//        List decript = spuSaveVO.getDecript();//        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();////获取到刚刚保存的 spu 基本信息对应的 id//        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());////留意:这里有可能没有图片, 可以设置一个默认图片//        if (decript.size() == 0) {//<el-upload
  702.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  703.       :data="dataObj"
  704.       :list-type="listType"
  705.       :file-list="fileList"
  706.       :before-upload="beforeUpload"
  707.       :on-remove="handleRemove"
  708.       :on-success="handleUploadSuccess"
  709.       :on-preview="handlePreview"
  710.       :limit="maxCount"
  711.       :on-exceed="handleExceed"
  712.       :show-file-list="showFile"
  713.     >
  714.       <i ></i>
  715.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");//        } else {//<el-upload
  716.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  717.       :data="dataObj"
  718.       :list-type="listType"
  719.       :file-list="fileList"
  720.       :before-upload="beforeUpload"
  721.       :on-remove="handleRemove"
  722.       :on-success="handleUploadSuccess"
  723.       :on-preview="handlePreview"
  724.       :limit="maxCount"
  725.       :on-exceed="handleExceed"
  726.       :show-file-list="showFile"
  727.     >
  728.       <i ></i>
  729.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));//        }////保存到 commodity_spu_info_desc, 这个方法时我们完成//        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);////        //3、保存 spu 的图片集 commodity_spu_images//        List images = spuSaveVO.getImages();////获取到刚刚保存的 spu 基本信息对应的 id//        imagesService.saveImages(spuInfoEntity.getId(), images);////4、保存 spu 的基本属性(一个 spu 可以有多个基本属性/规格参数)://// commodity_product_attr_value//        List baseAttrs = spuSaveVO.getBaseAttrs();//        List collect = baseAttrs.stream().map(attr -> {//<el-upload
  730.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  731.       :data="dataObj"
  732.       :list-type="listType"
  733.       :file-list="fileList"
  734.       :before-upload="beforeUpload"
  735.       :on-remove="handleRemove"
  736.       :on-success="handleUploadSuccess"
  737.       :on-preview="handlePreview"
  738.       :limit="maxCount"
  739.       :on-exceed="handleExceed"
  740.       :show-file-list="showFile"
  741.     >
  742.       <i ></i>
  743.     </el-upload>  ProductAttrValueEntity valueEntity = new ProductAttrValueEntity();//<el-upload
  744.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  745.       :data="dataObj"
  746.       :list-type="listType"
  747.       :file-list="fileList"
  748.       :before-upload="beforeUpload"
  749.       :on-remove="handleRemove"
  750.       :on-success="handleUploadSuccess"
  751.       :on-preview="handlePreview"
  752.       :limit="maxCount"
  753.       :on-exceed="handleExceed"
  754.       :show-file-list="showFile"
  755.     >
  756.       <i ></i>
  757.     </el-upload>  valueEntity.setAttrId(attr.getAttrId());//<el-upload
  758.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  759.       :data="dataObj"
  760.       :list-type="listType"
  761.       :file-list="fileList"
  762.       :before-upload="beforeUpload"
  763.       :on-remove="handleRemove"
  764.       :on-success="handleUploadSuccess"
  765.       :on-preview="handlePreview"
  766.       :limit="maxCount"
  767.       :on-exceed="handleExceed"
  768.       :show-file-list="showFile"
  769.     >
  770.       <i ></i>
  771.     </el-upload>  AttrEntity id = attrService.getById(attr.getAttrId());//<el-upload
  772.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  773.       :data="dataObj"
  774.       :list-type="listType"
  775.       :file-list="fileList"
  776.       :before-upload="beforeUpload"
  777.       :on-remove="handleRemove"
  778.       :on-success="handleUploadSuccess"
  779.       :on-preview="handlePreview"
  780.       :limit="maxCount"
  781.       :on-exceed="handleExceed"
  782.       :show-file-list="showFile"
  783.     >
  784.       <i ></i>
  785.     </el-upload>  valueEntity.setAttrName(id.getAttrName());//<el-upload
  786.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  787.       :data="dataObj"
  788.       :list-type="listType"
  789.       :file-list="fileList"
  790.       :before-upload="beforeUpload"
  791.       :on-remove="handleRemove"
  792.       :on-success="handleUploadSuccess"
  793.       :on-preview="handlePreview"
  794.       :limit="maxCount"
  795.       :on-exceed="handleExceed"
  796.       :show-file-list="showFile"
  797.     >
  798.       <i ></i>
  799.     </el-upload>  valueEntity.setAttrValue(attr.getAttrValues());//<el-upload
  800.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  801.       :data="dataObj"
  802.       :list-type="listType"
  803.       :file-list="fileList"
  804.       :before-upload="beforeUpload"
  805.       :on-remove="handleRemove"
  806.       :on-success="handleUploadSuccess"
  807.       :on-preview="handlePreview"
  808.       :limit="maxCount"
  809.       :on-exceed="handleExceed"
  810.       :show-file-list="showFile"
  811.     >
  812.       <i ></i>
  813.     </el-upload>  valueEntity.setQuickShow(attr.getShowDesc());//<el-upload
  814.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  815.       :data="dataObj"
  816.       :list-type="listType"
  817.       :file-list="fileList"
  818.       :before-upload="beforeUpload"
  819.       :on-remove="handleRemove"
  820.       :on-success="handleUploadSuccess"
  821.       :on-preview="handlePreview"
  822.       :limit="maxCount"
  823.       :on-exceed="handleExceed"
  824.       :show-file-list="showFile"
  825.     >
  826.       <i ></i>
  827.     </el-upload>  valueEntity.setSpuId(spuInfoEntity.getId());//<el-upload
  828.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  829.       :data="dataObj"
  830.       :list-type="listType"
  831.       :file-list="fileList"
  832.       :before-upload="beforeUpload"
  833.       :on-remove="handleRemove"
  834.       :on-success="handleUploadSuccess"
  835.       :on-preview="handlePreview"
  836.       :limit="maxCount"
  837.       :on-exceed="handleExceed"
  838.       :show-file-list="showFile"
  839.     >
  840.       <i ></i>
  841.     </el-upload>  return valueEntity;//        }).collect(Collectors.toList());//        productAttrValueService.saveProductAttr(collect);////        //5、保存当前 spu 对应的全部 sku 信息;一个 spu 可以 对应多个 sku,//// 组成一个可以销售的商品信息////留意 Images 类在 vo 包下, 确保有@Data 修饰//        List skus = spuSaveVO.getSkus();//        if(skus!=null && skus.size()>0){//<el-upload
  842.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  843.       :data="dataObj"
  844.       :list-type="listType"
  845.       :file-list="fileList"
  846.       :before-upload="beforeUpload"
  847.       :on-remove="handleRemove"
  848.       :on-success="handleUploadSuccess"
  849.       :on-preview="handlePreview"
  850.       :limit="maxCount"
  851.       :on-exceed="handleExceed"
  852.       :show-file-list="showFile"
  853.     >
  854.       <i ></i>
  855.     </el-upload>  skus.forEach(item->{//<el-upload
  856.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  857.       :data="dataObj"
  858.       :list-type="listType"
  859.       :file-list="fileList"
  860.       :before-upload="beforeUpload"
  861.       :on-remove="handleRemove"
  862.       :on-success="handleUploadSuccess"
  863.       :on-preview="handlePreview"
  864.       :limit="maxCount"
  865.       :on-exceed="handleExceed"
  866.       :show-file-list="showFile"
  867.     >
  868.       <i ></i>
  869.     </el-upload>      String defaultImg = "default.jpg";////json 会提交很多图片,如果是当前这个 sku 的默认图片就先保存下 url//<el-upload
  870.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  871.       :data="dataObj"
  872.       :list-type="listType"
  873.       :file-list="fileList"
  874.       :before-upload="beforeUpload"
  875.       :on-remove="handleRemove"
  876.       :on-success="handleUploadSuccess"
  877.       :on-preview="handlePreview"
  878.       :limit="maxCount"
  879.       :on-exceed="handleExceed"
  880.       :show-file-list="showFile"
  881.     >
  882.       <i ></i>
  883.     </el-upload>      for (Images image : item.getImages()) {//<el-upload
  884.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  885.       :data="dataObj"
  886.       :list-type="listType"
  887.       :file-list="fileList"
  888.       :before-upload="beforeUpload"
  889.       :on-remove="handleRemove"
  890.       :on-success="handleUploadSuccess"
  891.       :on-preview="handlePreview"
  892.       :limit="maxCount"
  893.       :on-exceed="handleExceed"
  894.       :show-file-list="showFile"
  895.     >
  896.       <i ></i>
  897.     </el-upload><el-upload
  898.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  899.       :data="dataObj"
  900.       :list-type="listType"
  901.       :file-list="fileList"
  902.       :before-upload="beforeUpload"
  903.       :on-remove="handleRemove"
  904.       :on-success="handleUploadSuccess"
  905.       :on-preview="handlePreview"
  906.       :limit="maxCount"
  907.       :on-exceed="handleExceed"
  908.       :show-file-list="showFile"
  909.     >
  910.       <i ></i>
  911.     </el-upload>if(image.getDefaultImg() == 1){//<el-upload
  912.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  913.       :data="dataObj"
  914.       :list-type="listType"
  915.       :file-list="fileList"
  916.       :before-upload="beforeUpload"
  917.       :on-remove="handleRemove"
  918.       :on-success="handleUploadSuccess"
  919.       :on-preview="handlePreview"
  920.       :limit="maxCount"
  921.       :on-exceed="handleExceed"
  922.       :show-file-list="showFile"
  923.     >
  924.       <i ></i>
  925.     </el-upload><el-upload
  926.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  927.       :data="dataObj"
  928.       :list-type="listType"
  929.       :file-list="fileList"
  930.       :before-upload="beforeUpload"
  931.       :on-remove="handleRemove"
  932.       :on-success="handleUploadSuccess"
  933.       :on-preview="handlePreview"
  934.       :limit="maxCount"
  935.       :on-exceed="handleExceed"
  936.       :show-file-list="showFile"
  937.     >
  938.       <i ></i>
  939.     </el-upload>    defaultImg = image.getImgUrl();//<el-upload
  940.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  941.       :data="dataObj"
  942.       :list-type="listType"
  943.       :file-list="fileList"
  944.       :before-upload="beforeUpload"
  945.       :on-remove="handleRemove"
  946.       :on-success="handleUploadSuccess"
  947.       :on-preview="handlePreview"
  948.       :limit="maxCount"
  949.       :on-exceed="handleExceed"
  950.       :show-file-list="showFile"
  951.     >
  952.       <i ></i>
  953.     </el-upload><el-upload
  954.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  955.       :data="dataObj"
  956.       :list-type="listType"
  957.       :file-list="fileList"
  958.       :before-upload="beforeUpload"
  959.       :on-remove="handleRemove"
  960.       :on-success="handleUploadSuccess"
  961.       :on-preview="handlePreview"
  962.       :limit="maxCount"
  963.       :on-exceed="handleExceed"
  964.       :show-file-list="showFile"
  965.     >
  966.       <i ></i>
  967.     </el-upload>}//<el-upload
  968.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  969.       :data="dataObj"
  970.       :list-type="listType"
  971.       :file-list="fileList"
  972.       :before-upload="beforeUpload"
  973.       :on-remove="handleRemove"
  974.       :on-success="handleUploadSuccess"
  975.       :on-preview="handlePreview"
  976.       :limit="maxCount"
  977.       :on-exceed="handleExceed"
  978.       :show-file-list="showFile"
  979.     >
  980.       <i ></i>
  981.     </el-upload>      }//<el-upload
  982.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  983.       :data="dataObj"
  984.       :list-type="listType"
  985.       :file-list="fileList"
  986.       :before-upload="beforeUpload"
  987.       :on-remove="handleRemove"
  988.       :on-success="handleUploadSuccess"
  989.       :on-preview="handlePreview"
  990.       :limit="maxCount"
  991.       :on-exceed="handleExceed"
  992.       :show-file-list="showFile"
  993.     >
  994.       <i ></i>
  995.     </el-upload>      SkuInfoEntity skuInfoEntity = new SkuInfoEntity();////把 item 中的信息拷贝给 skuInfoEntity//<el-upload
  996.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  997.       :data="dataObj"
  998.       :list-type="listType"
  999.       :file-list="fileList"
  1000.       :before-upload="beforeUpload"
  1001.       :on-remove="handleRemove"
  1002.       :on-success="handleUploadSuccess"
  1003.       :on-preview="handlePreview"
  1004.       :limit="maxCount"
  1005.       :on-exceed="handleExceed"
  1006.       :show-file-list="showFile"
  1007.     >
  1008.       <i ></i>
  1009.     </el-upload>      BeanUtils.copyProperties(item,skuInfoEntity);////item 中没有信息,但是 skuInfoEntity 必要的信息,////可以从 spuInfoEntity 中获取//<el-upload
  1010.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1011.       :data="dataObj"
  1012.       :list-type="listType"
  1013.       :file-list="fileList"
  1014.       :before-upload="beforeUpload"
  1015.       :on-remove="handleRemove"
  1016.       :on-success="handleUploadSuccess"
  1017.       :on-preview="handlePreview"
  1018.       :limit="maxCount"
  1019.       :on-exceed="handleExceed"
  1020.       :show-file-list="showFile"
  1021.     >
  1022.       <i ></i>
  1023.     </el-upload>      skuInfoEntity.setBrandId(spuInfoEntity.getBrandId());//<el-upload
  1024.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1025.       :data="dataObj"
  1026.       :list-type="listType"
  1027.       :file-list="fileList"
  1028.       :before-upload="beforeUpload"
  1029.       :on-remove="handleRemove"
  1030.       :on-success="handleUploadSuccess"
  1031.       :on-preview="handlePreview"
  1032.       :limit="maxCount"
  1033.       :on-exceed="handleExceed"
  1034.       :show-file-list="showFile"
  1035.     >
  1036.       <i ></i>
  1037.     </el-upload>      skuInfoEntity.setCatalogId(spuInfoEntity.getCatalogId());//<el-upload
  1038.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1039.       :data="dataObj"
  1040.       :list-type="listType"
  1041.       :file-list="fileList"
  1042.       :before-upload="beforeUpload"
  1043.       :on-remove="handleRemove"
  1044.       :on-success="handleUploadSuccess"
  1045.       :on-preview="handlePreview"
  1046.       :limit="maxCount"
  1047.       :on-exceed="handleExceed"
  1048.       :show-file-list="showFile"
  1049.     >
  1050.       <i ></i>
  1051.     </el-upload>      skuInfoEntity.setSaleCount(0L);//初始化销量为 0//<el-upload
  1052.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1053.       :data="dataObj"
  1054.       :list-type="listType"
  1055.       :file-list="fileList"
  1056.       :before-upload="beforeUpload"
  1057.       :on-remove="handleRemove"
  1058.       :on-success="handleUploadSuccess"
  1059.       :on-preview="handlePreview"
  1060.       :limit="maxCount"
  1061.       :on-exceed="handleExceed"
  1062.       :show-file-list="showFile"
  1063.     >
  1064.       <i ></i>
  1065.     </el-upload>      skuInfoEntity.setSpuId(spuInfoEntity.getId());//<el-upload
  1066.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1067.       :data="dataObj"
  1068.       :list-type="listType"
  1069.       :file-list="fileList"
  1070.       :before-upload="beforeUpload"
  1071.       :on-remove="handleRemove"
  1072.       :on-success="handleUploadSuccess"
  1073.       :on-preview="handlePreview"
  1074.       :limit="maxCount"
  1075.       :on-exceed="handleExceed"
  1076.       :show-file-list="showFile"
  1077.     >
  1078.       <i ></i>
  1079.     </el-upload>      skuInfoEntity.setSkuDefaultImg(defaultImg);////1)、保存 sku 的基本信息;到 commodity_sku_info//<el-upload
  1080.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1081.       :data="dataObj"
  1082.       :list-type="listType"
  1083.       :file-list="fileList"
  1084.       :before-upload="beforeUpload"
  1085.       :on-remove="handleRemove"
  1086.       :on-success="handleUploadSuccess"
  1087.       :on-preview="handlePreview"
  1088.       :limit="maxCount"
  1089.       :on-exceed="handleExceed"
  1090.       :show-file-list="showFile"
  1091.     >
  1092.       <i ></i>
  1093.     </el-upload>      skuInfoService.saveSkuInfo(skuInfoEntity);//<el-upload
  1094.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1095.       :data="dataObj"
  1096.       :list-type="listType"
  1097.       :file-list="fileList"
  1098.       :before-upload="beforeUpload"
  1099.       :on-remove="handleRemove"
  1100.       :on-success="handleUploadSuccess"
  1101.       :on-preview="handlePreview"
  1102.       :limit="maxCount"
  1103.       :on-exceed="handleExceed"
  1104.       :show-file-list="showFile"
  1105.     >
  1106.       <i ></i>
  1107.     </el-upload>  });//        }//    }//    @Transactional//    @Override//    public void saveSpuInfo(SpuSaveVO spuSaveVO) {//        //1、保存 spu 基本信息 , 对应的表 commodity_spu_info//        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();//        BeanUtils.copyProperties(spuSaveVO, spuInfoEntity);//        spuInfoEntity.setCreateTime(new Date());//        spuInfoEntity.setUpdateTime(new Date());////SpuInfoEntity 信息保存到 commodity_spu_info//        this.saveBaseSpuInfo(spuInfoEntity);////2、保存 Spu 的描述图片路径 commodity_spu_info_desc//        List decript = spuSaveVO.getDecript();//        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();////获取到刚刚保存的 spu 基本信息对应的 id//        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());////留意:这里有可能没有图片, 可以设置一个默认图片//        if (decript.size() == 0) {//<el-upload
  1108.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1109.       :data="dataObj"
  1110.       :list-type="listType"
  1111.       :file-list="fileList"
  1112.       :before-upload="beforeUpload"
  1113.       :on-remove="handleRemove"
  1114.       :on-success="handleUploadSuccess"
  1115.       :on-preview="handlePreview"
  1116.       :limit="maxCount"
  1117.       :on-exceed="handleExceed"
  1118.       :show-file-list="showFile"
  1119.     >
  1120.       <i ></i>
  1121.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");//        } else {//<el-upload
  1122.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1123.       :data="dataObj"
  1124.       :list-type="listType"
  1125.       :file-list="fileList"
  1126.       :before-upload="beforeUpload"
  1127.       :on-remove="handleRemove"
  1128.       :on-success="handleUploadSuccess"
  1129.       :on-preview="handlePreview"
  1130.       :limit="maxCount"
  1131.       :on-exceed="handleExceed"
  1132.       :show-file-list="showFile"
  1133.     >
  1134.       <i ></i>
  1135.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));//        }////保存到 commodity_spu_info_desc, 这个方法时我们完成//        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);//        //3、保存 spu 的图片集 commodity_spu_images//        List images = spuSaveVO.getImages();////获取到刚刚保存的 spu 基本信息对应的 id//        imagesService.saveImages(spuInfoEntity.getId(), images);////4、保存 spu 的基本属性(一个 spu 可以有多个基本属性/规格参数)://// commodity_product_attr_value//        List baseAttrs = spuSaveVO.getBaseAttrs();//        List collect = baseAttrs.stream().map(attr -> {//<el-upload
  1136.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1137.       :data="dataObj"
  1138.       :list-type="listType"
  1139.       :file-list="fileList"
  1140.       :before-upload="beforeUpload"
  1141.       :on-remove="handleRemove"
  1142.       :on-success="handleUploadSuccess"
  1143.       :on-preview="handlePreview"
  1144.       :limit="maxCount"
  1145.       :on-exceed="handleExceed"
  1146.       :show-file-list="showFile"
  1147.     >
  1148.       <i ></i>
  1149.     </el-upload>  ProductAttrValueEntity valueEntity = new ProductAttrValueEntity();//<el-upload
  1150.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1151.       :data="dataObj"
  1152.       :list-type="listType"
  1153.       :file-list="fileList"
  1154.       :before-upload="beforeUpload"
  1155.       :on-remove="handleRemove"
  1156.       :on-success="handleUploadSuccess"
  1157.       :on-preview="handlePreview"
  1158.       :limit="maxCount"
  1159.       :on-exceed="handleExceed"
  1160.       :show-file-list="showFile"
  1161.     >
  1162.       <i ></i>
  1163.     </el-upload>  valueEntity.setAttrId(attr.getAttrId());//<el-upload
  1164.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1165.       :data="dataObj"
  1166.       :list-type="listType"
  1167.       :file-list="fileList"
  1168.       :before-upload="beforeUpload"
  1169.       :on-remove="handleRemove"
  1170.       :on-success="handleUploadSuccess"
  1171.       :on-preview="handlePreview"
  1172.       :limit="maxCount"
  1173.       :on-exceed="handleExceed"
  1174.       :show-file-list="showFile"
  1175.     >
  1176.       <i ></i>
  1177.     </el-upload>  AttrEntity id = attrService.getById(attr.getAttrId());//<el-upload
  1178.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1179.       :data="dataObj"
  1180.       :list-type="listType"
  1181.       :file-list="fileList"
  1182.       :before-upload="beforeUpload"
  1183.       :on-remove="handleRemove"
  1184.       :on-success="handleUploadSuccess"
  1185.       :on-preview="handlePreview"
  1186.       :limit="maxCount"
  1187.       :on-exceed="handleExceed"
  1188.       :show-file-list="showFile"
  1189.     >
  1190.       <i ></i>
  1191.     </el-upload>  valueEntity.setAttrName(id.getAttrName());//<el-upload
  1192.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1193.       :data="dataObj"
  1194.       :list-type="listType"
  1195.       :file-list="fileList"
  1196.       :before-upload="beforeUpload"
  1197.       :on-remove="handleRemove"
  1198.       :on-success="handleUploadSuccess"
  1199.       :on-preview="handlePreview"
  1200.       :limit="maxCount"
  1201.       :on-exceed="handleExceed"
  1202.       :show-file-list="showFile"
  1203.     >
  1204.       <i ></i>
  1205.     </el-upload>  valueEntity.setAttrValue(attr.getAttrValues());//<el-upload
  1206.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1207.       :data="dataObj"
  1208.       :list-type="listType"
  1209.       :file-list="fileList"
  1210.       :before-upload="beforeUpload"
  1211.       :on-remove="handleRemove"
  1212.       :on-success="handleUploadSuccess"
  1213.       :on-preview="handlePreview"
  1214.       :limit="maxCount"
  1215.       :on-exceed="handleExceed"
  1216.       :show-file-list="showFile"
  1217.     >
  1218.       <i ></i>
  1219.     </el-upload>  valueEntity.setQuickShow(attr.getShowDesc());//<el-upload
  1220.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1221.       :data="dataObj"
  1222.       :list-type="listType"
  1223.       :file-list="fileList"
  1224.       :before-upload="beforeUpload"
  1225.       :on-remove="handleRemove"
  1226.       :on-success="handleUploadSuccess"
  1227.       :on-preview="handlePreview"
  1228.       :limit="maxCount"
  1229.       :on-exceed="handleExceed"
  1230.       :show-file-list="showFile"
  1231.     >
  1232.       <i ></i>
  1233.     </el-upload>  valueEntity.setSpuId(spuInfoEntity.getId());//<el-upload
  1234.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1235.       :data="dataObj"
  1236.       :list-type="listType"
  1237.       :file-list="fileList"
  1238.       :before-upload="beforeUpload"
  1239.       :on-remove="handleRemove"
  1240.       :on-success="handleUploadSuccess"
  1241.       :on-preview="handlePreview"
  1242.       :limit="maxCount"
  1243.       :on-exceed="handleExceed"
  1244.       :show-file-list="showFile"
  1245.     >
  1246.       <i ></i>
  1247.     </el-upload>  return valueEntity;//        }).collect(Collectors.toList());//        productAttrValueService.saveProductAttr(collect);//    }    //因为有多个添加操作,使用事务控制//    @Transactional//    @Override//    public void saveSpuInfo(SpuSaveVO spuSaveVO) {////1、保存 spu 基本信息 , 对应的表 commodity_spu_info//        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();//        BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);//        spuInfoEntity.setCreateTime(new Date());//        spuInfoEntity.setUpdateTime(new Date());////SpuInfoEntity 信息保存到 commodity_spu_info//        this.saveBaseSpuInfo(spuInfoEntity);////2、保存 Spu 的描述图片路径 commodity_spu_info_desc//        List decript = spuSaveVO.getDecript();//        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();////获取到刚刚保存的 spu 基本信息对应的 id//        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());////留意:这里有可能没有图片, 可以设置一个默认图片//        if(decript.size() == 0) {//<el-upload
  1248.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1249.       :data="dataObj"
  1250.       :list-type="listType"
  1251.       :file-list="fileList"
  1252.       :before-upload="beforeUpload"
  1253.       :on-remove="handleRemove"
  1254.       :on-success="handleUploadSuccess"
  1255.       :on-preview="handlePreview"
  1256.       :limit="maxCount"
  1257.       :on-exceed="handleExceed"
  1258.       :show-file-list="showFile"
  1259.     >
  1260.       <i ></i>
  1261.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");//        }else {//<el-upload
  1262.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1263.       :data="dataObj"
  1264.       :list-type="listType"
  1265.       :file-list="fileList"
  1266.       :before-upload="beforeUpload"
  1267.       :on-remove="handleRemove"
  1268.       :on-success="handleUploadSuccess"
  1269.       :on-preview="handlePreview"
  1270.       :limit="maxCount"
  1271.       :on-exceed="handleExceed"
  1272.       :show-file-list="showFile"
  1273.     >
  1274.       <i ></i>
  1275.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));//        }////保存到 commodity_spu_info_desc, 这个方法时我们完成//        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);////        //3、保存 spu 的图片集 commodity_spu_images//        List images = spuSaveVO.getImages();////获取到刚刚保存的 spu 基本信息对应的 id//        imagesService.saveImages(spuInfoEntity.getId(), images);//    }    @Override    public PageUtils queryPage(Map params) {        IPage page = this.page(<el-upload
  1276.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1277.       :data="dataObj"
  1278.       :list-type="listType"
  1279.       :file-list="fileList"
  1280.       :before-upload="beforeUpload"
  1281.       :on-remove="handleRemove"
  1282.       :on-success="handleUploadSuccess"
  1283.       :on-preview="handlePreview"
  1284.       :limit="maxCount"
  1285.       :on-exceed="handleExceed"
  1286.       :show-file-list="showFile"
  1287.     >
  1288.       <i ></i>
  1289.     </el-upload>      new Query().getPage(params),<el-upload
  1290.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1291.       :data="dataObj"
  1292.       :list-type="listType"
  1293.       :file-list="fileList"
  1294.       :before-upload="beforeUpload"
  1295.       :on-remove="handleRemove"
  1296.       :on-success="handleUploadSuccess"
  1297.       :on-preview="handlePreview"
  1298.       :limit="maxCount"
  1299.       :on-exceed="handleExceed"
  1300.       :show-file-list="showFile"
  1301.     >
  1302.       <i ></i>
  1303.     </el-upload>      new QueryWrapper()        );        return new PageUtils(page);    }    /**     * 保存 spu 的基本信息到 commodity_spu_info     *     * @param spuInfoEntity     */    @Override    public void saveBaseSpuInfo(SpuInfoEntity spuInfoEntity) {        this.baseMapper.insert(spuInfoEntity);    }//    @Override//    public void saveSpuInfo(SpuSaveVO spuSaveVO) {////1、保存 spu 基本信息 , 对应的表 commodity_spu_info//        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();//        BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);//        spuInfoEntity.setCreateTime(new Date());//        spuInfoEntity.setUpdateTime(new Date());////2. 将 SpuInfoEntity 信息保存到 commodity_spu_info//        this.saveBaseSpuInfo(spuInfoEntity);//    }}
复制代码


保存 sku 的销售属性
对照 JSON 数据分析
  1. # 创建保存 sku 的销售属性表
  2. /*====================================================*/
  3. /* 1.保存 sku 的销售属性/值, 一个 sku 可以有多个销售属性/值
  4. /* 2.比如 1 个 sku 有颜色(黑色)和尺寸(100*300)两个销售属性
  5. /*=====================================================*/
  6. USE hspliving_commodity
  7. CREATE TABLE commodity_sku_sale_attr_value
  8. (
  9. id BIGINT NOT NULL AUTO_INCREMENT COMMENT 'id',
  10. sku_id BIGINT COMMENT 'sku_id',
  11. attr_id BIGINT COMMENT 'attr_id',
  12. attr_name VARCHAR(200) COMMENT '销售属性名',
  13. attr_value VARCHAR(200) COMMENT '销售属性值',
  14. attr_sort INT COMMENT '顺序', PRIMARY KEY (id)
  15. )CHARSET=utf8mb4 COMMENT='sku 的销售属性/值表';
  16. SELECT * FROM commodity_sku_sale_attr_value
复制代码
  1. package com.rainbowsea.rainbowsealiving.commodity.service.impl;import com.rainbowsea.rainbowsealiving.commodity.entity.AttrEntity;import com.rainbowsea.rainbowsealiving.commodity.entity.ProductAttrValueEntity;import com.rainbowsea.rainbowsealiving.commodity.entity.SkuImagesEntity;import com.rainbowsea.rainbowsealiving.commodity.entity.SkuInfoEntity;import com.rainbowsea.rainbowsealiving.commodity.entity.SkuSaleAttrValueEntity;import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoDescEntity;import com.rainbowsea.rainbowsealiving.commodity.service.AttrService;import com.rainbowsea.rainbowsealiving.commodity.service.ProductAttrValueService;import com.rainbowsea.rainbowsealiving.commodity.service.SkuImagesService;import com.rainbowsea.rainbowsealiving.commodity.service.SkuInfoService;import com.rainbowsea.rainbowsealiving.commodity.service.SkuSaleAttrValueService;import com.rainbowsea.rainbowsealiving.commodity.service.SpuImagesService;import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoDescService;import com.rainbowsea.rainbowsealiving.commodity.vo.Attr;import com.rainbowsea.rainbowsealiving.commodity.vo.BaseAttrs;import com.rainbowsea.rainbowsealiving.commodity.vo.Images;import com.rainbowsea.rainbowsealiving.commodity.vo.Skus;import com.rainbowsea.rainbowsealiving.commodity.vo.SpuSaveVO;import org.apache.commons.lang.StringUtils;import org.springframework.beans.BeanUtils;import org.springframework.stereotype.Service;import java.util.Date;import java.util.List;import java.util.Map;import java.util.stream.Collectors;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;import com.baomidou.mybatisplus.core.metadata.IPage;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;import com.rainbowsea.common.utils.PageUtils;import com.rainbowsea.common.utils.Query;import com.rainbowsea.rainbowsealiving.commodity.dao.SpuInfoDao;import com.rainbowsea.rainbowsealiving.commodity.entity.SpuInfoEntity;import com.rainbowsea.rainbowsealiving.commodity.service.SpuInfoService;import org.springframework.transaction.annotation.Transactional;import javax.annotation.Resource;@Service("spuInfoService")public class SpuInfoServiceImpl extends ServiceImpl implements SpuInfoService {    @Resource    AttrService attrService;    @Resource    ProductAttrValueService productAttrValueService;    @Resource    SkuInfoService skuInfoService;    @Resource    SkuImagesService skuImagesService;    @Resource    SpuImagesService imagesService;    @Resource    SpuInfoDescService spuInfoDescService;    @Resource    SkuSaleAttrValueService skuSaleAttrValueService;    @Transactional    @Override    public void saveSpuInfo(SpuSaveVO spuSaveVO) {        //1、保存 spu 基本信息 , 对应的表 commodity_spu_info        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();        BeanUtils.copyProperties(spuSaveVO, spuInfoEntity);        spuInfoEntity.setCreateTime(new Date());        spuInfoEntity.setUpdateTime(new Date());//SpuInfoEntity 信息保存到 commodity_spu_info        this.saveBaseSpuInfo(spuInfoEntity);        //2、保存 Spu 的描述图片路径 commodity_spu_info_desc        List decript = spuSaveVO.getDecript();        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();//获取到刚刚保存的 spu 基本信息对应的 id        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());//留意:这里有可能没有图片, 可以设置一个默认图片        if (decript.size() == 0) {<el-upload
  2.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  3.       :data="dataObj"
  4.       :list-type="listType"
  5.       :file-list="fileList"
  6.       :before-upload="beforeUpload"
  7.       :on-remove="handleRemove"
  8.       :on-success="handleUploadSuccess"
  9.       :on-preview="handlePreview"
  10.       :limit="maxCount"
  11.       :on-exceed="handleExceed"
  12.       :show-file-list="showFile"
  13.     >
  14.       <i ></i>
  15.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");        } else {<el-upload
  16.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  17.       :data="dataObj"
  18.       :list-type="listType"
  19.       :file-list="fileList"
  20.       :before-upload="beforeUpload"
  21.       :on-remove="handleRemove"
  22.       :on-success="handleUploadSuccess"
  23.       :on-preview="handlePreview"
  24.       :limit="maxCount"
  25.       :on-exceed="handleExceed"
  26.       :show-file-list="showFile"
  27.     >
  28.       <i ></i>
  29.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));        }//保存到 commodity_spu_info_desc, 这个方法时我们完成        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);//3、保存 spu 的图片集 commodity_spu_images        List images = spuSaveVO.getImages();//获取到刚刚保存的 spu 基本信息对应的 id        imagesService.saveImages(spuInfoEntity.getId(), images);//4 、 保 存 spu 的 基 本 属 性 ( 一 个 spu 可 以 有 多 个 基 本 属 性 / 规 格 参 数 ):commodity_product_attr_value        List baseAttrs = spuSaveVO.getBaseAttrs();        List collect = baseAttrs.stream().map(attr -> {<el-upload
  30.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  31.       :data="dataObj"
  32.       :list-type="listType"
  33.       :file-list="fileList"
  34.       :before-upload="beforeUpload"
  35.       :on-remove="handleRemove"
  36.       :on-success="handleUploadSuccess"
  37.       :on-preview="handlePreview"
  38.       :limit="maxCount"
  39.       :on-exceed="handleExceed"
  40.       :show-file-list="showFile"
  41.     >
  42.       <i ></i>
  43.     </el-upload>  ProductAttrValueEntity valueEntity = new ProductAttrValueEntity();<el-upload
  44.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  45.       :data="dataObj"
  46.       :list-type="listType"
  47.       :file-list="fileList"
  48.       :before-upload="beforeUpload"
  49.       :on-remove="handleRemove"
  50.       :on-success="handleUploadSuccess"
  51.       :on-preview="handlePreview"
  52.       :limit="maxCount"
  53.       :on-exceed="handleExceed"
  54.       :show-file-list="showFile"
  55.     >
  56.       <i ></i>
  57.     </el-upload>  valueEntity.setAttrId(attr.getAttrId());<el-upload
  58.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  59.       :data="dataObj"
  60.       :list-type="listType"
  61.       :file-list="fileList"
  62.       :before-upload="beforeUpload"
  63.       :on-remove="handleRemove"
  64.       :on-success="handleUploadSuccess"
  65.       :on-preview="handlePreview"
  66.       :limit="maxCount"
  67.       :on-exceed="handleExceed"
  68.       :show-file-list="showFile"
  69.     >
  70.       <i ></i>
  71.     </el-upload>  AttrEntity id = attrService.getById(attr.getAttrId());<el-upload
  72.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  73.       :data="dataObj"
  74.       :list-type="listType"
  75.       :file-list="fileList"
  76.       :before-upload="beforeUpload"
  77.       :on-remove="handleRemove"
  78.       :on-success="handleUploadSuccess"
  79.       :on-preview="handlePreview"
  80.       :limit="maxCount"
  81.       :on-exceed="handleExceed"
  82.       :show-file-list="showFile"
  83.     >
  84.       <i ></i>
  85.     </el-upload>  valueEntity.setAttrName(id.getAttrName());<el-upload
  86.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  87.       :data="dataObj"
  88.       :list-type="listType"
  89.       :file-list="fileList"
  90.       :before-upload="beforeUpload"
  91.       :on-remove="handleRemove"
  92.       :on-success="handleUploadSuccess"
  93.       :on-preview="handlePreview"
  94.       :limit="maxCount"
  95.       :on-exceed="handleExceed"
  96.       :show-file-list="showFile"
  97.     >
  98.       <i ></i>
  99.     </el-upload>  valueEntity.setAttrValue(attr.getAttrValues());<el-upload
  100.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  101.       :data="dataObj"
  102.       :list-type="listType"
  103.       :file-list="fileList"
  104.       :before-upload="beforeUpload"
  105.       :on-remove="handleRemove"
  106.       :on-success="handleUploadSuccess"
  107.       :on-preview="handlePreview"
  108.       :limit="maxCount"
  109.       :on-exceed="handleExceed"
  110.       :show-file-list="showFile"
  111.     >
  112.       <i ></i>
  113.     </el-upload>  valueEntity.setQuickShow(attr.getShowDesc());<el-upload
  114.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  115.       :data="dataObj"
  116.       :list-type="listType"
  117.       :file-list="fileList"
  118.       :before-upload="beforeUpload"
  119.       :on-remove="handleRemove"
  120.       :on-success="handleUploadSuccess"
  121.       :on-preview="handlePreview"
  122.       :limit="maxCount"
  123.       :on-exceed="handleExceed"
  124.       :show-file-list="showFile"
  125.     >
  126.       <i ></i>
  127.     </el-upload>  valueEntity.setSpuId(spuInfoEntity.getId());<el-upload
  128.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  129.       :data="dataObj"
  130.       :list-type="listType"
  131.       :file-list="fileList"
  132.       :before-upload="beforeUpload"
  133.       :on-remove="handleRemove"
  134.       :on-success="handleUploadSuccess"
  135.       :on-preview="handlePreview"
  136.       :limit="maxCount"
  137.       :on-exceed="handleExceed"
  138.       :show-file-list="showFile"
  139.     >
  140.       <i ></i>
  141.     </el-upload>  return valueEntity;        }).collect(Collectors.toList());        productAttrValueService.saveProductAttr(collect);        //5、保存当前 spu 对应的全部 sku 信息;一个 spu 可以 对应多个 sku, 组成一个可以销售的商品信息        List skus = spuSaveVO.getSkus();        if (skus != null && skus.size() > 0) {<el-upload
  142.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  143.       :data="dataObj"
  144.       :list-type="listType"
  145.       :file-list="fileList"
  146.       :before-upload="beforeUpload"
  147.       :on-remove="handleRemove"
  148.       :on-success="handleUploadSuccess"
  149.       :on-preview="handlePreview"
  150.       :limit="maxCount"
  151.       :on-exceed="handleExceed"
  152.       :show-file-list="showFile"
  153.     >
  154.       <i ></i>
  155.     </el-upload>  skus.forEach(item -> {<el-upload
  156.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  157.       :data="dataObj"
  158.       :list-type="listType"
  159.       :file-list="fileList"
  160.       :before-upload="beforeUpload"
  161.       :on-remove="handleRemove"
  162.       :on-success="handleUploadSuccess"
  163.       :on-preview="handlePreview"
  164.       :limit="maxCount"
  165.       :on-exceed="handleExceed"
  166.       :show-file-list="showFile"
  167.     >
  168.       <i ></i>
  169.     </el-upload>      String defaultImg = "default.jpg";<el-upload
  170.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  171.       :data="dataObj"
  172.       :list-type="listType"
  173.       :file-list="fileList"
  174.       :before-upload="beforeUpload"
  175.       :on-remove="handleRemove"
  176.       :on-success="handleUploadSuccess"
  177.       :on-preview="handlePreview"
  178.       :limit="maxCount"
  179.       :on-exceed="handleExceed"
  180.       :show-file-list="showFile"
  181.     >
  182.       <i ></i>
  183.     </el-upload>      //json 会提交很多图片,如果是当前这个 sku 的默认图片就先保存下 url<el-upload
  184.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  185.       :data="dataObj"
  186.       :list-type="listType"
  187.       :file-list="fileList"
  188.       :before-upload="beforeUpload"
  189.       :on-remove="handleRemove"
  190.       :on-success="handleUploadSuccess"
  191.       :on-preview="handlePreview"
  192.       :limit="maxCount"
  193.       :on-exceed="handleExceed"
  194.       :show-file-list="showFile"
  195.     >
  196.       <i ></i>
  197.     </el-upload>      for (Images image : item.getImages()) {<el-upload
  198.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  199.       :data="dataObj"
  200.       :list-type="listType"
  201.       :file-list="fileList"
  202.       :before-upload="beforeUpload"
  203.       :on-remove="handleRemove"
  204.       :on-success="handleUploadSuccess"
  205.       :on-preview="handlePreview"
  206.       :limit="maxCount"
  207.       :on-exceed="handleExceed"
  208.       :show-file-list="showFile"
  209.     >
  210.       <i ></i>
  211.     </el-upload><el-upload
  212.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  213.       :data="dataObj"
  214.       :list-type="listType"
  215.       :file-list="fileList"
  216.       :before-upload="beforeUpload"
  217.       :on-remove="handleRemove"
  218.       :on-success="handleUploadSuccess"
  219.       :on-preview="handlePreview"
  220.       :limit="maxCount"
  221.       :on-exceed="handleExceed"
  222.       :show-file-list="showFile"
  223.     >
  224.       <i ></i>
  225.     </el-upload>if (image.getDefaultImg() == 1) {<el-upload
  226.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  227.       :data="dataObj"
  228.       :list-type="listType"
  229.       :file-list="fileList"
  230.       :before-upload="beforeUpload"
  231.       :on-remove="handleRemove"
  232.       :on-success="handleUploadSuccess"
  233.       :on-preview="handlePreview"
  234.       :limit="maxCount"
  235.       :on-exceed="handleExceed"
  236.       :show-file-list="showFile"
  237.     >
  238.       <i ></i>
  239.     </el-upload><el-upload
  240.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  241.       :data="dataObj"
  242.       :list-type="listType"
  243.       :file-list="fileList"
  244.       :before-upload="beforeUpload"
  245.       :on-remove="handleRemove"
  246.       :on-success="handleUploadSuccess"
  247.       :on-preview="handlePreview"
  248.       :limit="maxCount"
  249.       :on-exceed="handleExceed"
  250.       :show-file-list="showFile"
  251.     >
  252.       <i ></i>
  253.     </el-upload>    defaultImg = image.getImgUrl();<el-upload
  254.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  255.       :data="dataObj"
  256.       :list-type="listType"
  257.       :file-list="fileList"
  258.       :before-upload="beforeUpload"
  259.       :on-remove="handleRemove"
  260.       :on-success="handleUploadSuccess"
  261.       :on-preview="handlePreview"
  262.       :limit="maxCount"
  263.       :on-exceed="handleExceed"
  264.       :show-file-list="showFile"
  265.     >
  266.       <i ></i>
  267.     </el-upload><el-upload
  268.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  269.       :data="dataObj"
  270.       :list-type="listType"
  271.       :file-list="fileList"
  272.       :before-upload="beforeUpload"
  273.       :on-remove="handleRemove"
  274.       :on-success="handleUploadSuccess"
  275.       :on-preview="handlePreview"
  276.       :limit="maxCount"
  277.       :on-exceed="handleExceed"
  278.       :show-file-list="showFile"
  279.     >
  280.       <i ></i>
  281.     </el-upload>}<el-upload
  282.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  283.       :data="dataObj"
  284.       :list-type="listType"
  285.       :file-list="fileList"
  286.       :before-upload="beforeUpload"
  287.       :on-remove="handleRemove"
  288.       :on-success="handleUploadSuccess"
  289.       :on-preview="handlePreview"
  290.       :limit="maxCount"
  291.       :on-exceed="handleExceed"
  292.       :show-file-list="showFile"
  293.     >
  294.       <i ></i>
  295.     </el-upload>      }//保存 sku 的基本信息;到 commodity_sku_info start<el-upload
  296.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  297.       :data="dataObj"
  298.       :list-type="listType"
  299.       :file-list="fileList"
  300.       :before-upload="beforeUpload"
  301.       :on-remove="handleRemove"
  302.       :on-success="handleUploadSuccess"
  303.       :on-preview="handlePreview"
  304.       :limit="maxCount"
  305.       :on-exceed="handleExceed"
  306.       :show-file-list="showFile"
  307.     >
  308.       <i ></i>
  309.     </el-upload>      SkuInfoEntity skuInfoEntity = new SkuInfoEntity();//把 item 中的信息拷贝给 skuInfoEntity<el-upload
  310.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  311.       :data="dataObj"
  312.       :list-type="listType"
  313.       :file-list="fileList"
  314.       :before-upload="beforeUpload"
  315.       :on-remove="handleRemove"
  316.       :on-success="handleUploadSuccess"
  317.       :on-preview="handlePreview"
  318.       :limit="maxCount"
  319.       :on-exceed="handleExceed"
  320.       :show-file-list="showFile"
  321.     >
  322.       <i ></i>
  323.     </el-upload>      BeanUtils.copyProperties(item, skuInfoEntity);//item 中没有信息,但是 skuInfoEntity 必要的信息,可以从 spuInfoEntity 中获取<el-upload
  324.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  325.       :data="dataObj"
  326.       :list-type="listType"
  327.       :file-list="fileList"
  328.       :before-upload="beforeUpload"
  329.       :on-remove="handleRemove"
  330.       :on-success="handleUploadSuccess"
  331.       :on-preview="handlePreview"
  332.       :limit="maxCount"
  333.       :on-exceed="handleExceed"
  334.       :show-file-list="showFile"
  335.     >
  336.       <i ></i>
  337.     </el-upload>      skuInfoEntity.setBrandId(spuInfoEntity.getBrandId());<el-upload
  338.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  339.       :data="dataObj"
  340.       :list-type="listType"
  341.       :file-list="fileList"
  342.       :before-upload="beforeUpload"
  343.       :on-remove="handleRemove"
  344.       :on-success="handleUploadSuccess"
  345.       :on-preview="handlePreview"
  346.       :limit="maxCount"
  347.       :on-exceed="handleExceed"
  348.       :show-file-list="showFile"
  349.     >
  350.       <i ></i>
  351.     </el-upload>      skuInfoEntity.setCatalogId(spuInfoEntity.getCatalogId());<el-upload
  352.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  353.       :data="dataObj"
  354.       :list-type="listType"
  355.       :file-list="fileList"
  356.       :before-upload="beforeUpload"
  357.       :on-remove="handleRemove"
  358.       :on-success="handleUploadSuccess"
  359.       :on-preview="handlePreview"
  360.       :limit="maxCount"
  361.       :on-exceed="handleExceed"
  362.       :show-file-list="showFile"
  363.     >
  364.       <i ></i>
  365.     </el-upload>      skuInfoEntity.setSaleCount(0L);//初始化销量为 0<el-upload
  366.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  367.       :data="dataObj"
  368.       :list-type="listType"
  369.       :file-list="fileList"
  370.       :before-upload="beforeUpload"
  371.       :on-remove="handleRemove"
  372.       :on-success="handleUploadSuccess"
  373.       :on-preview="handlePreview"
  374.       :limit="maxCount"
  375.       :on-exceed="handleExceed"
  376.       :show-file-list="showFile"
  377.     >
  378.       <i ></i>
  379.     </el-upload>      skuInfoEntity.setSpuId(spuInfoEntity.getId());<el-upload
  380.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  381.       :data="dataObj"
  382.       :list-type="listType"
  383.       :file-list="fileList"
  384.       :before-upload="beforeUpload"
  385.       :on-remove="handleRemove"
  386.       :on-success="handleUploadSuccess"
  387.       :on-preview="handlePreview"
  388.       :limit="maxCount"
  389.       :on-exceed="handleExceed"
  390.       :show-file-list="showFile"
  391.     >
  392.       <i ></i>
  393.     </el-upload>      skuInfoEntity.setSkuDefaultImg(defaultImg);<el-upload
  394.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  395.       :data="dataObj"
  396.       :list-type="listType"
  397.       :file-list="fileList"
  398.       :before-upload="beforeUpload"
  399.       :on-remove="handleRemove"
  400.       :on-success="handleUploadSuccess"
  401.       :on-preview="handlePreview"
  402.       :limit="maxCount"
  403.       :on-exceed="handleExceed"
  404.       :show-file-list="showFile"
  405.     >
  406.       <i ></i>
  407.     </el-upload>      skuInfoService.saveSkuInfo(skuInfoEntity);//保存 sku 的基本信息;到 commodity_sku_info end<el-upload
  408.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  409.       :data="dataObj"
  410.       :list-type="listType"
  411.       :file-list="fileList"
  412.       :before-upload="beforeUpload"
  413.       :on-remove="handleRemove"
  414.       :on-success="handleUploadSuccess"
  415.       :on-preview="handlePreview"
  416.       :limit="maxCount"
  417.       :on-exceed="handleExceed"
  418.       :show-file-list="showFile"
  419.     >
  420.       <i ></i>
  421.     </el-upload>      //保存 sku 的图片信息;到 commodity_sku_images start//一个 sku 可以有多张图片<el-upload
  422.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  423.       :data="dataObj"
  424.       :list-type="listType"
  425.       :file-list="fileList"
  426.       :before-upload="beforeUpload"
  427.       :on-remove="handleRemove"
  428.       :on-success="handleUploadSuccess"
  429.       :on-preview="handlePreview"
  430.       :limit="maxCount"
  431.       :on-exceed="handleExceed"
  432.       :show-file-list="showFile"
  433.     >
  434.       <i ></i>
  435.     </el-upload>      Long skuId = skuInfoEntity.getSkuId();<el-upload
  436.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  437.       :data="dataObj"
  438.       :list-type="listType"
  439.       :file-list="fileList"
  440.       :before-upload="beforeUpload"
  441.       :on-remove="handleRemove"
  442.       :on-success="handleUploadSuccess"
  443.       :on-preview="handlePreview"
  444.       :limit="maxCount"
  445.       :on-exceed="handleExceed"
  446.       :show-file-list="showFile"
  447.     >
  448.       <i ></i>
  449.     </el-upload>      List imagesEntities = item.getImages().stream().map(img -><el-upload
  450.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  451.       :data="dataObj"
  452.       :list-type="listType"
  453.       :file-list="fileList"
  454.       :before-upload="beforeUpload"
  455.       :on-remove="handleRemove"
  456.       :on-success="handleUploadSuccess"
  457.       :on-preview="handlePreview"
  458.       :limit="maxCount"
  459.       :on-exceed="handleExceed"
  460.       :show-file-list="showFile"
  461.     >
  462.       <i ></i>
  463.     </el-upload>      {//取出当前 item (就是一个 spk)的信息,组装成 一个 SkuImagesEntity, 进行保存<el-upload
  464.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  465.       :data="dataObj"
  466.       :list-type="listType"
  467.       :file-list="fileList"
  468.       :before-upload="beforeUpload"
  469.       :on-remove="handleRemove"
  470.       :on-success="handleUploadSuccess"
  471.       :on-preview="handlePreview"
  472.       :limit="maxCount"
  473.       :on-exceed="handleExceed"
  474.       :show-file-list="showFile"
  475.     >
  476.       <i ></i>
  477.     </el-upload><el-upload
  478.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  479.       :data="dataObj"
  480.       :list-type="listType"
  481.       :file-list="fileList"
  482.       :before-upload="beforeUpload"
  483.       :on-remove="handleRemove"
  484.       :on-success="handleUploadSuccess"
  485.       :on-preview="handlePreview"
  486.       :limit="maxCount"
  487.       :on-exceed="handleExceed"
  488.       :show-file-list="showFile"
  489.     >
  490.       <i ></i>
  491.     </el-upload>SkuImagesEntity skuImagesEntity = new SkuImagesEntity();<el-upload
  492.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  493.       :data="dataObj"
  494.       :list-type="listType"
  495.       :file-list="fileList"
  496.       :before-upload="beforeUpload"
  497.       :on-remove="handleRemove"
  498.       :on-success="handleUploadSuccess"
  499.       :on-preview="handlePreview"
  500.       :limit="maxCount"
  501.       :on-exceed="handleExceed"
  502.       :show-file-list="showFile"
  503.     >
  504.       <i ></i>
  505.     </el-upload><el-upload
  506.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  507.       :data="dataObj"
  508.       :list-type="listType"
  509.       :file-list="fileList"
  510.       :before-upload="beforeUpload"
  511.       :on-remove="handleRemove"
  512.       :on-success="handleUploadSuccess"
  513.       :on-preview="handlePreview"
  514.       :limit="maxCount"
  515.       :on-exceed="handleExceed"
  516.       :show-file-list="showFile"
  517.     >
  518.       <i ></i>
  519.     </el-upload>skuImagesEntity.setSkuId(skuId);<el-upload
  520.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  521.       :data="dataObj"
  522.       :list-type="listType"
  523.       :file-list="fileList"
  524.       :before-upload="beforeUpload"
  525.       :on-remove="handleRemove"
  526.       :on-success="handleUploadSuccess"
  527.       :on-preview="handlePreview"
  528.       :limit="maxCount"
  529.       :on-exceed="handleExceed"
  530.       :show-file-list="showFile"
  531.     >
  532.       <i ></i>
  533.     </el-upload><el-upload
  534.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  535.       :data="dataObj"
  536.       :list-type="listType"
  537.       :file-list="fileList"
  538.       :before-upload="beforeUpload"
  539.       :on-remove="handleRemove"
  540.       :on-success="handleUploadSuccess"
  541.       :on-preview="handlePreview"
  542.       :limit="maxCount"
  543.       :on-exceed="handleExceed"
  544.       :show-file-list="showFile"
  545.     >
  546.       <i ></i>
  547.     </el-upload>skuImagesEntity.setImgUrl(img.getImgUrl());<el-upload
  548.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  549.       :data="dataObj"
  550.       :list-type="listType"
  551.       :file-list="fileList"
  552.       :before-upload="beforeUpload"
  553.       :on-remove="handleRemove"
  554.       :on-success="handleUploadSuccess"
  555.       :on-preview="handlePreview"
  556.       :limit="maxCount"
  557.       :on-exceed="handleExceed"
  558.       :show-file-list="showFile"
  559.     >
  560.       <i ></i>
  561.     </el-upload><el-upload
  562.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  563.       :data="dataObj"
  564.       :list-type="listType"
  565.       :file-list="fileList"
  566.       :before-upload="beforeUpload"
  567.       :on-remove="handleRemove"
  568.       :on-success="handleUploadSuccess"
  569.       :on-preview="handlePreview"
  570.       :limit="maxCount"
  571.       :on-exceed="handleExceed"
  572.       :show-file-list="showFile"
  573.     >
  574.       <i ></i>
  575.     </el-upload>skuImagesEntity.setDefaultImg(img.getDefaultImg());<el-upload
  576.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  577.       :data="dataObj"
  578.       :list-type="listType"
  579.       :file-list="fileList"
  580.       :before-upload="beforeUpload"
  581.       :on-remove="handleRemove"
  582.       :on-success="handleUploadSuccess"
  583.       :on-preview="handlePreview"
  584.       :limit="maxCount"
  585.       :on-exceed="handleExceed"
  586.       :show-file-list="showFile"
  587.     >
  588.       <i ></i>
  589.     </el-upload><el-upload
  590.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  591.       :data="dataObj"
  592.       :list-type="listType"
  593.       :file-list="fileList"
  594.       :before-upload="beforeUpload"
  595.       :on-remove="handleRemove"
  596.       :on-success="handleUploadSuccess"
  597.       :on-preview="handlePreview"
  598.       :limit="maxCount"
  599.       :on-exceed="handleExceed"
  600.       :show-file-list="showFile"
  601.     >
  602.       <i ></i>
  603.     </el-upload>return skuImagesEntity;<el-upload
  604.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  605.       :data="dataObj"
  606.       :list-type="listType"
  607.       :file-list="fileList"
  608.       :before-upload="beforeUpload"
  609.       :on-remove="handleRemove"
  610.       :on-success="handleUploadSuccess"
  611.       :on-preview="handlePreview"
  612.       :limit="maxCount"
  613.       :on-exceed="handleExceed"
  614.       :show-file-list="showFile"
  615.     >
  616.       <i ></i>
  617.     </el-upload>      }).filter(entity -> {//如果 image 为 empty ,就不过滤掉, 返回 true 就是必要,false 就是剔除<el-upload
  618.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  619.       :data="dataObj"
  620.       :list-type="listType"
  621.       :file-list="fileList"
  622.       :before-upload="beforeUpload"
  623.       :on-remove="handleRemove"
  624.       :on-success="handleUploadSuccess"
  625.       :on-preview="handlePreview"
  626.       :limit="maxCount"
  627.       :on-exceed="handleExceed"
  628.       :show-file-list="showFile"
  629.     >
  630.       <i ></i>
  631.     </el-upload><el-upload
  632.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  633.       :data="dataObj"
  634.       :list-type="listType"
  635.       :file-list="fileList"
  636.       :before-upload="beforeUpload"
  637.       :on-remove="handleRemove"
  638.       :on-success="handleUploadSuccess"
  639.       :on-preview="handlePreview"
  640.       :limit="maxCount"
  641.       :on-exceed="handleExceed"
  642.       :show-file-list="showFile"
  643.     >
  644.       <i ></i>
  645.     </el-upload>return !StringUtils.isEmpty(entity.getImgUrl());<el-upload
  646.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  647.       :data="dataObj"
  648.       :list-type="listType"
  649.       :file-list="fileList"
  650.       :before-upload="beforeUpload"
  651.       :on-remove="handleRemove"
  652.       :on-success="handleUploadSuccess"
  653.       :on-preview="handlePreview"
  654.       :limit="maxCount"
  655.       :on-exceed="handleExceed"
  656.       :show-file-list="showFile"
  657.     >
  658.       <i ></i>
  659.     </el-upload>      }).collect(Collectors.toList());<el-upload
  660.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  661.       :data="dataObj"
  662.       :list-type="listType"
  663.       :file-list="fileList"
  664.       :before-upload="beforeUpload"
  665.       :on-remove="handleRemove"
  666.       :on-success="handleUploadSuccess"
  667.       :on-preview="handlePreview"
  668.       :limit="maxCount"
  669.       :on-exceed="handleExceed"
  670.       :show-file-list="showFile"
  671.     >
  672.       <i ></i>
  673.     </el-upload>      skuImagesService.saveBatch(imagesEntities);//保存 sku 的图片信息;到 commodity_sku_images end//保存 sku 的销售属性-值到 commodity_sku_sale_attr_value start<el-upload
  674.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  675.       :data="dataObj"
  676.       :list-type="listType"
  677.       :file-list="fileList"
  678.       :before-upload="beforeUpload"
  679.       :on-remove="handleRemove"
  680.       :on-success="handleUploadSuccess"
  681.       :on-preview="handlePreview"
  682.       :limit="maxCount"
  683.       :on-exceed="handleExceed"
  684.       :show-file-list="showFile"
  685.     >
  686.       <i ></i>
  687.     </el-upload>      List attr = item.getAttr();<el-upload
  688.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  689.       :data="dataObj"
  690.       :list-type="listType"
  691.       :file-list="fileList"
  692.       :before-upload="beforeUpload"
  693.       :on-remove="handleRemove"
  694.       :on-success="handleUploadSuccess"
  695.       :on-preview="handlePreview"
  696.       :limit="maxCount"
  697.       :on-exceed="handleExceed"
  698.       :show-file-list="showFile"
  699.     >
  700.       <i ></i>
  701.     </el-upload>      List skuSaleAttrValueEntities =<el-upload
  702.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  703.       :data="dataObj"
  704.       :list-type="listType"
  705.       :file-list="fileList"
  706.       :before-upload="beforeUpload"
  707.       :on-remove="handleRemove"
  708.       :on-success="handleUploadSuccess"
  709.       :on-preview="handlePreview"
  710.       :limit="maxCount"
  711.       :on-exceed="handleExceed"
  712.       :show-file-list="showFile"
  713.     >
  714.       <i ></i>
  715.     </el-upload><el-upload
  716.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  717.       :data="dataObj"
  718.       :list-type="listType"
  719.       :file-list="fileList"
  720.       :before-upload="beforeUpload"
  721.       :on-remove="handleRemove"
  722.       :on-success="handleUploadSuccess"
  723.       :on-preview="handlePreview"
  724.       :limit="maxCount"
  725.       :on-exceed="handleExceed"
  726.       :show-file-list="showFile"
  727.     >
  728.       <i ></i>
  729.     </el-upload>    attr.stream().map(a -> {<el-upload
  730.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  731.       :data="dataObj"
  732.       :list-type="listType"
  733.       :file-list="fileList"
  734.       :before-upload="beforeUpload"
  735.       :on-remove="handleRemove"
  736.       :on-success="handleUploadSuccess"
  737.       :on-preview="handlePreview"
  738.       :limit="maxCount"
  739.       :on-exceed="handleExceed"
  740.       :show-file-list="showFile"
  741.     >
  742.       <i ></i>
  743.     </el-upload><el-upload
  744.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  745.       :data="dataObj"
  746.       :list-type="listType"
  747.       :file-list="fileList"
  748.       :before-upload="beforeUpload"
  749.       :on-remove="handleRemove"
  750.       :on-success="handleUploadSuccess"
  751.       :on-preview="handlePreview"
  752.       :limit="maxCount"
  753.       :on-exceed="handleExceed"
  754.       :show-file-list="showFile"
  755.     >
  756.       <i ></i>
  757.     </el-upload>        SkuSaleAttrValueEntity attrValueEntity = new<el-upload
  758.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  759.       :data="dataObj"
  760.       :list-type="listType"
  761.       :file-list="fileList"
  762.       :before-upload="beforeUpload"
  763.       :on-remove="handleRemove"
  764.       :on-success="handleUploadSuccess"
  765.       :on-preview="handlePreview"
  766.       :limit="maxCount"
  767.       :on-exceed="handleExceed"
  768.       :show-file-list="showFile"
  769.     >
  770.       <i ></i>
  771.     </el-upload><el-upload
  772.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  773.       :data="dataObj"
  774.       :list-type="listType"
  775.       :file-list="fileList"
  776.       :before-upload="beforeUpload"
  777.       :on-remove="handleRemove"
  778.       :on-success="handleUploadSuccess"
  779.       :on-preview="handlePreview"
  780.       :limit="maxCount"
  781.       :on-exceed="handleExceed"
  782.       :show-file-list="showFile"
  783.     >
  784.       <i ></i>
  785.     </el-upload><el-upload
  786.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  787.       :data="dataObj"
  788.       :list-type="listType"
  789.       :file-list="fileList"
  790.       :before-upload="beforeUpload"
  791.       :on-remove="handleRemove"
  792.       :on-success="handleUploadSuccess"
  793.       :on-preview="handlePreview"
  794.       :limit="maxCount"
  795.       :on-exceed="handleExceed"
  796.       :show-file-list="showFile"
  797.     >
  798.       <i ></i>
  799.     </el-upload>      SkuSaleAttrValueEntity();<el-upload
  800.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  801.       :data="dataObj"
  802.       :list-type="listType"
  803.       :file-list="fileList"
  804.       :before-upload="beforeUpload"
  805.       :on-remove="handleRemove"
  806.       :on-success="handleUploadSuccess"
  807.       :on-preview="handlePreview"
  808.       :limit="maxCount"
  809.       :on-exceed="handleExceed"
  810.       :show-file-list="showFile"
  811.     >
  812.       <i ></i>
  813.     </el-upload><el-upload
  814.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  815.       :data="dataObj"
  816.       :list-type="listType"
  817.       :file-list="fileList"
  818.       :before-upload="beforeUpload"
  819.       :on-remove="handleRemove"
  820.       :on-success="handleUploadSuccess"
  821.       :on-preview="handlePreview"
  822.       :limit="maxCount"
  823.       :on-exceed="handleExceed"
  824.       :show-file-list="showFile"
  825.     >
  826.       <i ></i>
  827.     </el-upload>        BeanUtils.copyProperties(a, attrValueEntity);<el-upload
  828.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  829.       :data="dataObj"
  830.       :list-type="listType"
  831.       :file-list="fileList"
  832.       :before-upload="beforeUpload"
  833.       :on-remove="handleRemove"
  834.       :on-success="handleUploadSuccess"
  835.       :on-preview="handlePreview"
  836.       :limit="maxCount"
  837.       :on-exceed="handleExceed"
  838.       :show-file-list="showFile"
  839.     >
  840.       <i ></i>
  841.     </el-upload><el-upload
  842.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  843.       :data="dataObj"
  844.       :list-type="listType"
  845.       :file-list="fileList"
  846.       :before-upload="beforeUpload"
  847.       :on-remove="handleRemove"
  848.       :on-success="handleUploadSuccess"
  849.       :on-preview="handlePreview"
  850.       :limit="maxCount"
  851.       :on-exceed="handleExceed"
  852.       :show-file-list="showFile"
  853.     >
  854.       <i ></i>
  855.     </el-upload>        attrValueEntity.setSkuId(skuId);<el-upload
  856.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  857.       :data="dataObj"
  858.       :list-type="listType"
  859.       :file-list="fileList"
  860.       :before-upload="beforeUpload"
  861.       :on-remove="handleRemove"
  862.       :on-success="handleUploadSuccess"
  863.       :on-preview="handlePreview"
  864.       :limit="maxCount"
  865.       :on-exceed="handleExceed"
  866.       :show-file-list="showFile"
  867.     >
  868.       <i ></i>
  869.     </el-upload><el-upload
  870.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  871.       :data="dataObj"
  872.       :list-type="listType"
  873.       :file-list="fileList"
  874.       :before-upload="beforeUpload"
  875.       :on-remove="handleRemove"
  876.       :on-success="handleUploadSuccess"
  877.       :on-preview="handlePreview"
  878.       :limit="maxCount"
  879.       :on-exceed="handleExceed"
  880.       :show-file-list="showFile"
  881.     >
  882.       <i ></i>
  883.     </el-upload>        return attrValueEntity;<el-upload
  884.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  885.       :data="dataObj"
  886.       :list-type="listType"
  887.       :file-list="fileList"
  888.       :before-upload="beforeUpload"
  889.       :on-remove="handleRemove"
  890.       :on-success="handleUploadSuccess"
  891.       :on-preview="handlePreview"
  892.       :limit="maxCount"
  893.       :on-exceed="handleExceed"
  894.       :show-file-list="showFile"
  895.     >
  896.       <i ></i>
  897.     </el-upload><el-upload
  898.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  899.       :data="dataObj"
  900.       :list-type="listType"
  901.       :file-list="fileList"
  902.       :before-upload="beforeUpload"
  903.       :on-remove="handleRemove"
  904.       :on-success="handleUploadSuccess"
  905.       :on-preview="handlePreview"
  906.       :limit="maxCount"
  907.       :on-exceed="handleExceed"
  908.       :show-file-list="showFile"
  909.     >
  910.       <i ></i>
  911.     </el-upload>    }).collect(Collectors.toList());<el-upload
  912.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  913.       :data="dataObj"
  914.       :list-type="listType"
  915.       :file-list="fileList"
  916.       :before-upload="beforeUpload"
  917.       :on-remove="handleRemove"
  918.       :on-success="handleUploadSuccess"
  919.       :on-preview="handlePreview"
  920.       :limit="maxCount"
  921.       :on-exceed="handleExceed"
  922.       :show-file-list="showFile"
  923.     >
  924.       <i ></i>
  925.     </el-upload>      skuSaleAttrValueService.saveBatch(skuSaleAttrValueEntities);//保存 sku 的销售属性-值到 commodity_sku_sale_attr_value end<el-upload
  926.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  927.       :data="dataObj"
  928.       :list-type="listType"
  929.       :file-list="fileList"
  930.       :before-upload="beforeUpload"
  931.       :on-remove="handleRemove"
  932.       :on-success="handleUploadSuccess"
  933.       :on-preview="handlePreview"
  934.       :limit="maxCount"
  935.       :on-exceed="handleExceed"
  936.       :show-file-list="showFile"
  937.     >
  938.       <i ></i>
  939.     </el-upload>  });        }    }//    @Transactional//    @Override//    public void saveSpuInfo(SpuSaveVO spuSaveVO) {//        //1、保存 spu 基本信息 , 对应的表 commodity_spu_info//        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();//        BeanUtils.copyProperties(spuSaveVO, spuInfoEntity);//        spuInfoEntity.setCreateTime(new Date());//        spuInfoEntity.setUpdateTime(new Date());////SpuInfoEntity 信息保存到 commodity_spu_info//        this.saveBaseSpuInfo(spuInfoEntity);////2、保存 Spu 的描述图片路径 commodity_spu_info_desc//        List decript = spuSaveVO.getDecript();//        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();////获取到刚刚保存的 spu 基本信息对应的 id//        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());////留意:这里有可能没有图片, 可以设置一个默认图片//        if (decript.size() == 0) {//<el-upload
  940.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  941.       :data="dataObj"
  942.       :list-type="listType"
  943.       :file-list="fileList"
  944.       :before-upload="beforeUpload"
  945.       :on-remove="handleRemove"
  946.       :on-success="handleUploadSuccess"
  947.       :on-preview="handlePreview"
  948.       :limit="maxCount"
  949.       :on-exceed="handleExceed"
  950.       :show-file-list="showFile"
  951.     >
  952.       <i ></i>
  953.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");//        } else {//<el-upload
  954.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  955.       :data="dataObj"
  956.       :list-type="listType"
  957.       :file-list="fileList"
  958.       :before-upload="beforeUpload"
  959.       :on-remove="handleRemove"
  960.       :on-success="handleUploadSuccess"
  961.       :on-preview="handlePreview"
  962.       :limit="maxCount"
  963.       :on-exceed="handleExceed"
  964.       :show-file-list="showFile"
  965.     >
  966.       <i ></i>
  967.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));//        }////保存到 commodity_spu_info_desc, 这个方法时我们完成//        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);//        //3、保存 spu 的图片集 commodity_spu_images//        List images = spuSaveVO.getImages();////获取到刚刚保存的 spu 基本信息对应的 id//        imagesService.saveImages(spuInfoEntity.getId(), images);////4 、 保 存 spu 的 基 本 属 性 ( 一 个 spu 可 以 有 多 个 基 本 属 性 / 规 格 参 数 ):commodity_product_attr_value//        List baseAttrs = spuSaveVO.getBaseAttrs();//        List collect = baseAttrs.stream().map(attr -> {//<el-upload
  968.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  969.       :data="dataObj"
  970.       :list-type="listType"
  971.       :file-list="fileList"
  972.       :before-upload="beforeUpload"
  973.       :on-remove="handleRemove"
  974.       :on-success="handleUploadSuccess"
  975.       :on-preview="handlePreview"
  976.       :limit="maxCount"
  977.       :on-exceed="handleExceed"
  978.       :show-file-list="showFile"
  979.     >
  980.       <i ></i>
  981.     </el-upload>  ProductAttrValueEntity valueEntity = new ProductAttrValueEntity();//<el-upload
  982.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  983.       :data="dataObj"
  984.       :list-type="listType"
  985.       :file-list="fileList"
  986.       :before-upload="beforeUpload"
  987.       :on-remove="handleRemove"
  988.       :on-success="handleUploadSuccess"
  989.       :on-preview="handlePreview"
  990.       :limit="maxCount"
  991.       :on-exceed="handleExceed"
  992.       :show-file-list="showFile"
  993.     >
  994.       <i ></i>
  995.     </el-upload>  valueEntity.setAttrId(attr.getAttrId());//<el-upload
  996.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  997.       :data="dataObj"
  998.       :list-type="listType"
  999.       :file-list="fileList"
  1000.       :before-upload="beforeUpload"
  1001.       :on-remove="handleRemove"
  1002.       :on-success="handleUploadSuccess"
  1003.       :on-preview="handlePreview"
  1004.       :limit="maxCount"
  1005.       :on-exceed="handleExceed"
  1006.       :show-file-list="showFile"
  1007.     >
  1008.       <i ></i>
  1009.     </el-upload>  AttrEntity id = attrService.getById(attr.getAttrId());//<el-upload
  1010.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1011.       :data="dataObj"
  1012.       :list-type="listType"
  1013.       :file-list="fileList"
  1014.       :before-upload="beforeUpload"
  1015.       :on-remove="handleRemove"
  1016.       :on-success="handleUploadSuccess"
  1017.       :on-preview="handlePreview"
  1018.       :limit="maxCount"
  1019.       :on-exceed="handleExceed"
  1020.       :show-file-list="showFile"
  1021.     >
  1022.       <i ></i>
  1023.     </el-upload>  valueEntity.setAttrName(id.getAttrName());//<el-upload
  1024.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1025.       :data="dataObj"
  1026.       :list-type="listType"
  1027.       :file-list="fileList"
  1028.       :before-upload="beforeUpload"
  1029.       :on-remove="handleRemove"
  1030.       :on-success="handleUploadSuccess"
  1031.       :on-preview="handlePreview"
  1032.       :limit="maxCount"
  1033.       :on-exceed="handleExceed"
  1034.       :show-file-list="showFile"
  1035.     >
  1036.       <i ></i>
  1037.     </el-upload>  valueEntity.setAttrValue(attr.getAttrValues());//<el-upload
  1038.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1039.       :data="dataObj"
  1040.       :list-type="listType"
  1041.       :file-list="fileList"
  1042.       :before-upload="beforeUpload"
  1043.       :on-remove="handleRemove"
  1044.       :on-success="handleUploadSuccess"
  1045.       :on-preview="handlePreview"
  1046.       :limit="maxCount"
  1047.       :on-exceed="handleExceed"
  1048.       :show-file-list="showFile"
  1049.     >
  1050.       <i ></i>
  1051.     </el-upload>  valueEntity.setQuickShow(attr.getShowDesc());//<el-upload
  1052.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1053.       :data="dataObj"
  1054.       :list-type="listType"
  1055.       :file-list="fileList"
  1056.       :before-upload="beforeUpload"
  1057.       :on-remove="handleRemove"
  1058.       :on-success="handleUploadSuccess"
  1059.       :on-preview="handlePreview"
  1060.       :limit="maxCount"
  1061.       :on-exceed="handleExceed"
  1062.       :show-file-list="showFile"
  1063.     >
  1064.       <i ></i>
  1065.     </el-upload>  valueEntity.setSpuId(spuInfoEntity.getId());//<el-upload
  1066.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1067.       :data="dataObj"
  1068.       :list-type="listType"
  1069.       :file-list="fileList"
  1070.       :before-upload="beforeUpload"
  1071.       :on-remove="handleRemove"
  1072.       :on-success="handleUploadSuccess"
  1073.       :on-preview="handlePreview"
  1074.       :limit="maxCount"
  1075.       :on-exceed="handleExceed"
  1076.       :show-file-list="showFile"
  1077.     >
  1078.       <i ></i>
  1079.     </el-upload>  return valueEntity;//        }).collect(Collectors.toList());//        productAttrValueService.saveProductAttr(collect);////        //5、保存当前 spu 对应的全部 sku 信息;一个 spu 可以 对应多个 sku, 组成一个可以销售的商品信息.//        List skus = spuSaveVO.getSkus();//        if (skus != null && skus.size() > 0) {//<el-upload
  1080.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1081.       :data="dataObj"
  1082.       :list-type="listType"
  1083.       :file-list="fileList"
  1084.       :before-upload="beforeUpload"
  1085.       :on-remove="handleRemove"
  1086.       :on-success="handleUploadSuccess"
  1087.       :on-preview="handlePreview"
  1088.       :limit="maxCount"
  1089.       :on-exceed="handleExceed"
  1090.       :show-file-list="showFile"
  1091.     >
  1092.       <i ></i>
  1093.     </el-upload>  skus.forEach(item -> {//<el-upload
  1094.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1095.       :data="dataObj"
  1096.       :list-type="listType"
  1097.       :file-list="fileList"
  1098.       :before-upload="beforeUpload"
  1099.       :on-remove="handleRemove"
  1100.       :on-success="handleUploadSuccess"
  1101.       :on-preview="handlePreview"
  1102.       :limit="maxCount"
  1103.       :on-exceed="handleExceed"
  1104.       :show-file-list="showFile"
  1105.     >
  1106.       <i ></i>
  1107.     </el-upload>      String defaultImg = "default.jpg";////json 会提交很多图片,如果是当前这个 sku 的默认图片就先保存下 url//<el-upload
  1108.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1109.       :data="dataObj"
  1110.       :list-type="listType"
  1111.       :file-list="fileList"
  1112.       :before-upload="beforeUpload"
  1113.       :on-remove="handleRemove"
  1114.       :on-success="handleUploadSuccess"
  1115.       :on-preview="handlePreview"
  1116.       :limit="maxCount"
  1117.       :on-exceed="handleExceed"
  1118.       :show-file-list="showFile"
  1119.     >
  1120.       <i ></i>
  1121.     </el-upload>      for (Images image : item.getImages()) {//<el-upload
  1122.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1123.       :data="dataObj"
  1124.       :list-type="listType"
  1125.       :file-list="fileList"
  1126.       :before-upload="beforeUpload"
  1127.       :on-remove="handleRemove"
  1128.       :on-success="handleUploadSuccess"
  1129.       :on-preview="handlePreview"
  1130.       :limit="maxCount"
  1131.       :on-exceed="handleExceed"
  1132.       :show-file-list="showFile"
  1133.     >
  1134.       <i ></i>
  1135.     </el-upload><el-upload
  1136.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1137.       :data="dataObj"
  1138.       :list-type="listType"
  1139.       :file-list="fileList"
  1140.       :before-upload="beforeUpload"
  1141.       :on-remove="handleRemove"
  1142.       :on-success="handleUploadSuccess"
  1143.       :on-preview="handlePreview"
  1144.       :limit="maxCount"
  1145.       :on-exceed="handleExceed"
  1146.       :show-file-list="showFile"
  1147.     >
  1148.       <i ></i>
  1149.     </el-upload>if (image.getDefaultImg() == 1) {//<el-upload
  1150.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1151.       :data="dataObj"
  1152.       :list-type="listType"
  1153.       :file-list="fileList"
  1154.       :before-upload="beforeUpload"
  1155.       :on-remove="handleRemove"
  1156.       :on-success="handleUploadSuccess"
  1157.       :on-preview="handlePreview"
  1158.       :limit="maxCount"
  1159.       :on-exceed="handleExceed"
  1160.       :show-file-list="showFile"
  1161.     >
  1162.       <i ></i>
  1163.     </el-upload><el-upload
  1164.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1165.       :data="dataObj"
  1166.       :list-type="listType"
  1167.       :file-list="fileList"
  1168.       :before-upload="beforeUpload"
  1169.       :on-remove="handleRemove"
  1170.       :on-success="handleUploadSuccess"
  1171.       :on-preview="handlePreview"
  1172.       :limit="maxCount"
  1173.       :on-exceed="handleExceed"
  1174.       :show-file-list="showFile"
  1175.     >
  1176.       <i ></i>
  1177.     </el-upload>    defaultImg = image.getImgUrl();//<el-upload
  1178.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1179.       :data="dataObj"
  1180.       :list-type="listType"
  1181.       :file-list="fileList"
  1182.       :before-upload="beforeUpload"
  1183.       :on-remove="handleRemove"
  1184.       :on-success="handleUploadSuccess"
  1185.       :on-preview="handlePreview"
  1186.       :limit="maxCount"
  1187.       :on-exceed="handleExceed"
  1188.       :show-file-list="showFile"
  1189.     >
  1190.       <i ></i>
  1191.     </el-upload><el-upload
  1192.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1193.       :data="dataObj"
  1194.       :list-type="listType"
  1195.       :file-list="fileList"
  1196.       :before-upload="beforeUpload"
  1197.       :on-remove="handleRemove"
  1198.       :on-success="handleUploadSuccess"
  1199.       :on-preview="handlePreview"
  1200.       :limit="maxCount"
  1201.       :on-exceed="handleExceed"
  1202.       :show-file-list="showFile"
  1203.     >
  1204.       <i ></i>
  1205.     </el-upload>}//<el-upload
  1206.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1207.       :data="dataObj"
  1208.       :list-type="listType"
  1209.       :file-list="fileList"
  1210.       :before-upload="beforeUpload"
  1211.       :on-remove="handleRemove"
  1212.       :on-success="handleUploadSuccess"
  1213.       :on-preview="handlePreview"
  1214.       :limit="maxCount"
  1215.       :on-exceed="handleExceed"
  1216.       :show-file-list="showFile"
  1217.     >
  1218.       <i ></i>
  1219.     </el-upload>      }////保存 sku 的基本信息;到 commodity_sku_info start//<el-upload
  1220.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1221.       :data="dataObj"
  1222.       :list-type="listType"
  1223.       :file-list="fileList"
  1224.       :before-upload="beforeUpload"
  1225.       :on-remove="handleRemove"
  1226.       :on-success="handleUploadSuccess"
  1227.       :on-preview="handlePreview"
  1228.       :limit="maxCount"
  1229.       :on-exceed="handleExceed"
  1230.       :show-file-list="showFile"
  1231.     >
  1232.       <i ></i>
  1233.     </el-upload>      SkuInfoEntity skuInfoEntity = new SkuInfoEntity();////把 item 中的信息拷贝给 skuInfoEntity//<el-upload
  1234.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1235.       :data="dataObj"
  1236.       :list-type="listType"
  1237.       :file-list="fileList"
  1238.       :before-upload="beforeUpload"
  1239.       :on-remove="handleRemove"
  1240.       :on-success="handleUploadSuccess"
  1241.       :on-preview="handlePreview"
  1242.       :limit="maxCount"
  1243.       :on-exceed="handleExceed"
  1244.       :show-file-list="showFile"
  1245.     >
  1246.       <i ></i>
  1247.     </el-upload>      BeanUtils.copyProperties(item, skuInfoEntity);////item 中没有信息,但是 skuInfoEntity 必要的信息,可以从 spuInfoEntity 中获取//<el-upload
  1248.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1249.       :data="dataObj"
  1250.       :list-type="listType"
  1251.       :file-list="fileList"
  1252.       :before-upload="beforeUpload"
  1253.       :on-remove="handleRemove"
  1254.       :on-success="handleUploadSuccess"
  1255.       :on-preview="handlePreview"
  1256.       :limit="maxCount"
  1257.       :on-exceed="handleExceed"
  1258.       :show-file-list="showFile"
  1259.     >
  1260.       <i ></i>
  1261.     </el-upload>      skuInfoEntity.setBrandId(spuInfoEntity.getBrandId());//<el-upload
  1262.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1263.       :data="dataObj"
  1264.       :list-type="listType"
  1265.       :file-list="fileList"
  1266.       :before-upload="beforeUpload"
  1267.       :on-remove="handleRemove"
  1268.       :on-success="handleUploadSuccess"
  1269.       :on-preview="handlePreview"
  1270.       :limit="maxCount"
  1271.       :on-exceed="handleExceed"
  1272.       :show-file-list="showFile"
  1273.     >
  1274.       <i ></i>
  1275.     </el-upload>      skuInfoEntity.setCatalogId(spuInfoEntity.getCatalogId());//<el-upload
  1276.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1277.       :data="dataObj"
  1278.       :list-type="listType"
  1279.       :file-list="fileList"
  1280.       :before-upload="beforeUpload"
  1281.       :on-remove="handleRemove"
  1282.       :on-success="handleUploadSuccess"
  1283.       :on-preview="handlePreview"
  1284.       :limit="maxCount"
  1285.       :on-exceed="handleExceed"
  1286.       :show-file-list="showFile"
  1287.     >
  1288.       <i ></i>
  1289.     </el-upload>      skuInfoEntity.setSaleCount(0L);//初始化销量为 0//<el-upload
  1290.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1291.       :data="dataObj"
  1292.       :list-type="listType"
  1293.       :file-list="fileList"
  1294.       :before-upload="beforeUpload"
  1295.       :on-remove="handleRemove"
  1296.       :on-success="handleUploadSuccess"
  1297.       :on-preview="handlePreview"
  1298.       :limit="maxCount"
  1299.       :on-exceed="handleExceed"
  1300.       :show-file-list="showFile"
  1301.     >
  1302.       <i ></i>
  1303.     </el-upload>      skuInfoEntity.setSpuId(spuInfoEntity.getId());//<el-upload
  1304.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1305.       :data="dataObj"
  1306.       :list-type="listType"
  1307.       :file-list="fileList"
  1308.       :before-upload="beforeUpload"
  1309.       :on-remove="handleRemove"
  1310.       :on-success="handleUploadSuccess"
  1311.       :on-preview="handlePreview"
  1312.       :limit="maxCount"
  1313.       :on-exceed="handleExceed"
  1314.       :show-file-list="showFile"
  1315.     >
  1316.       <i ></i>
  1317.     </el-upload>      skuInfoEntity.setSkuDefaultImg(defaultImg);//<el-upload
  1318.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1319.       :data="dataObj"
  1320.       :list-type="listType"
  1321.       :file-list="fileList"
  1322.       :before-upload="beforeUpload"
  1323.       :on-remove="handleRemove"
  1324.       :on-success="handleUploadSuccess"
  1325.       :on-preview="handlePreview"
  1326.       :limit="maxCount"
  1327.       :on-exceed="handleExceed"
  1328.       :show-file-list="showFile"
  1329.     >
  1330.       <i ></i>
  1331.     </el-upload>      skuInfoService.saveSkuInfo(skuInfoEntity);////保存 sku 的基本信息;到 commodity_sku_info end////保存 sku 的图片信息;到 commodity_sku_images start////一个 sku 可以有多张图片//<el-upload
  1332.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1333.       :data="dataObj"
  1334.       :list-type="listType"
  1335.       :file-list="fileList"
  1336.       :before-upload="beforeUpload"
  1337.       :on-remove="handleRemove"
  1338.       :on-success="handleUploadSuccess"
  1339.       :on-preview="handlePreview"
  1340.       :limit="maxCount"
  1341.       :on-exceed="handleExceed"
  1342.       :show-file-list="showFile"
  1343.     >
  1344.       <i ></i>
  1345.     </el-upload>      Long skuId = skuInfoEntity.getSkuId();//<el-upload
  1346.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1347.       :data="dataObj"
  1348.       :list-type="listType"
  1349.       :file-list="fileList"
  1350.       :before-upload="beforeUpload"
  1351.       :on-remove="handleRemove"
  1352.       :on-success="handleUploadSuccess"
  1353.       :on-preview="handlePreview"
  1354.       :limit="maxCount"
  1355.       :on-exceed="handleExceed"
  1356.       :show-file-list="showFile"
  1357.     >
  1358.       <i ></i>
  1359.     </el-upload>      List imagesEntities =//<el-upload
  1360.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1361.       :data="dataObj"
  1362.       :list-type="listType"
  1363.       :file-list="fileList"
  1364.       :before-upload="beforeUpload"
  1365.       :on-remove="handleRemove"
  1366.       :on-success="handleUploadSuccess"
  1367.       :on-preview="handlePreview"
  1368.       :limit="maxCount"
  1369.       :on-exceed="handleExceed"
  1370.       :show-file-list="showFile"
  1371.     >
  1372.       <i ></i>
  1373.     </el-upload><el-upload
  1374.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1375.       :data="dataObj"
  1376.       :list-type="listType"
  1377.       :file-list="fileList"
  1378.       :before-upload="beforeUpload"
  1379.       :on-remove="handleRemove"
  1380.       :on-success="handleUploadSuccess"
  1381.       :on-preview="handlePreview"
  1382.       :limit="maxCount"
  1383.       :on-exceed="handleExceed"
  1384.       :show-file-list="showFile"
  1385.     >
  1386.       <i ></i>
  1387.     </el-upload>    item.getImages().stream().map(img -> {////取出当前 item (就是一个 spk)的信息,组装成 一个 SkuImagesEntity, 进行保存////<el-upload
  1388.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1389.       :data="dataObj"
  1390.       :list-type="listType"
  1391.       :file-list="fileList"
  1392.       :before-upload="beforeUpload"
  1393.       :on-remove="handleRemove"
  1394.       :on-success="handleUploadSuccess"
  1395.       :on-preview="handlePreview"
  1396.       :limit="maxCount"
  1397.       :on-exceed="handleExceed"
  1398.       :show-file-list="showFile"
  1399.     >
  1400.       <i ></i>
  1401.     </el-upload><el-upload
  1402.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1403.       :data="dataObj"
  1404.       :list-type="listType"
  1405.       :file-list="fileList"
  1406.       :before-upload="beforeUpload"
  1407.       :on-remove="handleRemove"
  1408.       :on-success="handleUploadSuccess"
  1409.       :on-preview="handlePreview"
  1410.       :limit="maxCount"
  1411.       :on-exceed="handleExceed"
  1412.       :show-file-list="showFile"
  1413.     >
  1414.       <i ></i>
  1415.     </el-upload>        SkuImagesEntity skuImagesEntity = new SkuImagesEntity();//<el-upload
  1416.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1417.       :data="dataObj"
  1418.       :list-type="listType"
  1419.       :file-list="fileList"
  1420.       :before-upload="beforeUpload"
  1421.       :on-remove="handleRemove"
  1422.       :on-success="handleUploadSuccess"
  1423.       :on-preview="handlePreview"
  1424.       :limit="maxCount"
  1425.       :on-exceed="handleExceed"
  1426.       :show-file-list="showFile"
  1427.     >
  1428.       <i ></i>
  1429.     </el-upload><el-upload
  1430.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1431.       :data="dataObj"
  1432.       :list-type="listType"
  1433.       :file-list="fileList"
  1434.       :before-upload="beforeUpload"
  1435.       :on-remove="handleRemove"
  1436.       :on-success="handleUploadSuccess"
  1437.       :on-preview="handlePreview"
  1438.       :limit="maxCount"
  1439.       :on-exceed="handleExceed"
  1440.       :show-file-list="showFile"
  1441.     >
  1442.       <i ></i>
  1443.     </el-upload>        skuImagesEntity.setSkuId(skuId);//<el-upload
  1444.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1445.       :data="dataObj"
  1446.       :list-type="listType"
  1447.       :file-list="fileList"
  1448.       :before-upload="beforeUpload"
  1449.       :on-remove="handleRemove"
  1450.       :on-success="handleUploadSuccess"
  1451.       :on-preview="handlePreview"
  1452.       :limit="maxCount"
  1453.       :on-exceed="handleExceed"
  1454.       :show-file-list="showFile"
  1455.     >
  1456.       <i ></i>
  1457.     </el-upload><el-upload
  1458.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1459.       :data="dataObj"
  1460.       :list-type="listType"
  1461.       :file-list="fileList"
  1462.       :before-upload="beforeUpload"
  1463.       :on-remove="handleRemove"
  1464.       :on-success="handleUploadSuccess"
  1465.       :on-preview="handlePreview"
  1466.       :limit="maxCount"
  1467.       :on-exceed="handleExceed"
  1468.       :show-file-list="showFile"
  1469.     >
  1470.       <i ></i>
  1471.     </el-upload>        skuImagesEntity.setImgUrl(img.getImgUrl());//<el-upload
  1472.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1473.       :data="dataObj"
  1474.       :list-type="listType"
  1475.       :file-list="fileList"
  1476.       :before-upload="beforeUpload"
  1477.       :on-remove="handleRemove"
  1478.       :on-success="handleUploadSuccess"
  1479.       :on-preview="handlePreview"
  1480.       :limit="maxCount"
  1481.       :on-exceed="handleExceed"
  1482.       :show-file-list="showFile"
  1483.     >
  1484.       <i ></i>
  1485.     </el-upload><el-upload
  1486.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1487.       :data="dataObj"
  1488.       :list-type="listType"
  1489.       :file-list="fileList"
  1490.       :before-upload="beforeUpload"
  1491.       :on-remove="handleRemove"
  1492.       :on-success="handleUploadSuccess"
  1493.       :on-preview="handlePreview"
  1494.       :limit="maxCount"
  1495.       :on-exceed="handleExceed"
  1496.       :show-file-list="showFile"
  1497.     >
  1498.       <i ></i>
  1499.     </el-upload>        skuImagesEntity.setDefaultImg(img.getDefaultImg());//<el-upload
  1500.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1501.       :data="dataObj"
  1502.       :list-type="listType"
  1503.       :file-list="fileList"
  1504.       :before-upload="beforeUpload"
  1505.       :on-remove="handleRemove"
  1506.       :on-success="handleUploadSuccess"
  1507.       :on-preview="handlePreview"
  1508.       :limit="maxCount"
  1509.       :on-exceed="handleExceed"
  1510.       :show-file-list="showFile"
  1511.     >
  1512.       <i ></i>
  1513.     </el-upload><el-upload
  1514.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1515.       :data="dataObj"
  1516.       :list-type="listType"
  1517.       :file-list="fileList"
  1518.       :before-upload="beforeUpload"
  1519.       :on-remove="handleRemove"
  1520.       :on-success="handleUploadSuccess"
  1521.       :on-preview="handlePreview"
  1522.       :limit="maxCount"
  1523.       :on-exceed="handleExceed"
  1524.       :show-file-list="showFile"
  1525.     >
  1526.       <i ></i>
  1527.     </el-upload>        return skuImagesEntity;//<el-upload
  1528.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1529.       :data="dataObj"
  1530.       :list-type="listType"
  1531.       :file-list="fileList"
  1532.       :before-upload="beforeUpload"
  1533.       :on-remove="handleRemove"
  1534.       :on-success="handleUploadSuccess"
  1535.       :on-preview="handlePreview"
  1536.       :limit="maxCount"
  1537.       :on-exceed="handleExceed"
  1538.       :show-file-list="showFile"
  1539.     >
  1540.       <i ></i>
  1541.     </el-upload><el-upload
  1542.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1543.       :data="dataObj"
  1544.       :list-type="listType"
  1545.       :file-list="fileList"
  1546.       :before-upload="beforeUpload"
  1547.       :on-remove="handleRemove"
  1548.       :on-success="handleUploadSuccess"
  1549.       :on-preview="handlePreview"
  1550.       :limit="maxCount"
  1551.       :on-exceed="handleExceed"
  1552.       :show-file-list="showFile"
  1553.     >
  1554.       <i ></i>
  1555.     </el-upload>    }).filter(entity -> {////如果 image 为 empty ,就不过滤掉, 返回 true 就是必要,false 就是剔除//<el-upload
  1556.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1557.       :data="dataObj"
  1558.       :list-type="listType"
  1559.       :file-list="fileList"
  1560.       :before-upload="beforeUpload"
  1561.       :on-remove="handleRemove"
  1562.       :on-success="handleUploadSuccess"
  1563.       :on-preview="handlePreview"
  1564.       :limit="maxCount"
  1565.       :on-exceed="handleExceed"
  1566.       :show-file-list="showFile"
  1567.     >
  1568.       <i ></i>
  1569.     </el-upload><el-upload
  1570.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1571.       :data="dataObj"
  1572.       :list-type="listType"
  1573.       :file-list="fileList"
  1574.       :before-upload="beforeUpload"
  1575.       :on-remove="handleRemove"
  1576.       :on-success="handleUploadSuccess"
  1577.       :on-preview="handlePreview"
  1578.       :limit="maxCount"
  1579.       :on-exceed="handleExceed"
  1580.       :show-file-list="showFile"
  1581.     >
  1582.       <i ></i>
  1583.     </el-upload>        return !StringUtils.isEmpty(entity.getImgUrl());//<el-upload
  1584.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1585.       :data="dataObj"
  1586.       :list-type="listType"
  1587.       :file-list="fileList"
  1588.       :before-upload="beforeUpload"
  1589.       :on-remove="handleRemove"
  1590.       :on-success="handleUploadSuccess"
  1591.       :on-preview="handlePreview"
  1592.       :limit="maxCount"
  1593.       :on-exceed="handleExceed"
  1594.       :show-file-list="showFile"
  1595.     >
  1596.       <i ></i>
  1597.     </el-upload><el-upload
  1598.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1599.       :data="dataObj"
  1600.       :list-type="listType"
  1601.       :file-list="fileList"
  1602.       :before-upload="beforeUpload"
  1603.       :on-remove="handleRemove"
  1604.       :on-success="handleUploadSuccess"
  1605.       :on-preview="handlePreview"
  1606.       :limit="maxCount"
  1607.       :on-exceed="handleExceed"
  1608.       :show-file-list="showFile"
  1609.     >
  1610.       <i ></i>
  1611.     </el-upload>    }).collect(Collectors.toList());//<el-upload
  1612.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1613.       :data="dataObj"
  1614.       :list-type="listType"
  1615.       :file-list="fileList"
  1616.       :before-upload="beforeUpload"
  1617.       :on-remove="handleRemove"
  1618.       :on-success="handleUploadSuccess"
  1619.       :on-preview="handlePreview"
  1620.       :limit="maxCount"
  1621.       :on-exceed="handleExceed"
  1622.       :show-file-list="showFile"
  1623.     >
  1624.       <i ></i>
  1625.     </el-upload>      skuImagesService.saveBatch(imagesEntities);////保存 sku 的图片信息;到 commodity_sku_images end//<el-upload
  1626.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1627.       :data="dataObj"
  1628.       :list-type="listType"
  1629.       :file-list="fileList"
  1630.       :before-upload="beforeUpload"
  1631.       :on-remove="handleRemove"
  1632.       :on-success="handleUploadSuccess"
  1633.       :on-preview="handlePreview"
  1634.       :limit="maxCount"
  1635.       :on-exceed="handleExceed"
  1636.       :show-file-list="showFile"
  1637.     >
  1638.       <i ></i>
  1639.     </el-upload>  });//        }//    }////    @Transactional//    @Override//    public void saveSpuInfo(SpuSaveVO spuSaveVO) {//        //1、保存 spu 基本信息 , 对应的表 commodity_spu_info//        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();//        BeanUtils.copyProperties(spuSaveVO, spuInfoEntity);//        spuInfoEntity.setCreateTime(new Date());//        spuInfoEntity.setUpdateTime(new Date());////SpuInfoEntity 信息保存到 commodity_spu_info//        this.saveBaseSpuInfo(spuInfoEntity);////2、保存 Spu 的描述图片路径 commodity_spu_info_desc//        List decript = spuSaveVO.getDecript();//        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();////获取到刚刚保存的 spu 基本信息对应的 id//        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());////留意:这里有可能没有图片, 可以设置一个默认图片//        if (decript.size() == 0) {//<el-upload
  1640.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1641.       :data="dataObj"
  1642.       :list-type="listType"
  1643.       :file-list="fileList"
  1644.       :before-upload="beforeUpload"
  1645.       :on-remove="handleRemove"
  1646.       :on-success="handleUploadSuccess"
  1647.       :on-preview="handlePreview"
  1648.       :limit="maxCount"
  1649.       :on-exceed="handleExceed"
  1650.       :show-file-list="showFile"
  1651.     >
  1652.       <i ></i>
  1653.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");//        } else {//<el-upload
  1654.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1655.       :data="dataObj"
  1656.       :list-type="listType"
  1657.       :file-list="fileList"
  1658.       :before-upload="beforeUpload"
  1659.       :on-remove="handleRemove"
  1660.       :on-success="handleUploadSuccess"
  1661.       :on-preview="handlePreview"
  1662.       :limit="maxCount"
  1663.       :on-exceed="handleExceed"
  1664.       :show-file-list="showFile"
  1665.     >
  1666.       <i ></i>
  1667.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));//        }////保存到 commodity_spu_info_desc, 这个方法时我们完成//        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);////        //3、保存 spu 的图片集 commodity_spu_images//        List images = spuSaveVO.getImages();////获取到刚刚保存的 spu 基本信息对应的 id//        imagesService.saveImages(spuInfoEntity.getId(), images);////4、保存 spu 的基本属性(一个 spu 可以有多个基本属性/规格参数)://// commodity_product_attr_value//        List baseAttrs = spuSaveVO.getBaseAttrs();//        List collect = baseAttrs.stream().map(attr -> {//<el-upload
  1668.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1669.       :data="dataObj"
  1670.       :list-type="listType"
  1671.       :file-list="fileList"
  1672.       :before-upload="beforeUpload"
  1673.       :on-remove="handleRemove"
  1674.       :on-success="handleUploadSuccess"
  1675.       :on-preview="handlePreview"
  1676.       :limit="maxCount"
  1677.       :on-exceed="handleExceed"
  1678.       :show-file-list="showFile"
  1679.     >
  1680.       <i ></i>
  1681.     </el-upload>  ProductAttrValueEntity valueEntity = new ProductAttrValueEntity();//<el-upload
  1682.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1683.       :data="dataObj"
  1684.       :list-type="listType"
  1685.       :file-list="fileList"
  1686.       :before-upload="beforeUpload"
  1687.       :on-remove="handleRemove"
  1688.       :on-success="handleUploadSuccess"
  1689.       :on-preview="handlePreview"
  1690.       :limit="maxCount"
  1691.       :on-exceed="handleExceed"
  1692.       :show-file-list="showFile"
  1693.     >
  1694.       <i ></i>
  1695.     </el-upload>  valueEntity.setAttrId(attr.getAttrId());//<el-upload
  1696.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1697.       :data="dataObj"
  1698.       :list-type="listType"
  1699.       :file-list="fileList"
  1700.       :before-upload="beforeUpload"
  1701.       :on-remove="handleRemove"
  1702.       :on-success="handleUploadSuccess"
  1703.       :on-preview="handlePreview"
  1704.       :limit="maxCount"
  1705.       :on-exceed="handleExceed"
  1706.       :show-file-list="showFile"
  1707.     >
  1708.       <i ></i>
  1709.     </el-upload>  AttrEntity id = attrService.getById(attr.getAttrId());//<el-upload
  1710.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1711.       :data="dataObj"
  1712.       :list-type="listType"
  1713.       :file-list="fileList"
  1714.       :before-upload="beforeUpload"
  1715.       :on-remove="handleRemove"
  1716.       :on-success="handleUploadSuccess"
  1717.       :on-preview="handlePreview"
  1718.       :limit="maxCount"
  1719.       :on-exceed="handleExceed"
  1720.       :show-file-list="showFile"
  1721.     >
  1722.       <i ></i>
  1723.     </el-upload>  valueEntity.setAttrName(id.getAttrName());//<el-upload
  1724.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1725.       :data="dataObj"
  1726.       :list-type="listType"
  1727.       :file-list="fileList"
  1728.       :before-upload="beforeUpload"
  1729.       :on-remove="handleRemove"
  1730.       :on-success="handleUploadSuccess"
  1731.       :on-preview="handlePreview"
  1732.       :limit="maxCount"
  1733.       :on-exceed="handleExceed"
  1734.       :show-file-list="showFile"
  1735.     >
  1736.       <i ></i>
  1737.     </el-upload>  valueEntity.setAttrValue(attr.getAttrValues());//<el-upload
  1738.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1739.       :data="dataObj"
  1740.       :list-type="listType"
  1741.       :file-list="fileList"
  1742.       :before-upload="beforeUpload"
  1743.       :on-remove="handleRemove"
  1744.       :on-success="handleUploadSuccess"
  1745.       :on-preview="handlePreview"
  1746.       :limit="maxCount"
  1747.       :on-exceed="handleExceed"
  1748.       :show-file-list="showFile"
  1749.     >
  1750.       <i ></i>
  1751.     </el-upload>  valueEntity.setQuickShow(attr.getShowDesc());//<el-upload
  1752.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1753.       :data="dataObj"
  1754.       :list-type="listType"
  1755.       :file-list="fileList"
  1756.       :before-upload="beforeUpload"
  1757.       :on-remove="handleRemove"
  1758.       :on-success="handleUploadSuccess"
  1759.       :on-preview="handlePreview"
  1760.       :limit="maxCount"
  1761.       :on-exceed="handleExceed"
  1762.       :show-file-list="showFile"
  1763.     >
  1764.       <i ></i>
  1765.     </el-upload>  valueEntity.setSpuId(spuInfoEntity.getId());//<el-upload
  1766.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1767.       :data="dataObj"
  1768.       :list-type="listType"
  1769.       :file-list="fileList"
  1770.       :before-upload="beforeUpload"
  1771.       :on-remove="handleRemove"
  1772.       :on-success="handleUploadSuccess"
  1773.       :on-preview="handlePreview"
  1774.       :limit="maxCount"
  1775.       :on-exceed="handleExceed"
  1776.       :show-file-list="showFile"
  1777.     >
  1778.       <i ></i>
  1779.     </el-upload>  return valueEntity;//        }).collect(Collectors.toList());//        productAttrValueService.saveProductAttr(collect);////        //5、保存当前 spu 对应的全部 sku 信息;一个 spu 可以 对应多个 sku,//// 组成一个可以销售的商品信息////留意 Images 类在 vo 包下, 确保有@Data 修饰//        List skus = spuSaveVO.getSkus();//        if(skus!=null && skus.size()>0){//<el-upload
  1780.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1781.       :data="dataObj"
  1782.       :list-type="listType"
  1783.       :file-list="fileList"
  1784.       :before-upload="beforeUpload"
  1785.       :on-remove="handleRemove"
  1786.       :on-success="handleUploadSuccess"
  1787.       :on-preview="handlePreview"
  1788.       :limit="maxCount"
  1789.       :on-exceed="handleExceed"
  1790.       :show-file-list="showFile"
  1791.     >
  1792.       <i ></i>
  1793.     </el-upload>  skus.forEach(item->{//<el-upload
  1794.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1795.       :data="dataObj"
  1796.       :list-type="listType"
  1797.       :file-list="fileList"
  1798.       :before-upload="beforeUpload"
  1799.       :on-remove="handleRemove"
  1800.       :on-success="handleUploadSuccess"
  1801.       :on-preview="handlePreview"
  1802.       :limit="maxCount"
  1803.       :on-exceed="handleExceed"
  1804.       :show-file-list="showFile"
  1805.     >
  1806.       <i ></i>
  1807.     </el-upload>      String defaultImg = "default.jpg";////json 会提交很多图片,如果是当前这个 sku 的默认图片就先保存下 url//<el-upload
  1808.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1809.       :data="dataObj"
  1810.       :list-type="listType"
  1811.       :file-list="fileList"
  1812.       :before-upload="beforeUpload"
  1813.       :on-remove="handleRemove"
  1814.       :on-success="handleUploadSuccess"
  1815.       :on-preview="handlePreview"
  1816.       :limit="maxCount"
  1817.       :on-exceed="handleExceed"
  1818.       :show-file-list="showFile"
  1819.     >
  1820.       <i ></i>
  1821.     </el-upload>      for (Images image : item.getImages()) {//<el-upload
  1822.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1823.       :data="dataObj"
  1824.       :list-type="listType"
  1825.       :file-list="fileList"
  1826.       :before-upload="beforeUpload"
  1827.       :on-remove="handleRemove"
  1828.       :on-success="handleUploadSuccess"
  1829.       :on-preview="handlePreview"
  1830.       :limit="maxCount"
  1831.       :on-exceed="handleExceed"
  1832.       :show-file-list="showFile"
  1833.     >
  1834.       <i ></i>
  1835.     </el-upload><el-upload
  1836.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1837.       :data="dataObj"
  1838.       :list-type="listType"
  1839.       :file-list="fileList"
  1840.       :before-upload="beforeUpload"
  1841.       :on-remove="handleRemove"
  1842.       :on-success="handleUploadSuccess"
  1843.       :on-preview="handlePreview"
  1844.       :limit="maxCount"
  1845.       :on-exceed="handleExceed"
  1846.       :show-file-list="showFile"
  1847.     >
  1848.       <i ></i>
  1849.     </el-upload>if(image.getDefaultImg() == 1){//<el-upload
  1850.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1851.       :data="dataObj"
  1852.       :list-type="listType"
  1853.       :file-list="fileList"
  1854.       :before-upload="beforeUpload"
  1855.       :on-remove="handleRemove"
  1856.       :on-success="handleUploadSuccess"
  1857.       :on-preview="handlePreview"
  1858.       :limit="maxCount"
  1859.       :on-exceed="handleExceed"
  1860.       :show-file-list="showFile"
  1861.     >
  1862.       <i ></i>
  1863.     </el-upload><el-upload
  1864.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1865.       :data="dataObj"
  1866.       :list-type="listType"
  1867.       :file-list="fileList"
  1868.       :before-upload="beforeUpload"
  1869.       :on-remove="handleRemove"
  1870.       :on-success="handleUploadSuccess"
  1871.       :on-preview="handlePreview"
  1872.       :limit="maxCount"
  1873.       :on-exceed="handleExceed"
  1874.       :show-file-list="showFile"
  1875.     >
  1876.       <i ></i>
  1877.     </el-upload>    defaultImg = image.getImgUrl();//<el-upload
  1878.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1879.       :data="dataObj"
  1880.       :list-type="listType"
  1881.       :file-list="fileList"
  1882.       :before-upload="beforeUpload"
  1883.       :on-remove="handleRemove"
  1884.       :on-success="handleUploadSuccess"
  1885.       :on-preview="handlePreview"
  1886.       :limit="maxCount"
  1887.       :on-exceed="handleExceed"
  1888.       :show-file-list="showFile"
  1889.     >
  1890.       <i ></i>
  1891.     </el-upload><el-upload
  1892.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1893.       :data="dataObj"
  1894.       :list-type="listType"
  1895.       :file-list="fileList"
  1896.       :before-upload="beforeUpload"
  1897.       :on-remove="handleRemove"
  1898.       :on-success="handleUploadSuccess"
  1899.       :on-preview="handlePreview"
  1900.       :limit="maxCount"
  1901.       :on-exceed="handleExceed"
  1902.       :show-file-list="showFile"
  1903.     >
  1904.       <i ></i>
  1905.     </el-upload>}//<el-upload
  1906.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1907.       :data="dataObj"
  1908.       :list-type="listType"
  1909.       :file-list="fileList"
  1910.       :before-upload="beforeUpload"
  1911.       :on-remove="handleRemove"
  1912.       :on-success="handleUploadSuccess"
  1913.       :on-preview="handlePreview"
  1914.       :limit="maxCount"
  1915.       :on-exceed="handleExceed"
  1916.       :show-file-list="showFile"
  1917.     >
  1918.       <i ></i>
  1919.     </el-upload>      }//<el-upload
  1920.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1921.       :data="dataObj"
  1922.       :list-type="listType"
  1923.       :file-list="fileList"
  1924.       :before-upload="beforeUpload"
  1925.       :on-remove="handleRemove"
  1926.       :on-success="handleUploadSuccess"
  1927.       :on-preview="handlePreview"
  1928.       :limit="maxCount"
  1929.       :on-exceed="handleExceed"
  1930.       :show-file-list="showFile"
  1931.     >
  1932.       <i ></i>
  1933.     </el-upload>      SkuInfoEntity skuInfoEntity = new SkuInfoEntity();////把 item 中的信息拷贝给 skuInfoEntity//<el-upload
  1934.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1935.       :data="dataObj"
  1936.       :list-type="listType"
  1937.       :file-list="fileList"
  1938.       :before-upload="beforeUpload"
  1939.       :on-remove="handleRemove"
  1940.       :on-success="handleUploadSuccess"
  1941.       :on-preview="handlePreview"
  1942.       :limit="maxCount"
  1943.       :on-exceed="handleExceed"
  1944.       :show-file-list="showFile"
  1945.     >
  1946.       <i ></i>
  1947.     </el-upload>      BeanUtils.copyProperties(item,skuInfoEntity);////item 中没有信息,但是 skuInfoEntity 必要的信息,////可以从 spuInfoEntity 中获取//<el-upload
  1948.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1949.       :data="dataObj"
  1950.       :list-type="listType"
  1951.       :file-list="fileList"
  1952.       :before-upload="beforeUpload"
  1953.       :on-remove="handleRemove"
  1954.       :on-success="handleUploadSuccess"
  1955.       :on-preview="handlePreview"
  1956.       :limit="maxCount"
  1957.       :on-exceed="handleExceed"
  1958.       :show-file-list="showFile"
  1959.     >
  1960.       <i ></i>
  1961.     </el-upload>      skuInfoEntity.setBrandId(spuInfoEntity.getBrandId());//<el-upload
  1962.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1963.       :data="dataObj"
  1964.       :list-type="listType"
  1965.       :file-list="fileList"
  1966.       :before-upload="beforeUpload"
  1967.       :on-remove="handleRemove"
  1968.       :on-success="handleUploadSuccess"
  1969.       :on-preview="handlePreview"
  1970.       :limit="maxCount"
  1971.       :on-exceed="handleExceed"
  1972.       :show-file-list="showFile"
  1973.     >
  1974.       <i ></i>
  1975.     </el-upload>      skuInfoEntity.setCatalogId(spuInfoEntity.getCatalogId());//<el-upload
  1976.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1977.       :data="dataObj"
  1978.       :list-type="listType"
  1979.       :file-list="fileList"
  1980.       :before-upload="beforeUpload"
  1981.       :on-remove="handleRemove"
  1982.       :on-success="handleUploadSuccess"
  1983.       :on-preview="handlePreview"
  1984.       :limit="maxCount"
  1985.       :on-exceed="handleExceed"
  1986.       :show-file-list="showFile"
  1987.     >
  1988.       <i ></i>
  1989.     </el-upload>      skuInfoEntity.setSaleCount(0L);//初始化销量为 0//<el-upload
  1990.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  1991.       :data="dataObj"
  1992.       :list-type="listType"
  1993.       :file-list="fileList"
  1994.       :before-upload="beforeUpload"
  1995.       :on-remove="handleRemove"
  1996.       :on-success="handleUploadSuccess"
  1997.       :on-preview="handlePreview"
  1998.       :limit="maxCount"
  1999.       :on-exceed="handleExceed"
  2000.       :show-file-list="showFile"
  2001.     >
  2002.       <i ></i>
  2003.     </el-upload>      skuInfoEntity.setSpuId(spuInfoEntity.getId());//<el-upload
  2004.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2005.       :data="dataObj"
  2006.       :list-type="listType"
  2007.       :file-list="fileList"
  2008.       :before-upload="beforeUpload"
  2009.       :on-remove="handleRemove"
  2010.       :on-success="handleUploadSuccess"
  2011.       :on-preview="handlePreview"
  2012.       :limit="maxCount"
  2013.       :on-exceed="handleExceed"
  2014.       :show-file-list="showFile"
  2015.     >
  2016.       <i ></i>
  2017.     </el-upload>      skuInfoEntity.setSkuDefaultImg(defaultImg);////1)、保存 sku 的基本信息;到 commodity_sku_info//<el-upload
  2018.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2019.       :data="dataObj"
  2020.       :list-type="listType"
  2021.       :file-list="fileList"
  2022.       :before-upload="beforeUpload"
  2023.       :on-remove="handleRemove"
  2024.       :on-success="handleUploadSuccess"
  2025.       :on-preview="handlePreview"
  2026.       :limit="maxCount"
  2027.       :on-exceed="handleExceed"
  2028.       :show-file-list="showFile"
  2029.     >
  2030.       <i ></i>
  2031.     </el-upload>      skuInfoService.saveSkuInfo(skuInfoEntity);//<el-upload
  2032.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2033.       :data="dataObj"
  2034.       :list-type="listType"
  2035.       :file-list="fileList"
  2036.       :before-upload="beforeUpload"
  2037.       :on-remove="handleRemove"
  2038.       :on-success="handleUploadSuccess"
  2039.       :on-preview="handlePreview"
  2040.       :limit="maxCount"
  2041.       :on-exceed="handleExceed"
  2042.       :show-file-list="showFile"
  2043.     >
  2044.       <i ></i>
  2045.     </el-upload>  });//        }//    }//    @Transactional//    @Override//    public void saveSpuInfo(SpuSaveVO spuSaveVO) {//        //1、保存 spu 基本信息 , 对应的表 commodity_spu_info//        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();//        BeanUtils.copyProperties(spuSaveVO, spuInfoEntity);//        spuInfoEntity.setCreateTime(new Date());//        spuInfoEntity.setUpdateTime(new Date());////SpuInfoEntity 信息保存到 commodity_spu_info//        this.saveBaseSpuInfo(spuInfoEntity);////2、保存 Spu 的描述图片路径 commodity_spu_info_desc//        List decript = spuSaveVO.getDecript();//        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();////获取到刚刚保存的 spu 基本信息对应的 id//        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());////留意:这里有可能没有图片, 可以设置一个默认图片//        if (decript.size() == 0) {//<el-upload
  2046.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2047.       :data="dataObj"
  2048.       :list-type="listType"
  2049.       :file-list="fileList"
  2050.       :before-upload="beforeUpload"
  2051.       :on-remove="handleRemove"
  2052.       :on-success="handleUploadSuccess"
  2053.       :on-preview="handlePreview"
  2054.       :limit="maxCount"
  2055.       :on-exceed="handleExceed"
  2056.       :show-file-list="showFile"
  2057.     >
  2058.       <i ></i>
  2059.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");//        } else {//<el-upload
  2060.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2061.       :data="dataObj"
  2062.       :list-type="listType"
  2063.       :file-list="fileList"
  2064.       :before-upload="beforeUpload"
  2065.       :on-remove="handleRemove"
  2066.       :on-success="handleUploadSuccess"
  2067.       :on-preview="handlePreview"
  2068.       :limit="maxCount"
  2069.       :on-exceed="handleExceed"
  2070.       :show-file-list="showFile"
  2071.     >
  2072.       <i ></i>
  2073.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));//        }////保存到 commodity_spu_info_desc, 这个方法时我们完成//        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);//        //3、保存 spu 的图片集 commodity_spu_images//        List images = spuSaveVO.getImages();////获取到刚刚保存的 spu 基本信息对应的 id//        imagesService.saveImages(spuInfoEntity.getId(), images);////4、保存 spu 的基本属性(一个 spu 可以有多个基本属性/规格参数)://// commodity_product_attr_value//        List baseAttrs = spuSaveVO.getBaseAttrs();//        List collect = baseAttrs.stream().map(attr -> {//<el-upload
  2074.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2075.       :data="dataObj"
  2076.       :list-type="listType"
  2077.       :file-list="fileList"
  2078.       :before-upload="beforeUpload"
  2079.       :on-remove="handleRemove"
  2080.       :on-success="handleUploadSuccess"
  2081.       :on-preview="handlePreview"
  2082.       :limit="maxCount"
  2083.       :on-exceed="handleExceed"
  2084.       :show-file-list="showFile"
  2085.     >
  2086.       <i ></i>
  2087.     </el-upload>  ProductAttrValueEntity valueEntity = new ProductAttrValueEntity();//<el-upload
  2088.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2089.       :data="dataObj"
  2090.       :list-type="listType"
  2091.       :file-list="fileList"
  2092.       :before-upload="beforeUpload"
  2093.       :on-remove="handleRemove"
  2094.       :on-success="handleUploadSuccess"
  2095.       :on-preview="handlePreview"
  2096.       :limit="maxCount"
  2097.       :on-exceed="handleExceed"
  2098.       :show-file-list="showFile"
  2099.     >
  2100.       <i ></i>
  2101.     </el-upload>  valueEntity.setAttrId(attr.getAttrId());//<el-upload
  2102.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2103.       :data="dataObj"
  2104.       :list-type="listType"
  2105.       :file-list="fileList"
  2106.       :before-upload="beforeUpload"
  2107.       :on-remove="handleRemove"
  2108.       :on-success="handleUploadSuccess"
  2109.       :on-preview="handlePreview"
  2110.       :limit="maxCount"
  2111.       :on-exceed="handleExceed"
  2112.       :show-file-list="showFile"
  2113.     >
  2114.       <i ></i>
  2115.     </el-upload>  AttrEntity id = attrService.getById(attr.getAttrId());//<el-upload
  2116.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2117.       :data="dataObj"
  2118.       :list-type="listType"
  2119.       :file-list="fileList"
  2120.       :before-upload="beforeUpload"
  2121.       :on-remove="handleRemove"
  2122.       :on-success="handleUploadSuccess"
  2123.       :on-preview="handlePreview"
  2124.       :limit="maxCount"
  2125.       :on-exceed="handleExceed"
  2126.       :show-file-list="showFile"
  2127.     >
  2128.       <i ></i>
  2129.     </el-upload>  valueEntity.setAttrName(id.getAttrName());//<el-upload
  2130.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2131.       :data="dataObj"
  2132.       :list-type="listType"
  2133.       :file-list="fileList"
  2134.       :before-upload="beforeUpload"
  2135.       :on-remove="handleRemove"
  2136.       :on-success="handleUploadSuccess"
  2137.       :on-preview="handlePreview"
  2138.       :limit="maxCount"
  2139.       :on-exceed="handleExceed"
  2140.       :show-file-list="showFile"
  2141.     >
  2142.       <i ></i>
  2143.     </el-upload>  valueEntity.setAttrValue(attr.getAttrValues());//<el-upload
  2144.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2145.       :data="dataObj"
  2146.       :list-type="listType"
  2147.       :file-list="fileList"
  2148.       :before-upload="beforeUpload"
  2149.       :on-remove="handleRemove"
  2150.       :on-success="handleUploadSuccess"
  2151.       :on-preview="handlePreview"
  2152.       :limit="maxCount"
  2153.       :on-exceed="handleExceed"
  2154.       :show-file-list="showFile"
  2155.     >
  2156.       <i ></i>
  2157.     </el-upload>  valueEntity.setQuickShow(attr.getShowDesc());//<el-upload
  2158.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2159.       :data="dataObj"
  2160.       :list-type="listType"
  2161.       :file-list="fileList"
  2162.       :before-upload="beforeUpload"
  2163.       :on-remove="handleRemove"
  2164.       :on-success="handleUploadSuccess"
  2165.       :on-preview="handlePreview"
  2166.       :limit="maxCount"
  2167.       :on-exceed="handleExceed"
  2168.       :show-file-list="showFile"
  2169.     >
  2170.       <i ></i>
  2171.     </el-upload>  valueEntity.setSpuId(spuInfoEntity.getId());//<el-upload
  2172.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2173.       :data="dataObj"
  2174.       :list-type="listType"
  2175.       :file-list="fileList"
  2176.       :before-upload="beforeUpload"
  2177.       :on-remove="handleRemove"
  2178.       :on-success="handleUploadSuccess"
  2179.       :on-preview="handlePreview"
  2180.       :limit="maxCount"
  2181.       :on-exceed="handleExceed"
  2182.       :show-file-list="showFile"
  2183.     >
  2184.       <i ></i>
  2185.     </el-upload>  return valueEntity;//        }).collect(Collectors.toList());//        productAttrValueService.saveProductAttr(collect);//    }        //因为有多个添加操作,使用事务控制//    @Transactional//    @Override//    public void saveSpuInfo(SpuSaveVO spuSaveVO) {////1、保存 spu 基本信息 , 对应的表 commodity_spu_info//        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();//        BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);//        spuInfoEntity.setCreateTime(new Date());//        spuInfoEntity.setUpdateTime(new Date());////SpuInfoEntity 信息保存到 commodity_spu_info//        this.saveBaseSpuInfo(spuInfoEntity);////2、保存 Spu 的描述图片路径 commodity_spu_info_desc//        List decript = spuSaveVO.getDecript();//        SpuInfoDescEntity spuInfoDescEntity = new SpuInfoDescEntity();////获取到刚刚保存的 spu 基本信息对应的 id//        spuInfoDescEntity.setSpuId(spuInfoEntity.getId());////留意:这里有可能没有图片, 可以设置一个默认图片//        if(decript.size() == 0) {//<el-upload
  2186.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2187.       :data="dataObj"
  2188.       :list-type="listType"
  2189.       :file-list="fileList"
  2190.       :before-upload="beforeUpload"
  2191.       :on-remove="handleRemove"
  2192.       :on-success="handleUploadSuccess"
  2193.       :on-preview="handlePreview"
  2194.       :limit="maxCount"
  2195.       :on-exceed="handleExceed"
  2196.       :show-file-list="showFile"
  2197.     >
  2198.       <i ></i>
  2199.     </el-upload>  spuInfoDescEntity.setDecript("default.jpg");//        }else {//<el-upload
  2200.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2201.       :data="dataObj"
  2202.       :list-type="listType"
  2203.       :file-list="fileList"
  2204.       :before-upload="beforeUpload"
  2205.       :on-remove="handleRemove"
  2206.       :on-success="handleUploadSuccess"
  2207.       :on-preview="handlePreview"
  2208.       :limit="maxCount"
  2209.       :on-exceed="handleExceed"
  2210.       :show-file-list="showFile"
  2211.     >
  2212.       <i ></i>
  2213.     </el-upload>  spuInfoDescEntity.setDecript(String.join(",", decript));//        }////保存到 commodity_spu_info_desc, 这个方法时我们完成//        spuInfoDescService.saveSpuInfoDesc(spuInfoDescEntity);////        //3、保存 spu 的图片集 commodity_spu_images//        List images = spuSaveVO.getImages();////获取到刚刚保存的 spu 基本信息对应的 id//        imagesService.saveImages(spuInfoEntity.getId(), images);//    }        @Override        public PageUtils queryPage (Map < String, Object > params){<el-upload
  2214.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2215.       :data="dataObj"
  2216.       :list-type="listType"
  2217.       :file-list="fileList"
  2218.       :before-upload="beforeUpload"
  2219.       :on-remove="handleRemove"
  2220.       :on-success="handleUploadSuccess"
  2221.       :on-preview="handlePreview"
  2222.       :limit="maxCount"
  2223.       :on-exceed="handleExceed"
  2224.       :show-file-list="showFile"
  2225.     >
  2226.       <i ></i>
  2227.     </el-upload>  IPage page = this.page(<el-upload
  2228.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2229.       :data="dataObj"
  2230.       :list-type="listType"
  2231.       :file-list="fileList"
  2232.       :before-upload="beforeUpload"
  2233.       :on-remove="handleRemove"
  2234.       :on-success="handleUploadSuccess"
  2235.       :on-preview="handlePreview"
  2236.       :limit="maxCount"
  2237.       :on-exceed="handleExceed"
  2238.       :show-file-list="showFile"
  2239.     >
  2240.       <i ></i>
  2241.     </el-upload><el-upload
  2242.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2243.       :data="dataObj"
  2244.       :list-type="listType"
  2245.       :file-list="fileList"
  2246.       :before-upload="beforeUpload"
  2247.       :on-remove="handleRemove"
  2248.       :on-success="handleUploadSuccess"
  2249.       :on-preview="handlePreview"
  2250.       :limit="maxCount"
  2251.       :on-exceed="handleExceed"
  2252.       :show-file-list="showFile"
  2253.     >
  2254.       <i ></i>
  2255.     </el-upload>new Query().getPage(params),<el-upload
  2256.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2257.       :data="dataObj"
  2258.       :list-type="listType"
  2259.       :file-list="fileList"
  2260.       :before-upload="beforeUpload"
  2261.       :on-remove="handleRemove"
  2262.       :on-success="handleUploadSuccess"
  2263.       :on-preview="handlePreview"
  2264.       :limit="maxCount"
  2265.       :on-exceed="handleExceed"
  2266.       :show-file-list="showFile"
  2267.     >
  2268.       <i ></i>
  2269.     </el-upload><el-upload
  2270.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2271.       :data="dataObj"
  2272.       :list-type="listType"
  2273.       :file-list="fileList"
  2274.       :before-upload="beforeUpload"
  2275.       :on-remove="handleRemove"
  2276.       :on-success="handleUploadSuccess"
  2277.       :on-preview="handlePreview"
  2278.       :limit="maxCount"
  2279.       :on-exceed="handleExceed"
  2280.       :show-file-list="showFile"
  2281.     >
  2282.       <i ></i>
  2283.     </el-upload>new QueryWrapper()<el-upload
  2284.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2285.       :data="dataObj"
  2286.       :list-type="listType"
  2287.       :file-list="fileList"
  2288.       :before-upload="beforeUpload"
  2289.       :on-remove="handleRemove"
  2290.       :on-success="handleUploadSuccess"
  2291.       :on-preview="handlePreview"
  2292.       :limit="maxCount"
  2293.       :on-exceed="handleExceed"
  2294.       :show-file-list="showFile"
  2295.     >
  2296.       <i ></i>
  2297.     </el-upload>  );<el-upload
  2298.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2299.       :data="dataObj"
  2300.       :list-type="listType"
  2301.       :file-list="fileList"
  2302.       :before-upload="beforeUpload"
  2303.       :on-remove="handleRemove"
  2304.       :on-success="handleUploadSuccess"
  2305.       :on-preview="handlePreview"
  2306.       :limit="maxCount"
  2307.       :on-exceed="handleExceed"
  2308.       :show-file-list="showFile"
  2309.     >
  2310.       <i ></i>
  2311.     </el-upload>  return new PageUtils(page);        }        /**         * 保存 spu 的基本信息到 commodity_spu_info         *         * @param spuInfoEntity         */        @Override        public void saveBaseSpuInfo (SpuInfoEntity spuInfoEntity){<el-upload
  2312.       action="http://hspliving-10000.oss-cn-beijing.aliyuncs.com"
  2313.       :data="dataObj"
  2314.       :list-type="listType"
  2315.       :file-list="fileList"
  2316.       :before-upload="beforeUpload"
  2317.       :on-remove="handleRemove"
  2318.       :on-success="handleUploadSuccess"
  2319.       :on-preview="handlePreview"
  2320.       :limit="maxCount"
  2321.       :on-exceed="handleExceed"
  2322.       :show-file-list="showFile"
  2323.     >
  2324.       <i ></i>
  2325.     </el-upload>  this.baseMapper.insert(spuInfoEntity);        }//    @Override//    public void saveSpuInfo(SpuSaveVO spuSaveVO) {////1、保存 spu 基本信息 , 对应的表 commodity_spu_info//        SpuInfoEntity spuInfoEntity = new SpuInfoEntity();//        BeanUtils.copyProperties(spuSaveVO,spuInfoEntity);//        spuInfoEntity.setCreateTime(new Date());//        spuInfoEntity.setUpdateTime(new Date());////2. 将 SpuInfoEntity 信息保存到 commodity_spu_info//        this.saveBaseSpuInfo(spuInfoEntity);//    }    }
复制代码
使用订阅发布功能的实现

因为要使用到订阅发布功能,所以我们必要做如下操作.
使用 npm 添加依赖:npm install --save pubsub-js(失败的话使用此下令:cnpm install --save pubsub-js)
  1. E:\Java\project\RainbowSealiving\renren-fast-vue>npm install --save pubsub-js
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

傲渊山岳

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表