Commit f0addf73 authored by yanzg's avatar yanzg

常规BUG的修改

parent 4fba420b
...@@ -98,7 +98,8 @@ public class TableStruct { ...@@ -98,7 +98,8 @@ public class TableStruct {
List<TableFieldVo> commonActionList = this.getFieldActionList(DaoConst.FIELD_COMMON); List<TableFieldVo> commonActionList = this.getFieldActionList(DaoConst.FIELD_COMMON);
// 判断是否属于主键 // 判断是否属于主键
if (fieldAction == DaoConst.FIELD_PRIMARY || stringAction == DaoConst.FIELD_PRIMARY) { int resultActionType = getActionType(fieldAction, stringAction);
if (resultActionType == DaoConst.FIELD_PRIMARY) {
// 将历史主键添加到普通列,并且移除历史主键 // 将历史主键添加到普通列,并且移除历史主键
List<TableFieldVo> primaryActionList = this.getFieldActionList(DaoConst.FIELD_PRIMARY); List<TableFieldVo> primaryActionList = this.getFieldActionList(DaoConst.FIELD_PRIMARY);
commonActionList.addAll(primaryActionList); commonActionList.addAll(primaryActionList);
...@@ -109,27 +110,43 @@ public class TableStruct { ...@@ -109,27 +110,43 @@ public class TableStruct {
// 将所有非主键列添加到普通列 // 将所有非主键列添加到普通列
commonActionList.add(vo); commonActionList.add(vo);
boolean isTypeMany = fieldAction == DaoConst.FIELD_REMOVE_UPDATE || stringAction == DaoConst.FIELD_REMOVE_UPDATE boolean isTypeMany = resultActionType == DaoConst.FIELD_REMOVE_UPDATE || resultActionType == DaoConst.FIELD_CREATE;
|| fieldAction == DaoConst.FIELD_CREATE || stringAction == DaoConst.FIELD_CREATE;
if (isTypeMany) { if (isTypeMany) {
List<TableFieldVo> actionList = this.getFieldActionList(DaoConst.FIELD_REMOVE_UPDATE); List<TableFieldVo> actionList = this.getFieldActionList(resultActionType);
actionList.add(vo); actionList.add(vo);
} }
// 处理其他特殊列 // 处理其他特殊列
else if (fieldAction != DaoConst.FIELD_COMMON) { else if (resultActionType != DaoConst.FIELD_COMMON) {
List<TableFieldVo> actionList = this.getFieldActionList(resultActionType);
// fieldAction 优先级高于 stringAction
// 假如特殊列已经存在,则将已经存在的特殊列删除,并且添加新的特殊列 // 假如特殊列已经存在,则将已经存在的特殊列删除,并且添加新的特殊列
List<TableFieldVo> actionList = this.getFieldActionList(fieldAction); if (resultActionType == fieldAction) {
actionList.clear(); actionList.clear();
actionList.add(vo); actionList.add(vo);
} else if (stringAction != DaoConst.FIELD_COMMON) { } else {
// 假如是默认的,并且特殊列已经存在,则不进行任何处理 // 假如是默认的,并且特殊列已经存在,则不进行任何处理
List<TableFieldVo> actionList = this.getFieldActionList(stringAction);
if (actionList.isEmpty()) { if (actionList.isEmpty()) {
actionList.add(vo); actionList.add(vo);
} }
} }
} }
} }
}
/**
* 获取字段类型
*
* @param fieldAction 字段类型
* @param stringAction 字符串字段类型
* @return 最终类型
*/
private int getActionType(int fieldAction, int stringAction) {
if (fieldAction != DaoConst.FIELD_COMMON) {
return fieldAction;
} else {
return stringAction;
}
}
/** /**
* 获取字符串动作类型 * 获取字符串动作类型
...@@ -381,8 +398,9 @@ public class TableStruct { ...@@ -381,8 +398,9 @@ public class TableStruct {
sql.addConst(this.getKey().inputName, String.format(DaoConst.CODE_WHERE_EQUALS_PARA, this.getKey().name)); sql.addConst(this.getKey().inputName, String.format(DaoConst.CODE_WHERE_EQUALS_PARA, this.getKey().name));
// 增加普通代码片段字段 // 增加普通代码片段字段
for (TableFieldVo field : getFieldActionList(DaoConst.FIELD_COMMON, List<TableFieldVo> updateList = getFieldActionList(DaoConst.FIELD_COMMON,
DaoConst.FIELD_CREATE, DaoConst.FIELD_REMOVE, DaoConst.FIELD_VERSION)) { DaoConst.FIELD_CREATE, DaoConst.FIELD_REMOVE, DaoConst.FIELD_VERSION);
for (TableFieldVo field : updateList) {
sql.addParaConst(field.inputName, sql.addParaConst(field.inputName,
DaoConst.FIELD_CODE, String.format(DaoConst.CODE_UPDATE_FIELD_PARA, field.name) DaoConst.FIELD_CODE, String.format(DaoConst.CODE_UPDATE_FIELD_PARA, field.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