REM:
1. 修正更新数据库token字段异常问题
This commit is contained in:
HuangXin 2020-08-28 11:32:40 +08:00
parent 5af7cca3fd
commit c0c50c6d16
6 changed files with 15 additions and 16 deletions

View File

@ -2,12 +2,14 @@ server.port=9276
# 根据自身环境修改
server.tomcat.basedir=./basedir
# 多个项目放在nginx下同个端口通过该配置区分
server.servlet.context-path=/phoenix
server.servlet.context-path=/dispose
# 配置数据源
spring.datasource.url=jdbc:mysql://172.28.72.118:33061/phoenix_local?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true
spring.datasource.url=jdbc:mysql://172.28.72.118:33061/dispose_cl?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior\
=convertToNull&useUnicode=true
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=phoenix
spring.datasource.password=Hy@rfph32
# 配置连接池
spring.datasource.type=org.apache.commons.dbcp2.BasicDataSource
spring.datasource.dbcp2.max-total=128
@ -22,9 +24,10 @@ spring.datasource.dbcp2.connection-properties=characterEncoding=utf8
# 下划线转驼峰 将带有下划线的表字段映射为驼峰格式的实体类属性
#mybatis.configuration.map-underscore-to-camel-case: true
mybatis.mapper-locations=classpath*:mappers/*.xml
mybatis.type-aliases-package=com.cmcc.hy.phoenix.entity
mybatis.type-aliases-package=com.dispose.pojo.entity
mybatis.configuration.default-enum-type-handler=com.dispose.common.CommonEnumHandler
#config log
logging.config=file:config/logback.xml
logging.config=file:config/logback_debug.xml
#config tomcat
server.tomcat.max-threads=128
#====custom config,begin with phoenix====

View File

@ -43,7 +43,7 @@ phoenix.redis.type=redisson-single
#jedis config example>redis://:dfu56li_jdo8pd@172.28.72.111:7379/0,多个用逗号分隔
#redisson sentinel config example>redis://172.28.72.104:28379,redis://172.28.72.124:28380,redis://172.28.72.124:28381
#redisson single config example>redis://172.28.72.104:8380
phoenix.redis-server=redis://172.28.72.104:8380
#phoenix.redis-server=redis://172.28.72.104:8380
phoenix.redis-redisson-sentinel-master-name=mymaster
phoenix.redis-redisson-pwd=cmcc2019
#config request dec switch,true=dec,false=plain do nothing

View File

@ -1 +1 @@
spring.profiles.active=local,dispose
spring.profiles.active=dev,dispose

View File

@ -116,7 +116,8 @@ public class UserAccountManagerImpl implements UserAccountManager {
// 移除过期的项
userAccountCache.remove(user.getToken());
// 更新token
user.setToken(userAccountMapper.upgradeToken(username, token));
userAccountMapper.upgradeToken(username, token);
user.setToken(token);
// 重新添加到缓存中
userAccountCache.put(token, user);

View File

@ -95,13 +95,12 @@ public interface UserAccountMapper {
String upgradeLastAccessTime(@Param("username") String username);
/**
* Upgrade token string.
* Upgrade token.
*
* @param username the username
* @param token the token
* @return the string
*/
String upgradeToken(@Param("username") String username,
void upgradeToken(@Param("username") String username,
@Param("token") String token);
/**

View File

@ -63,16 +63,12 @@
WHERE username = #{username, jdbcType=VARCHAR}
</update>
<select id="upgradeToken" resultType="java.lang.String">
<update id="upgradeToken">
UPDATE
user_account
SET token = #{token, jdbcType=VARCHAR}
WHERE username = #{username, jdbcType=VARCHAR};
SELECT token
FROM user_account
WHERE username = #{username, jdbcType=VARCHAR}
</select>
</update>
<select id="setPwdErrTimes" resultType="java.lang.Integer">
UPDATE