|
楼主 |
发表于 2013-2-26 17:42:17
|
显示全部楼层
老师,您好,现在点拆旧的时候还会报错,JS代码里面改了,现在是java代码里面报错,执行的是这个方法;
public static void insertDepreciation(String year, String month)
throws Exception {
Statement stmt = null;
String sql = null;
String guid = "";
Connection conn = ModelUtils.getConnection("/OA");
ContextHelper.getTransaction().begin(conn);
try {
stmt = conn.createStatement();
String strDatabaseType = conn.getMetaData()
.getDatabaseProductName();
if (strDatabaseType.equalsIgnoreCase("Oracle")) {
guid = "sys_guid()";
} else {
guid = "newid()";
}
try {
sql = "insert into OA_AS_Deprecition"
+ "(fDepreYear,fDepreMonth,fBgDepreYear,fBgDepreMonth"
+ ",fID,fKindID,fKind,fName,fSpecType,fOriginValue"
+ ",fAddDepreValue"
+ ",fDutyDeptID,fDutyDeptName,fDutyPsnID,fDutyPsnName,fServiceYear"
+ ",fCreateTime,fCode,version)"
+ "select "
+ year
+ ","
+ month
+ ""
+ ",fBgDepreYear,fBgDepreMonth,"
+ guid
+ ",fKindID,fKind,fName,fSpecType,fOriginValue"
+ ",fAddDepreValue"
+ ",fDutyDeptID,fDutyDeptName,fDutyPsnID,fDutyPsnName,fServiceYear"
+ ",fCreateTime,fCode,version" + " from OA_AS_Card"
+ " where fcode not in (select d.fcode from OA_AS_Deprecition d where d.fdepreyear="+ year
+" and d.fdepremonth="+ month
+") and ((fBgDepreYear < " + year
+ " and fBgDepreMonth is not null)"
+ " or (fBgDepreYear =" + year
+ " and fBgDepreMonth <" + month
+ ")) and (fBgDepreYear+fServiceYear > "+ year
+" or (fBgDepreYear+fServiceYear ="+ year
+"and fBgDepreMonth > "+ month
+"))";
stmt.execute(sql);
} finally {
stmt.close();
stmt = null;
}
} finally {
conn.close();
conn = null;
}
}
现在输入的年份和月份都是Integer类型的,但是现在把上面代码中的单引号去掉,现在还是报类型不符合! |
|