package com.ssm.controller;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ssm.entity.User;
import com.ssm.service.IUserService;
/**
*
* @author liyongqiang
*
*/
@Controller
@RequestMapping("/user")
public class UserController {
@Resource
private IUserService userService;
/**
* 用户登录
*
* @param req
* @param mv
* @return
*/
@RequestMapping("/login")
public ModelAndView login(HttpServletRequest req, ModelAndView mv) {
Map<String, String> map = new HashMap<String, String>();
map.put("username", req.getParameter("username"));
map.put("password", req.getParameter("password"));
User user = userService.login(map);
if (user != null) {//登录成功进入首页
mv.setViewName("index");
} else {//登录失败回到登录页面
mv.addObject("message", "用户名或密码输入错误,请重新输入");
mv.setViewName("login");
}
return mv;
}
}
最近下载更多
李亮 LV19
2023年8月29日
999999999qqq LV2
2023年6月30日
暴龙战士 LV1
2023年6月8日
cqputyms LV1
2023年6月7日
微信网友_6507988172591104 LV1
2023年6月6日
我是可爱小阿福 LV1
2023年5月23日
女王不该在山炮村养花 LV8
2023年4月3日
李雪峰 LV1
2023年3月13日
hetianyu LV1
2022年12月18日
renyuan LV9
2022年12月6日
最近浏览更多
暂无贡献等级
zhoubowen LV3
2024年12月29日
wudi666
2024年11月27日
暂无贡献等级
xiaoaitx LV8
2024年11月19日
1516299986 LV9
2024年6月14日
lilitu LV6
2024年5月29日
2775645521 LV7
2024年4月26日
lcqlcl LV11
2023年8月29日
李亮 LV19
2023年8月29日
1289755 LV3
2023年7月29日

