欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

复杂业务sql根据数据库sql配置表实现动态配置sql,业务改变不需要写代码,提交sql脚本即可实现业务规则改动。

程序员文章站 2022-06-24 20:52:23
ExeSQL tcheckEXCSQL = new ExeSQL();//获取配置表中的sql String sql="select t.sysvarvalue from ldsysvar t where t.sysvar like 'DoubleRecordSchnl%'";SSRS ssrs = tExeSQL.execSQL(sql);StringBuffer stringBuffer=new StringBuffer();......
            ExeSQL tcheckEXCSQL = new ExeSQL();
			//获取配置表中的sql
            String sql="select t.sysvarvalue from ldsysvar t where t.sysvar like 'DoubleRecordSchnl%'";
			SSRS ssrs = tExeSQL.execSQL(sql);
			StringBuffer stringBuffer=new StringBuffer();
			for (int n=1;n<=ssrs.getMaxRow();n++) {
				strPT = new String[ssrs.getMaxCol()];
				strPT[0]= ssrs.GetText(n, 1);
				stringBuffer.append(strPT[0]);
			}
			checkSql = stringBuffer.toString();
			logger.info("------------------checkSql全局替换之前-------------------:"+checkSql);
			//替换XXX
			checkSql = checkSql.replaceAll("\\?contno\\?", tContno);
			//替换XXX
			checkSql = checkSql.replaceAll("\\?managecom\\?",tManageCom);
			//替换XXX
			checkSql = checkSql.replaceAll("\\?agentgroup\\?",tAgentGroup);

 

本文地址:https://blog.csdn.net/u014185140/article/details/107664882