/** * Copyright (c) 2018 业主系统 All rights reserved. *

* https://www.kioor.com *

* 版权所有,侵权必究! */ package com.kioor.common.controller; import com.kioor.annotation.Login; import com.kioor.annotation.LoginUser; import com.kioor.common.service.SysRegionService; import com.kioor.common.service.impl.SysRegionServiceImpl; import com.kioor.common.utils.Result; import com.kioor.user.entity.UserEntity; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * 测试接口 * * @author Mark sunlightcs@gmail.com */ @AllArgsConstructor @RestController @RequestMapping("/client") @Tag(name = "测试接口") public class ApiTestController { private final SysRegionService sysRegionService; private final SysRegionServiceImpl sysRegionServiceImpl; @Login @GetMapping("userInfo") @Operation(summary = "获取用户信息") public Result userInfo(@Parameter(hidden = true) @LoginUser UserEntity user) { return new Result().ok(user); } @Login @GetMapping("userId") @Operation(summary = "获取用户ID") public Result userInfo(@Parameter(hidden = true) @RequestAttribute("userId") Long userId) { return new Result().ok(userId); } @GetMapping("notToken") @Operation(summary = "忽略Token验证测试") public Result notToken() { return new Result().ok("无需token也能访问。。。"); } @GetMapping("allRegionJson") @Operation(summary = "忽略Token获取省市区json") public Result allRegionJson() { sysRegionService.allRegionJson(); return new Result().ok("无需token也能访问。。。"); } }