diff --git a/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniDictManagerController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniDictManagerController.java new file mode 100644 index 000000000..607a06a37 --- /dev/null +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniDictManagerController.java @@ -0,0 +1,88 @@ +package com.cool.store.controller.webc; + +import com.cool.store.request.dict.DictColumnQueryRequest; +import com.cool.store.request.dict.DictGroupQueryRequest; +import com.cool.store.request.dict.DictTableQueryRequest; +import com.cool.store.response.ResponseResult; +import com.cool.store.service.dict.DictColumnService; +import com.cool.store.service.dict.DictGroupService; +import com.cool.store.service.dict.DictTableInfoService; +import com.cool.store.vo.dict.DictColumnSimpleVO; +import com.cool.store.vo.dict.DictColumnVO; +import com.cool.store.vo.dict.DictGroupVO; +import com.cool.store.vo.dict.DictTableVO; +import com.github.pagehelper.PageInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotBlank; +import java.util.List; +import java.util.Map; + +/** + *

+ * 字典管理 前端控制器 + *

+ * + * @author wangff + * @since 2025/2/20 + */ +@Api(tags = "Mini字典管理") +@RestController +@RequestMapping("/mini/sys/dict") +@RequiredArgsConstructor +public class MiniDictManagerController { + private final DictGroupService groupService; + private final DictTableInfoService tableService; + private final DictColumnService columnService; + + @ApiOperation("字典分组-查询") + @GetMapping("/group/{groupId}") + public ResponseResult groupGet(@PathVariable("groupId") Long groupId) { + return ResponseResult.success(groupService.getById(groupId)); + } + + @ApiOperation("字典分组-列表") + @GetMapping("/group/list") + public ResponseResult> groupList(DictGroupQueryRequest dto) { + return ResponseResult.success(groupService.getList(dto)); + } + + @ApiOperation("字典表-查询") + @GetMapping("/table/{tableId}") + public ResponseResult tableGet(@PathVariable("tableId") Long tableId) { + return ResponseResult.success(tableService.getById(tableId)); + } + + @ApiOperation("字典表-列表") + @GetMapping("/table/list") + public ResponseResult> tableList(DictTableQueryRequest dto) { + return ResponseResult.success(tableService.getList(dto)); + } + + @ApiOperation("字典项-分页查询") + @GetMapping("/column/page") + public ResponseResult> columnPage(DictColumnQueryRequest dto) { + return ResponseResult.success(columnService.getPage(dto)); + } + + @ApiOperation("字典项-查询") + @GetMapping("/column/{columnId}") + public ResponseResult columnGet(@PathVariable("columnId") Long columnId) { + return ResponseResult.success(columnService.getById(columnId)); + } + + @ApiOperation("字典项-根据字典项code查询已启用的字典项") + @GetMapping("/column/getByColumnCode") + public ResponseResult getColumnByColumnCode(@NotBlank(message = "字典项编码不能为空") String columnCode) { + return ResponseResult.success(columnService.getColumnByColumnCode(columnCode)); + } + + @ApiOperation("字典项-根据字典表code查询已启用的字典项列表") + @PostMapping("/column/getMapByTableCodes") + public ResponseResult>> getColumnByTableCode(@RequestBody List tableCodes) { + return ResponseResult.success(columnService.getMapListByTableCode(tableCodes)); + } +}