diff --git a/ruoyi-cms/src/main/java/com/ruoyi/cms/controller/CmsUserController.java b/ruoyi-cms/src/main/java/com/ruoyi/cms/controller/CmsUserController.java index 2dad54797..3e8eb886b 100644 --- a/ruoyi-cms/src/main/java/com/ruoyi/cms/controller/CmsUserController.java +++ b/ruoyi-cms/src/main/java/com/ruoyi/cms/controller/CmsUserController.java @@ -31,10 +31,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import sun.awt.image.IntegerComponentRaster; @@ -49,6 +46,7 @@ import java.util.List; */ @Controller @RequestMapping("/web") +@SessionAttributes("user") public class CmsUserController { private static final Logger log = LoggerFactory.getLogger( CmsUserController.class ); @@ -110,6 +108,7 @@ public class CmsUserController { @RequestMapping("/user/index.html") public String webUserIndex(ModelMap map) { map.put( "user", ShiroUtils.getSysUser() ); + map.addAttribute("user", ShiroUtils.getSysUser()); return prefix + "/user/set"; } @RequestMapping("/user/home.html") diff --git a/ruoyi-cms/src/main/resources/templates/web/index.html b/ruoyi-cms/src/main/resources/templates/web/index.html index b478938e1..0018e7cdb 100644 --- a/ruoyi-cms/src/main/resources/templates/web/index.html +++ b/ruoyi-cms/src/main/resources/templates/web/index.html @@ -173,19 +173,19 @@