|
|
@@ -134,7 +134,7 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
dataForm = intent.getBooleanExtra("dataForm", false);
|
|
|
corekey = intent.getStringExtra("corekey");
|
|
|
isDevice = intent.getBooleanExtra("isDevice", false);
|
|
|
- groupId=intent.getIntExtra("groupId",0);
|
|
|
+ groupId = intent.getIntExtra("groupId", 0);
|
|
|
}
|
|
|
VoiceSearchView voiceSearchView = (VoiceSearchView) findViewById(R.id.voiceSearchView);
|
|
|
refreshListView = (PullToRefreshListView) findViewById(R.id.refreshListView);
|
|
|
@@ -249,13 +249,30 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private String getCondition(String keyWork) {
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ if (configMap == null || configMap.isEmpty()) {
|
|
|
+ builder.append("upper(" + (StringUtil.isEmpty(corekey) ? fieldKey : corekey) + ") like '%" + keyWork.toUpperCase() + "%'");
|
|
|
+ } else {
|
|
|
+ for (Map.Entry<String, String> e : configMap.entrySet()) {
|
|
|
+ builder.append("upper(" + e.getKey() + ") like '%" + keyWork.toUpperCase() + "%' or ");
|
|
|
+ }
|
|
|
+ if (builder.length() > 3) {
|
|
|
+ builder.delete(builder.length() - 3, builder.length() - 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return builder.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private void loadSearch(int page, final String keyWork) {
|
|
|
refreshListView.setMode(PullToRefreshBase.Mode.BOTH);
|
|
|
String condition = null;
|
|
|
if (StringUtil.isEmpty(keyWork)) {
|
|
|
condition = "1=1";
|
|
|
} else {
|
|
|
- condition = "upper(" + (StringUtil.isEmpty(corekey) ? fieldKey : corekey) + ") like '%" + keyWork.toUpperCase() + "%'";
|
|
|
+ condition = getCondition(keyWork);
|
|
|
}
|
|
|
HttpClient.Builder builder = new HttpClient.Builder();
|
|
|
boolean isForm = StringUtil.isEmpty(gCaller);
|
|
|
@@ -305,20 +322,24 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ private Map<String, String> configMap;
|
|
|
+ private String fieldKeyLike = null;
|
|
|
+
|
|
|
private void setData2Adapter(JSONArray data, JSONArray dbfinds) throws Exception {
|
|
|
- Map<String, String> configMap = new LinkedHashMap<>();
|
|
|
- //获取配置
|
|
|
- JSONObject config = null;
|
|
|
- String fieldKeyLike = null;
|
|
|
- for (int i = 0; i < dbfinds.size(); i++) {
|
|
|
- config = dbfinds.getJSONObject(i);
|
|
|
- String dbGridField = JSONUtil.getText(config, "dbGridField", "ds_dbfindfield");
|
|
|
- String field = JSONUtil.getText(config, "field", "ds_gridfield");
|
|
|
- if (!StringUtil.isEmpty(dbGridField) && !StringUtil.isEmpty(field)) {
|
|
|
- if (field.equals(fieldKey)) {
|
|
|
- fieldKeyLike = dbGridField;
|
|
|
+ if (configMap == null || TextUtils.isEmpty(fieldKeyLike)) {
|
|
|
+ configMap = new LinkedHashMap<>();
|
|
|
+ //获取配置
|
|
|
+ JSONObject config = null;
|
|
|
+ for (int i = 0; i < dbfinds.size(); i++) {
|
|
|
+ config = dbfinds.getJSONObject(i);
|
|
|
+ String dbGridField = JSONUtil.getText(config, "dbGridField", "ds_dbfindfield");//显示值对应字段名
|
|
|
+ String field = JSONUtil.getText(config, "field", "ds_gridfield");//实际字段名
|
|
|
+ if (!StringUtil.isEmpty(dbGridField) && !StringUtil.isEmpty(field)) {
|
|
|
+ if (field.equals(fieldKey)) {
|
|
|
+ fieldKeyLike = dbGridField;
|
|
|
+ }
|
|
|
+ configMap.put(dbGridField, field);
|
|
|
}
|
|
|
- configMap.put(dbGridField, field);
|
|
|
}
|
|
|
}
|
|
|
JSONObject o = null;
|
|
|
@@ -359,7 +380,7 @@ public class SelectNetAcitivty extends OABaseActivity {
|
|
|
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
|
|
if (mAdapter != null) {
|
|
|
Bean model = mAdapter.getModels((int) l);
|
|
|
- setResult(90, new Intent().putExtra("data", model.json).putExtra("groupId",groupId));
|
|
|
+ setResult(90, new Intent().putExtra("data", model.json).putExtra("groupId", groupId));
|
|
|
finish();
|
|
|
|
|
|
}
|