mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 09:35:29 +08:00
字体查询接口实现
This commit is contained in:
parent
ce8cc9b621
commit
04302b065b
@ -39,12 +39,8 @@ public class FontController {
|
||||
|
||||
@Operation(summary = "根据字体族名称列表查询字体")
|
||||
@PostMapping("list")
|
||||
public List<String> list(@RequestBody List<String> names) {
|
||||
List<String> fontContents = fontService.listFontsByNames(names);
|
||||
if (fontContents == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return fontContents;
|
||||
public List<Font> list(@RequestBody List<String> names) {
|
||||
return fontService.listFontsByNames(names);
|
||||
}
|
||||
|
||||
@Operation(summary = "根据ID获取字体详情")
|
||||
|
||||
@ -42,7 +42,7 @@ public interface FontService extends IService<Font> {
|
||||
* @param fontNameList 字体族名称列表
|
||||
* @return 字体列表
|
||||
*/
|
||||
List<String> listFontsByNames(List<String> fontNameList);
|
||||
List<Font> listFontsByNames(List<String> fontNameList);
|
||||
|
||||
/**
|
||||
* 根据ID获取字体详情
|
||||
|
||||
@ -71,24 +71,18 @@ public class FontServiceImpl extends ServiceImpl<FontDao, Font> implements FontS
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listFontsByNames(List<String> fontNameList) {
|
||||
public List<Font> listFontsByNames(List<String> fontNameList) {
|
||||
if (CollectionUtils.isEmpty(fontNameList)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 从MySQL查询字体内容
|
||||
List<Font> fonts = this.list(new LambdaQueryWrapper<Font>()
|
||||
.in(Font::getName, fontNameList)
|
||||
.isNotNull(Font::getContent));
|
||||
|
||||
.in(Font::getName, fontNameList)
|
||||
.isNotNull(Font::getContent));
|
||||
if (CollectionUtils.isEmpty(fonts)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 提取JSON内容
|
||||
return fonts.stream()
|
||||
.map(Font::getContent)
|
||||
.collect(Collectors.toList());
|
||||
return fonts;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user