Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
涂亚平
/
subsidy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e8f2f4cb
authored
Jan 06, 2023
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录登出数据匹配
1 parent
b86edc62
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
296 additions
and
39 deletions
src/main/java/com/subsidy/common/configure/WebSocketConfig.java
src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java
src/main/java/com/subsidy/controller/MemberController.java
src/main/java/com/subsidy/controller/MemberTokensController.java
src/main/java/com/subsidy/mapper/MemberTokensMapper.java
src/main/java/com/subsidy/mapper/OprMemDictMapper.java
src/main/java/com/subsidy/model/MemberTokensDO.java
src/main/java/com/subsidy/service/MemberService.java
src/main/java/com/subsidy/service/MemberTokensService.java
src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
src/main/java/com/subsidy/service/impl/MemberTokensServiceImpl.java
src/main/java/com/subsidy/util/websocket/WebSocketUtil.java
src/main/resources/code.properties
src/main/resources/mapper/MemberTokensMapper.xml
src/main/resources/mapper/OprMemDictMapper.xml
src/main/java/com/subsidy/common/configure/WebSocketConfig.java
View file @
e8f2f4c
...
...
@@ -3,10 +3,17 @@ package com.subsidy.common.configure;
import
com.subsidy.common.interceptor.WebSocketInterceptor
;
import
com.subsidy.util.websocket.WebSocketUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.socket.config.annotation.EnableWebSocket
;
import
org.springframework.web.socket.config.annotation.WebSocketConfigurer
;
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>
...
...
@@ -18,7 +25,7 @@ import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry
*/
@Configuration
@EnableWebSocket
public
class
WebSocketConfig
implements
WebSocketConfigurer
{
public
class
WebSocketConfig
extends
ServerEndpointConfig
.
Configurator
implements
WebSocketConfigurer
{
@Autowired
private
WebSocketUtil
webSocketUtil
;
...
...
@@ -33,4 +40,22 @@ public class WebSocketConfig implements WebSocketConfigurer {
.
addInterceptors
(
webSocketInterceptor
)
// 自定义验证规则
.
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
src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java
View file @
e8f2f4c
...
...
@@ -2,6 +2,7 @@ package com.subsidy.common.interceptor;
import
com.alibaba.fastjson.JSON
;
import
com.auth0.jwt.interfaces.Claim
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
...
...
@@ -9,8 +10,10 @@ import com.subsidy.common.constant.Code;
import
com.subsidy.common.exception.HttpException
;
import
com.subsidy.mapper.AdministerMapper
;
import
com.subsidy.mapper.MemberMapper
;
import
com.subsidy.mapper.MemberTokensMapper
;
import
com.subsidy.model.AdministerDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.model.MemberTokensDO
;
import
com.subsidy.util.ConstantUtils
;
import
com.subsidy.util.JwtUtil
;
import
com.subsidy.util.Localstorage
;
...
...
@@ -49,6 +52,9 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
@Autowired
private
MemberMapper
memberMapper
;
@Autowired
private
MemberTokensMapper
memberTokensMapper
;
@Override
@CrossOrigin
()
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
{
...
...
@@ -60,14 +66,14 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
HandlerMethod
handlerMethod
=
(
HandlerMethod
)
handler
;
Method
method
=
handlerMethod
.
getMethod
();
//
TimeRequired timeRequired = method.getAnnotation(TimeRequired.class);
//
if (timeRequired !=null){
//
Calendar calendar = Calendar.getInstance();
//
int hour = calendar.get(Calendar.HOUR_OF_DAY);
//
if (hour<6){
//
throw new HttpException(17001);
//
}
//
}
TimeRequired
timeRequired
=
method
.
getAnnotation
(
TimeRequired
.
class
);
if
(
timeRequired
!=
null
){
Calendar
calendar
=
Calendar
.
getInstance
();
int
hour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
if
(
hour
<
6
){
throw
new
HttpException
(
17001
);
}
}
LoginRequired
methodAnnotation
=
method
.
getAnnotation
(
LoginRequired
.
class
);
if
(
methodAnnotation
!=
null
)
{
...
...
@@ -98,6 +104,14 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
Localstorage
.
setUser
(
memberDO
);
return
true
;
}
int
count
=
memberTokensMapper
.
selectCount
(
new
QueryWrapper
<
MemberTokensDO
>()
.
lambda
()
.
eq
(
MemberTokensDO:
:
getMemberId
,
memberDO
.
getId
()));
if
(
count
==
0
){
throw
new
HttpException
(
1011
);
}
/**
* 学生端设置单设备登录
*/
...
...
src/main/java/com/subsidy/controller/MemberController.java
View file @
e8f2f4c
package
com
.
subsidy
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
...
...
@@ -7,6 +8,7 @@ import com.subsidy.common.interceptor.TimeRequired;
import
com.subsidy.dto.administer.VerifyCodeDTO
;
import
com.subsidy.dto.live.PolyvInfoDTO
;
import
com.subsidy.dto.member.*
;
import
com.subsidy.dto.vod.InsertHistoryNewDTO
;
import
com.subsidy.mapper.MemberMapper
;
import
com.subsidy.model.ExerciseDoneResultDO
;
import
com.subsidy.model.MemberDO
;
...
...
@@ -221,6 +223,13 @@ public class MemberController {
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
));
}
...
...
src/main/java/com/subsidy/controller/MemberTokensController.java
0 → 100644
View file @
e8f2f4c
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
{
}
src/main/java/com/subsidy/mapper/MemberTokensMapper.java
0 → 100644
View file @
e8f2f4c
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
);
}
src/main/java/com/subsidy/mapper/OprMemDictMapper.java
View file @
e8f2f4c
...
...
@@ -25,4 +25,6 @@ public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> {
OprMemDictDO
getLatestLoginInfo
(
Long
userId
);
void
deleteData
(
OprMemDictDO
oprMemDictDO
);
}
src/main/java/com/subsidy/model/MemberTokensDO.java
0 → 100644
View file @
e8f2f4c
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
;
}
src/main/java/com/subsidy/service/MemberService.java
View file @
e8f2f4c
...
...
@@ -78,4 +78,6 @@ public interface MemberService extends IService<MemberDO> {
List
<
MemberLivesVO
>
memberLives
(
MemberDO
memberDO
);
PolyvInfoVO
polyvInfo
(
String
userid
,
String
channelId
,
String
ts
,
String
token
);
String
logout
(
MemberDO
memberDO
);
}
src/main/java/com/subsidy/service/MemberTokensService.java
0 → 100644
View file @
e8f2f4c
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
>
{
}
src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java
View file @
e8f2f4c
...
...
@@ -254,7 +254,9 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
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
()))
{
BeanUtils
.
copyProperties
(
resultVO
,
imageCheckRecordDO
);
ActivityDetectionDO
activityDetectionDO
=
new
ActivityDetectionDO
();
...
...
@@ -286,6 +288,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
imageCheckRecordDO
.
setResult
(
0
);
imageCheckRecordDO
.
setResult
(
0
);
activityDetectionDO
.
setStatus
(
0
);
e
.
printStackTrace
();
}
activityDetectionMapper
.
insert
(
activityDetectionDO
);
imageCheckRecordMapper
.
updateById
(
imageCheckRecordDO
);
...
...
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
View file @
e8f2f4c
...
...
@@ -125,6 +125,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired
private
ActivityDetectionMapper
activityDetectionMapper
;
@Autowired
private
MemberTokensMapper
memberTokensMapper
;
public
IPage
<
GetAllVO
>
getAll
(
GetAllDTO
getAllDTO
)
{
Page
pager
=
new
Page
(
getAllDTO
.
getPageNum
(),
getAllDTO
.
getPageSize
());
...
...
@@ -340,12 +343,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
throw
new
HttpException
(
70010
);
}
//审计日志
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setIpAddress
(
IpAddressUtil
.
getIpAddress
(
request
));
oprMemDictMapper
.
insert
(
oprMemDictDO
);
OprMemDictDO
oprMemDictDO
=
oprMemDictMapper
.
getLatestLoginInfo
(
memberDO
.
getId
());
if
(
null
==
oprMemDictDO
||
!(
oprMemDictDO
.
getResult
()
==
1
&&
"登录"
.
equals
(
oprMemDictDO
.
getOprType
())))
{
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setIpAddress
(
IpAddressUtil
.
getIpAddress
(
request
));
oprMemDictMapper
.
insert
(
oprMemDictDO
);
}
//mongoTemplate.insert(oprMemDictDO);
userRoleVO
.
setCompanyId
(
companyDictDO
.
getId
());
userRoleVO
.
setSuperviseName
(
companyDictDO
.
getSuperviseName
());
...
...
@@ -390,12 +396,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
memberVO
.
setCompanyId
(
companyDictDO
.
getId
());
memberVO
.
setCompanyName
(
companyDictDO
.
getCompanyName
());
memberVO
.
setQxyStatus
(
companyDictDO
.
getQxyStatus
());
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setIpAddress
(
IpAddressUtil
.
getIpAddress
(
request
));
oprMemDictMapper
.
insert
(
oprMemDictDO
);
OprMemDictDO
oprMemDictDO
=
oprMemDictMapper
.
getLatestLoginInfo
(
memberDO
.
getId
());
if
(
null
==
oprMemDictDO
||
!(
oprMemDictDO
.
getResult
()
==
1
&&
"登录"
.
equals
(
oprMemDictDO
.
getOprType
())))
{
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setIpAddress
(
IpAddressUtil
.
getIpAddress
(
request
));
oprMemDictMapper
.
insert
(
oprMemDictDO
);
}
memberVO
.
setCompanyId
(
companyDictDO
.
getId
());
memberVO
.
setSuperviseName
(
companyDictDO
.
getSuperviseName
());
memberVO
.
setCompanyName
(
companyDictDO
.
getCompanyName
());
...
...
@@ -406,6 +415,20 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
memberVO
.
setRotationImgDictDOS
(
rotationImgDictDOS
);
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
);
memberVO
.
setToken
(
token
);
return
memberVO
;
...
...
@@ -536,12 +559,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
BeanUtils
.
copyProperties
(
memberDO
,
userRoleVO
);
//审计日志
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setIpAddress
(
IpAddressUtil
.
getIpAddress
(
request
));
oprMemDictMapper
.
insert
(
oprMemDictDO
);
OprMemDictDO
oprMemDictDO
=
oprMemDictMapper
.
getLatestLoginInfo
(
memberDO
.
getId
());
if
(
null
==
oprMemDictDO
||
!(
oprMemDictDO
.
getResult
()
==
1
&&
"登录"
.
equals
(
oprMemDictDO
.
getOprType
())))
{
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setIpAddress
(
IpAddressUtil
.
getIpAddress
(
request
));
oprMemDictMapper
.
insert
(
oprMemDictDO
);
}
userRoleVO
.
setCompanyId
(
companyDictDO
.
getId
());
userRoleVO
.
setSuperviseName
(
companyDictDO
.
getSuperviseName
());
userRoleVO
.
setCompanyName
(
companyDictDO
.
getCompanyName
());
...
...
@@ -627,12 +653,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
BeanUtils
.
copyProperties
(
memberDO
,
userRoleVO
);
//审计日志
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setIpAddress
(
IpAddressUtil
.
getIpAddress
(
request
));
oprMemDictMapper
.
insert
(
oprMemDictDO
);
OprMemDictDO
oprMemDictDO
=
oprMemDictMapper
.
getLatestLoginInfo
(
memberDO
.
getId
());
if
(
null
==
oprMemDictDO
||
!(
oprMemDictDO
.
getResult
()
==
1
&&
"登录"
.
equals
(
oprMemDictDO
.
getOprType
())))
{
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setIpAddress
(
IpAddressUtil
.
getIpAddress
(
request
));
oprMemDictMapper
.
insert
(
oprMemDictDO
);
}
userRoleVO
.
setCompanyId
(
companyDictDO
.
getId
());
userRoleVO
.
setSuperviseName
(
companyDictDO
.
getSuperviseName
());
userRoleVO
.
setCompanyName
(
companyDictDO
.
getCompanyName
());
...
...
@@ -1128,5 +1157,20 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
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
;
}
}
src/main/java/com/subsidy/service/impl/MemberTokensServiceImpl.java
0 → 100644
View file @
e8f2f4c
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
{
}
src/main/java/com/subsidy/util/websocket/WebSocketUtil.java
View file @
e8f2f4c
This diff is collapsed.
Click to expand it.
src/main/resources/code.properties
View file @
e8f2f4c
...
...
@@ -2,6 +2,7 @@ meishu.code-message[0]=成功
meishu.code-message[1010]=无效的令牌
meishu.code-message[1011]=当前账户已在其他设备登录
meishu.code-message[1012]=你已掉线,请重新登录
meishu.code-message[10003]=验证码错误
meishu.code-message[10004]=账号或密码错误
...
...
src/main/resources/mapper/MemberTokensMapper.xml
0 → 100644
View file @
e8f2f4c
<?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>
src/main/resources/mapper/OprMemDictMapper.xml
View file @
e8f2f4c
...
...
@@ -56,17 +56,28 @@
</select>
<select
id=
"getLatestLoginInfo"
parameterType=
"long"
resultType=
"com.subsidy.model.OprMemDictDO"
>
SELECT
t.ip_address,
SELECT
t.id,
t.ip_address,
t.opr_type,
t.result,
t.user_id,
max(t.create_date) as
create_date
t.
create_date
FROM
opr_mem_dict t
WHERE
t.delete_date IS NULL
and t.result = 1
AND t.user_id = #{userId}
AND t.result = 1
AND t.user_id =#{userId}
order by t.create_date desc
limit 1
</select>
<delete
id=
"deleteData"
parameterType=
"com.subsidy.model.OprMemDictDO"
>
DELETE
FROM
opr_mem_dict
WHERE
delete_date IS NULL
AND id = #{id}
</delete>
</mapper>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment