|  |  | 
 |  |  | import org.jdom2.Document; | 
 |  |  | import org.springframework.core.io.ResourceLoader; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @Author: liurunyu | 
 |  |  |  * @Date: 2024/7/24 13:41 | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     ///////////////////////////////// | 
 |  |  |     // 得到 | 
 |  |  |     //////////////////////////////// | 
 |  |  |     /** | 
 |  |  |      * 实始化 | 
 |  |  |      */ | 
 |  |  |     @SuppressWarnings("unused ") | 
 |  |  |     protected List<Org.OrgVo> get(ResourceLoader resourceLoader) { | 
 |  |  |         return this.doGet(resourceLoader); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 实始化 | 
 |  |  |      */ | 
 |  |  |     @SuppressWarnings("unused ") | 
 |  |  |     protected List<Org.OrgVo> doGet(ResourceLoader resourceLoader) { | 
 |  |  |         List<Org.OrgVo> list = null ; | 
 |  |  |         try { | 
 |  |  |             ConfigXml4Springboot configXml = new ConfigXml4Springboot() ; | 
 |  |  |             Document doc = configXml.createDom(resourceLoader, "init-config.xml") ; | 
 |  |  |             list = this.doGet(configXml, doc); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |         return list ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private List<Org.OrgVo> doGet(ConfigXml4Springboot configXml, Document doc) throws Exception { | 
 |  |  |         List<Org.OrgVo> list = null ; | 
 |  |  |         if (configXml != null && doc != null) { | 
 |  |  |             list = new ArrayList<>(); | 
 |  |  |             for (int num = 1; num <= 10000; num++) { | 
 |  |  |                 if (configXml.existElement(doc, "config.orgs.org" + num)) { | 
 |  |  |                     String orgTag = configXml.getSetAttrTxt(doc, "config.orgs.org" + num, "tag", null, false, null); | 
 |  |  |                     String orgName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num, "name", null, false, null); | 
 |  |  |                     Boolean enable = configXml.getSetAttrBoolean(doc, "config.orgs.org" + num, "enable", null, null); | 
 |  |  |                     if(enable != null && enable.booleanValue()){ | 
 |  |  |                         Org.OrgVo vo = new Org().new OrgVo() ; | 
 |  |  |                         vo.tag = orgTag ; | 
 |  |  |                         vo.name = orgName ; | 
 |  |  |                         list.add(vo) ; | 
 |  |  |                     } | 
 |  |  |                 }else{ | 
 |  |  |                     break ; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return list ; | 
 |  |  |     } | 
 |  |  | } |