登录返回用户区分状态

This commit is contained in:
赵旭 2023-10-24 15:40:27 +08:00
parent 17145f6242
commit b70cd5d87c
5 changed files with 31 additions and 6 deletions

View File

@ -1,5 +1,6 @@
package com.xinelu.applet.mapper.newapp; package com.xinelu.applet.mapper.newapp;
import com.xinelu.applet.vo.newapp.LoginStatusVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
public interface NewAppLoginMapper { public interface NewAppLoginMapper {
@ -10,5 +11,5 @@ public interface NewAppLoginMapper {
* @param personPassword * @param personPassword
* @return * @return
*/ */
int login(@Param("personAccount") String personAccount, @Param("personPassword") String personPassword); LoginStatusVo login(@Param("personAccount") String personAccount, @Param("personPassword") String personPassword);
} }

View File

@ -2,9 +2,11 @@ package com.xinelu.applet.service.newapp.impl;
import com.xinelu.applet.mapper.newapp.NewAppLoginMapper; import com.xinelu.applet.mapper.newapp.NewAppLoginMapper;
import com.xinelu.applet.service.newapp.NewAppLoginService; import com.xinelu.applet.service.newapp.NewAppLoginService;
import com.xinelu.applet.vo.newapp.LoginStatusVo;
import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.domain.AjaxResult;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
@Service @Service
public class NewAppLoginServiceImpl implements NewAppLoginService { public class NewAppLoginServiceImpl implements NewAppLoginService {
@ -20,9 +22,13 @@ public class NewAppLoginServiceImpl implements NewAppLoginService {
*/ */
@Override @Override
public AjaxResult login(String personAccount, String personPassword) { public AjaxResult login(String personAccount, String personPassword) {
int count = newAppLoginMapper.login(personAccount, personPassword); LoginStatusVo loginStatusVo = newAppLoginMapper.login(personAccount, personPassword);
if (count>0){ HashMap<String, String> hashMap = new HashMap<>();
return AjaxResult.success("登录成功!"); if (loginStatusVo.getCount()>0){
hashMap.put("status",loginStatusVo.getStatus());
hashMap.put("id",loginStatusVo.getId()+"");
hashMap.put("str","登录成功!");
return AjaxResult.success(hashMap);
}else { }else {
return AjaxResult.error("账号或密码错误!"); return AjaxResult.error("账号或密码错误!");
} }

View File

@ -0,0 +1,14 @@
package com.xinelu.applet.vo.newapp;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoginStatusVo implements Serializable {
private Integer count;
private Integer id;
//1家医医生 2泉医医生 3专病医生
private String status;
}

View File

@ -4,9 +4,9 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinelu.applet.mapper.newapp.NewAppLoginMapper"> <mapper namespace="com.xinelu.applet.mapper.newapp.NewAppLoginMapper">
<select id="login" resultType="int"> <select id="login" resultType="com.xinelu.applet.vo.newapp.LoginStatusVo">
select select
count(1) count(1) count, status,id
from hospital_person_info from hospital_person_info
<where> <where>
<if test="personAccount != null"> <if test="personAccount != null">

View File

@ -40,6 +40,8 @@
<result property="personIntroduce" column="person_introduce"/> <result property="personIntroduce" column="person_introduce"/>
<result property="personSort" column="person_sort"/> <result property="personSort" column="person_sort"/>
<result property="personPictureUrl" column="person_picture_url"/> <result property="personPictureUrl" column="person_picture_url"/>
<result property="personAccount" column="person_account"/>
<result property="personPassword" column="person_password"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
@ -201,6 +203,8 @@
hpi.person_introduce, hpi.person_introduce,
hpi.person_sort, hpi.person_sort,
hpi.person_picture_url, hpi.person_picture_url,
hpi.person_account,
hpi.person_password,
hpi.create_by, hpi.create_by,
hpi.create_time, hpi.create_time,
hpi.update_by, hpi.update_by,