|
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.hssx.cloudmodel.util.HttpRespMsg;
|
|
|
import com.hssx.cloudmodel.util.MD5Util;
|
|
|
import com.hssx.cloudmodel.util.PageUtil;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -42,20 +43,25 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
ProjectMapper projectMapper;
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg login(User user, HttpServletRequest request) {
|
|
|
- System.out.println("user" + user);
|
|
|
+ public HttpRespMsg login(UserVO userVO, HttpServletRequest request) {
|
|
|
+ System.out.println("user" + userVO);
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
//验证用户名是否存在
|
|
|
QueryWrapper<User> qw = new QueryWrapper<>();
|
|
|
- qw.eq("account", user.getAccount());
|
|
|
+ qw.eq("account", userVO.getAccount());
|
|
|
Integer count = userMapper.selectCount(qw);
|
|
|
//验证用户名是否正确
|
|
|
if (count > 0) {
|
|
|
User newUser = userMapper.selectOne(qw);
|
|
|
//验证密码是否正确
|
|
|
- if (MD5Util.getPassword(user.getPassword()).equals(newUser.getPassword())) {
|
|
|
+ if (MD5Util.getPassword(userVO.getPassword()).equals(newUser.getPassword())) {
|
|
|
newUser.setPassword("");
|
|
|
- msg.data = newUser;
|
|
|
+ BeanUtils.copyProperties(newUser,userVO);
|
|
|
+ //判断该用户是否为某个项目的项目经理
|
|
|
+ if(projectMapper.selectCount(new QueryWrapper<Project>().eq("manager_id",newUser.getId()))>0){
|
|
|
+ userVO.setIsManager(1);
|
|
|
+ }
|
|
|
+ msg.data = userVO;
|
|
|
} else {
|
|
|
msg.setError("密码错误");
|
|
|
}
|