LogicSysInit.sql脚本
insert into ADMIN_SECU_ITEM (ID, APP_ID, NAME, TYPE, DESC_, RDB_DS_ID, TABLE_NAME, FIELD_ID, FIELD_NAME, FIELD_PARENT_ID, VERSION, ISOUTSPREAD, ISFIXED) values (sequence_admin_secu_item.nextval, '%APP_ID%', 'RPT_ROLE', 1, '系统中报表和目录权限控制', SEQUENCE_MTOOL_RDB_DS.Currval, 'RPT_PUB_RES', 'ID', 'NAME', 'PARENT_ID', null, 0, 1)
/**
* 读取数据库脚本,并给appId付值
*
* @param appId
* @return 返回SQL脚本的集合
*/
private List readSql(String appId) throws BizException {
List lines = new ArrayList();
String line;
StringBuffer sbLine;
int index;
try {
ClassPathResource cpr = new ClassPathResource("LogicSysInit.sql");
BufferedReader rsr = new BufferedReader(new InputStreamReader(cpr.getInputStream()));
line = rsr.readLine();
while (line != null) {
line = line.trim();
if(line.startsWith("#")){
line = rsr.readLine();
continue;
}
if ((index = line.indexOf("%APP_ID%")) != -1) {
sbLine = new StringBuffer();
sbLine.append(line.substring(0, index));
sbLine.append(appId);
sbLine.append(line.substring(index + 8));
lines.add(sbLine);
line = rsr.readLine();
} else {
line = rsr.readLine();
continue;
}
}
}catch (Exception ex) {
//加上相应的Log语句
logger.error("新创逻辑系统时,读取数据库脚本时,初始化ADMIN_SECU_ITEM表数据不存在,系统将跳过,默认为不需要初始化");
}
return lines;
}