mirror of https://gitee.com/stylefeng/roses
【7.6.0】【config】更新系统配置类型的查询接口,调用字典相关的api
parent
37db3c5c7c
commit
1cf6010683
|
@ -17,6 +17,14 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!--字典相关的api-->
|
||||||
|
<!--配置分类需要调用字典相关的接口-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.stylefeng.roses</groupId>
|
||||||
|
<artifactId>dict-api</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!--资源api模块-->
|
<!--资源api模块-->
|
||||||
<!--用在资源控制器,资源扫描上-->
|
<!--用在资源控制器,资源扫描上-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* 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.config.modular.controller;
|
||||||
|
|
||||||
|
import cn.stylefeng.roses.kernel.config.modular.pojo.param.SysConfigTypeParam;
|
||||||
|
import cn.stylefeng.roses.kernel.config.modular.service.SysConfigTypeService;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||||
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
||||||
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
||||||
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置分类的控制器
|
||||||
|
* <p>
|
||||||
|
* 配置分类其实是对应的字典,字典类型编码是config_group
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/28 16:46
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@ApiResource(name = "配置分类的接口")
|
||||||
|
public class SysConfigTypeController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysConfigTypeService sysConfigTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看系统配置分类列表
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/28 16:51
|
||||||
|
*/
|
||||||
|
@GetResource(name = "查看系统配置分类列表", path = "/sysConfigType/list")
|
||||||
|
public ResponseData<List<SimpleDict>> sysConfigTypeList(SysConfigTypeParam sysConfigTypeParam) {
|
||||||
|
return new SuccessResponseData<>(sysConfigTypeService.getSysConfigTypeList(sysConfigTypeParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配置类型
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/28 17:00
|
||||||
|
*/
|
||||||
|
@PostResource(name = "新增配置类型", path = "/sysConfigType/add")
|
||||||
|
public ResponseData<?> add(@RequestBody @Validated(SysConfigTypeParam.add.class) SysConfigTypeParam sysConfigTypeParam) {
|
||||||
|
sysConfigTypeService.add(sysConfigTypeParam);
|
||||||
|
return new SuccessResponseData<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* 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.config.modular.pojo.param;
|
||||||
|
|
||||||
|
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统配置类型请求参数
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/28 17:02
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class SysConfigTypeParam extends BaseRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置类型id
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "配置类型id不能为空", groups = {edit.class, detail.class})
|
||||||
|
@ChineseDescription("配置类型id")
|
||||||
|
private Long configTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置类型名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "配置类型名称不能为空", groups = {add.class, edit.class})
|
||||||
|
@ChineseDescription("配置类型名称")
|
||||||
|
private String configTypeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置类型编码
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "配置类型编码不能为空", groups = {add.class, edit.class})
|
||||||
|
@ChineseDescription("配置类型编码")
|
||||||
|
private String configTypeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置类型顺序
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "配置类型顺序不能为空", groups = {add.class, edit.class})
|
||||||
|
@ChineseDescription("配置类型顺序")
|
||||||
|
private BigDecimal configTypeSort;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
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.rule.pojo.dict.SimpleDict;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置类型业务
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/28 16:52
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysConfigTypeService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DictApi dictApi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询系统配置类型列表
|
||||||
|
* <p>
|
||||||
|
* 查询字典类型为config_group的所有字典列表
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/28 16:56
|
||||||
|
*/
|
||||||
|
public List<SimpleDict> getSysConfigTypeList(SysConfigTypeParam sysConfigTypeParam) {
|
||||||
|
return dictApi.getDictDetailsByDictTypeCode(ConfigConstants.CONFIG_GROUP_DICT_TYPE_CODE, sysConfigTypeParam.getSearchText());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增系统配置类型
|
||||||
|
* <p>
|
||||||
|
* 针对字典类型编码为config_group的字典增加一个条目
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/28 17:07
|
||||||
|
*/
|
||||||
|
public void add(SysConfigTypeParam sysConfigTypeParam) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -70,7 +70,7 @@ public class UserTranslationController {
|
||||||
*/
|
*/
|
||||||
@GetResource(name = "获取所有的多语言类型编码", path = "/i18n/getAllLanguages", requiredPermission = false)
|
@GetResource(name = "获取所有的多语言类型编码", path = "/i18n/getAllLanguages", requiredPermission = false)
|
||||||
public ResponseData<List<SimpleDict>> getAllLanguages() {
|
public ResponseData<List<SimpleDict>> getAllLanguages() {
|
||||||
List<SimpleDict> dictDetailsByDictTypeCode = dictApi.getDictDetailsByDictTypeCode(I18nConstants.LANGUAGES_DICT_TYPE_CODE);
|
List<SimpleDict> dictDetailsByDictTypeCode = dictApi.getDictDetailsByDictTypeCode(I18nConstants.LANGUAGES_DICT_TYPE_CODE, null);
|
||||||
return new SuccessResponseData<>(dictDetailsByDictTypeCode);
|
return new SuccessResponseData<>(dictDetailsByDictTypeCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,8 @@ public class UserTranslationController {
|
||||||
* @since 2021/1/27 22:04
|
* @since 2021/1/27 22:04
|
||||||
*/
|
*/
|
||||||
@PostResource(name = "修改当前用户的多语言配置", path = "/i18n/changeUserTranslation", requiredPermission = false)
|
@PostResource(name = "修改当前用户的多语言配置", path = "/i18n/changeUserTranslation", requiredPermission = false)
|
||||||
public ResponseData<?> changeUserTranslation(@RequestBody @Validated(TranslationRequest.changeUserLanguage.class) TranslationRequest translationRequest) {
|
public ResponseData<?> changeUserTranslation(
|
||||||
|
@RequestBody @Validated(TranslationRequest.changeUserLanguage.class) TranslationRequest translationRequest) {
|
||||||
|
|
||||||
String token = LoginContext.me().getToken();
|
String token = LoginContext.me().getToken();
|
||||||
LoginUser loginUser = LoginContext.me().getLoginUser();
|
LoginUser loginUser = LoginContext.me().getLoginUser();
|
||||||
|
|
|
@ -51,11 +51,12 @@ public interface DictApi {
|
||||||
* 根据字典类型编码获取所有的字典
|
* 根据字典类型编码获取所有的字典
|
||||||
*
|
*
|
||||||
* @param dictTypeCode 字典类型编码
|
* @param dictTypeCode 字典类型编码
|
||||||
|
* @param searchText 查询条件,筛选字典类型下指定字符串的字典,可为空
|
||||||
* @return 字典的集合
|
* @return 字典的集合
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @since 2021/1/27 22:13
|
* @since 2021/1/27 22:13
|
||||||
*/
|
*/
|
||||||
List<SimpleDict> getDictDetailsByDictTypeCode(String dictTypeCode);
|
List<SimpleDict> getDictDetailsByDictTypeCode(String dictTypeCode, String searchText);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除字典,通过dictId
|
* 删除字典,通过dictId
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SimpleDict> getDictDetailsByDictTypeCode(String dictTypeCode) {
|
public List<SimpleDict> getDictDetailsByDictTypeCode(String dictTypeCode, String searchText) {
|
||||||
|
|
||||||
// 获取字典类型编码对应的字典类型id
|
// 获取字典类型编码对应的字典类型id
|
||||||
Long dictTypeId = dictTypeService.getDictTypeIdByDictTypeCode(dictTypeCode);
|
Long dictTypeId = dictTypeService.getDictTypeIdByDictTypeCode(dictTypeCode);
|
||||||
|
@ -231,6 +231,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
|
||||||
// 查询字典的列表
|
// 查询字典的列表
|
||||||
DictRequest dictRequest = new DictRequest();
|
DictRequest dictRequest = new DictRequest();
|
||||||
dictRequest.setDictTypeId(dictTypeId);
|
dictRequest.setDictTypeId(dictTypeId);
|
||||||
|
dictRequest.setSearchText(searchText);
|
||||||
LambdaQueryWrapper<SysDict> wrapper = this.createWrapper(dictRequest);
|
LambdaQueryWrapper<SysDict> wrapper = this.createWrapper(dictRequest);
|
||||||
wrapper.select(SysDict::getDictId, SysDict::getDictName, SysDict::getDictCode);
|
wrapper.select(SysDict::getDictId, SysDict::getDictName, SysDict::getDictCode);
|
||||||
List<SysDict> dictList = this.list(wrapper);
|
List<SysDict> dictList = this.list(wrapper);
|
||||||
|
|
|
@ -34,7 +34,8 @@ import java.util.stream.Collectors;
|
||||||
* @date 2023/06/10 21:23
|
* @date 2023/06/10 21:23
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class HrOrgApproverServiceImpl extends ServiceImpl<HrOrgApproverMapper, HrOrgApprover> implements HrOrgApproverService, RemoveOrgCallbackApi {
|
public class HrOrgApproverServiceImpl extends ServiceImpl<HrOrgApproverMapper, HrOrgApprover> implements HrOrgApproverService,
|
||||||
|
RemoveOrgCallbackApi {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DictApi dictApi;
|
private DictApi dictApi;
|
||||||
|
@ -47,7 +48,7 @@ public class HrOrgApproverServiceImpl extends ServiceImpl<HrOrgApproverMapper, H
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SimpleDict> getApproverTypeList() {
|
public List<SimpleDict> getApproverTypeList() {
|
||||||
return dictApi.getDictDetailsByDictTypeCode(ApproverConstants.APPROVER_TYPE_DICT_TYPE_CODE);
|
return dictApi.getDictDetailsByDictTypeCode(ApproverConstants.APPROVER_TYPE_DICT_TYPE_CODE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,7 +66,8 @@ public class HrOrgApproverServiceImpl extends ServiceImpl<HrOrgApproverMapper, H
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将每个类型的用户分组,key是审批组类型,value是该组下的用户
|
// 将每个类型的用户分组,key是审批组类型,value是该组下的用户
|
||||||
Map<Integer, List<HrOrgApprover>> groupingByUsers = orgTotalBindingList.stream().collect(Collectors.groupingBy(HrOrgApprover::getOrgApproverType));
|
Map<Integer, List<HrOrgApprover>> groupingByUsers = orgTotalBindingList.stream()
|
||||||
|
.collect(Collectors.groupingBy(HrOrgApprover::getOrgApproverType));
|
||||||
|
|
||||||
// 先初始化空的绑定情况列表
|
// 先初始化空的绑定情况列表
|
||||||
ArrayList<HrOrgApprover> resultList = new ArrayList<>();
|
ArrayList<HrOrgApprover> resultList = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in New Issue