1、系统配置快速获取方法

Former-commit-id: 3e3b838ae0ec81cfe9a628726651fa70fb47bf0c
master
王兵 4 years ago
parent 2b376f22ee
commit 32504d86f9

@ -65,4 +65,31 @@ public interface ProfilesManager {
* @return
*/
ProfilesGetResponse get(ProfilesGetRequest request, Token token);
/**
*
*
* @param key
* @param defaultValue
* @return
*/
String getString(String key, String defaultValue);
/**
*
*
* @param key
* @param defaultValue
* @return
*/
int getInt(String key, int defaultValue);
/**
*
*
* @param key
* @param defaultValue
* @return
*/
long getLong(String key, long defaultValue);
}

@ -1,10 +1,17 @@
package ${basePackage}.module.system.mgr;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.auth.Token;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.utils.IDgenerator;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.Message;
import ${basePackage}.frame.utils.StringUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.module.system.ent.Profiles;
import ${basePackage}.module.system.mpr.ProfilesMapper;
@ -18,12 +25,7 @@ import ${basePackage}.module.system.rsp.ProfilesDeleteResponse;
import ${basePackage}.module.system.rsp.ProfilesFindResponse;
import ${basePackage}.module.system.rsp.ProfilesGetResponse;
import ${basePackage}.module.system.rsp.ProfilesUpdateResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* PROFILES -
@ -188,4 +190,64 @@ public class ProfilesManagerImpl implements ProfilesManager {
return response;
}
/**
*
*
* @param key
* @param defaultValue
* @return
*/
@Override
public String getString(String key, String defaultValue) {
ProfilesFindRequest profilesFindRequest = new ProfilesFindRequest();
profilesFindRequest.setActive(LocalData.getActive());
profilesFindRequest.setKey(key);
ProfilesFindResponse profilesFindResponse = this.find(profilesFindRequest, LocalData.getSysToken());
if (profilesFindResponse.hasError() || profilesFindResponse.getResult().size() == 0) {
return defaultValue;
}
return profilesFindResponse.getResult().get(0).getValue();
}
/**
*
*
* @param key
* @param defaultValue
* @return
*/
@Override
public int getInt(String key, int defaultValue) {
String string = this.getString(key, "");
if (!StringUtil.isEmpty(string)) {
try {
return Integer.parseInt(string);
} catch (Exception ignored) {
}
}
return defaultValue;
}
/**
*
*
* @param key
* @param defaultValue
* @return
*/
@Override
public long getLong(String key, long defaultValue) {
String string = this.getString(key, "");
if (!StringUtil.isEmpty(string)) {
try {
return Long.parseLong(string);
} catch (Exception ignored) {
}
}
return defaultValue;
}
}

@ -340,7 +340,7 @@
} else {
this.onFind();
this.$refs['form'].resetFields();
this.form.dialog = false;
this.form.formShow = false;
}
}.bind(this))
} else {
@ -350,7 +350,7 @@
} else {
this.onFind();
this.$refs['form'].resetFields();
this.form.dialog = false;
this.form.formShow = false;
}
}.bind(this))
}

Loading…
Cancel
Save

Powered by TurnKey Linux.