【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());
        
    }
}
相关推荐
向葭奔赴♡21 小时前
Spring Boot 分模块:从数据库到前端接口
数据库·spring boot·后端
计算机毕业设计木哥21 小时前
计算机毕业设计选题推荐:基于SpringBoot和Vue的爱心公益网站
java·开发语言·vue.js·spring boot·后端·课程设计
番茄Salad21 小时前
自定义Spring Boot Starter项目并且在其他项目中通过pom引入使用
java·spring boot
MC丶科1 天前
【SpringBoot 快速上手实战系列】5 分钟用 Spring Boot 搭建一个用户管理系统(含前后端分离)!新手也能一次跑通!
java·vue.js·spring boot·后端
lang201509281 天前
Spring Boot 入门:5分钟搭建Hello World
java·spring boot·后端
Javashop_jjj1 天前
三勾软件| 用SpringBoot+Element-UI+UniApp+Redis+MySQL打造的点餐连锁系统
spring boot·ui·uni-app
PHP源码1 天前
SpringBoot校园二手商城系统
java·spring boot·springboot二手商城·java校园二手商城系统
毕业设计制作和分享1 天前
springboot159基于springboot框架开发的景区民宿预约系统的设计与实现
java·spring boot·后端
MC丶科1 天前
【SpringBoot常见报错与解决方案】端口被占用?Spring Boot 修改端口号的 3 种方法,第 3 种 90% 的人不知道!
java·linux·spring boot