diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java index d6de4e8..fafdf6b 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java @@ -5,7 +5,6 @@ import com.yipin.liuwanr.helper.RedisHelper; import com.yipin.liuwanr.service.StaffService; import com.yipin.liuwanr.service.StudentService; import com.yipin.liuwanr.service.UserInfoService; -import com.yipin.liuwanr.service.UserService; import com.yipin.liuwanr.vo.UserInfoVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -30,9 +29,6 @@ public class UserInfoController { @Autowired private UserInfoService userInfoService; - @Autowired - private UserService userService; - @Autowired RedisHelper redisHelper; @@ -693,4 +689,27 @@ public class UserInfoController { } return resp; } + + /** + * 查询电话 + */ + @GetMapping("/queryPhone") + Response queryPhone(@RequestParam String phone) { + Response resp = new Response(); + if (phone==null||phone=="") {//前台传来的值是否为空 + resp.setStatus(300); + resp.setErrmessage("手机号为空!查询失败!"); + }else { + HashMap ret = userInfoService.queryPhone(phone); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + } + return resp; + } } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/entity/UserInfo.java b/src/main/java/com/yipin/liuwanr/entity/UserInfo.java index bfc0aba..f56be07 100644 --- a/src/main/java/com/yipin/liuwanr/entity/UserInfo.java +++ b/src/main/java/com/yipin/liuwanr/entity/UserInfo.java @@ -1,5 +1,7 @@ package com.yipin.liuwanr.entity; +import lombok.Data; + import java.util.List; /** @@ -7,9 +9,12 @@ import java.util.List; * * @author Ning */ +@Data public class UserInfo { //用户id private Integer userId; + //用户token + private String token; //角色id private String roleId; //用户姓名 @@ -94,349 +99,4 @@ public class UserInfo { private String twoDepartmentName; //组织架构id private Integer organizationRelationshipId; - - public Integer getOrganizationRelationshipId() { - return organizationRelationshipId; - } - - public void setOrganizationRelationshipId(Integer organizationRelationshipId) { - this.organizationRelationshipId = organizationRelationshipId; - } - - public String getWorkNumber() { - return workNumber; - } - - public void setWorkNumber(String workNumber) { - this.workNumber = workNumber; - } - - public String getOneDepartmentIds() { - return oneDepartmentIds; - } - - public void setOneDepartmentIds(String oneDepartmentIds) { - this.oneDepartmentIds = oneDepartmentIds; - } - - public String getTwoDepartmentIds() { - return twoDepartmentIds; - } - - public void setTwoDepartmentIds(String twoDepartmentIds) { - this.twoDepartmentIds = twoDepartmentIds; - } - - public String getOneDepartmentName() { - return oneDepartmentName; - } - - public void setOneDepartmentName(String oneDepartmentName) { - this.oneDepartmentName = oneDepartmentName; - } - - public String getTwoDepartmentName() { - return twoDepartmentName; - } - - public void setTwoDepartmentName(String twoDepartmentName) { - this.twoDepartmentName = twoDepartmentName; - } - - public Integer getOneDepartmentId() { - return oneDepartmentId; - } - - public void setOneDepartmentId(Integer oneDepartmentId) { - this.oneDepartmentId = oneDepartmentId; - } - - public Integer getTwoDepartmentId() { - return twoDepartmentId; - } - - public void setTwoDepartmentId(Integer twoDepartmentId) { - this.twoDepartmentId = twoDepartmentId; - } - - public Integer getUserId() { - return userId; - } - - public void setUserId(Integer userId) { - this.userId = userId; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getAccount() { - return account; - } - - public void setAccount(String account) { - this.account = account; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getCountries() { - return countries; - } - - public void setCountries(String countries) { - this.countries = countries; - } - - public Integer getProvinceId() { - return provinceId; - } - - public void setProvinceId(Integer provinceId) { - this.provinceId = provinceId; - } - - public Integer getCityId() { - return cityId; - } - - public void setCityId(Integer cityId) { - this.cityId = cityId; - } - - public String getCreationTime() { - return creationTime; - } - - public void setCreationTime(String creationTime) { - this.creationTime = creationTime; - } - - public Integer getLogInNumber() { - return logInNumber; - } - - public void setLogInNumber(Integer logInNumber) { - this.logInNumber = logInNumber; - } - - public String getLastLoginTime() { - return lastLoginTime; - } - - public void setLastLoginTime(String lastLoginTime) { - this.lastLoginTime = lastLoginTime; - } - - public Integer getSex() { - return sex; - } - - public void setSex(Integer sex) { - this.sex = sex; - } - - public Integer getDocumentType() { - return documentType; - } - - public void setDocumentType(Integer documentType) { - this.documentType = documentType; - } - - public String getIDNumber() { - return IDNumber; - } - - public void setIDNumber(String IDNumber) { - this.IDNumber = IDNumber; - } - - public Integer getEducationDegree() { - return educationDegree; - } - - public void setEducationDegree(Integer educationDegree) { - this.educationDegree = educationDegree; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getWeChatID() { - return WeChatID; - } - - public void setWeChatID(String weChatID) { - WeChatID = weChatID; - } - - public String getDateBirth() { - return dateBirth; - } - - public void setDateBirth(String dateBirth) { - this.dateBirth = dateBirth; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public Integer getSchoolId() { - return schoolId; - } - - public void setSchoolId(Integer schoolId) { - this.schoolId = schoolId; - } - - public String getUniqueIdentificationAccount() { - return uniqueIdentificationAccount; - } - - public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) { - this.uniqueIdentificationAccount = uniqueIdentificationAccount; - } - - public String getSearchContent() { - return searchContent; - } - - public void setSearchContent(String searchContent) { - this.searchContent = searchContent; - } - - public List getUser() { - return user; - } - - public void setUser(List user) { - this.user = user; - } - - public String getUserAvatars() { - return userAvatars; - } - - public void setUserAvatars(String userAvatars) { - this.userAvatars = userAvatars; - } - - public String getSchoolName() { - return schoolName; - } - - public void setSchoolName(String schoolName) { - this.schoolName = schoolName; - } - - public String getProvinceName() { - return provinceName; - } - - public void setProvinceName(String provinceName) { - this.provinceName = provinceName; - } - - public String getCityName() { - return cityName; - } - - public void setCityName(String cityName) { - this.cityName = cityName; - } - - public Integer getMonth() { - return month; - } - - public void setMonth(Integer month) { - this.month = month; - } - - public String getEndTime() { - return endTime; - } - - public void setEndTime(String endTime) { - this.endTime = endTime; - } - - public Integer getProfessionalClassId() { - return professionalClassId; - } - - public void setProfessionalClassId(Integer professionalClassId) { - this.professionalClassId = professionalClassId; - } - - public String getProfessionalClassName() { - return professionalClassName; - } - - public void setProfessionalClassName(String professionalClassName) { - this.professionalClassName = professionalClassName; - } - - public Integer getDisciplineId() { - return disciplineId; - } - - public void setDisciplineId(Integer disciplineId) { - this.disciplineId = disciplineId; - } - - public String getDisciplineName() { - return disciplineName; - } - - public void setDisciplineName(String disciplineName) { - this.disciplineName = disciplineName; - } - - public Integer getProfessionalId() { - return professionalId; - } - - public void setProfessionalId(Integer professionalId) { - this.professionalId = professionalId; - } - - public String getProfessionalName() { - return professionalName; - } - - public void setProfessionalName(String professionalName) { - this.professionalName = professionalName; - } - - public String getRoleId() { - return roleId; - } - - public void setRoleId(String roleId) { - this.roleId = roleId; - } - } diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java index fca38f2..9583004 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java @@ -26,8 +26,8 @@ public interface UserInfoMapper { ""}) void update(User user); - @Insert("INSERT INTO hr_user_info(userName,uniqueIdentificationAccount,documentType,IDNumber,provinceId,cityId,countries,dateBirth,educationDegree,schoolId,phone,weChatID,email,account,password,creationTime,logInNumber,sex,userAvatars,isdel,roleId)" - + " VALUES(#{userName},#{uniqueIdentificationAccount},#{documentType},#{IDNumber},#{provinceId},#{cityId},#{countries},#{dateBirth},#{educationDegree},#{schoolId},#{phone},#{weChatID},#{email},#{account},#{password},now(),0,#{sex},#{userAvatars},0,#{roleId})") + @Insert("INSERT INTO hr_user_info(userName,uniqueIdentificationAccount,documentType,IDNumber,provinceId,cityId,countries,dateBirth,educationDegree,schoolId,phone,weChatID,email,account,password,creationTime,logInNumber,sex,userAvatars,isdel,roleId,token)" + + " VALUES(#{userName},#{uniqueIdentificationAccount},#{documentType},#{IDNumber},#{provinceId},#{cityId},#{countries},#{dateBirth},#{educationDegree},#{schoolId},#{phone},#{weChatID},#{email},#{account},#{password},now(),0,#{sex},#{userAvatars},0,#{roleId},#{token})") @Options(useGeneratedKeys = true, keyProperty = "userId", keyColumn = "userId") void addUser(UserInfo user); @@ -124,11 +124,11 @@ public interface UserInfoMapper { void updateStudent(Student student); //登陆 - @Select("SELECT hui.schoolId,hui.account,hui.cityId,hui.countries,hui.creationTime,hui.dateBirth,hui.documentType,hui.educationDegree,hui.email,hui.iDNumber,hui.logInNumber,hui.phone,hui.provinceId,hui.sex,hui.uniqueIdentificationAccount,hui.userAvatars,hui.userId,hui.userName,hui.weChatID from hr_user_info hui where hui.isdel=0 and hui.userId = #{userId} ") + @Select("SELECT hui.token,hui.schoolId,hui.account,hui.cityId,hui.countries,hui.creationTime,hui.dateBirth,hui.documentType,hui.educationDegree,hui.email,hui.iDNumber,hui.logInNumber,hui.phone,hui.provinceId,hui.sex,hui.uniqueIdentificationAccount,hui.userAvatars,hui.userId,hui.userName,hui.weChatID from hr_user_info hui where hui.isdel=0 and hui.userId = #{userId} ") UserInfo logins(UserInfo userInfo); //登陆 - @Select("SELECT userId,userName,roleId from hr_user_info where isdel=0 and account = #{account} and password = #{password}") + @Select("SELECT token,userId,userName,roleId from hr_user_info where isdel=0 and account = #{account} and password = #{password}") UserInfo adminLogins(UserInfo userInfo); //登陆账号密码 @@ -171,7 +171,7 @@ public interface UserInfoMapper { List queryUserPlatformStaff(Integer userId); //查询用户手机 - @Select("SELECT userId from hr_user_info where isdel=0 and phone = #{phone}") + @Select("SELECT userId,phone from hr_user_info where isdel=0 and phone = #{phone}") List queryPhone(String phone); //查询用户详情 diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java index 89e1d3d..fb8fad1 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java @@ -183,8 +183,8 @@ public interface UserMapper { UserM logins(UserM user); //查询用户手机 - @Select("SELECT u.* from user u where isdel=0 and phone = #{phone}") - List queryPhone(String phone); + @Select("SELECT u.phone,u.userId from hr_user_info u where isdel=0 and phone = #{phone}") + List queryPhone(String phone); //查询用户详情 @Select({"