Commit 9ec3b853 authored by 李驰骋's avatar 李驰骋

APP新增、更新调整历史是否最新问题修复

parent 3710404a
...@@ -101,6 +101,11 @@ public class Constants { ...@@ -101,6 +101,11 @@ public class Constants {
*/ */
public static final String JWT_USERID = "userid"; public static final String JWT_USERID = "userid";
/**
* 用户多语言
*/
public static final String JWT_LOCAL = "local";
/** /**
* 用户名称 * 用户名称
*/ */
......
...@@ -114,6 +114,7 @@ public class TokenService ...@@ -114,6 +114,7 @@ public class TokenService
Map<String, Object> claims = new HashMap<>(); Map<String, Object> claims = new HashMap<>();
claims.put(Constants.LOGIN_USER_KEY, token); claims.put(Constants.LOGIN_USER_KEY, token);
claims.put(Constants.JWT_USERNAME, loginUser.getUsername()); claims.put(Constants.JWT_USERNAME, loginUser.getUsername());
claims.put(Constants.JWT_LOCAL, loginUser.getUser().getLocale());
return createToken(claims); return createToken(claims);
} }
......
...@@ -52,11 +52,14 @@ public class AppConfigServiceImpl implements IAppConfigService { ...@@ -52,11 +52,14 @@ public class AppConfigServiceImpl implements IAppConfigService {
@Override @Override
public int insertAppConfig(AppConfig appConfig) { public int insertAppConfig(AppConfig appConfig) {
List<AppConfig> lastVersion = this.selectLastVersion(appConfig.getAppName()); List<AppConfig> lastVersion = this.selectLastVersion(appConfig.getAppName());
lastVersion.forEach(s->{ //修改历史版本为非最新
s.setLastVersion(0); if(appConfig.getLastVersion()==0){
appConfig.updateAction(); lastVersion.forEach(s->{
this.updateAppConfig(appConfig); s.setLastVersion(1);
}); s.updateAction();
appConfigMapper.updateAppConfig(s);
});
}
appConfig.createAction(); appConfig.createAction();
return appConfigMapper.insertAppConfig(appConfig); return appConfigMapper.insertAppConfig(appConfig);
} }
...@@ -69,15 +72,16 @@ public class AppConfigServiceImpl implements IAppConfigService { ...@@ -69,15 +72,16 @@ public class AppConfigServiceImpl implements IAppConfigService {
*/ */
@Override @Override
public int updateAppConfig(AppConfig appConfig) { public int updateAppConfig(AppConfig appConfig) {
QueryWrapper<AppConfig> appConfigQueryWrapper = new QueryWrapper<>(); List<AppConfig> lastVersion = this.selectLastVersion(appConfig.getAppName());
List<AppConfig> appConfigs = appConfigMapper.selectListByQw(appConfigQueryWrapper);
for (AppConfig config : appConfigs) {
config.setLastVersion(1);
appConfig.updateAction();
appConfigMapper.updateAppConfig(config);
}
appConfig.updateAction(); appConfig.updateAction();
//修改历史版本为非最新
if(appConfig.getLastVersion()==0){
lastVersion.forEach(s->{
s.setLastVersion(1);
s.updateAction();
appConfigMapper.updateAppConfig(s);
});
}
return appConfigMapper.updateAppConfig(appConfig); return appConfigMapper.updateAppConfig(appConfig);
} }
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<where> <where>
<if test="version != null and version != ''">and version = #{version}</if> <if test="version != null and version != ''">and version = #{version}</if>
<if test="url != null and url != ''">and url = #{url}</if> <if test="url != null and url != ''">and url = #{url}</if>
<if test="appName != null and appName != ''">and app_name = #{appName}</if>
<if test="updateState != null ">and update_state = #{updateState}</if> <if test="updateState != null ">and update_state = #{updateState}</if>
<if test="updateDesc != null ">and update_desc = #{updateDesc}</if> <if test="updateDesc != null ">and update_desc = #{updateDesc}</if>
</where> </where>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment