通用获取中文拼音

pull/57/head
Liyanjun 2023-07-01 13:49:39 +08:00
parent a61c457b7e
commit 9c79f5dfd6
3 changed files with 27 additions and 0 deletions

View File

@ -144,4 +144,15 @@ 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

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

View File

@ -435,4 +435,12 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
}
}
@Override
public String getPinyin(String name) {
if(ObjectUtil.isNotEmpty(name)) {
name=pinYinApi.parseEveryPinyinFirstLetter(name);
}
return name;
}
}