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

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

parent 3710404a
......@@ -101,6 +101,11 @@ public class Constants {
*/
public static final String JWT_USERID = "userid";
/**
* 用户多语言
*/
public static final String JWT_LOCAL = "local";
/**
* 用户名称
*/
......
......@@ -114,6 +114,7 @@ public class TokenService
Map<String, Object> claims = new HashMap<>();
claims.put(Constants.LOGIN_USER_KEY, token);
claims.put(Constants.JWT_USERNAME, loginUser.getUsername());
claims.put(Constants.JWT_LOCAL, loginUser.getUser().getLocale());
return createToken(claims);
}
......
......@@ -52,11 +52,14 @@ public class AppConfigServiceImpl implements IAppConfigService {
@Override
public int insertAppConfig(AppConfig appConfig) {
List<AppConfig> lastVersion = this.selectLastVersion(appConfig.getAppName());
//修改历史版本为非最新
if(appConfig.getLastVersion()==0){
lastVersion.forEach(s->{
s.setLastVersion(0);
appConfig.updateAction();
this.updateAppConfig(appConfig);
s.setLastVersion(1);
s.updateAction();
appConfigMapper.updateAppConfig(s);
});
}
appConfig.createAction();
return appConfigMapper.insertAppConfig(appConfig);
}
......@@ -69,15 +72,16 @@ public class AppConfigServiceImpl implements IAppConfigService {
*/
@Override
public int updateAppConfig(AppConfig appConfig) {
QueryWrapper<AppConfig> appConfigQueryWrapper = new QueryWrapper<>();
List<AppConfig> appConfigs = appConfigMapper.selectListByQw(appConfigQueryWrapper);
for (AppConfig config : appConfigs) {
config.setLastVersion(1);
List<AppConfig> lastVersion = this.selectLastVersion(appConfig.getAppName());
appConfig.updateAction();
appConfigMapper.updateAppConfig(config);
//修改历史版本为非最新
if(appConfig.getLastVersion()==0){
lastVersion.forEach(s->{
s.setLastVersion(1);
s.updateAction();
appConfigMapper.updateAppConfig(s);
});
}
appConfig.updateAction();
return appConfigMapper.updateAppConfig(appConfig);
}
......
......@@ -38,6 +38,7 @@
<where>
<if test="version != null and version != ''">and version = #{version}</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="updateDesc != null ">and update_desc = #{updateDesc}</if>
</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