package com.ssm.web.controller; import java.util.Date; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beasn.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.srpingframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.ssm.po.Role; import com.ssm.po.User; import com.ssm.service.RoleService; import com.ssm.service.UserService; /* *用户控制类 */ @Controller public class UserController{ //依赖注入 @Autowired private UserService userService; @Autowired private RoleService roleService; //查询所有用户状态的用户集合(用户列表) @RequestMapping(value="/findUserList.action") public String findUserList(String keywords,Integer userListRoleId,Model model){ //获取角色列表 List<Role> roleList = roleService.findRoleList(); model.addAttribute("userList",userList); model.addAttribute("keywords",keywords); model.addAttribute("userListRoleId",userListRoleId); return "user/user_list"; } //转向添加用户 @RequestMapping(vaule="/toAddUser.action") public String toAddUser(Model model){ //获取角色列表,用于添加用户页面中的用户角色下拉列表 List<Role> roleList = roleService.findRoleList(); model.addAttribute("roleList",roleList); return "user/add_user"; } //判断登录账号是否已存在 @RequestMapping(vulue="/checkLoginName.action") @ResponseBody public User checkLoginName(@RequestBody User user,Model modle){ User checkUSer = userService.getUserByLoginName(user.getLoginName()); } }
【Spring Boot】Controller类--UserController
张天龙2024-06-20 9:04
相关推荐
向葭奔赴♡21 小时前
Spring Boot 分模块:从数据库到前端接口计算机毕业设计木哥21 小时前
计算机毕业设计选题推荐:基于SpringBoot和Vue的爱心公益网站番茄Salad21 小时前
自定义Spring Boot Starter项目并且在其他项目中通过pom引入使用MC丶科1 天前
【SpringBoot 快速上手实战系列】5 分钟用 Spring Boot 搭建一个用户管理系统(含前后端分离)!新手也能一次跑通!lang201509281 天前
Spring Boot 入门:5分钟搭建Hello WorldJavashop_jjj1 天前
三勾软件| 用SpringBoot+Element-UI+UniApp+Redis+MySQL打造的点餐连锁系统PHP源码1 天前
SpringBoot校园二手商城系统毕业设计制作和分享1 天前
springboot159基于springboot框架开发的景区民宿预约系统的设计与实现MC丶科1 天前
【SpringBoot常见报错与解决方案】端口被占用?Spring Boot 修改端口号的 3 种方法,第 3 种 90% 的人不知道!