【Spring Boot】Controller类--UserController

复制代码
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());
        
    }
}
相关推荐
白仑色3 小时前
Spring Cloud Gateway 实战指南
spring boot·微服务·路由转发·限流熔断
追风少年浪子彦9 小时前
mapstruct与lombok冲突原因及解决方案
java·spring boot·spring·spring cloud
军军君019 小时前
基于Springboot+UniApp+Ai实现模拟面试小工具四:后端项目基础框架搭建下
spring boot·spring·面试·elementui·typescript·uni-app·mybatis
白仑色11 小时前
完整 Spring Boot + Vue 登录系统
vue.js·spring boot·后端
MZ_ZXD00111 小时前
flask校园学科竞赛管理系统-计算机毕业设计源码12876
java·spring boot·python·spring·django·flask·php
小郭的学习日记13 小时前
互联网大厂Java面试:从Spring Boot到微服务的场景应用
spring boot·微服务·java面试·技术栈·电商平台
超级小忍13 小时前
在 Spring Boot 中使用 MyBatis 的 XML 文件编写 SQL 语句详解
xml·spring boot·mybatis
Q_Q196328847514 小时前
python的平安驾校管理系统
开发语言·spring boot·python·django·flask·node.js·php
超级小忍14 小时前
在 Spring Boot 中如何使用 Assert 进行断言校验
spring boot·后端