【7.6.0】【config】更新系统配置类型的查询接口,调用字典相关的api

pull/57/head
fengshuonan 2023-06-28 17:19:17 +08:00
parent 37db3c5c7c
commit 1cf6010683
8 changed files with 223 additions and 7 deletions

View File

@ -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>

View File

@ -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.
*
* GunsAPACHE 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<>();
}
}

View File

@ -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.
*
* GunsAPACHE 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;
}

View File

@ -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) {
}
}

View File

@ -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();

View File

@ -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

View File

@ -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);

View File

@ -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<>();