Commit 596ac9a0 authored by yanzg's avatar yanzg

常规BUG的修改

parent bccd38c0
......@@ -93,11 +93,11 @@ public class DaoConst {
/**
* 更新SQL语句模板
*/
public static final String UPDATE_MODEL = "UPDATE {TABLE} SET {FIELD} WHERE 1=1 {WHERE}";
public static final String UPDATE_MODEL = "UPDATE {TABLE} AS a{INNER} SET {FIELD} WHERE 1=1 {WHERE}";
/**
* 删除SQL语句模板
*/
public static final String REMOVE_MODEL = "DELETE FROM {TABLE} WHERE 1=1 {WHERE}";
public static final String REMOVE_MODEL = "DELETE a FROM {TABLE} AS a{INNER} WHERE 1=1 {WHERE}";
/**
* 加载SQL语句模板
*/
......
......@@ -334,21 +334,21 @@ public class TableStruct {
TableFieldVo removeField = this.getRemove();
TableFieldVo versionField = this.getVersion();
sql.addParaConst(this.getKey().inputName,
DaoConst.FIELD_CODE, "" + this.getKey().name + "=" + this.getKey().name,
DaoConst.WHERE_CODE, " AND " + this.getKey().name + "=?");
DaoConst.FIELD_CODE, "a." + this.getKey().name + "=a." + this.getKey().name,
DaoConst.WHERE_CODE, " AND a." + this.getKey().name + "=?");
for (TableFieldVo field : this.getFields()) {
if (field == removeField || field == versionField) {
continue;
}
sql.addParaConst(field.inputName, DaoConst.FIELD_CODE, "," + field.name + "=?");
sql.addParaConst(field.inputName, DaoConst.FIELD_CODE, ",a." + field.name + "=?");
}
if (removeField != null) {
sql.addParaConst(removeField.inputName, DaoConst.WHERE_CODE, " AND " + removeField.name + "=0");
sql.addParaConst(removeField.inputName, DaoConst.WHERE_CODE, " AND a." + removeField.name + "=0");
}
if (versionField != null) {
sql.addParaConst(versionField.inputName,
DaoConst.FIELD_CODE, "," + versionField.name + "=1+" + versionField.name,
DaoConst.WHERE_CODE, " AND " + versionField.name + "=?");
DaoConst.FIELD_CODE, ",a." + versionField.name + "=1+a." + versionField.name,
DaoConst.WHERE_CODE, " AND a." + versionField.name + "=?");
}
return sql;
}
......@@ -365,19 +365,19 @@ public class TableStruct {
// 生成添加的SQL语句
String text = DaoConst.UPDATE_MODEL.replace(DaoConst.TABLE_CODE, this.name);
SqlData sql = new SqlData(DaoConst.REMOVE, text);
sql.addCode(DaoConst.FIELD_CODE, removeField.name + "=1");
sql.addCode(DaoConst.FIELD_CODE, "a." + removeField.name + "=1");
for (TableFieldVo field : this.getFieldActionList(DaoConst.FIELD_REMOVE_UPDATE)) {
sql.addParaConst(field.inputName, DaoConst.FIELD_CODE, "," + field.name + "=?");
sql.addParaConst(field.inputName, DaoConst.FIELD_CODE, ",a." + field.name + "=?");
}
if (versionField != null) {
sql.addCode(DaoConst.FIELD_CODE, "," + versionField.name + "=1+" + versionField.name);
sql.addCode(DaoConst.FIELD_CODE, ",a." + versionField.name + "=1+a." + versionField.name);
}
addWhereField(sql, "", true);
addWhereField(sql, "a.", true);
return sql;
} else {
String text = DaoConst.REMOVE_MODEL.replace(DaoConst.TABLE_CODE, this.name);
SqlData sql = new SqlData(DaoConst.REMOVE, text);
addWhereField(sql, "", true);
addWhereField(sql, "a.", true);
return sql;
}
}
......
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