Commit 24d4ff91 authored by yanzg's avatar yanzg

表结构修改表结构修改

parent c5c9feb3
......@@ -141,7 +141,7 @@ public class DaoConst {
/**
* 更新字段模板参数
*/
public static final String CODE_UPDATE_FIELD_REMOVE = "a.%s=1";
public static final String CODE_UPDATE_FIELD_REMOVE = "a.%s=IFNULL(?,1)";
/**
* 等于条件
*/
......@@ -173,7 +173,7 @@ public class DaoConst {
/**
* 未删除条件
*/
public static final String CODE_WHERE_EQUALS_NOT_REMOVE = "AND a.%s=0";
public static final String CODE_WHERE_EQUALS_NOT_REMOVE = "AND a.%s=IFNULL(?,0)";
/**
* 版本好字段
*/
......@@ -225,7 +225,7 @@ public class DaoConst {
/**
* 删除字符串长度变量
*/
public static final String REMOVE_FLAG_INPUT = "remove_input";
public static final String OLD_FLAG = "Old";
/**
* ID字段
*/
......
......@@ -6,37 +6,22 @@ import io.swagger.annotations.ApiModelProperty;
/**
* 查询参数
*
* @author 颜佐光
* @author 颜佐光
*/
@ApiModel(description = "查询参数")
public class QueryPara {
/**
* 查询删除
*/
public static QueryPara LOAD_REMOVE = new QueryPara(false, true);
/**
* 所有条件生效
*/
public static QueryPara FULL_COND = new QueryPara(true, false);
public static QueryPara FULL_COND = new QueryPara(true);
/**
* 所有条件生效
*/
@ApiModelProperty(notes = "所有条件生效,而不仅仅在主键存在时,通过主键加载")
private boolean fullCond;
/**
* 查询删除标记的结果
*/
@ApiModelProperty(notes = "在数据通过删除标记删除时,可以通过该参数查询出来")
private boolean loadRemove;
public QueryPara(boolean fullCond, boolean loadRemove) {
public QueryPara(boolean fullCond) {
this.fullCond = fullCond;
this.loadRemove = loadRemove;
}
public boolean isFullCond() {
......@@ -46,12 +31,4 @@ public class QueryPara {
public void setFullCond(boolean fullCond) {
this.fullCond = fullCond;
}
public boolean isLoadRemove() {
return loadRemove;
}
public void setLoadRemove(boolean loadRemove) {
this.loadRemove = loadRemove;
}
}
......@@ -61,8 +61,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
// 最终处理
this.created(model);
// 返回执行结果
String retVal = ret > 0 ? keyString : "";
return retVal;
return ret > 0 ? keyString : "";
}
protected List<String> createReplaceList(String sqlName, Collection collection) {
......@@ -403,8 +402,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
return model;
}
// 获取来源主键
Object from = this.table.getKeyObject(model);
return from;
return this.table.getKeyObject(model);
}
private <T> void checkLoadResult(T toItem, List<T> tos) {
......
......@@ -213,16 +213,7 @@ public abstract class BaseDaoSql {
* @param copy 是否复制
*/
protected SqlData getSqlQueryPara(SqlData sqlData, QueryPara queryPara, boolean copy) {
SqlData copyTo = sqlData;
if (queryPara != null && queryPara.isLoadRemove()) {
if (copyTo.getField(DaoConst.REMOVE_FLAG_INPUT) != null) {
if (copy) {
copyTo = sqlData.copy();
}
copyTo.removeField(DaoConst.REMOVE_FLAG_INPUT);
}
}
return copyTo;
return sqlData;
}
/**
......
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