【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());
        
    }
}
相关推荐
dkbnull13 小时前
深入理解Spring两大特性:IoC和AOP
spring boot
洋洋技术笔记17 小时前
Spring Boot条件注解详解
java·spring boot
洋洋技术笔记2 天前
Spring Boot配置管理最佳实践
spring boot
用户8307196840822 天前
Spring Boot 项目中日期处理的最佳实践
java·spring boot
大道至简Edward3 天前
Spring Boot 2.7 + JDK 8 升级到 Spring Boot 3.x + JDK 17 完整指南
spring boot·后端
洋洋技术笔记3 天前
Spring Boot启动流程解析
spring boot·后端
怒放吧德德3 天前
Spring Boot 实战:RSA+AES 接口全链路加解密(防篡改 / 防重放)
java·spring boot·后端
李慕婉学姐3 天前
Springboot智慧社区系统设计与开发6n99s526(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
数据库·spring boot·后端
QQ5110082853 天前
python+springboot+django/flask的校园资料分享系统
spring boot·python·django·flask·node.js·php
WeiXin_DZbishe3 天前
基于django在线音乐数据采集的设计与实现-计算机毕设 附源码 22647
javascript·spring boot·mysql·django·node.js·php·html5