mirror of https://gitee.com/stylefeng/roses
【7.6.0】【config】更新配置类型:新增接口
parent
1cf6010683
commit
79b4c68a73
|
@ -3,6 +3,8 @@ package cn.stylefeng.roses.kernel.config.modular.service;
|
|||
import cn.stylefeng.roses.kernel.config.api.constants.ConfigConstants;
|
||||
import cn.stylefeng.roses.kernel.config.modular.pojo.param.SysConfigTypeParam;
|
||||
import cn.stylefeng.roses.kernel.dict.api.DictApi;
|
||||
import cn.stylefeng.roses.kernel.dict.api.DictTypeApi;
|
||||
import cn.stylefeng.roses.kernel.dict.api.pojo.SimpleDictAddParam;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -21,6 +23,9 @@ public class SysConfigTypeService {
|
|||
@Resource
|
||||
private DictApi dictApi;
|
||||
|
||||
@Resource
|
||||
private DictTypeApi dictTypeApi;
|
||||
|
||||
/**
|
||||
* 查询系统配置类型列表
|
||||
* <p>
|
||||
|
@ -43,6 +48,18 @@ public class SysConfigTypeService {
|
|||
*/
|
||||
public void add(SysConfigTypeParam sysConfigTypeParam) {
|
||||
|
||||
// 查询字典类型
|
||||
Long dictTypeId = dictTypeApi.getDictTypeIdByDictTypeCode(ConfigConstants.CONFIG_GROUP_DICT_TYPE_CODE);
|
||||
|
||||
// 配置类型信息转化为新增字典的参数信息
|
||||
SimpleDictAddParam simpleDictAddParam = new SimpleDictAddParam();
|
||||
simpleDictAddParam.setDictTypeId(dictTypeId);
|
||||
simpleDictAddParam.setDictName(sysConfigTypeParam.getConfigTypeName());
|
||||
simpleDictAddParam.setDictCode(sysConfigTypeParam.getConfigTypeCode());
|
||||
simpleDictAddParam.setDictSort(sysConfigTypeParam.getConfigTypeSort());
|
||||
|
||||
// 新增一个字典
|
||||
dictApi.simpleAddDict(simpleDictAddParam);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
package cn.stylefeng.roses.kernel.dict.api;
|
||||
|
||||
import cn.stylefeng.roses.kernel.dict.api.pojo.SimpleDictAddParam;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -75,4 +76,12 @@ public interface DictApi {
|
|||
*/
|
||||
String getDictNameByDictId(Long dictId);
|
||||
|
||||
/**
|
||||
* 外部系统调用本模块进行新增字典
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/6/28 17:26
|
||||
*/
|
||||
void simpleAddDict(SimpleDictAddParam simpleDictAddParam);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright [2020-2030] [https://www.stylefeng.cn]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||
*
|
||||
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
* 2.请不要删除和修改Guns源码头部的版权声明。
|
||||
* 3.请保留源码和相关描述文件的项目出处,作者声明等。
|
||||
* 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||
* 6.若您的项目无法满足以上几点,可申请商业授权
|
||||
*/
|
||||
package cn.stylefeng.roses.kernel.dict.api;
|
||||
|
||||
/**
|
||||
* 字典类型的api
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/6/28 17:24
|
||||
*/
|
||||
public interface DictTypeApi {
|
||||
|
||||
/**
|
||||
* 通过字典类型的编码,获取到字典类型的id
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/6/27 17:39
|
||||
*/
|
||||
Long getDictTypeIdByDictTypeCode(String dictTypeCode);
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright [2020-2030] [https://www.stylefeng.cn]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||
*
|
||||
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
* 2.请不要删除和修改Guns源码头部的版权声明。
|
||||
* 3.请保留源码和相关描述文件的项目出处,作者声明等。
|
||||
* 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||
* 6.若您的项目无法满足以上几点,可申请商业授权
|
||||
*/
|
||||
package cn.stylefeng.roses.kernel.dict.api.pojo;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 外部系统添加字典的请求参数
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/6/28 17:21
|
||||
*/
|
||||
@Data
|
||||
public class SimpleDictAddParam {
|
||||
|
||||
/**
|
||||
* 字典id
|
||||
*/
|
||||
@ChineseDescription("字典id")
|
||||
private Long dictId;
|
||||
|
||||
/**
|
||||
* 字典类型id
|
||||
*/
|
||||
@ChineseDescription("字典类型id")
|
||||
private Long dictTypeId;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
@ChineseDescription("字典名称")
|
||||
private String dictName;
|
||||
|
||||
/**
|
||||
* 字典编码
|
||||
*/
|
||||
@ChineseDescription("字典编码")
|
||||
private String dictCode;
|
||||
|
||||
/**
|
||||
* 上级字典的id
|
||||
*/
|
||||
@ChineseDescription("上级字典的id")
|
||||
private Long dictParentId = -1L;
|
||||
|
||||
/**
|
||||
* 排序,带小数点
|
||||
*/
|
||||
@ChineseDescription("排序")
|
||||
private BigDecimal dictSort;
|
||||
|
||||
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
package cn.stylefeng.roses.kernel.dict.modular.service;
|
||||
|
||||
|
||||
import cn.stylefeng.roses.kernel.dict.api.DictTypeApi;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDictType;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.pojo.request.DictTypeRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
@ -37,7 +38,7 @@ import java.util.List;
|
|||
* @author fengshuonan
|
||||
* @since 2020/10/29 18:54
|
||||
*/
|
||||
public interface DictTypeService extends IService<SysDictType> {
|
||||
public interface DictTypeService extends IService<SysDictType>, DictTypeApi {
|
||||
|
||||
/**
|
||||
* 添加字典类型
|
||||
|
@ -85,12 +86,4 @@ public interface DictTypeService extends IService<SysDictType> {
|
|||
*/
|
||||
List<SysDictType> findList(DictTypeRequest dictTypeRequest);
|
||||
|
||||
/**
|
||||
* 通过字典类型的编码,获取到字典类型的id
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/6/27 17:39
|
||||
*/
|
||||
Long getDictTypeIdByDictTypeCode(String dictTypeCode);
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.stylefeng.roses.kernel.dict.api.exception.DictException;
|
||||
import cn.stylefeng.roses.kernel.dict.api.exception.enums.DictExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.dict.api.pojo.SimpleDictAddParam;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDict;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.factory.DictFactory;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.mapper.DictMapper;
|
||||
|
@ -39,6 +40,7 @@ import cn.stylefeng.roses.kernel.dict.modular.service.DictTypeService;
|
|||
import cn.stylefeng.roses.kernel.pinyin.api.PinYinApi;
|
||||
import cn.stylefeng.roses.kernel.rule.constants.SymbolConstant;
|
||||
import cn.stylefeng.roses.kernel.rule.constants.TreeConstants;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
|
||||
import cn.stylefeng.roses.kernel.rule.tree.buildpids.PidStructureBuildUtil;
|
||||
import cn.stylefeng.roses.kernel.rule.tree.factory.DefaultTreeBuildFactory;
|
||||
|
@ -275,6 +277,20 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simpleAddDict(SimpleDictAddParam simpleDictAddParam) {
|
||||
|
||||
// 组装添加字典的参数
|
||||
DictRequest dictRequest = new DictRequest();
|
||||
BeanUtil.copyProperties(simpleDictAddParam, dictRequest);
|
||||
|
||||
// 设置为启用
|
||||
dictRequest.setStatusFlag(StatusEnum.ENABLE.getCode());
|
||||
|
||||
// 添加字典
|
||||
this.add(dictRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取详细信息
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue