diff --git a/nflg-mobilebroken-admin/src/test/java/TTest.java b/nflg-mobilebroken-admin/src/test/java/TTest.java index 74f06a87..3dc103ef 100644 --- a/nflg-mobilebroken-admin/src/test/java/TTest.java +++ b/nflg-mobilebroken-admin/src/test/java/TTest.java @@ -1,4 +1,7 @@ +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; import java.time.LocalDate; import java.time.LocalDateTime; @@ -7,9 +10,9 @@ import java.time.temporal.ChronoUnit; public class TTest { @Test - public void test1(){ - LocalDate t1=LocalDateTime.now().toLocalDate(); - LocalDate t2=LocalDateTime.now().toLocalDate().minusDays(1); + public void test1() { + LocalDate t1 = LocalDateTime.now().toLocalDate(); + LocalDate t2 = LocalDateTime.now().toLocalDate().minusDays(1); System.out.println(t1); System.out.println(t2); System.out.println(ChronoUnit.DAYS.between(null, t1)); @@ -19,4 +22,12 @@ public class TTest { public void test2() { System.out.println("【" + " 打 撒sfc dffd发多少分多少 分多少分的d f ".replaceAll("\\s+", "") + "】"); } + + @Test + public void test4() { + PasswordEncoder PASSWORDENCODER = new BCryptPasswordEncoder(); + String password = PASSWORDENCODER.encode("Nflg0331"); + System.out.println(password); + Assertions.assertTrue(PASSWORDENCODER.matches("Nflg0331", password), "密码不正确"); + } } \ No newline at end of file diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelImageItemService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelImageItemService.java index ad7d3a6f..c05af960 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelImageItemService.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelImageItemService.java @@ -4,6 +4,7 @@ import com.nflg.mobilebroken.common.pojo.request.ProductModelImageItemAddRequest import com.nflg.mobilebroken.repository.entity.ProductModelImageItem; import com.baomidou.mybatisplus.extension.service.IService; +import javax.validation.constraints.NotEmpty; import java.util.List; /** @@ -21,4 +22,6 @@ public interface IProductModelImageItemService extends IService items); List getInfo(Integer modelImagesId); + + void removeByImageIds(List ids); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelIntroItemService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelIntroItemService.java index 9a7242ea..a272a07a 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelIntroItemService.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelIntroItemService.java @@ -17,7 +17,9 @@ import java.util.List; */ public interface IProductModelIntroItemService extends IService { - void add(Integer id, @NotEmpty List items); + void add(Integer id, List items); void update(List items); + + void deleteByIntroIds(List ids); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelVideoItemService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelVideoItemService.java index 360da456..8da100e2 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelVideoItemService.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelVideoItemService.java @@ -21,4 +21,6 @@ public interface IProductModelVideoItemService extends IService items); List getInfo(Integer modelVideoId); + + void removeByVideoIds(List itemIds); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelFileServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelFileServiceImpl.java index 1ddd02d7..d5e6f321 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelFileServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelFileServiceImpl.java @@ -1,5 +1,6 @@ package com.nflg.mobilebroken.repository.service.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -18,6 +19,7 @@ import com.nflg.mobilebroken.common.util.VUtils; import com.nflg.mobilebroken.repository.entity.Language; import com.nflg.mobilebroken.repository.entity.ProductModelFile; import com.nflg.mobilebroken.repository.entity.ProductModelFileItem; +import com.nflg.mobilebroken.repository.entity.ProductModelIntro; import com.nflg.mobilebroken.repository.mapper.ProductModelFileMapper; import com.nflg.mobilebroken.repository.service.ILanguageService; import com.nflg.mobilebroken.repository.service.IProductModelFileItemService; @@ -59,11 +61,11 @@ public class ProductModelFileServiceImpl extends ServiceImpl ids) { - remove(new LambdaQueryWrapper().in(ProductModelFile::getModelId, ids)); + List itemIds = lambdaQuery() + .eq(ProductModelFile::getModelId, ids) + .select(ProductModelFile::getId) + .list() + .stream() + .map(ProductModelFile::getId) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(itemIds)) { + productModelFileItemService.removeByFileIds(itemIds); + } + removeByIds(itemIds); } @Override @@ -229,7 +242,7 @@ public class ProductModelFileServiceImpl extends ServiceImpl getDefaultConfig(Integer modelId) { - List vos=new ArrayList<>(); + List vos = new ArrayList<>(); List languages = languageService.getLanguages(); List list = productModelFileItemService.getPublishedByLanguage(modelId); languages.forEach(language -> { @@ -267,6 +280,6 @@ public class ProductModelFileServiceImpl extends ServiceImpl getListByLanguage(Integer modelId, String language) { - return baseMapper.getListByLanguage(modelId,language); + return baseMapper.getListByLanguage(modelId, language); } } \ No newline at end of file diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelImageItemServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelImageItemServiceImpl.java index c509cee2..f86c5ebd 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelImageItemServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelImageItemServiceImpl.java @@ -69,4 +69,11 @@ public class ProductModelImageItemServiceImpl extends ServiceImpl ids) { + lambdaUpdate() + .in(ProductModelImageItem::getModelImagesId, ids) + .remove(); + } } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelImageServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelImageServiceImpl.java index 01bf0a51..0c2764e1 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelImageServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelImageServiceImpl.java @@ -15,6 +15,7 @@ import com.nflg.mobilebroken.common.pojo.vo.ProductImageVO; import com.nflg.mobilebroken.common.pojo.vo.ProductModelImagesInfoVO; import com.nflg.mobilebroken.common.util.AdminUserUtil; import com.nflg.mobilebroken.common.util.VUtils; +import com.nflg.mobilebroken.repository.entity.ProductModelFile; import com.nflg.mobilebroken.repository.entity.ProductModelImage; import com.nflg.mobilebroken.repository.mapper.ProductModelImageMapper; import com.nflg.mobilebroken.repository.service.IProductModelImageItemService; @@ -76,6 +77,7 @@ public class ProductModelImageServiceImpl extends ServiceImpl ids) { - remove(new LambdaQueryWrapper().in(ProductModelImage::getModelId, ids)); + List itemIds = lambdaQuery() + .eq(ProductModelImage::getModelId, ids) + .select(ProductModelImage::getId) + .list() + .stream() + .map(ProductModelImage::getId) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(itemIds)) { + productModelImageItemService.removeByImageIds(itemIds); + } + removeByIds(itemIds); } @Override diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelIntroItemServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelIntroItemServiceImpl.java index 4cdd752c..de978fff 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelIntroItemServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelIntroItemServiceImpl.java @@ -52,4 +52,11 @@ public class ProductModelIntroItemServiceImpl extends ServiceImpl ids) { + lambdaUpdate() + .in(ProductModelIntroItem::getModelIntroId, ids) + .remove(); + } } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelIntroServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelIntroServiceImpl.java index 83c26a84..f79e7768 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelIntroServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelIntroServiceImpl.java @@ -1,5 +1,6 @@ package com.nflg.mobilebroken.repository.service.impl; +import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -10,6 +11,7 @@ import com.nflg.mobilebroken.common.util.AdminUserUtil; import com.nflg.mobilebroken.common.util.VUtils; import com.nflg.mobilebroken.repository.entity.ProductModelIntro; import com.nflg.mobilebroken.repository.entity.ProductModelIntroItem; +import com.nflg.mobilebroken.repository.entity.ProductModelParams; import com.nflg.mobilebroken.repository.mapper.ProductModelIntroMapper; import com.nflg.mobilebroken.repository.service.IProductModelIntroItemService; import com.nflg.mobilebroken.repository.service.IProductModelIntroService; @@ -20,10 +22,11 @@ import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** *

- * 服务实现类 + * 服务实现类 *

* * @author 代码生成器生成 @@ -63,6 +66,7 @@ public class ProductModelIntroServiceImpl extends ServiceImpl getInfo(Integer introId) { return productModelIntroItemService.lambdaQuery() - .eq(ProductModelIntroItem::getModelIntroId,introId) + .eq(ProductModelIntroItem::getModelIntroId, introId) .list(); } @Override public void copyItems(Integer oldId, Integer newId) { - baseMapper.copyItems(oldId,newId); + baseMapper.copyItems(oldId, newId); } + @Transactional @Override public void deleteByModel(List ids) { - remove(new LambdaQueryWrapper().in(ProductModelIntro::getModelId, ids)); + List itemIds = lambdaQuery() + .eq(ProductModelIntro::getModelId, ids) + .select(ProductModelIntro::getId) + .list() + .stream() + .map(ProductModelIntro::getId) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(itemIds)) { + productModelIntroItemService.deleteByIntroIds(itemIds); + } + removeByIds(itemIds); } @Override public ProductModelIntroItem getByLanguage(Integer modelId, String language) { - return baseMapper.getByLanguage(modelId,language); + return baseMapper.getByLanguage(modelId, language); } } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsServiceImpl.java index 63937de6..dcc1f0b0 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsServiceImpl.java @@ -144,9 +144,20 @@ public class ProductModelParamsServiceImpl extends ServiceImpl ids) { - remove(new LambdaQueryWrapper().in(ProductModelParams::getModelId, ids)); + List itemIds=lambdaQuery() + .eq(ProductModelParams::getModelId, ids) + .select(ProductModelParams::getId) + .list() + .stream() + .map(ProductModelParams::getId) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(itemIds)){ + productModelParamsItemService.deleteByParamsIds(itemIds); + } + removeByIds(itemIds); } @Override diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelVideoItemServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelVideoItemServiceImpl.java index 1c9b7880..d0607762 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelVideoItemServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelVideoItemServiceImpl.java @@ -75,4 +75,11 @@ public class ProductModelVideoItemServiceImpl extends ServiceImpl itemIds) { + lambdaUpdate() + .in(ProductModelVideoItem::getModelVideoId, itemIds) + .remove(); + } } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelVideoServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelVideoServiceImpl.java index f9144c44..d303290f 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelVideoServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelVideoServiceImpl.java @@ -15,6 +15,7 @@ import com.nflg.mobilebroken.common.pojo.vo.ProductModelVideoInfoVO; import com.nflg.mobilebroken.common.pojo.vo.ProductVideoVO; import com.nflg.mobilebroken.common.util.AdminUserUtil; import com.nflg.mobilebroken.common.util.VUtils; +import com.nflg.mobilebroken.repository.entity.ProductModelImage; import com.nflg.mobilebroken.repository.entity.ProductModelVideo; import com.nflg.mobilebroken.repository.mapper.ProductModelVideoMapper; import com.nflg.mobilebroken.repository.service.IProductModelVideoItemService; @@ -97,6 +98,7 @@ public class ProductModelVideoServiceImpl extends ServiceImpl ids) { - remove(new LambdaQueryWrapper().in(ProductModelVideo::getModelId, ids)); + List itemIds = lambdaQuery() + .eq(ProductModelVideo::getModelId, ids) + .select(ProductModelVideo::getId) + .list() + .stream() + .map(ProductModelVideo::getId) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(itemIds)) { + productModelVideoItemService.removeByVideoIds(itemIds); + } + removeByIds(itemIds); } @Override