Merge #7 into master from cc_20251209_dict

fix:小程序新增字典接口

* cc_20251209_dict: (1 commits squashed)

  - fix:小程序新增字典接口

Signed-off-by: 王非凡 <accounts_67eba0c5fee9c49c80c8e2b4@mail.teambition.com>
Reviewed-by: 苏竹红 <accounts_68551bf01395375227aee211@mail.teambition.com>
Merged-by: 苏竹红 <accounts_68551bf01395375227aee211@mail.teambition.com>

CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/7
This commit is contained in:
王非凡
2025-12-09 07:49:16 +00:00
committed by 苏竹红
parent a444130b21
commit aaaa40f2c8

View File

@@ -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;
/**
* <p>
* 字典管理 前端控制器
* </p>
*
* @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<DictGroupVO> groupGet(@PathVariable("groupId") Long groupId) {
return ResponseResult.success(groupService.getById(groupId));
}
@ApiOperation("字典分组-列表")
@GetMapping("/group/list")
public ResponseResult<List<DictGroupVO>> groupList(DictGroupQueryRequest dto) {
return ResponseResult.success(groupService.getList(dto));
}
@ApiOperation("字典表-查询")
@GetMapping("/table/{tableId}")
public ResponseResult<DictTableVO> tableGet(@PathVariable("tableId") Long tableId) {
return ResponseResult.success(tableService.getById(tableId));
}
@ApiOperation("字典表-列表")
@GetMapping("/table/list")
public ResponseResult<List<DictTableVO>> tableList(DictTableQueryRequest dto) {
return ResponseResult.success(tableService.getList(dto));
}
@ApiOperation("字典项-分页查询")
@GetMapping("/column/page")
public ResponseResult<PageInfo<DictColumnVO>> columnPage(DictColumnQueryRequest dto) {
return ResponseResult.success(columnService.getPage(dto));
}
@ApiOperation("字典项-查询")
@GetMapping("/column/{columnId}")
public ResponseResult<DictColumnVO> columnGet(@PathVariable("columnId") Long columnId) {
return ResponseResult.success(columnService.getById(columnId));
}
@ApiOperation("字典项-根据字典项code查询已启用的字典项")
@GetMapping("/column/getByColumnCode")
public ResponseResult<DictColumnSimpleVO> getColumnByColumnCode(@NotBlank(message = "字典项编码不能为空") String columnCode) {
return ResponseResult.success(columnService.getColumnByColumnCode(columnCode));
}
@ApiOperation("字典项-根据字典表code查询已启用的字典项列表")
@PostMapping("/column/getMapByTableCodes")
public ResponseResult<Map<String, List<DictColumnSimpleVO>>> getColumnByTableCode(@RequestBody List<String> tableCodes) {
return ResponseResult.success(columnService.getMapListByTableCode(tableCodes));
}
}