feat: 字典项下拉接口完善
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.youlai.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.system.common.model.Option;
|
||||
import com.youlai.system.common.result.PageResult;
|
||||
import com.youlai.system.common.result.Result;
|
||||
import com.youlai.system.model.vo.DictPageVO;
|
||||
@@ -15,6 +16,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典控制层
|
||||
*
|
||||
@@ -38,6 +41,15 @@ public class SysDictController {
|
||||
return PageResult.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "字典数据项列表")
|
||||
@GetMapping("/{code}/options")
|
||||
public Result<List<Option>> getDictOptions(
|
||||
@Parameter(description = "字典编码") @PathVariable String code
|
||||
) {
|
||||
List<Option> options = dictService.listDictItemsByCode(code);
|
||||
return Result.success(options);
|
||||
}
|
||||
|
||||
@Operation(summary = "字典表单")
|
||||
@GetMapping("/{id}/form")
|
||||
public Result<DictForm> getDictForm(
|
||||
|
||||
@@ -66,10 +66,10 @@ public interface SysDictService extends IService<SysDict> {
|
||||
/**
|
||||
* 获取字典的数据项
|
||||
*
|
||||
* @param typeCode
|
||||
* @param code 字典编码
|
||||
* @return
|
||||
*/
|
||||
List<Option> listDictItemsByCode(String typeCode);
|
||||
List<Option> listDictItemsByCode(String code);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -217,8 +217,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
);
|
||||
|
||||
// 转换为 Option
|
||||
List<Option> options = dictItemConverter.convertToOption(dictItems);
|
||||
return options;
|
||||
return dictItemConverter.convertToOption(dictItems);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user