增加查询当前登陆管理员的基本信息的接口
This commit is contained in:
@@ -8,6 +8,7 @@ import cn.iocoder.mall.managementweb.controller.admin.dto.AdminPageDTO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateInfoDTO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateStatusDTO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.vo.AdminPageItemVO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.vo.AdminVO;
|
||||
import cn.iocoder.mall.managementweb.manager.admin.AdminManager;
|
||||
import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder;
|
||||
import cn.iocoder.security.annotations.RequiresPermissions;
|
||||
@@ -63,4 +64,12 @@ public class AdminController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// =========== 当前管理员 API ===========
|
||||
|
||||
@GetMapping("/info")
|
||||
@ApiOperation(value = "更新管理员状态")
|
||||
public CommonResult<AdminVO> info() {
|
||||
return success(adminManager.getAdmin(AdminSecurityContextHolder.getAdminId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.experimental.Accessors;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "分页时,管理员的信息 VO")
|
||||
@ApiModel(value = "分页时,管理员的信息 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminPageItemVO {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.mall.managementweb.controller.admin.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel(value = "管理员 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminVO {
|
||||
|
||||
@ApiModelProperty(value = "管理员编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "真实名字", required = true, example = "小王")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
@ApiModelProperty(value = "在职状态", required = true, example = "1", notes = "见 AdminStatusEnum 枚举")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "登陆账号", required = true, example = "15601691300")
|
||||
private String username;
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package cn.iocoder.mall.managementweb.controller.admin.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Author: jiangweifan
|
||||
* @Date: 2020/5/12
|
||||
* @Description: 管理员 - 用户信息 - 用户分页列表Response
|
||||
*/
|
||||
@ApiModel("用户分页信息 Response")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsUserPageResponse {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "昵称", required = false, example = "1")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "13631780241")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "头像", required = false, example = "http://www.iocoder.cn/xxx.jpg")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "用户状态 1 - 开启;2 - 禁用", required = true, example = "1")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -26,4 +26,6 @@ public interface AdminConvert {
|
||||
|
||||
PageResult<AdminPageItemVO> convert(PageResult<AdminVO> pageResultData);
|
||||
|
||||
cn.iocoder.mall.managementweb.controller.admin.vo.AdminVO convert(AdminVO bean);
|
||||
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ import cn.iocoder.mall.managementweb.controller.admin.dto.AdminPageDTO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateInfoDTO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateStatusDTO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.vo.AdminPageItemVO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.vo.AdminVO;
|
||||
import cn.iocoder.mall.managementweb.convert.admin.AdminConvert;
|
||||
import cn.iocoder.mall.systemservice.rpc.admin.AdminRpc;
|
||||
import cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -20,7 +20,8 @@ public class AdminManager {
|
||||
private AdminRpc adminRpc;
|
||||
|
||||
public PageResult<AdminPageItemVO> pageAdmin(AdminPageDTO pageDTO) {
|
||||
CommonResult<PageResult<AdminVO>> pageResult = adminRpc.pageAdmin(AdminConvert.INSTANCE.convert(pageDTO));
|
||||
CommonResult<PageResult<cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO>> pageResult =
|
||||
adminRpc.pageAdmin(AdminConvert.INSTANCE.convert(pageDTO));
|
||||
pageResult.checkError();
|
||||
// 转换结果
|
||||
PageResult<AdminPageItemVO> adminPageVO = AdminConvert.INSTANCE.convert(pageResult.getData());
|
||||
@@ -59,4 +60,10 @@ public class AdminManager {
|
||||
updateAdminResult.checkError();
|
||||
}
|
||||
|
||||
public AdminVO getAdmin(Integer adminId) {
|
||||
CommonResult<cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO> getAdminResult = adminRpc.getAdmin(adminId);
|
||||
getAdminResult.checkError();
|
||||
return AdminConvert.INSTANCE.convert(getAdminResult.getData());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user