【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());
        
    }
}
相关推荐
q5431470879 分钟前
VScode 开发 Springboot 程序
java·spring boot·后端
学习要积极27 分钟前
Springboot图片验证码-EasyCaptcha
java·spring boot·后端
yuyu_030437 分钟前
畜牧(牛)数字化管理系统系统概要
spring boot
波波七41 分钟前
SSM与Springboot是什么关系? -----区别与联系
java·spring boot·后端
计算机学姐1 小时前
基于SpringBoot的校园二手书籍交易系统【个性化推荐+数据可视化统计+我买到的+我卖出的】
vue.js·spring boot·后端·mysql·信息可视化·intellij-idea·mybatis
SmartBrain1 小时前
Spring Boot 中常用注解总结(AI工程化)
java·人工智能·spring boot·后端
计算机学姐2 小时前
基于SpringBoot的校园二手交易系统
java·vue.js·spring boot·后端·spring·tomcat·intellij-idea
小胖java2 小时前
养老院管理系统
java·spring boot
moxiaoran57533 小时前
使用springboot+flowable实现一个简单的订单审批工作流
java·spring boot·后端
计算机徐师兄4 小时前
Java基于SpringBoot的运动健康小程序【附源码、文档说明】
spring boot·小程序·运动健康·java运动健康小程序·运动健康小程序·java运动健康微信小程序·运动健康微信小程序