55 lines
1.8 KiB
Java
55 lines
1.8 KiB
Java
package com.amarsoft.app.base.businessobject;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
|
|
|
public class FtpDownloadFile {
|
|
|
|
public static List<BusinessObject> loadBusinessObjects_SQL() throws Exception{
|
|
List<BusinessObject> lst=new ArrayList<BusinessObject>();
|
|
List<Map<String, String>> docList = DataOperatorUtil.getDataBySql("select itemname from CODE_LIBRARY where CodeNo='DocList' and IsInUse='1' and length(itemno)=6 group by itemname");
|
|
if(docList!=null){
|
|
int docInt = 1;
|
|
for (Map<String, String> map : docList) {
|
|
String itemname = map.get("itemname");
|
|
String SortNo = getNo(docInt);
|
|
BusinessObject bo = BusinessObject.createBusinessObject();
|
|
bo.setAttributeValue("ID", SortNo);
|
|
bo.setAttributeValue("SortNo", SortNo);
|
|
bo.setAttributeValue("Name",itemname);
|
|
lst.add(bo);
|
|
docInt++;
|
|
int docNameInt = 1;
|
|
List<Map<String, String>> docNameList = DataOperatorUtil.getDataBySql("SELECT doc_name as docName FROM LB_DOCCONFIG WHERE DOC_CLASS_ITEMNO IN (SELECT itemno FROM CODE_LIBRARY WHERE CodeNo='DocList' AND IsInUse='1' AND itemname='"+
|
|
itemname+"') GROUP BY doc_name");
|
|
if(docNameList!=null){
|
|
for (Map<String, String> map2 : docNameList) {
|
|
String docNameno = SortNo+getNo(docNameInt);
|
|
BusinessObject docNameBo = BusinessObject.createBusinessObject();
|
|
docNameBo.setAttributeValue("ID", docNameno);
|
|
docNameBo.setAttributeValue("SortNo", docNameno);
|
|
docNameBo.setAttributeValue("Name",map2.get("docName"));
|
|
lst.add(docNameBo);
|
|
docNameInt++;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
return lst;
|
|
}
|
|
|
|
private static String getNo (int number){
|
|
if(number<10){
|
|
return "00"+ number;
|
|
}else if(number<100){
|
|
return "0"+ number;
|
|
}else {
|
|
return number+"";
|
|
}
|
|
}
|
|
}
|