From 90b26c90abbd2ed99bb8cf07eaca2b654be7c2be Mon Sep 17 00:00:00 2001 From: "zhiyong.ning" <354350178@qq.com> Date: Fri, 25 Sep 2020 14:39:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserInfoController.java | 31 +++- .../liuwanr/entity/ExperimentalTeaching.java | 172 ------------------ .../yipin/liuwanr/mapper/UserInfoMapper.java | 8 +- .../liuwanr/service/UserInfoService.java | 21 +++ 4 files changed, 57 insertions(+), 175 deletions(-) delete mode 100644 src/main/java/com/yipin/liuwanr/entity/ExperimentalTeaching.java diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java index 4fadf4a..d6de4e8 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java @@ -301,7 +301,36 @@ public class UserInfoController { } /** - * 登陆 + * 服务端登陆 + */ + @GetMapping("/adminLogins") + Response adminLogins(@RequestParam("account") String account, @RequestParam("password") String password,HttpServletRequest req, HttpServletResponse res) { + Response resp = new Response(); + UserInfo userInfo = new UserInfo(); + if (account == null) { + resp.setStatus(300); + resp.setErrmessage("用户账号为空,登录失败!"); + }else if(password ==null) { + resp.setStatus(300); + resp.setErrmessage("用户密码为空,登录失败!"); + } else{ + userInfo.setAccount(account); + userInfo.setPassword(password); + HashMap ret = userInfoService.adminLogins(userInfo); + 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; + } + + /** + * 客户端登陆 */ @GetMapping("/logins") Response logins(@RequestParam("userId") Integer userId, @RequestParam("schoolId") Integer schoolId,@RequestParam("roleId") String roleId, HttpServletRequest req, HttpServletResponse res) { diff --git a/src/main/java/com/yipin/liuwanr/entity/ExperimentalTeaching.java b/src/main/java/com/yipin/liuwanr/entity/ExperimentalTeaching.java deleted file mode 100644 index 59243d1..0000000 --- a/src/main/java/com/yipin/liuwanr/entity/ExperimentalTeaching.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.yipin.liuwanr.entity; - -import java.util.List; - -/** - * 实验教学实体 - * - * @author Ning - */ -public class ExperimentalTeaching { - - //实验教学主键ID - private Integer id; - //实验班级名称 - private String experimentalClassName; - //实验名称 - private String experimentalName; - //绑定项目id - private Integer projectId; - //绑定项目名称 - private String projectName; - //实验人数 - private Integer experimentalNumber; - //实验时长 - private String experimentDuration; - //发布类型 - private Integer type; - //启动时间 - private String startTime; - //结束时间 - private String stopTime; - //状态 - private Integer status; - //邀请码 - private String invitationCode; - //是否启用邀请码 - private Integer isCode; - //绑定用户Id - private Integer userId; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getExperimentalClassName() { - return experimentalClassName; - } - - public void setExperimentalClassName(String experimentalClassName) { - this.experimentalClassName = experimentalClassName; - } - - public String getExperimentalName() { - return experimentalName; - } - - public void setExperimentalName(String experimentalName) { - this.experimentalName = experimentalName; - } - - public Integer getProjectId() { - return projectId; - } - - public void setProjectId(Integer projectId) { - this.projectId = projectId; - } - - public String getProjectName() { - return projectName; - } - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - public Integer getExperimentalNumber() { - return experimentalNumber; - } - - public void setExperimentalNumber(Integer experimentalNumber) { - this.experimentalNumber = experimentalNumber; - } - - public String getExperimentDuration() { - return experimentDuration; - } - - public void setExperimentDuration(String experimentDuration) { - this.experimentDuration = experimentDuration; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public String getStartTime() { - return startTime; - } - - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - public String getStopTime() { - return stopTime; - } - - public void setStopTime(String stopTime) { - this.stopTime = stopTime; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getInvitationCode() { - return invitationCode; - } - - public void setInvitationCode(String invitationCode) { - this.invitationCode = invitationCode; - } - - public Integer getIsCode() { - return isCode; - } - - public void setIsCode(Integer isCode) { - this.isCode = isCode; - } - - public Integer getUserId() { - return userId; - } - - public void setUserId(Integer userId) { - this.userId = userId; - } - - @Override - public String toString() { - return "ExperimentalTeaching{" + - "id=" + id + - ", experimentalClassName='" + experimentalClassName + '\'' + - ", experimentalName='" + experimentalName + '\'' + - ", projectId=" + projectId + - ", projectName='" + projectName + '\'' + - ", experimentalNumber=" + experimentalNumber + - ", experimentDuration='" + experimentDuration + '\'' + - ", type=" + type + - ", startTime='" + startTime + '\'' + - ", stopTime='" + stopTime + '\'' + - ", status=" + status + - ", invitationCode='" + invitationCode + '\'' + - ", isCode=" + isCode + - ", userId=" + userId + - '}'; - } -} diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java index d8f7479..fca38f2 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java @@ -46,7 +46,7 @@ public interface UserInfoMapper { " and u.schoolId = #{schoolId} ", " and s.cityId = #{cityId} ", " and u.roleId LIKE CONCAT('%',#{roleId},'%')", - " AND CONCAT(u.userName, s.schoolName,u.account) LIKE CONCAT('%',#{searchContent},'%')", + " AND CONCAT(u.userName, s.schoolName) LIKE CONCAT('%',#{searchContent},'%')", " and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)", " and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)", " and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 9 MONTH)", @@ -127,6 +127,10 @@ public interface UserInfoMapper { @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} ") UserInfo logins(UserInfo userInfo); + //登陆 + @Select("SELECT userId,userName,roleId from hr_user_info where isdel=0 and account = #{account} and password = #{password}") + UserInfo adminLogins(UserInfo userInfo); + //登陆账号密码 @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.account = #{account} and password = #{password} ") UserInfo loginsAP(UserInfo userInfo); @@ -223,7 +227,7 @@ public interface UserInfoMapper { "SELECT customerId,customerName,schoolId FROM customer where isdel = 0", " and customerName like CONCAT('%',#{searchContent},'%')", " " - + " #{customerIds}" + + " #{customerIds}" + "" + "", " "}) diff --git a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java index 4181acc..4e820c8 100644 --- a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java +++ b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java @@ -414,6 +414,27 @@ public class UserInfoService { return resp; } + //登陆 + public HashMap adminLogins(UserInfo userInfo){ + HashMap resp = new HashMap(); + try { + UserInfo user=userInfoMapper.adminLogins(userInfo); + if (user==null){ + resp.put("retvalue","账号密码有误,请稍后再试!"); + resp.put("retcode", 300); + }else{ + resp.put("retvalue",user); + resp.put("retcode", 200); + } + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "登陆异常,请稍后再试!"); + return resp; + } + return resp; + } + //登陆获取角色 public HashMap loginRole(Integer userId,Integer schoolId){ HashMap resp = new HashMap();