【7.6.0】【config】配置类型:更新删除配置类型

pull/57/head
fengshuonan 2023-06-28 18:24:17 +08:00
parent 5cb58e9c7a
commit b0b04649fc
5 changed files with 55 additions and 1 deletions

View File

@ -90,6 +90,18 @@ public class SysConfigTypeController {
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2023/6/28 17:00
*/
@PostResource(name = "删除配置类型", path = "/sysConfigType/delete")
public ResponseData<?> delete(@RequestBody @Validated(BaseRequest.delete.class) SysConfigTypeParam sysConfigTypeParam) {
sysConfigTypeService.delete(sysConfigTypeParam);
return new SuccessResponseData<>();
}
}

View File

@ -45,7 +45,7 @@ public class SysConfigTypeParam extends BaseRequest {
/**
* id
*/
@NotBlank(message = "配置类型id不能为空", groups = {edit.class, detail.class})
@NotBlank(message = "配置类型id不能为空", groups = {edit.class, delete.class})
@ChineseDescription("配置类型id")
private Long configTypeId;

View File

@ -58,6 +58,15 @@ public interface SysConfigService extends IService<SysConfig>, InitConfigApi {
*/
void del(SysConfigParam sysConfigParam);
/**
*
*
* @param configGroupCode
* @author fengshuonan
* @since 2023/6/28 18:21
*/
void delByConfigCode(String configGroupCode);
/**
*
*

View File

@ -102,4 +102,25 @@ public class SysConfigTypeService {
}
/**
*
* <p>
* config_group
*
* @author fengshuonan
* @since 2023/6/28 18:13
*/
@Transactional(rollbackFor = Exception.class)
public void delete(SysConfigTypeParam sysConfigTypeParam) {
// 获取字典的编码
SimpleDict originDictInfo = dictApi.getDictByDictId(sysConfigTypeParam.getConfigTypeId());
// 删除字典
this.dictApi.deleteByDictId(sysConfigTypeParam.getConfigTypeId());
// 删除配置类型对应的所有配置
this.sysConfigService.delByConfigCode(originDictInfo.getCode());
}
}

View File

@ -109,6 +109,18 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
ConfigContext.me().deleteConfig(sysConfigParam.getConfigCode());
}
@Override
public void delByConfigCode(String configGroupCode) {
if (ObjectUtil.isEmpty(configGroupCode)) {
return;
}
LambdaUpdateWrapper<SysConfig> sysConfigLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
sysConfigLambdaUpdateWrapper.eq(SysConfig::getGroupCode, configGroupCode);
this.remove(sysConfigLambdaUpdateWrapper);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void edit(SysConfigParam sysConfigParam) {