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
相关推荐
不够优雅37 分钟前
【Concept Plugin 3】轻量级插件化解决方案|动态类加载现在,此刻4 小时前
flink学习与如何在springboot项目中使用flinkJIngJaneIL7 小时前
停车场管理|停车预约管理|基于Springboot的停车场管理系统设计与实现(源码+数据库+文档)苹果醋39 小时前
element-ui源码阅读-样式没有bug.的程序员10 小时前
@Controller、@RestController、@RequestMapping 解析机制老华带你飞11 小时前
商城推荐系统|基于SprinBoot+vue的商城推荐系统(源码+数据库+文档)一 乐11 小时前
物业管理系统|小区物业管理|基于SprinBoot+vue的小区物业管理系统(源码+数据库+文档)yolo_Yang12 小时前
【Spring Boot】Spring Boot解决循环依赖屹奕13 小时前
Arthas工具快速使用陈果然DeepVersion14 小时前
Java大厂面试真题:Spring Boot微服务+Kafka消息队列+AIGC场景实战问答全解析