图库新增删除功能

This commit is contained in:
liyj 2026-01-12 15:48:50 +08:00
parent 080778a62e
commit 2885f477dd
4 changed files with 31 additions and 0 deletions

View File

@ -65,4 +65,17 @@ public class LibraryProductController {
return libraryProductService.shopImportToLib(storeId); return libraryProductService.shopImportToLib(storeId);
} }
/**
* 删除
* @param
* @return
*/
@ApiOperation(value = "删除图库图", notes = "根据主图id删除图库图")
@RequestMapping(value = "/delByLibraryProductId", method = RequestMethod.DELETE)
public CommonResult delByLibraryProductId(@RequestParam("libraryProductId") long libraryProductId) {
return libraryProductService.delLibraryProductById(libraryProductId);
}
} }

View File

@ -41,4 +41,6 @@ public interface LibraryProductService extends IBaseService<LibraryProduct> {
CommonResult shopImportToLib(Integer storeId); CommonResult shopImportToLib(Integer storeId);
CommonResult delLibraryProductById(long storeId);
} }

View File

@ -333,6 +333,19 @@ public class LibraryProductImpl extends BaseServiceImpl<LibraryProductMapper, Li
return CommonResult.success("导入成功:路径复制中..."); return CommonResult.success("导入成功:路径复制中...");
} }
@Override
public CommonResult delLibraryProductById(long libraryProductId) {
this.remove(libraryProductId);
QueryWrapper<LibraryProductImage> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("product_id",libraryProductId);
List<LibraryProductImage> libraryProductImageList= libraryProductImageService.list(queryWrapper);
if(!libraryProductImageList.isEmpty()){
List<Long> LibraryProductImageIds=libraryProductImageList.stream().map(LibraryProductImage::getId).collect(Collectors.toList());
libraryProductImageService.removeBatchByIds(LibraryProductImageIds);
}
return CommonResult.success("操作成功");
}
/** /**
* 批量保存到图库 * 批量保存到图库
* @param shopProductImageList * @param shopProductImageList
@ -483,6 +496,8 @@ public class LibraryProductImpl extends BaseServiceImpl<LibraryProductMapper, Li
} }
/** /**
* 校验是否存在存在则去除 * 校验是否存在存在则去除
* @param shopProductBaseMap * @param shopProductBaseMap

View File

@ -0,0 +1 @@
INSERT INTO `admin_base_protocol` (`ctl`, `met`, `db`, `rights_id`, `log`, `path`,`comment`) VALUES ('/admin/shop/libraryProduct/delByLibraryProductId', 'index', 'master', '', '0', '/admin/shop/libraryProduct/delByLibraryProductId','图库图片删除');