【7.6.0】【dict】通用字典接口单独放一个类

pull/57/head
fengshuonan 2023-07-01 21:45:15 +08:00
parent 9a9f3eba67
commit 6e8fa81490
4 changed files with 70 additions and 21 deletions

View File

@ -0,0 +1,60 @@
/*
* 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.dict.modular.controller;
import cn.stylefeng.roses.kernel.dict.modular.service.DictService;
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 org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*
* @author fengshuonan
* @since 2023/7/1 21:43
*/
@RestController
@ApiResource(name = "字典通用接口")
public class CommonDictController {
@Resource
private DictService dictService;
/**
*
*
* @author liyanjun
* @since 2023/7/01 10:31
*/
@GetResource(name = "通用获取中文拼音", path = "/common/getPinyin")
public ResponseData<String> getPinyin(String name) {
return new SuccessResponseData<>(this.dictService.getPinyin(name));
}
}

View File

@ -144,15 +144,4 @@ public class DictController {
return new SuccessResponseData<>();
}
/**
*
* <p>
*
* @author liyanjun
* @since 2023/7/01 10:31
*/
@GetResource(name = "通用获取中文拼音", path = "/common/getPinyin")
public ResponseData<String> getPinyin(String name) {
return new SuccessResponseData<>( this.dictService.getPinyin(name));
}
}

View File

@ -113,10 +113,10 @@ public interface DictService extends IService<SysDict>, DictApi {
/**
*
* <p>
*
* @author liyanjun
* @since 2023/7/01 10:31
*/
String getPinyin(String name) ;
String getPinyin(String name);
}

View File

@ -321,6 +321,14 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
this.edit(dictRequest);
}
@Override
public String getPinyin(String name) {
if (ObjectUtil.isNotEmpty(name)) {
name = pinYinApi.parsePinyinString(name);
}
return name;
}
/**
*
*
@ -435,12 +443,4 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
}
}
@Override
public String getPinyin(String name) {
if(ObjectUtil.isNotEmpty(name)) {
name=pinYinApi.parsePinyinString(name);
}
return name;
}
}