BUGFIX:删除library元素时没有将brand中关联的数据删除,导致出现空指针
This commit is contained in:
@@ -2478,6 +2478,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
if (returnCredits && unusedCreditsTotal.compareTo(BigDecimal.ZERO) != 0){
|
||||
BigDecimal subtracted = adminAcc.getCreditsUsage().subtract(unusedCreditsTotal);
|
||||
adminAcc.setCreditsUsage(subtracted.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : subtracted);
|
||||
adminAcc.setCredits(adminAcc.getCreditsUsageLimit().subtract(adminAcc.getCreditsUsage()));
|
||||
adminAcc.setUpdateDate(new Date());
|
||||
baseMapper.updateById(adminAcc);
|
||||
}
|
||||
|
||||
@@ -554,6 +554,12 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
deleteDTO.getTimeZone()
|
||||
);
|
||||
}
|
||||
|
||||
// 判断当前libraryId是否被brand_rel_library引用
|
||||
QueryWrapper<BrandRelLibrary> brandRelLibraryQueryWrapper = new QueryWrapper<>();
|
||||
brandRelLibraryQueryWrapper.lambda().in(BrandRelLibrary::getLibraryId, deleteDTO.getLibraryIds());
|
||||
|
||||
brandRelLibraryMapper.delete(brandRelLibraryQueryWrapper);
|
||||
// for (Library library : librarys) {
|
||||
// if (library.getUrl().startsWith(sysImage)) {
|
||||
// continue;
|
||||
|
||||
@@ -22,11 +22,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -71,6 +71,9 @@ public class ProductImageServiceImpl implements ProductImageService {
|
||||
int current = 0;
|
||||
for (Long libraryId : libraryIds) {
|
||||
Library library = libraryMapper.selectById(libraryId);
|
||||
if (Objects.isNull(library)){
|
||||
continue;
|
||||
}
|
||||
String url = library.getUrl();
|
||||
|
||||
QueryWrapper<ProductImageAttribute> qw = new QueryWrapper<>();
|
||||
|
||||
Reference in New Issue
Block a user