Commit c8cc6237 by hulei

XRT多实体调整

parent 005d1e10
......@@ -125,7 +125,7 @@ public class CbsRange {
String sql = "";
sql += " WHERE CUR = '" + cur + "'";
sql += " AND date_format(BEGDAT, '%y%m%d') <= " + Utils.dbSqlDate(dat) + " AND date_format(ENDDAT, '%y%m%d') > " + Utils.dbSqlDate(dat) + " ";
// sql = Utils.sdbEtyGenSql("XRT",sql);
sql = Utils.sdbEtyGenSql("XRT",sql);
List<Xrt> xrtList = xrtMapper.getXrtByConditionSql(sql);
if (xrtList != null && xrtList.size() > 0) {
BeanUtils.copyProperties(xrtList.get(0), xrt); //需要深拷贝,不然调用得到的对象指向的还是原来的地址
......
......@@ -402,7 +402,8 @@ public class Utils {
//! (Normally the multientity selector condition created by SdbEtyGenInsSql or SdbEtyGenTblSql)
//! The function returns a SQL condition incl. a leading where clause with optional parenthesis around the existing sql and logically ANDed condition.
boolean argWhrFlg = false;
if (!StringUtils.isEmpty(argSql) && (argSql.startsWith("WHERE") || argSql.startsWith("where"))) {
// if (!StringUtils.isEmpty(argSql) && (argSql.startsWith("WHERE") || argSql.startsWith("where"))) {
if (!StringUtils.isEmpty(argSql) && (argSql.matches("(?i) *where.*"))) {
argWhrFlg = true;
} else {
argWhrFlg = false;
......@@ -412,10 +413,10 @@ public class Utils {
if (argWhrFlg || StringUtils.isEmpty(argSql)) {
// if the passed sql is empty or already holds the where clause
// the argument is directly returned
sql = StringUtils.trim(argSql);
sql = argSql;
} else {
// if no where was passed it has to be added
sql = "WHERE " + StringUtils.trim(argSql);
sql = "WHERE " + argSql;
}
} else {
// If one of the two fields exists, the necessary query has to be
......@@ -423,12 +424,13 @@ public class Utils {
// beginning of the query, if no where clause exists.
// In both cases the rest of the command has to be put into brakets.
if (argWhrFlg) {
sql = "WHERE " + argCon + " and ( " + argSql.substring(5) + " )";
String upsql = argSql.toUpperCase();
sql = "WHERE " + argCon + " and ( " + argSql.substring(upsql.lastIndexOf("WHERE")+5) + " )";
} else {
if (MdaUtils.isEmpty(argSql)) {
sql = "WHERE " + argCon;
} else {
sql = "WHERE " + argCon + " and ( " + StringUtils.trim(argSql) + " )";
sql = "WHERE " + argCon + " and ( " + argSql + " )";
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment