package com.edu.stu.service.impl;
import com.edu.stu.comment.SessionAdministrate;
import com.edu.stu.dao.LoginUserDao;
import com.edu.stu.model.LoginUser;
import com.edu.stu.model.StausCodes;
import com.edu.stu.service.LoginUserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
/**
* Created by ASUS on 2018/2/25.
*/
@Service
public class LoginUserServiceImpl implements LoginUserService {
@Resource
private LoginUserDao loginUserDao;
/**
* 登录验证
* @param loginUser
* @return
*/
@Override
public StausCodes Login(LoginUser loginUser, HttpSession session) {
StausCodes stausCodes = new StausCodes();
LoginUser loginUser1 = loginUserDao.login(loginUser);
if (loginUser1 != null){
session.setAttribute(SessionAdministrate.LOGIN_SESSION,loginUser1.getUsername());
if ("admin".equals(loginUser1.getPower())){
stausCodes.setSuccessCode("10000");
System.out.println("管理员登录成功!!");
System.out.println(stausCodes.getSuccessCode());
}if ("student".equals(loginUser1.getPower())){
stausCodes.setSuccessCode("10001");
System.out.println("学生登录成功!!");
}
}else if (loginUser1 == null){
stausCodes.setErrorCode("10002");
stausCodes.setHintCode("账号或者密码错误,请检查!!");
System.out.println("登录失败!!");
System.out.println(stausCodes.getErrorCode());
}
System.out.println(stausCodes);
return stausCodes;
}
/**
* 修改密码
* @param loginUser
* @return
*/
@Override
public StausCodes updateLoginUser(LoginUser loginUser) {
StausCodes stausCodes = new StausCodes();
int i = loginUserDao.updateLoginUser(loginUser);
if (i>0){
stausCodes.setSuccessCode("20000");
System.out.println("修改成功!!");
}else if (i == 0){
stausCodes.setErrorCode("20001");
stausCodes.setHintCode("修改失败!!");
}
return stausCodes;
}
/**
* 查询用户
* @return
*/
@Override
public LoginUser queryLoginUser(String username) {
LoginUser loginUser = loginUserDao.queryLoginUser(username);
return loginUser;
}
/**
* 添加用户
* @param loginUser
* @return
*/
@Override
public StausCodes insertLoginuser(LoginUser loginUser) {
StausCodes stausCodes = new StausCodes();
int i = loginUserDao.insertLoginuser(loginUser);
if (i>0){
stausCodes.setSuccessCode("30000");
System.out.println("添加成功!!");
}else if(i==0){
stausCodes.setErrorCode("30001");
System.out.println("添加失败!!");
}
return stausCodes;
}
@Override
public StausCodes updatePower(LoginUser loginUser) {
StausCodes stausCodes = new StausCodes();
int i = loginUserDao.updatePower(loginUser);
if (i>0){
stausCodes.setSuccessCode("40001");
stausCodes.setHintCode("权限修改成功!!");
}else {
stausCodes.setErrorCode("40002");
stausCodes.setHintCode("权限修改失败!!");
}
return stausCodes;
}
@Override
public StausCodes resetPower(LoginUser loginUser) {
StausCodes stausCodes = new StausCodes();
loginUser.setPassword("123456");
int i = loginUserDao.resetPower(loginUser);
if (i>0){
stausCodes.setSuccessCode("50001");
stausCodes.setHintCode("密码重置成功");
}else {
stausCodes.setErrorCode("50002");
stausCodes.setHintCode("密码重置失败");
}
return stausCodes;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于springmvc与mybatis的员工管理系统 (260个子文件)
LoginUserServiceImpl.class 4KB
LoginUserServiceImpl.class 4KB
LoginUserServiceImpl.class 3KB
LoginUserController.class 3KB
LoginUserController.class 3KB
LoginUserController.class 3KB
Employee.class 3KB
Employee.class 3KB
Employee.class 3KB
EmployeeController.class 3KB
EmployeeController.class 3KB
EmployeeController.class 3KB
EmployeeServiceImpl.class 2KB
EmployeeServiceImpl.class 2KB
EmployeeServiceImpl.class 2KB
Score.class 2KB
Score.class 2KB
Info.class 2KB
Info.class 2KB
Info.class 2KB
StudentServiceImpl.class 2KB
StudentServiceImpl.class 2KB
LoginUser.class 2KB
LoginUser.class 2KB
LoginUser.class 2KB
StudentController.class 2KB
StudentController.class 2KB
ScoreObj.class 2KB
ScoreObj.class 2KB
LoginUserObj.class 2KB
LoginUserObj.class 2KB
LoginUserObj.class 2KB
StausCodes.class 1KB
StausCodes.class 1KB
StausCodes.class 1KB
AdminController.class 1KB
AdminController.class 1KB
loginTest.class 1KB
loginTest.class 1KB
loginTest.class 1KB
EmployeeObj.class 1KB
EmployeeObj.class 1KB
EmployeeObj.class 1KB
EmployeeService.class 579B
EmployeeService.class 579B
EmployeeService.class 579B
EmployeeDao.class 509B
EmployeeDao.class 509B
EmployeeDao.class 509B
LoginUserService.class 481B
LoginUserService.class 481B
LoginUserService.class 481B
StudentService.class 471B
StudentService.class 471B
LoginUserDao.class 407B
LoginUserDao.class 407B
LoginUserDao.class 407B
SessionAdministrate.class 394B
SessionAdministrate.class 394B
SessionAdministrate.class 394B
StudentDao.class 363B
StudentDao.class 363B
AdminDao.class 113B
AdminDao.class 113B
weui.css 357KB
weui.css 357KB
weui.min.css 49KB
weui.min.css 49KB
datepicker.css 4KB
datepicker.css 4KB
datepicker.css 4KB
datepicker.css 4KB
img.gif 2KB
img.gif 2KB
img.gif 2KB
img.gif 2KB
datePicker.gif 1KB
datePicker.gif 1KB
student.iml 1KB
com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar 1.57MB
com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar 1.57MB
mybatis-3.4.1.jar 1.51MB
mybatis-3.4.1.jar 1.51MB
spring-context-4.1.2.RELEASE.jar 1003KB
spring-context-4.1.2.RELEASE.jar 1003KB
spring-core-4.1.2.RELEASE.jar 982KB
spring-core-4.1.2.RELEASE.jar 982KB
jackson-databind-2.2.1.jar 845KB
jackson-databind-2.2.1.jar 845KB
spring-webmvc-4.1.2.RELEASE.jar 762KB
spring-webmvc-4.1.2.RELEASE.jar 762KB
mysql-connector-java-5.1.8-bin.jar 707KB
mysql-connector-java-5.1.8-bin.jar 707KB
spring-web-4.1.2.RELEASE.jar 695KB
spring-web-4.1.2.RELEASE.jar 695KB
spring-beans-4.1.2.RELEASE.jar 690KB
spring-beans-4.1.2.RELEASE.jar 690KB
jackson-mapper-asl-1.8.8.jar 653KB
jackson-mapper-asl-1.8.8.jar 653KB
spring-test-4.1.2.RELEASE.jar 491KB
共 260 条
- 1
- 2
- 3
资源评论
孤儿J
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功