mirror of https://gitee.com/stylefeng/roses
【7.6.0】【config】配置类型:更新删除配置类型
parent
5cb58e9c7a
commit
b0b04649fc
|
@ -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<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* 编辑系统参数配置
|
||||
*
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue