!327 fix & improve

Merge pull request !327 from OceansDeep/pg
This commit is contained in:
OceansDeep 2024-01-22 02:55:04 +00:00 committed by Gitee
commit 26c1c97442
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 21 additions and 35 deletions

View File

@ -7,7 +7,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Map;
/**
* 商品导入DTO
@ -36,7 +35,7 @@ public class GoodsImportDTO {
private Boolean release;
@ApiModelProperty(value = "商品图片")
private List<Map<String, String>> images;
private List<String> images;
private List<String> goodsGalleryList;
@ApiModelProperty(value = "成本价")

View File

@ -32,18 +32,5 @@ public class SpecValueVO implements Serializable {
* 规格图片
*/
@ApiModelProperty(value = "规格的图片")
private List<SpecImages> specImage;
@Data
public static class SpecImages implements Serializable {
private static final long serialVersionUID = 1816357809660916086L;
private String url;
private String name;
private String status;
}
private List<String> specImage;
}

View File

@ -33,7 +33,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Slf4j
@Service
@ -203,15 +205,11 @@ public class GoodsImportServiceImpl implements GoodsImportService {
goodsImportDTO.setCategory(category);
goodsImportDTO.setTemplate(templateId);
goodsImportDTO.setGoodsUnit(objects.get(4).toString().substring(objects.get(4).toString().indexOf("-") + 1));
goodsImportDTO.setRelease(objects.get(5).toString().equals("上架") ? true : false);
goodsImportDTO.setRelease(objects.get(5).toString().equals("上架"));
List<Map<String, String>> images = new ArrayList<>();
List<String> goodsGalleryList = new ArrayList<>();
Map<String, String> map = new HashMap<>();
map.put("url", objects.get(6).toString());
images.add(map);
goodsGalleryList.add(objects.get(6).toString());
goodsImportDTO.setImages(images);
goodsImportDTO.setImages(goodsGalleryList);
goodsImportDTO.setGoodsGalleryList(goodsGalleryList);
goodsImportDTO.setCost(Convert.toDouble(objects.get(7)));

View File

@ -334,6 +334,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
}
}
goodsSkuDetail.getGoodsGalleryList().addAll(goodsVO.getGoodsGalleryList());
map.put("data", goodsSkuDetail);
//获取分类
@ -474,13 +475,10 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
SpecValueVO specValueVO = new SpecValueVO();
if ("images".equals(entry.getKey())) {
specValueVO.setSpecName(entry.getKey());
if (entry.getValue().toString().contains("url")) {
List<SpecValueVO.SpecImages> specImages = JSONUtil.toList(JSONUtil.parseArray(entry.getValue()),
SpecValueVO.SpecImages.class);
specValueVO.setSpecImage(specImages);
goodsGalleryList =
specImages.stream().map(SpecValueVO.SpecImages::getUrl).collect(Collectors.toList());
}
List<String> specImages = JSONUtil.toList(JSONUtil.parseArray(entry.getValue()),
String.class);
specValueVO.setSpecImage(specImages);
goodsGalleryList = new ArrayList<>(specImages);
} else {
specValueVO.setSpecName(entry.getKey());
specValueVO.setSpecValue(entry.getValue().toString());

View File

@ -28,6 +28,10 @@ public class InsertIgnoreBatchAllColumn extends AbstractMethod {
@Accessors(chain = true)
private Predicate<TableFieldInfo> predicate;
protected InsertIgnoreBatchAllColumn(String methodName) {
super(methodName);
}
@SuppressWarnings("Duplicates")
@Override
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
@ -36,7 +40,7 @@ public class InsertIgnoreBatchAllColumn extends AbstractMethod {
String sqlTemplate = "<script>\nINSERT IGNORE INTO %s %s VALUES %s\n</script>";
List<TableFieldInfo> fieldList = tableInfo.getFieldList();
String insertSqlColumn = tableInfo.getKeyInsertSqlColumn(true, false) +
String insertSqlColumn = tableInfo.getKeyInsertSqlColumn(true, "", false) +
this.filterTableFieldInfo(fieldList, predicate, TableFieldInfo::getInsertSqlColumn, EMPTY);
String columnScript = LEFT_BRACKET + insertSqlColumn.substring(0, insertSqlColumn.length() - 1) + RIGHT_BRACKET;
String insertSqlProperty = tableInfo.getKeyInsertSqlProperty(true, ENTITY_DOT, false) +

View File

@ -28,7 +28,7 @@ public class SpiceSqlInjector extends DefaultSqlInjector {
// methodList.add(new InsertBatchSomeColumn(t -> !t.isLogicDelete() && !"update_time".equals(t.getColumn())));
// 要逻辑删除 t.isLogicDelete() 默认不要
methodList.add(new InsertBatchSomeColumn(t -> !t.isLogicDelete()));
methodList.add(new InsertIgnoreBatchAllColumn());
methodList.add(new InsertIgnoreBatchAllColumn("insertIgnoreBatchAllColumn"));
return methodList;
}
}

View File

@ -25,12 +25,12 @@
<docker-registry>registry.cn-beijing.aliyuncs.com/lili-images</docker-registry>
<images-version>1</images-version>
<alipay-sdk-version>4.22.32.ALL</alipay-sdk-version>
<mybatis-plus-version>3.5.1</mybatis-plus-version>
<Hutool-version>5.8.14</Hutool-version>
<mybatis-plus-version>3.5.5</mybatis-plus-version>
<Hutool-version>5.8.24</Hutool-version>
<TinyPinyin-verions>2.0.3.RELEASE</TinyPinyin-verions>
<jasypt-version>3.0.4</jasypt-version>
<neetl-version>2.9.10</neetl-version>
<lombok-version>1.18.24</lombok-version>
<lombok-version>1.18.30</lombok-version>
<redisson>3.15.6</redisson>
<aliyun-version>4.5.18</aliyun-version>
<aliyun-sdk-oss-version>3.11.1</aliyun-sdk-oss-version>