Merge branch 'zhaoyue-dev' into 'master'
Add admin info inter See merge request !19
Showing
1 changed file
with
44 additions
and
0 deletions
| 1 | +package com.xkl.controller.uploadsoft; | ||
| 2 | + | ||
| 3 | +import com.wordnik.swagger.annotations.ApiImplicitParam; | ||
| 4 | +import com.wordnik.swagger.annotations.ApiImplicitParams; | ||
| 5 | +import com.wordnik.swagger.annotations.ApiOperation; | ||
| 6 | +import com.xkl.authorization.annotation.*; | ||
| 7 | +import com.xkl.config.ResultStatus; | ||
| 8 | +import com.xkl.domain.XklAdminEntity; | ||
| 9 | +import com.xkl.domain.XklCompanyEntity; | ||
| 10 | +import com.xkl.model.AdminLoginModel; | ||
| 11 | +import com.xkl.model.ResultModel; | ||
| 12 | +import com.xkl.repository.XklCompanyRepository; | ||
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | +import org.springframework.http.HttpStatus; | ||
| 15 | +import org.springframework.http.ResponseEntity; | ||
| 16 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 17 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 18 | +import org.springframework.web.bind.annotation.RestController; | ||
| 19 | + | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * 操作员信息查询接口 | ||
| 23 | + */ | ||
| 24 | +@RestController | ||
| 25 | +@RequestMapping("/adminInfo") | ||
| 26 | +public class AdminInfoController { | ||
| 27 | + @Autowired | ||
| 28 | + private XklCompanyRepository xklCompanyRepository; | ||
| 29 | + | ||
| 30 | + @RequestMapping(method = RequestMethod.GET) | ||
| 31 | + @Authorization | ||
| 32 | + @ApiOperation(value = "操作员信息查询接口") | ||
| 33 | + @ApiImplicitParams({ | ||
| 34 | + @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), | ||
| 35 | + }) | ||
| 36 | + public ResponseEntity<ResultModel> getAdminInfo(@CurrentAdmin XklAdminEntity admin) { | ||
| 37 | + XklCompanyEntity companyEntity = xklCompanyRepository.findById(admin.getCoid()); | ||
| 38 | + if (companyEntity == null) { | ||
| 39 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.COMPANY_ERROR), HttpStatus.OK); | ||
| 40 | + } | ||
| 41 | + AdminLoginModel adminLoginModel = new AdminLoginModel(admin.getId(), admin.getAccount(), companyEntity.getId(), companyEntity.getName(), "", ""); | ||
| 42 | + return new ResponseEntity<>(ResultModel.ok(adminLoginModel), HttpStatus.OK); | ||
| 43 | + } | ||
| 44 | +} |
-
Please register or login to post a comment