mirror of https://gitee.com/stylefeng/roses
通用获取中文拼音
parent
a61c457b7e
commit
9c79f5dfd6
|
@ -144,4 +144,15 @@ public class DictController {
|
||||||
return new SuccessResponseData<>();
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,4 +111,12 @@ public interface DictService extends IService<SysDict>, DictApi {
|
||||||
*/
|
*/
|
||||||
void updateDictTree(DictRequest dictRequest);
|
void updateDictTree(DictRequest dictRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用获取中文拼音
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* @author liyanjun
|
||||||
|
* @since 2023/7/01 10:31
|
||||||
|
*/
|
||||||
|
String getPinyin(String name) ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue