Commit 420f7f52 authored by yanzg's avatar yanzg

1.3版本修改,增加删除功能

parent 648e5ce3
......@@ -141,7 +141,8 @@ public class DaoConst {
/**
* 更新字段模板参数
*/
public static final String CODE_UPDATE_FIELD_REMOVE = ",a.%s=CASE WHEN a.%s THEN 0 AND IFNULL(?,0)=0 THEN 1 ELSE IFNULL(?,1) END";
public static final String CODE_REMOVE_FIELD_REMOVE = ",a.%s=CASE WHEN a.%s=0 AND IFNULL(?,0)=0 THEN 1 ELSE IFNULL(?,1) END";
public static final String CODE_UPDATE_FIELD_REMOVE = ",a.%s=IFNULL(?,1)";
/**
* 等于条件
*/
......
......@@ -691,8 +691,14 @@ public class TableStruct {
TableFieldVo remove = this.getRemove();
// 设置删除标记可以通过前台传入
if (remove != null) {
if (sql.getSqlType() == SQL_TYPE_REMOVE) {
sql.addParaConst(remove.inputName,
CODE_FIELD, String.format(CODE_UPDATE_FIELD_REMOVE, remove.name, remove.name));
CODE_FIELD, String.format(CODE_REMOVE_FIELD_REMOVE, remove.name, remove.name));
} else {
sql.addParaConst(remove.inputName,
CODE_FIELD, String.format(CODE_UPDATE_FIELD_REMOVE, remove.name));
}
}
}
......
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