fix - 调整产品与权限点关联关系的存储实现
This commit is contained in:
parent
957070b9fc
commit
958ea432c5
@ -8,6 +8,7 @@ import cn.axzo.tyr.client.model.product.ProductFeatureRelationVO;
|
||||
import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation;
|
||||
import cn.axzo.tyr.server.repository.service.SaasProductModuleFeatureRelationDao;
|
||||
import cn.axzo.tyr.server.service.ProductFeatureRelationService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -44,7 +45,10 @@ public class ProductFeatureRelationServiceImpl implements ProductFeatureRelation
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApiResult<Boolean> updateFeatureRelation(List<ProductFeatureRelationUpdateReq> req) {
|
||||
List<Long> productIds = req.stream().map(ProductFeatureRelationUpdateReq::getProductModuleId).distinct().collect(Collectors.toList());
|
||||
saasProductModuleFeatureRelationDao.removeByIds(productIds);
|
||||
if(!CollectionUtils.isEmpty(productIds)) {
|
||||
saasProductModuleFeatureRelationDao.remove(new LambdaQueryWrapper<SaasProductModuleFeatureRelation>()
|
||||
.in(SaasProductModuleFeatureRelation::getProductModuleId, productIds));
|
||||
}
|
||||
List<SaasProductModuleFeatureRelation> saveList = new ArrayList<>();
|
||||
req.forEach(i -> i.getFeatureIds().forEach(featureId -> {
|
||||
SaasProductModuleFeatureRelation relation = new SaasProductModuleFeatureRelation();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user