SysDictController.java 2.69 KB
/*
 *
 *      Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the gsc4cloud.com developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: lengleng (wangiegie@gmail.com)
 *
 */

package com.gsc4cloud.agentmanage.controller;

import com.gsc4cloud.gsc.common.core.util.R;
import com.gsc4cloud.gsc.common.feign.annotation.NoToken;
import com.gsc4cloud.agentmanage.utils.ThreadLocalCache;
import com.gsc4cloud.agentmanage.request.sys.DetailRequest;
import com.gsc4cloud.agentmanage.response.rop.LoginAccountResponse;
import com.gsc4cloud.agentmanage.anotation.RopSession;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

/**
 * 字典表前端控制器
 *
 * @author lengleng
 * @date 2025/05/30
 * @since 2019-03-19
 */
@RestController
@AllArgsConstructor
@RequestMapping("/dict")
@Tag(description = "dict", name = "字典管理模块")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysDictController {

    /**
     * 通过ID查询字典信息
     *
     * @param id 字典ID
     * @return 包含字典信息的响应对象
     */
    @PostMapping("/details/byId")
    @Operation(summary = "通过ID查询字典信息")
    public R getById(DetailRequest detailRequest) {
        System.out.println("用户信息:" + ThreadLocalCache.getLoginInfo());
        return R.ok("ok");
    }

    @RopSession // ROPsession注解,必须要rop登录信息
    @PostMapping("/details/user")
    @Operation(summary = "用户信息")
    public R<LoginAccountResponse> getUser(DetailRequest detailRequest) {
        System.out.println("用户信息:" + ThreadLocalCache.getLoginAccountInfo());
        return R.ok(ThreadLocalCache.getLoginAccountInfo());
    }

    @GetMapping("/sign/test")
    @Operation(summary = "验签测试")
    public R<String> signTest(DetailRequest detailRequest) {
        return R.ok("验签成功");
    }


}