2018-06-03 22:26:41 +08:00

59 lines
1.8 KiB
Java

package com.amarsoft.app.als.image;
import java.sql.SQLException;
import java.util.List;
import jbo.image.ECM_IMAGE_TYPE;
import jbo.image.ECM_PAGE;
import com.amarsoft.app.als.sys.tools.JBOHelper;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
public class ImageUtil {
private String startWithId ;
public String GetNewTypeNo( JBOTransaction tx ) throws SQLException, JBOException{
String sRes = "10", sFilter = "";
sFilter = "'"+ startWithId + "%'";
String sMax=JBOHelper.querySingle(tx, false, ECM_IMAGE_TYPE.CLASS_NAME, "Select Max(TypeNo) as v.max From o Where TypeNo Like "+sFilter, "")
.getAttribute("max").getString();
if( sMax != null && sMax.length() != 0 ){
sRes = String.valueOf( Integer.parseInt( sMax ) + 1 );
}
return sRes;
}
public String getStartWithId() {
return startWithId;
}
public void setStartWithId(String startWithId) {
this.startWithId = startWithId;
}
/**»ñȡӰÏñµÄÎĵµÁбí
* @param objectNo
* @param objectType
* @param typeNo
* @return
* @throws JBOException
*/
public static StringBuffer getImgDocList(String objectNo,String objectType,String typeNo) throws JBOException{
StringBuffer sb = new StringBuffer();
BizObjectManager bom = JBOFactory.getBizObjectManager(ECM_PAGE.CLASS_NAME);
List<BizObject> boList = bom.createQuery(" select documentId from o where objectType=:objectType and objectNo=:objectNo and typeNo=:typeNo and documentId is not null order by pageNum ")
.setParameter("objectType", objectType)
.setParameter("objectNo", objectNo)
.setParameter("typeNo", typeNo).getResultList(false);
for(BizObject bo:boList){
sb.append(bo.getAttribute("documentId").getString()).append("|");
}
return sb;
}
}