From ab8a8e235524128a7acd596ebf05840028b9a8a9 Mon Sep 17 00:00:00 2001
From: whycxzp <perryhsu@163.com>
Date: 星期一, 08 十一月 2021 15:32:00 +0800
Subject: [PATCH] 更新

---
 src/main/java/com/whyc/controller/ChangeUserController.java |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/whyc/controller/ChangeUserController.java b/src/main/java/com/whyc/controller/ChangeUserController.java
index b5546fb..c139a13 100644
--- a/src/main/java/com/whyc/controller/ChangeUserController.java
+++ b/src/main/java/com/whyc/controller/ChangeUserController.java
@@ -1,26 +1,37 @@
 package com.whyc.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.whyc.dto.Response;
+import com.whyc.mapper.BattInfMapper;
+import com.whyc.mapper.UserMapper;
 import com.whyc.pojo.UserInf;
 import com.whyc.util.ActionUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.catalina.User;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PutMapping;
 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;
 
 @RestController
 @RequestMapping("changeUser")
 @Api(tags = "鍒囨崲鐢ㄦ埛")
 public class ChangeUserController {
 
+    @Resource
+    private UserMapper mapper;
+
     @PutMapping
     @ApiOperation(value = "鍒囨崲鐢ㄦ埛")
     public void changeUser(@RequestParam Long userId){
-        UserInf userInf = new UserInf();
-        userInf.setUName("superuser");
-        userInf.setUId(userId);
+        QueryWrapper<UserInf> query = Wrappers.query();
+        query.eq("uId",userId).last(" limit 1");
+        UserInf userInf = mapper.selectOne(query);
         ActionUtil.getSession().setAttribute("user",userInf);
     }
 

--
Gitblit v1.9.1