首页>代码>springboot整合thymeleaf+layui实现简单的商品后台管理系统>/简单点JAVA架构/beliefframework/src/main/java/com/javaer/beliefframework/controller/HomeController.java
package com.javaer.beliefframework.controller;

import com.javaer.beliefframework.common.CommonResult;
import com.javaer.beliefframework.mapper.entity.User;
import com.javaer.beliefframework.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HomeController {
    @Autowired
    UserService userService;

    
    //登入页面
    @RequestMapping({"/","/information"})
    public String index(){
    	System.out.println("进来了额");
        return "system/login";
    }

    //触发登入页面    判断用户登入
    @ResponseBody
    @RequestMapping("/system/login")
    public CommonResult<User> login(User user){
        User loginUser = userService.getUserByAccount(user.getUserAccount());
        System.out.println("触发登入页面"+user.getUserAccount());
        if(loginUser == null || !loginUser.getUserPwd().equals(user.getUserPwd())){
           return  CommonResult.generateFailureResult("帐号或密码不正确", 1, null);
        }else{
            return CommonResult.generateSuccessResult(1, loginUser);
        }
    }
}
最近下载更多
hkxyyz  LV6 3月25日
f22m1a2b2  LV17 1月8日
lz88888  LV12 1月7日
ma406805131  LV19 2024年11月29日
zolscy  LV24 2024年11月26日
kaonixiwa  LV3 2024年10月30日
fei3655  LV6 2024年10月16日
y1214435276  LV9 2024年9月26日
微信网友_7134912998903808  LV15 2024年8月29日
599142776  LV2 2024年8月13日
最近浏览更多
hkxyyz  LV6 3月25日
zhangtian1997  LV10 2月5日
f22m1a2b2  LV17 1月8日
lz88888  LV12 1月7日
weishenme1993  LV9 1月1日
xinshou11111x 2024年12月12日
暂无贡献等级
haomc052829  LV4 2024年12月3日
kaonixiwa  LV3 2024年10月30日
fei3655  LV6 2024年10月16日
y1214435276  LV9 2024年9月26日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友