|
|
|
@ -46,23 +46,23 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet
|
|
|
|
public void updateShopDetail(ShopDetail shopDetail,ShopDetail dbShopDetail) {
|
|
|
|
public void updateShopDetail(ShopDetail shopDetail,ShopDetail dbShopDetail) {
|
|
|
|
// 更新除数据库中的信息,再删除图片
|
|
|
|
// 更新除数据库中的信息,再删除图片
|
|
|
|
shopDetailMapper.updateById(shopDetail);
|
|
|
|
shopDetailMapper.updateById(shopDetail);
|
|
|
|
if (!Objects.equals(dbShopDetail.getShopLogo(), shopDetail.getShopLogo())) {
|
|
|
|
// if (!Objects.equals(dbShopDetail.getShopLogo(), shopDetail.getShopLogo())) {
|
|
|
|
// 删除logo
|
|
|
|
// // 删除logo
|
|
|
|
attachFileService.deleteFile(shopDetail.getShopLogo());
|
|
|
|
// attachFileService.deleteFile(shopDetail.getShopLogo());
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
// 店铺图片
|
|
|
|
// // 店铺图片
|
|
|
|
String shopPhotos = shopDetail.getShopPhotos();
|
|
|
|
// String shopPhotos = shopDetail.getShopPhotos();
|
|
|
|
String[] shopPhotoArray =StrUtil.isBlank(shopPhotos)?new String[]{}: shopPhotos.split(",");
|
|
|
|
// String[] shopPhotoArray =StrUtil.isBlank(shopPhotos)?new String[]{}: shopPhotos.split(",");
|
|
|
|
|
|
|
|
//
|
|
|
|
// 数据库中的店铺图片
|
|
|
|
// // 数据库中的店铺图片
|
|
|
|
String dbShopPhotos = dbShopDetail.getShopPhotos();
|
|
|
|
// String dbShopPhotos = dbShopDetail.getShopPhotos();
|
|
|
|
String[] dbShopPhotoArray =StrUtil.isBlank(dbShopPhotos)?new String[]{}: dbShopPhotos.split(",");
|
|
|
|
// String[] dbShopPhotoArray =StrUtil.isBlank(dbShopPhotos)?new String[]{}: dbShopPhotos.split(",");
|
|
|
|
for (String dbShopPhoto : dbShopPhotoArray) {
|
|
|
|
// for (String dbShopPhoto : dbShopPhotoArray) {
|
|
|
|
// 如果新插入的图片中没有旧数据中的图片,则删除旧数据中的图片
|
|
|
|
// // 如果新插入的图片中没有旧数据中的图片,则删除旧数据中的图片
|
|
|
|
if (!ArrayUtil.contains(shopPhotoArray, dbShopPhoto)) {
|
|
|
|
// if (!ArrayUtil.contains(shopPhotoArray, dbShopPhoto)) {
|
|
|
|
attachFileService.deleteFile(dbShopPhoto);
|
|
|
|
// attachFileService.deleteFile(dbShopPhoto);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@ -72,17 +72,17 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet
|
|
|
|
// 先删除数据库中的信息,再删除图片
|
|
|
|
// 先删除数据库中的信息,再删除图片
|
|
|
|
shopDetailMapper.deleteById(shopId);
|
|
|
|
shopDetailMapper.deleteById(shopId);
|
|
|
|
|
|
|
|
|
|
|
|
ShopDetail shopDetail = shopDetailMapper.selectById(shopId);
|
|
|
|
// ShopDetail shopDetail = shopDetailMapper.selectById(shopId);
|
|
|
|
// 删除logo
|
|
|
|
// 删除logo
|
|
|
|
attachFileService.deleteFile(shopDetail.getShopLogo());
|
|
|
|
// attachFileService.deleteFile(shopDetail.getShopLogo());
|
|
|
|
// 删除店铺图片
|
|
|
|
// // 删除店铺图片
|
|
|
|
String shopPhotos = shopDetail.getShopPhotos();
|
|
|
|
// String shopPhotos = shopDetail.getShopPhotos();
|
|
|
|
if (StrUtil.isNotBlank(shopPhotos)) {
|
|
|
|
// if (StrUtil.isNotBlank(shopPhotos)) {
|
|
|
|
String[] shopPhotoArray = shopPhotos.split(",");
|
|
|
|
// String[] shopPhotoArray = shopPhotos.split(",");
|
|
|
|
for (String shopPhoto : shopPhotoArray) {
|
|
|
|
// for (String shopPhoto : shopPhotoArray) {
|
|
|
|
attachFileService.deleteFile(shopPhoto);
|
|
|
|
// attachFileService.deleteFile(shopPhoto);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|