yingp 8 жил өмнө
parent
commit
a10714c761

+ 12 - 0
src/main/java/com/uas/erp/database/domain/MasterView.java

@@ -1,15 +1,19 @@
 package com.uas.erp.database.domain;
 
+import org.springframework.util.StringUtils;
+
 /**
  * Created by Pro1 on 2017/8/22.
  */
 public class MasterView {
     private String name;
     private String title;
+    private String env;
 
     public MasterView(Master master) {
         this.name = master.getMa_user().toUpperCase();
         this.title = master.getMa_function();
+        this.env = StringUtils.isEmpty(master.getMa_env()) ? "test" : master.getMa_env();
     }
 
     public String getName() {
@@ -27,4 +31,12 @@ public class MasterView {
     public void setTitle(String title) {
         this.title = title;
     }
+
+    public String getEnv() {
+        return env;
+    }
+
+    public void setEnv(String env) {
+        this.env = env;
+    }
 }

+ 3 - 6
src/main/java/com/uas/erp/database/service/DBAService.java

@@ -10,10 +10,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  * Created by Pro1 on 2017/7/27.
@@ -63,7 +60,7 @@ public class DBAService {
         Integer count = baseRepository.queryForObject("select count(1) from user_tables where table_name='MASTER'", Integer.class);
         if (count == 1) {
             // 本账套有Master表,说明是默认账套
-            masters.addAll(baseRepository.queryForBeanList("select * from master where ma_enable=1", Master.class));
+            masters.addAll(baseRepository.queryForBeanList("select * from master where ma_enable=1 order by ma_user", Master.class));
         } else {
             // 说明是SYSTEM账号
             List<String> users = baseRepository.queryForList("select distinct owner from all_tab_cols where table_name='MASTER' and column_name='MA_ENABLE' order by owner", String.class);
@@ -78,7 +75,7 @@ public class DBAService {
                 master.setMa_url(dba.url());
             }
         }
-        return new HashSet<>(masters);
+        return new LinkedHashSet<>(masters);
     }
 
 }

+ 2 - 1
src/main/java/com/uas/erp/database/service/MasterService.java

@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -48,7 +49,7 @@ public class MasterService implements InitializingBean{
     }
 
     public Set<MasterView> findAllView() {
-        Set<MasterView> views = new HashSet<>();
+        Set<MasterView> views = new LinkedHashSet<>();
         for (Master master : masters) {
             views.add(new MasterView(master));
         }

+ 1 - 1
src/main/resources/application.yml

@@ -39,7 +39,7 @@ spring:
   profiles: dev
 dba:
   url: jdbc:oracle:thin:@192.168.253.12:1521:orcl
-  username: UASS
+  username: UAS
   password: select!#%*(
 ---
 spring: