|
@@ -190,6 +190,23 @@ public class PropertyService extends ServiceImpl<PropertyItemDao, PropertyItem>
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional
|
|
|
|
+ public void deletePropertyItem(PropertyItem item) {
|
|
|
|
+ PropertyItem base = findOne(item.getAppId(), item.getVersionId(), item.getModuleId(), BASELINE_ENV_ID,
|
|
|
|
+ item.getKey());
|
|
|
|
+ if (base != null) {
|
|
|
|
+ throw new ParameterException("存在基线配置项时不能删除");
|
|
|
|
+ }
|
|
|
|
+ PropertyItem current = findOne(item.getAppId(), item.getVersionId(), item.getModuleId(), item.getEnvId(),
|
|
|
|
+ item.getKey());
|
|
|
|
+ if (current == null) {
|
|
|
|
+ throw new ParameterException("配置项不存在");
|
|
|
|
+ }
|
|
|
|
+ propertyItemDao.delete(new LambdaQueryWrapper<PropertyItem>().eq(PropertyItem::getAppId, item.getAppId())
|
|
|
|
+ .eq(PropertyItem::getVersionId, item.getVersionId()).eq(PropertyItem::getModuleId, item.getModuleId())
|
|
|
|
+ .eq(PropertyItem::getEnvId, item.getEnvId()).eq(PropertyItem::getKey, item.getKey()));
|
|
|
|
+ }
|
|
|
|
+
|
|
public PropertyItem findOne(Long appId, Long versionId, Long moduleId, Long envId, String key) {
|
|
public PropertyItem findOne(Long appId, Long versionId, Long moduleId, Long envId, String key) {
|
|
return propertyItemDao.selectOne(new LambdaQueryWrapper<PropertyItem>().eq(PropertyItem::getAppId, appId)
|
|
return propertyItemDao.selectOne(new LambdaQueryWrapper<PropertyItem>().eq(PropertyItem::getAppId, appId)
|
|
.eq(PropertyItem::getVersionId, versionId).eq(PropertyItem::getModuleId, moduleId)
|
|
.eq(PropertyItem::getVersionId, versionId).eq(PropertyItem::getModuleId, moduleId)
|