Commit 9fad4ad8 authored by yanzg's avatar yanzg

常规BUG的修改

parent 753c8505
......@@ -372,12 +372,12 @@ public class TableStruct {
if (versionField != null) {
sql.addCode(DaoConst.FIELD_CODE, "," + versionField.name + "=1+" + versionField.name);
}
addWhereField(sql, "");
addWhereField(sql, "", true);
return sql;
} else {
String text = DaoConst.REMOVE_MODEL.replace(DaoConst.TABLE_CODE, this.name);
SqlData sql = new SqlData(DaoConst.REMOVE, text);
addWhereField(sql, "");
addWhereField(sql, "", true);
return sql;
}
}
......@@ -391,7 +391,7 @@ public class TableStruct {
// 生成添加的SQL语句
String text = DaoConst.LOAD_MODEL.replace(DaoConst.TABLE_CODE, this.name);
SqlData sql = new SqlData(DaoConst.LOAD, text);
addWhereField(sql, "a.");
addWhereField(sql, "a.", false);
return sql;
}
......@@ -400,10 +400,23 @@ public class TableStruct {
*
* @param sql
*/
private void addWhereField(SqlData sql, String tag) {
private void addWhereField(SqlData sql, String tag, boolean isRemove) {
TableFieldVo removeField = this.getRemove();
sql.add(this.getKey().inputName, " AND " + tag + this.getKey().name + "=?");
// 删除时更新字段
List<TableFieldVo> removeUpdate = this.getRemoveUpdate();
Map<TableFieldVo, Boolean> updateField = new HashMap<>(removeUpdate.size());
if (isRemove) {
for (TableFieldVo field : removeUpdate) {
updateField.put(field, true);
}
}
for (TableFieldVo field : this.getFields()) {
if (updateField.containsKey(field)) {
continue;
}
sql.add(field.inputName, " AND " + tag + field.name + "=?");
}
if (removeField != null) {
......
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