Commit e8f2f4cb by 涂亚平

登录登出数据匹配

1 parent b86edc62
...@@ -3,10 +3,17 @@ package com.subsidy.common.configure; ...@@ -3,10 +3,17 @@ package com.subsidy.common.configure;
import com.subsidy.common.interceptor.WebSocketInterceptor; import com.subsidy.common.interceptor.WebSocketInterceptor;
import com.subsidy.util.websocket.WebSocketUtil; import com.subsidy.util.websocket.WebSocketUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket; import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer; import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
import javax.servlet.http.HttpSession;
import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
import javax.websocket.server.ServerEndpointConfig;
/** /**
* <p> * <p>
...@@ -18,7 +25,7 @@ import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry ...@@ -18,7 +25,7 @@ import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry
*/ */
@Configuration @Configuration
@EnableWebSocket @EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer { public class WebSocketConfig extends ServerEndpointConfig.Configurator implements WebSocketConfigurer {
@Autowired @Autowired
private WebSocketUtil webSocketUtil; private WebSocketUtil webSocketUtil;
...@@ -33,4 +40,22 @@ public class WebSocketConfig implements WebSocketConfigurer { ...@@ -33,4 +40,22 @@ public class WebSocketConfig implements WebSocketConfigurer {
.addInterceptors(webSocketInterceptor) // 自定义验证规则 .addInterceptors(webSocketInterceptor) // 自定义验证规则
.setAllowedOrigins("*"); .setAllowedOrigins("*");
} }
@Override
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
HttpSession httpSession = (HttpSession)request.getHttpSession();
if (httpSession != null) {
// 读取session域中存储的数据
sec.getUserProperties().put(HttpSession.class.getName(),httpSession);
}
super.modifyHandshake(sec, request, response);
}
@Bean
public ServerEndpointExporter serverEndpointExporter(){
return new ServerEndpointExporter();
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.subsidy.common.interceptor; ...@@ -2,6 +2,7 @@ package com.subsidy.common.interceptor;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.auth0.jwt.interfaces.Claim; import com.auth0.jwt.interfaces.Claim;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO; import com.subsidy.common.ResponseVO;
...@@ -9,8 +10,10 @@ import com.subsidy.common.constant.Code; ...@@ -9,8 +10,10 @@ import com.subsidy.common.constant.Code;
import com.subsidy.common.exception.HttpException; import com.subsidy.common.exception.HttpException;
import com.subsidy.mapper.AdministerMapper; import com.subsidy.mapper.AdministerMapper;
import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.MemberTokensMapper;
import com.subsidy.model.AdministerDO; import com.subsidy.model.AdministerDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import com.subsidy.model.MemberTokensDO;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.JwtUtil; import com.subsidy.util.JwtUtil;
import com.subsidy.util.Localstorage; import com.subsidy.util.Localstorage;
...@@ -49,6 +52,9 @@ public class AuthenticationInterceptor implements HandlerInterceptor { ...@@ -49,6 +52,9 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
@Autowired @Autowired
private MemberMapper memberMapper; private MemberMapper memberMapper;
@Autowired
private MemberTokensMapper memberTokensMapper;
@Override @Override
@CrossOrigin() @CrossOrigin()
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
...@@ -60,14 +66,14 @@ public class AuthenticationInterceptor implements HandlerInterceptor { ...@@ -60,14 +66,14 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
HandlerMethod handlerMethod = (HandlerMethod) handler; HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod(); Method method = handlerMethod.getMethod();
// TimeRequired timeRequired = method.getAnnotation(TimeRequired.class); TimeRequired timeRequired = method.getAnnotation(TimeRequired.class);
// if (timeRequired !=null){ if (timeRequired !=null){
// Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
// int hour = calendar.get(Calendar.HOUR_OF_DAY); int hour = calendar.get(Calendar.HOUR_OF_DAY);
// if (hour<6){ if (hour<6){
// throw new HttpException(17001); throw new HttpException(17001);
// } }
// } }
LoginRequired methodAnnotation = method.getAnnotation(LoginRequired.class); LoginRequired methodAnnotation = method.getAnnotation(LoginRequired.class);
if (methodAnnotation != null) { if (methodAnnotation != null) {
...@@ -98,6 +104,14 @@ public class AuthenticationInterceptor implements HandlerInterceptor { ...@@ -98,6 +104,14 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
Localstorage.setUser(memberDO); Localstorage.setUser(memberDO);
return true; return true;
} }
int count = memberTokensMapper.selectCount(new QueryWrapper<MemberTokensDO>()
.lambda()
.eq(MemberTokensDO::getMemberId,memberDO.getId()));
if (count==0){
throw new HttpException(1011);
}
/** /**
* 学生端设置单设备登录 * 学生端设置单设备登录
*/ */
......
package com.subsidy.controller; package com.subsidy.controller;
import com.alibaba.fastjson.JSON;
import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO; import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired; import com.subsidy.common.interceptor.LoginRequired;
...@@ -7,6 +8,7 @@ import com.subsidy.common.interceptor.TimeRequired; ...@@ -7,6 +8,7 @@ import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.administer.VerifyCodeDTO; import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.live.PolyvInfoDTO; import com.subsidy.dto.live.PolyvInfoDTO;
import com.subsidy.dto.member.*; import com.subsidy.dto.member.*;
import com.subsidy.dto.vod.InsertHistoryNewDTO;
import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.MemberMapper;
import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
...@@ -221,6 +223,13 @@ public class MemberController { ...@@ -221,6 +223,13 @@ public class MemberController {
return memberService.polyvInfo(userid,channelId,ts,token); return memberService.polyvInfo(userid,channelId,ts,token);
} }
@RequestMapping("logout")
@ApiOperation("登出 学生id")
@TimeRequired
public ResponseVO logout(@RequestBody String param){
MemberDO memberDO = JSON.parseObject(param, MemberDO.class);
return ResponseData.generateCreatedResponse(0,memberService.logout(memberDO));
}
......
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 用户登录token 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-01-06
*/
@RestController
@Api(tags = "用户登录token")
@RequestMapping("/member-tokens-do")
public class MemberTokensController {
}
package com.subsidy.mapper;
import com.subsidy.model.MemberTokensDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 用户登录token Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-01-06
*/
@Repository
public interface MemberTokensMapper extends BaseMapper<MemberTokensDO> {
void updateToken(Long memberId,String token);
}
...@@ -25,4 +25,6 @@ public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> { ...@@ -25,4 +25,6 @@ public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> {
OprMemDictDO getLatestLoginInfo(Long userId); OprMemDictDO getLatestLoginInfo(Long userId);
void deleteData(OprMemDictDO oprMemDictDO);
} }
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 用户登录token
* </p>
*
* @author Tuyp
* @since 2023-01-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("member_tokens")
public class MemberTokensDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long memberId;
/**
* 用户token
*/
private String token;
}
...@@ -78,4 +78,6 @@ public interface MemberService extends IService<MemberDO> { ...@@ -78,4 +78,6 @@ public interface MemberService extends IService<MemberDO> {
List<MemberLivesVO> memberLives(MemberDO memberDO); List<MemberLivesVO> memberLives(MemberDO memberDO);
PolyvInfoVO polyvInfo(String userid,String channelId,String ts,String token); PolyvInfoVO polyvInfo(String userid,String channelId,String ts,String token);
String logout(MemberDO memberDO);
} }
package com.subsidy.service;
import com.subsidy.model.MemberTokensDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 用户登录token 服务类
* </p>
*
* @author Tuyp
* @since 2023-01-06
*/
public interface MemberTokensService extends IService<MemberTokensDO> {
}
...@@ -254,7 +254,9 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap ...@@ -254,7 +254,9 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
ResultVO resultVO = this.checkResult(checkResultDTO.getId(), sign3); ResultVO resultVO = this.checkResult(checkResultDTO.getId(), sign3);
//存数据库 //存数据库
ImageCheckRecordDO imageCheckRecordDO = imageCheckRecordMapper.selectById(checkResultDTO.getId()); ImageCheckRecordDO imageCheckRecordDO = imageCheckRecordMapper.selectOne(new QueryWrapper<ImageCheckRecordDO>()
.lambda()
.eq(ImageCheckRecordDO::getBizSeqNo,checkResultDTO.getId()));
if (!StringUtils.isEmpty(resultVO.getSimilarity())) { if (!StringUtils.isEmpty(resultVO.getSimilarity())) {
BeanUtils.copyProperties(resultVO, imageCheckRecordDO); BeanUtils.copyProperties(resultVO, imageCheckRecordDO);
ActivityDetectionDO activityDetectionDO = new ActivityDetectionDO(); ActivityDetectionDO activityDetectionDO = new ActivityDetectionDO();
...@@ -286,6 +288,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap ...@@ -286,6 +288,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
imageCheckRecordDO.setResult(0); imageCheckRecordDO.setResult(0);
imageCheckRecordDO.setResult(0); imageCheckRecordDO.setResult(0);
activityDetectionDO.setStatus(0); activityDetectionDO.setStatus(0);
e.printStackTrace();
} }
activityDetectionMapper.insert(activityDetectionDO); activityDetectionMapper.insert(activityDetectionDO);
imageCheckRecordMapper.updateById(imageCheckRecordDO); imageCheckRecordMapper.updateById(imageCheckRecordDO);
......
...@@ -125,6 +125,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -125,6 +125,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired @Autowired
private ActivityDetectionMapper activityDetectionMapper; private ActivityDetectionMapper activityDetectionMapper;
@Autowired
private MemberTokensMapper memberTokensMapper;
public IPage<GetAllVO> getAll(GetAllDTO getAllDTO) { public IPage<GetAllVO> getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize()); Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
...@@ -340,12 +343,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -340,12 +343,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
throw new HttpException(70010); throw new HttpException(70010);
} }
//审计日志 //审计日志
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
oprMemDictDO.setUserId(memberDO.getId()); if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
oprMemDictDO.setOprType("登录"); oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setResult(1); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request)); oprMemDictDO.setOprType("登录");
oprMemDictMapper.insert(oprMemDictDO); oprMemDictDO.setResult(1);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
}
//mongoTemplate.insert(oprMemDictDO); //mongoTemplate.insert(oprMemDictDO);
userRoleVO.setCompanyId(companyDictDO.getId()); userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName()); userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
...@@ -390,12 +396,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -390,12 +396,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
memberVO.setCompanyId(companyDictDO.getId()); memberVO.setCompanyId(companyDictDO.getId());
memberVO.setCompanyName(companyDictDO.getCompanyName()); memberVO.setCompanyName(companyDictDO.getCompanyName());
memberVO.setQxyStatus(companyDictDO.getQxyStatus()); memberVO.setQxyStatus(companyDictDO.getQxyStatus());
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
oprMemDictDO.setUserId(memberDO.getId()); if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
oprMemDictDO.setOprType("登录"); oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setResult(1); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request)); oprMemDictDO.setOprType("登录");
oprMemDictMapper.insert(oprMemDictDO); oprMemDictDO.setResult(1);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
}
memberVO.setCompanyId(companyDictDO.getId()); memberVO.setCompanyId(companyDictDO.getId());
memberVO.setSuperviseName(companyDictDO.getSuperviseName()); memberVO.setSuperviseName(companyDictDO.getSuperviseName());
memberVO.setCompanyName(companyDictDO.getCompanyName()); memberVO.setCompanyName(companyDictDO.getCompanyName());
...@@ -406,6 +415,20 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -406,6 +415,20 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
memberVO.setRotationImgDictDOS(rotationImgDictDOS); memberVO.setRotationImgDictDOS(rotationImgDictDOS);
String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE); String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE);
//更新token
int count = memberTokensMapper.selectCount(new QueryWrapper<MemberTokensDO>()
.lambda()
.eq(MemberTokensDO::getMemberId, memberDO.getId()));
if (count > 0) {
memberTokensMapper.updateToken(memberDO.getId(), token);
} else {
MemberTokensDO memberTokensDO = new MemberTokensDO();
memberTokensDO.setMemberId(memberDO.getId());
memberTokensDO.setToken(token);
memberTokensMapper.insert(memberTokensDO);
}
Localstorage.setUser(memberDO); Localstorage.setUser(memberDO);
memberVO.setToken(token); memberVO.setToken(token);
return memberVO; return memberVO;
...@@ -536,12 +559,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -536,12 +559,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
BeanUtils.copyProperties(memberDO, userRoleVO); BeanUtils.copyProperties(memberDO, userRoleVO);
//审计日志 //审计日志
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
oprMemDictDO.setUserId(memberDO.getId()); if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
oprMemDictDO.setOprType("登录"); oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setResult(1); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request)); oprMemDictDO.setOprType("登录");
oprMemDictMapper.insert(oprMemDictDO); oprMemDictDO.setResult(1);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
}
userRoleVO.setCompanyId(companyDictDO.getId()); userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName()); userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
userRoleVO.setCompanyName(companyDictDO.getCompanyName()); userRoleVO.setCompanyName(companyDictDO.getCompanyName());
...@@ -627,12 +653,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -627,12 +653,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
BeanUtils.copyProperties(memberDO, userRoleVO); BeanUtils.copyProperties(memberDO, userRoleVO);
//审计日志 //审计日志
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
oprMemDictDO.setUserId(memberDO.getId()); if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
oprMemDictDO.setOprType("登录"); oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setResult(1); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request)); oprMemDictDO.setOprType("登录");
oprMemDictMapper.insert(oprMemDictDO); oprMemDictDO.setResult(1);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
}
userRoleVO.setCompanyId(companyDictDO.getId()); userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName()); userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
userRoleVO.setCompanyName(companyDictDO.getCompanyName()); userRoleVO.setCompanyName(companyDictDO.getCompanyName());
...@@ -1128,5 +1157,20 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -1128,5 +1157,20 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return polyvInfoVO; return polyvInfoVO;
} }
public String logout(MemberDO memberDO) {
memberTokensMapper.delete(new QueryWrapper<MemberTokensDO>()
.lambda()
.eq(MemberTokensDO::getMemberId, memberDO.getId()));
OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
if (oprMemDictDO.getResult() == 1 && "登出".equals(oprMemDictDO.getOprType())) {
oprMemDictMapper.deleteData(oprMemDictDO);
}
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setResult(1);
oprMemDictDO.setOprType("登出");
oprMemDictMapper.insert(oprMemDictDO);
return ConstantUtils.ADD_SUCCESS;
}
} }
package com.subsidy.service.impl;
import com.subsidy.model.MemberTokensDO;
import com.subsidy.mapper.MemberTokensMapper;
import com.subsidy.service.MemberTokensService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 用户登录token 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-01-06
*/
@Service
public class MemberTokensServiceImpl extends ServiceImpl<MemberTokensMapper, MemberTokensDO> implements MemberTokensService {
}
...@@ -2,6 +2,7 @@ meishu.code-message[0]=成功 ...@@ -2,6 +2,7 @@ meishu.code-message[0]=成功
meishu.code-message[1010]=无效的令牌 meishu.code-message[1010]=无效的令牌
meishu.code-message[1011]=当前账户已在其他设备登录 meishu.code-message[1011]=当前账户已在其他设备登录
meishu.code-message[1012]=你已掉线,请重新登录
meishu.code-message[10003]=验证码错误 meishu.code-message[10003]=验证码错误
meishu.code-message[10004]=账号或密码错误 meishu.code-message[10004]=账号或密码错误
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.MemberTokensMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.MemberTokensDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="member_id" property="memberId" />
<result column="token" property="token" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, member_id, token
</sql>
<update id="updateToken">
UPDATE member_tokens t
SET t.token = #{token}
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
</update>
</mapper>
...@@ -56,17 +56,28 @@ ...@@ -56,17 +56,28 @@
</select> </select>
<select id="getLatestLoginInfo" parameterType="long" resultType="com.subsidy.model.OprMemDictDO"> <select id="getLatestLoginInfo" parameterType="long" resultType="com.subsidy.model.OprMemDictDO">
SELECT SELECT t.id,
t.ip_address, t.ip_address,
t.opr_type, t.opr_type,
t.result, t.result,
t.user_id, t.user_id,
max(t.create_date) as create_date t.create_date
FROM FROM
opr_mem_dict t opr_mem_dict t
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
and t.result = 1 AND t.result = 1
AND t.user_id = #{userId} AND t.user_id =#{userId}
order by t.create_date desc
limit 1
</select> </select>
<delete id="deleteData" parameterType="com.subsidy.model.OprMemDictDO">
DELETE
FROM
opr_mem_dict
WHERE
delete_date IS NULL
AND id = #{id}
</delete>
</mapper> </mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!