Commit b13dd8e8 authored by yanzg's avatar yanzg

常规BUG的修改

parent e10e2d8e
......@@ -121,8 +121,7 @@ public class TableStruct {
// 处理其他特殊列
if (isTypeMany) {
actionList.add(vo);
}
else if (resultActionType == fieldAction) {
} else if (resultActionType == fieldAction) {
// fieldAction 优先级高于 stringAction
// 假如特殊列已经存在,则将已经存在的特殊列删除,并且添加新的特殊列
actionList.clear();
......@@ -156,7 +155,7 @@ public class TableStruct {
* 获取字符串动作类型
*
* @param vo 输入子弹
* @return
* @return 获取到的自动类型
*/
private int getStringAction(TableFieldVo vo) {
if (getKey() == null) {
......@@ -218,14 +217,14 @@ public class TableStruct {
}
/**
* 获取某个类型的字段
* 获取某个类型的第一个字段
*
* @param type 类型
* @return
* @return 获取到的子弹
*/
private TableFieldVo getFieldAction(int type) {
List<TableFieldVo> list = getFieldActionList(type);
return list.size() > 0 ? list.get(0) : null;
return list.isEmpty() ? list.get(0) : null;
}
/**
......@@ -240,7 +239,7 @@ public class TableStruct {
/**
* 获取表名
*
* @return
* @return 获取到的名称
*/
public String getName() {
return name;
......@@ -249,7 +248,7 @@ public class TableStruct {
/**
* 设置表名
*
* @param name
* @param name 设置的表名
*/
public void setName(String name) {
this.name = name;
......@@ -258,7 +257,7 @@ public class TableStruct {
/**
* 主键
*
* @return
* @return 获取到的键值
*/
public TableFieldVo getKey() {
return getFieldAction(DaoConst.FIELD_PRIMARY);
......@@ -267,7 +266,7 @@ public class TableStruct {
/**
* 主键名称
*
* @return
* @return 主键名称
*/
public String getKeyName() {
return this.getKey().inputName;
......@@ -276,7 +275,7 @@ public class TableStruct {
/**
* 主键数据类型
*
* @return
* @return 主键类型
*/
public Class<?> getKeyType() {
return this.getKey().type;
......@@ -285,7 +284,7 @@ public class TableStruct {
/**
* MD5缓存字段
*
* @return
* @return md5字段
*/
public TableFieldVo getMd5Key() {
return getFieldAction(DaoConst.FIELD_MD5);
......@@ -294,7 +293,7 @@ public class TableStruct {
/**
* MD5缓存键值
*
* @return
* @return MD5名称
*/
public String getMD5KeyName() {
TableFieldVo md5Key = this.getMd5Key();
......@@ -304,7 +303,7 @@ public class TableStruct {
/**
* 判断是否包含版本号字段
*
* @return
* @return 版本号字段
*/
public TableFieldVo getVersion() {
return getFieldAction(DaoConst.FIELD_VERSION);
......@@ -313,7 +312,7 @@ public class TableStruct {
/**
* 判断是否包含remove字段
*
* @return
* @return 删除字段
*/
public TableFieldVo getRemove() {
return getFieldAction(DaoConst.FIELD_REMOVE);
......@@ -333,7 +332,7 @@ public class TableStruct {
* 获取某一列
*
* @param name 列名
* @return
* @return 获取到的字段
*/
public TableFieldVo getField(String name) {
if (StringHelper.isEmpty(name)) {
......@@ -350,7 +349,7 @@ public class TableStruct {
/**
* 通过表结构自动生成SQL语句
*
* @return
* @return 初始化的表SQL语句
*/
public void init(TableSqlCache table) {
table.setTable(this);
......@@ -363,6 +362,8 @@ public class TableStruct {
/**
* 初始化SaveWith
*
* @return 初始化的表SQL语句
*/
private void initSaveWith(TableSqlCache table) {
List<TableFieldVo> saveWithField = getFieldActionList(DaoConst.FIELD_SAVE_WITH);
......@@ -374,6 +375,8 @@ public class TableStruct {
/**
* 初始化添加统计SQL语句
*
* @return 初始化的表SQL语句
*/
private void initAddGroup(TableSqlCache table) {
List<TableFieldVo> addGroupField = getFieldActionList(DaoConst.FIELD_ADD_GROUP);
......@@ -389,7 +392,7 @@ public class TableStruct {
/**
* 生成创建的SQL语句
*
* @return
* @return 生成的语句
*/
private SqlData releaseSqlCreate() {
// 生成添加的SQL语句
......@@ -416,7 +419,7 @@ public class TableStruct {
/**
* 生成修改的SQL语句
*
* @return
* @return 生成的语句
*/
private SqlData releaseSqlUpdate() {
// 生成添加的SQL语句
......@@ -449,7 +452,7 @@ public class TableStruct {
/**
* 生成删除的SQL语句
*
* @return
* @return 生成的语句
*/
private SqlData releaseSqlRemove() {
if (this.getRemove() != null) {
......@@ -484,7 +487,7 @@ public class TableStruct {
/**
* 生成加载的SQL语句
*
* @return
* @return 生成的语句
*/
private SqlData releaseSqlLoad() {
// 生成添加的SQL语句
......@@ -499,7 +502,10 @@ public class TableStruct {
/**
* 当前当前表所有字段的等于SQL语句
*
* @param sql
* @param sql SDL语句
* @param tag 标记
* @param isRemove 是否生成删除相关字段
* @return 生成的语句
*/
private void addWhereField(SqlData sql, String tag, boolean isRemove) {
sql.add(this.getKey().inputName,
......@@ -528,7 +534,7 @@ public class TableStruct {
/**
* 添加删除WHERE条件字段
*
* @param sql
* @param sql SQL语句实体
*/
private void addWhereRemove(SqlData sql) {
if (getRemove() != null) {
......@@ -560,7 +566,7 @@ public class TableStruct {
* @param valueModel 值字段模板
* @param valueFields 值字段
* @param whereFields WHERE字段
* @return
* @return 生成的SQL语句
*/
private SqlData releaseSql(int sqlType, String name, String model, String valueModel, List<TableFieldVo> valueFields, List<TableFieldVo> whereFields) {
// 参数字段
......
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