Commit a1b61a54 by huangshunlin

去掉date_format函数

parent 293d7188
...@@ -43,7 +43,7 @@ public class CbsRange { ...@@ -43,7 +43,7 @@ public class CbsRange {
String sql = ""; String sql = "";
sql += " WHERE FEEINR = '" + feeinr + "'"; sql += " WHERE FEEINR = '" + feeinr + "'";
sql += " AND FEEPRI = '" + feepri + "'"; sql += " AND FEEPRI = '" + feepri + "'";
sql += " AND date_format(BEGDAT, '%y%m%d') <= " + Utils.dbSqlDate(dat) + " AND date_format(ENDDAT, '%y%m%d') > " + Utils.dbSqlDate(dat) + " "; sql += " AND BEGDAT <= " + Utils.dbSqlDate(dat) + " AND ENDDAT > " + Utils.dbSqlDate(dat) + " ";
List<Fec> fecList = fecMapper.selectFecByConditionSql(sql); List<Fec> fecList = fecMapper.selectFecByConditionSql(sql);
if (fecList != null && fecList.size() > 0) { if (fecList != null && fecList.size() > 0) {
BeanUtils.copyProperties(fecList.get(0), fec); //需要深拷贝,不然调用得到的对象指向的还是原来的地址 BeanUtils.copyProperties(fecList.get(0), fec); //需要深拷贝,不然调用得到的对象指向的还是原来的地址
...@@ -65,7 +65,7 @@ public class CbsRange { ...@@ -65,7 +65,7 @@ public class CbsRange {
sql += " AND FEEPRI = '" + feepri + "'"; sql += " AND FEEPRI = '" + feepri + "'";
sql += " AND OBJTYP = '" + objTyp + "'"; sql += " AND OBJTYP = '" + objTyp + "'";
sql += " AND OBJINR = '" + objInr + "'"; sql += " AND OBJINR = '" + objInr + "'";
sql += " AND date_format(BEGDAT, '%y%m%d') <= " + Utils.dbSqlDate(dat) + " AND date_format(ENDDAT, '%y%m%d') > " + Utils.dbSqlDate(dat) + " "; sql += " AND BEGDAT <= " + Utils.dbSqlDate(dat) + " AND ENDDAT > " + Utils.dbSqlDate(dat) + " ";
List<Fec> fecList = fecMapper.selectFecByConditionSql(sql); List<Fec> fecList = fecMapper.selectFecByConditionSql(sql);
if (fecList != null && fecList.size() > 0) { if (fecList != null && fecList.size() > 0) {
BeanUtils.copyProperties(fecList.get(0), fec); //需要深拷贝,不然调用得到的对象指向的还是原来的地址 BeanUtils.copyProperties(fecList.get(0), fec); //需要深拷贝,不然调用得到的对象指向的还是原来的地址
...@@ -85,7 +85,7 @@ public class CbsRange { ...@@ -85,7 +85,7 @@ public class CbsRange {
sql += " WHERE CUR = '" + cur + "'"; sql += " WHERE CUR = '" + cur + "'";
sql += " AND OBJTYP = '" + objTyp + "'"; sql += " AND OBJTYP = '" + objTyp + "'";
sql += " AND OBJINR = '" + objInr + "'"; sql += " AND OBJINR = '" + objInr + "'";
sql += " AND date_format(BEGDAT, '%y%m%d') <= " + Utils.dbSqlDate(dat) + " AND date_format(ENDDAT, '%y%m%d') > " + Utils.dbSqlDate(dat) + " "; sql += " AND BEGDAT <= " + Utils.dbSqlDate(dat) + " AND ENDDAT > " + Utils.dbSqlDate(dat) + " ";
List<Irs> irsList = irsMapper.selectIrsByConditionSql(sql); List<Irs> irsList = irsMapper.selectIrsByConditionSql(sql);
if (irsList != null && irsList.size() > 0) { if (irsList != null && irsList.size() > 0) {
BeanUtils.copyProperties(irsList.get(0), irs); //需要深拷贝,不然调用得到的对象指向的还是原来的地址 BeanUtils.copyProperties(irsList.get(0), irs); //需要深拷贝,不然调用得到的对象指向的还是原来的地址
...@@ -108,7 +108,7 @@ public class CbsRange { ...@@ -108,7 +108,7 @@ public class CbsRange {
sql += " AND EXTID = '" + extid + "'"; sql += " AND EXTID = '" + extid + "'";
sql += " AND OBJTYP = '" + objTyp + "'"; sql += " AND OBJTYP = '" + objTyp + "'";
sql += " AND OBJINR = '" + objInr + "'"; sql += " AND OBJINR = '" + objInr + "'";
sql += " AND date_format(BEGDAT, '%y%m%d') <= " + Utils.dbSqlDate(dat) + " AND date_format(ENDDAT, '%y%m%d') > " + Utils.dbSqlDate(dat) + " "; sql += " AND BEGDAT <= " + Utils.dbSqlDate(dat) + " AND ENDDAT > " + Utils.dbSqlDate(dat) + " ";
List<Cbb> cbbList = cbbMapper.getCbbByContiditionSql(sql); List<Cbb> cbbList = cbbMapper.getCbbByContiditionSql(sql);
if (cbbList != null && cbbList.size() > 0) { if (cbbList != null && cbbList.size() > 0) {
BeanUtils.copyProperties(cbbList.get(0), cbb); //需要深拷贝,不然调用得到的对象指向的还是原来的地址 BeanUtils.copyProperties(cbbList.get(0), cbb); //需要深拷贝,不然调用得到的对象指向的还是原来的地址
...@@ -124,7 +124,7 @@ public class CbsRange { ...@@ -124,7 +124,7 @@ public class CbsRange {
String cur = xrt.getCur(); String cur = xrt.getCur();
String sql = ""; String sql = "";
sql += " WHERE CUR = '" + cur + "'"; 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 += " AND BEGDAT <= " + Utils.dbSqlDate(dat) + " AND ENDDAT > " + Utils.dbSqlDate(dat) + " ";
sql = Utils.sdbEtyGenSql("XRT",sql); sql = Utils.sdbEtyGenSql("XRT",sql);
List<Xrt> xrtList = xrtMapper.getXrtByConditionSql(sql); List<Xrt> xrtList = xrtMapper.getXrtByConditionSql(sql);
if (xrtList != null && xrtList.size() > 0) { if (xrtList != null && xrtList.size() > 0) {
...@@ -140,7 +140,7 @@ public class CbsRange { ...@@ -140,7 +140,7 @@ public class CbsRange {
String cur = xrt.getCur(); String cur = xrt.getCur();
String sql = ""; String sql = "";
sql += " WHERE CUR = '" + cur + "'"; 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 += " AND BEGDAT <= " + Utils.dbSqlDate(dat) + " AND ENDDAT > " + Utils.dbSqlDate(dat) + " ";
List<Zmqxrt> zmqxrtList = zmqxrtMapper.getZmqxrtByConditionSql(sql); List<Zmqxrt> zmqxrtList = zmqxrtMapper.getZmqxrtByConditionSql(sql);
if (zmqxrtList != null && zmqxrtList.size() > 0) { if (zmqxrtList != null && zmqxrtList.size() > 0) {
BeanUtils.copyProperties(zmqxrtList.get(0), xrt); //需要深拷贝,不然调用得到的对象指向的还是原来的地址 BeanUtils.copyProperties(zmqxrtList.get(0), xrt); //需要深拷贝,不然调用得到的对象指向的还是原来的地址
...@@ -170,7 +170,7 @@ public class CbsRange { ...@@ -170,7 +170,7 @@ public class CbsRange {
if (endDate == null || Dates.diff(endDate, maxDate) > 0) { if (endDate == null || Dates.diff(endDate, maxDate) > 0) {
endDate = maxDate; endDate = maxDate;
} }
sql += " AND date_format(BEGDAT, '%y%m%d') <= " + Utils.dbSqlDate(beginDate) + " AND date_format(ENDDAT, '%y%m%d') > " + Utils.dbSqlDate(beginDate) + " "; sql += " AND BEGDAT <= " + Utils.dbSqlDate(beginDate) + " AND ENDDAT > " + Utils.dbSqlDate(beginDate) + " ";
Cbb lastCbb = getCbbByContiditionSql(sql); Cbb lastCbb = getCbbByContiditionSql(sql);
if (lastCbb != null) { if (lastCbb != null) {
Date endDate2 = lastCbb.getEnddat(); Date endDate2 = lastCbb.getEnddat();
...@@ -219,7 +219,7 @@ public class CbsRange { ...@@ -219,7 +219,7 @@ public class CbsRange {
if (endDate == null || Dates.diff(endDate, maxDate) > 0) { if (endDate == null || Dates.diff(endDate, maxDate) > 0) {
endDate = maxDate; endDate = maxDate;
} }
sql += " AND date_format(BEGDAT, '%y%m%d') <= " + Utils.dbSqlDate(beginDate) + " AND date_format(ENDDAT, '%y%m%d') > " + Utils.dbSqlDate(beginDate) + " "; sql += " AND BEGDAT <= " + Utils.dbSqlDate(beginDate) + " AND ENDDAT > " + Utils.dbSqlDate(beginDate) + " ";
Fec lastFec = getFecByContiditionSql(sql); Fec lastFec = getFecByContiditionSql(sql);
if (lastFec != null) { if (lastFec != null) {
Date endDate2 = lastFec.getEnddat(); Date endDate2 = lastFec.getEnddat();
...@@ -265,7 +265,7 @@ public class CbsRange { ...@@ -265,7 +265,7 @@ public class CbsRange {
sql += " AND FEEPRI = '" + feepri + "'"; sql += " AND FEEPRI = '" + feepri + "'";
sql += " AND OBJTYP = '" + objTyp + "'"; sql += " AND OBJTYP = '" + objTyp + "'";
sql += " AND OBJINR = '" + objInr + "'"; sql += " AND OBJINR = '" + objInr + "'";
sql += " AND date_format(ENDDAT, '%y%m%d') = " + Utils.dbSqlDate(beginDate) + ""; sql += " AND ENDDAT = " + Utils.dbSqlDate(beginDate) + "";
/** /**
* 老国结Inr为8位,新国结为16位并填了0,新国结的inr必定小于老国结的inr * 老国结Inr为8位,新国结为16位并填了0,新国结的inr必定小于老国结的inr
* 但老国结按照逻辑,应该要比新国结小因此加了or * 但老国结按照逻辑,应该要比新国结小因此加了or
...@@ -293,9 +293,9 @@ public class CbsRange { ...@@ -293,9 +293,9 @@ public class CbsRange {
sql += " AND OBJTYP = '" + objTyp + "'"; sql += " AND OBJTYP = '" + objTyp + "'";
sql += " AND OBJINR = '" + objInr + "'"; sql += " AND OBJINR = '" + objInr + "'";
if (beginDate == null) { if (beginDate == null) {
sql += "AND date_format(BEGDAT, '%y%m%d') >= " + Utils.dbSqlDate(Utils.getMinDate()); sql += "AND BEGDAT >= " + Utils.dbSqlDate(Utils.getMinDate());
} else { } else {
sql += "AND date_format(BEGDAT, '%y%m%d') > " + Utils.dbSqlDate(beginDate); sql += "AND BEGDAT > " + Utils.dbSqlDate(beginDate);
} }
sql += " ORDER BY BEGDAT, INR"; sql += " ORDER BY BEGDAT, INR";
return cbbMapper.getCbbByContiditionSql(sql); return cbbMapper.getCbbByContiditionSql(sql);
...@@ -313,9 +313,9 @@ public class CbsRange { ...@@ -313,9 +313,9 @@ public class CbsRange {
sql += " AND OBJTYP = '" + objTyp + "'"; sql += " AND OBJTYP = '" + objTyp + "'";
sql += " AND OBJINR = '" + objInr + "'"; sql += " AND OBJINR = '" + objInr + "'";
if (beginDate == null) { if (beginDate == null) {
sql += "AND date_format(BEGDAT, '%y%m%d') >= " + Utils.dbSqlDate(Utils.getMinDate()); sql += "AND BEGDAT >= " + Utils.dbSqlDate(Utils.getMinDate());
} else { } else {
sql += "AND date_format(BEGDAT, '%y%m%d') > " + Utils.dbSqlDate(beginDate); sql += "AND BEGDAT > " + Utils.dbSqlDate(beginDate);
} }
sql += " ORDER BY BEGDAT, INR"; sql += " ORDER BY BEGDAT, INR";
return fecMapper.selectFecByConditionSql(sql); return fecMapper.selectFecByConditionSql(sql);
...@@ -338,9 +338,9 @@ public class CbsRange { ...@@ -338,9 +338,9 @@ public class CbsRange {
sql = sql + " AND INR > '" + inr + "')"; sql = sql + " AND INR > '" + inr + "')";
sql = sql + " OR (BEGDAT IS NOT NULL))"; sql = sql + " OR (BEGDAT IS NOT NULL))";
} else { } else {
sql = sql + " AND ((date_format(BEGDAT, '%y%m%d') = " + Utils.dbSqlDate(beginDate); sql = sql + " AND ((BEGDAT = " + Utils.dbSqlDate(beginDate);
sql = sql + " AND INR > '" + inr + "' )"; sql = sql + " AND INR > '" + inr + "' )";
sql = sql + " OR (date_format(BEGDAT, '%y%m%d') > " + Utils.dbSqlDate(beginDate) + "))"; sql = sql + " OR (BEGDAT > " + Utils.dbSqlDate(beginDate) + "))";
} }
sql += " ORDER BY BEGDAT, INR"; sql += " ORDER BY BEGDAT, INR";
return cbbMapper.getCbbByContiditionSql(sql); return cbbMapper.getCbbByContiditionSql(sql);
...@@ -365,7 +365,7 @@ public class CbsRange { ...@@ -365,7 +365,7 @@ public class CbsRange {
sql += " AND EXTID = '" + extid + "'"; sql += " AND EXTID = '" + extid + "'";
sql += " AND OBJTYP = '" + objTyp + "'"; sql += " AND OBJTYP = '" + objTyp + "'";
sql += " AND OBJINR = '" + objInr + "'"; sql += " AND OBJINR = '" + objInr + "'";
sql += " AND date_format(ENDDAT, '%y%m%d') = " + Utils.dbSqlDate(beginDate) + ""; sql += " AND ENDDAT = " + Utils.dbSqlDate(beginDate) + "";
/** /**
* 老国结Inr为8位,新国结为16位并填了0,新国结的inr必定小于老国结的inr * 老国结Inr为8位,新国结为16位并填了0,新国结的inr必定小于老国结的inr
* 但老国结按照逻辑,应该要比新国结小因此加了or * 但老国结按照逻辑,应该要比新国结小因此加了or
......
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