Commit af07416e authored by 温志超's avatar 温志超

Merge remote-tracking branch 'origin/dev' into dev

parents 93490505 a7bf6e5c
......@@ -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());
lastVersion.forEach(s->{
s.setLastVersion(0);
appConfig.updateAction();
this.updateAppConfig(appConfig);
});
//修改历史版本为非最新
if(appConfig.getLastVersion()==0){
lastVersion.forEach(s->{
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);
appConfig.updateAction();
appConfigMapper.updateAppConfig(config);
}
List<AppConfig> lastVersion = this.selectLastVersion(appConfig.getAppName());
appConfig.updateAction();
//修改历史版本为非最新
if(appConfig.getLastVersion()==0){
lastVersion.forEach(s->{
s.setLastVersion(1);
s.updateAction();
appConfigMapper.updateAppConfig(s);
});
}
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