You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.4 KiB
48 lines
1.4 KiB
package com.fr.plugin.xxx.report.core; |
|
|
|
import com.fr.main.TemplateWorkBook; |
|
import com.fr.stable.StringUtils; |
|
import com.fr.web.request.ReportletRequest; |
|
|
|
import java.util.Map; |
|
|
|
/** |
|
* @author 秃破天际 |
|
* @version 10.0 |
|
* Created by 秃破天际 on 2020-04-03 |
|
**/ |
|
public abstract class RelationBuilder extends BuilderProvider { |
|
|
|
private String dsName; |
|
private String colKey; |
|
private String colValue; |
|
|
|
public RelationBuilder( String dsName, String colKey, String colValue ){ |
|
this.dsName = dsName; |
|
this.colKey = colKey; |
|
this.colValue = colValue; |
|
} |
|
protected abstract boolean accept(TemplateWorkBook book, ReportletRequest request)throws Exception; |
|
|
|
protected abstract void build(TemplateWorkBook book, ReportletRequest request,Map<String, String> relation)throws Exception; |
|
|
|
@Override |
|
public void build(TemplateWorkBook book, ReportletRequest request )throws Exception{ |
|
if( !accept(book,request) ){ |
|
return; |
|
} |
|
Map<String, String> relation = DsUtils.getRelation(dsName, colKey, colValue, book, request); |
|
build(book,request,relation); |
|
} |
|
|
|
protected String[] split( String record , String sep ){ |
|
if( StringUtils.isEmpty( record ) ){ |
|
return new String[0]; |
|
} |
|
String [] group = new String[]{record}; |
|
if( record.contains(sep) ){ |
|
group = record.split(sep); |
|
} |
|
return group; |
|
} |
|
}
|
|
|