package org.jeecg.modules.app.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Tag(name = "App公共相关接口")
@RestController
@RequestMapping("/app/common")
public class CommonAppController {
    @Resource
    private SysBaseApiImpl sysBaseApi;
    /**
     * 根据字典code查询字典项
     *
     * @param dictCode 顺序：tableName,text,code
     * @param dictCode 要查询的key
     * @return
     */
    @Operation(summary="根据字典code查询字典项")
    @GetMapping("/getDictItems")
    public Result<List<DictModel>> getDictItems(@RequestParam("dictCode") String dictCode) {
        return Result.OK(sysBaseApi.queryDictItemsByCode(dictCode));
    }
}
