feat(REQ-2545): 保存产品接口修改

This commit is contained in:
李昆鹏 2024-07-10 17:59:22 +08:00
parent 89d0d040fc
commit 1087c505c8
3 changed files with 12 additions and 0 deletions

View File

@ -32,6 +32,8 @@ public interface ProductFeatureRelationService extends IService<SaasProductModul
*/
void updateFeatureResourceRelation(List<ProductFeatureRelationUpdateReq> req, int relationType);
void removeFeatureResourceRelationByProductIdAndType(Long productId, int relationType);
ApiResult<List<ProductFeatureRelationVO>> featureListByProduct(List<Long> productIds);
/**

View File

@ -139,6 +139,12 @@ public class ProductFeatureRelationServiceImpl extends ServiceImpl<SaasProductMo
saasProductModuleFeatureRelationDao.saveBatch(saveList);
}
@Override
public void removeFeatureResourceRelationByProductIdAndType(Long productId, int relationType) {
saasProductModuleFeatureRelationDao.remove(new LambdaQueryWrapper<SaasProductModuleFeatureRelation>()
.eq(SaasProductModuleFeatureRelation::getProductModuleId, productId).eq(SaasProductModuleFeatureRelation::getType, relationType));
}
@Override
public ApiResult<List<ProductFeatureRelationVO>> featureListByProduct(List<Long> productIds) {
if (CollectionUtil.isEmpty(productIds)) {

View File

@ -367,6 +367,10 @@ public class ProductServiceImpl implements ProductService {
* 保存非政务端产品功能权限
*/
private void saveNonGaFeatureResource(Long productId, List<ProductSaveReq.ProductFeatureRelation> relations) {
if (CollectionUtils.isEmpty(relations)) {
productFeatureRelationService.removeFeatureResourceRelationByProductIdAndType(productId, ProductModuleFeatureRelationTypeEnum.FEATURE_RESOURCE.getCode());
return;
}
List<Long> dictCodeIds = Lists.newArrayList();
for (ProductSaveReq.ProductFeatureRelation relation : relations) {
AssertUtil.notNull(relation.getDictCodeId(), "功能范围选择的字典ID不能未空。");