feat: 代码生成支持字典类型
This commit is contained in:
@@ -44,6 +44,13 @@ public class SysDictController {
|
||||
return PageResult.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "字典列表")
|
||||
@GetMapping("/list")
|
||||
public Result<List<Option>> getDictList() {
|
||||
List<Option> list = dictService.getDictList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "字典数据项列表")
|
||||
@GetMapping("/{code}/options")
|
||||
public Result<List<Option>> getDictOptions(
|
||||
|
||||
@@ -96,4 +96,10 @@ public class GenFieldConfig extends BaseEntity {
|
||||
private String tsType;
|
||||
|
||||
|
||||
/**
|
||||
* 字典类型
|
||||
*/
|
||||
private String dictType;
|
||||
|
||||
|
||||
}
|
||||
@@ -81,5 +81,8 @@ public class GenConfigForm {
|
||||
@Schema(description = "查询类型")
|
||||
private QueryTypeEnum queryType;
|
||||
|
||||
@Schema(description = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,4 +72,10 @@ public interface SysDictService extends IService<SysDict> {
|
||||
List<Option> listDictItemsByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Option> getDictList();
|
||||
}
|
||||
|
||||
@@ -222,7 +222,18 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
return dictItemConverter.convertToOption(dictItems);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典列表
|
||||
*/
|
||||
@Override
|
||||
public List<Option> getDictList() {
|
||||
return this.list(new LambdaQueryWrapper<SysDict>()
|
||||
.eq(SysDict::getStatus, 1)
|
||||
.select(SysDict::getName, SysDict::getCode)
|
||||
).stream()
|
||||
.map(dict -> new Option(dict.getCode(), dict.getName()))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user