Skip to content

Commit

Permalink
1.8.0 发布
Browse files Browse the repository at this point in the history
  • Loading branch information
785160953 committed Jul 7, 2019
1 parent e817238 commit 7bd1db8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ https://gitee.com/leo_xi/SpringJbaDemo
```
1. value 列名,1.7.6+支持自定义列名
2. defaultValue 默认值
3. notNull 是否允许为空
4. primary 是否是主键
5. policy 主键生成策略
3. notNull 是否允许为空(默认允许)
4. primary 是否是主键(默认否)
5. policy 主键生成策略(默认无)
6. length 长度限制
7. remark 备注
8. precision 精度(小于length)
8. precision 精度(小于length)(默认4)
9. charset (1.5.5+新增)设置表字符编码,默认utf8
10. order (1.7.8+新增)对应表的列的顺序,默认0
```
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/xin/xihc/jba/db/DB_MySql_Opera.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
package xin.xihc.jba.db;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import xin.xihc.jba.annotation.Column;
import xin.xihc.jba.annotation.Index;
import xin.xihc.jba.core.JbaTemplate;
Expand Down Expand Up @@ -42,6 +44,7 @@ public class DB_MySql_Opera implements I_TableOperation {
private static final int CHAR_MAX_LENGTH = 64;
/** varchar的最长的长度,超过字段类型为text */
private static final int VARCHAR_MAX_LENGTH = 20000;
private static final Logger LOGGER = LoggerFactory.getLogger(DB_MySql_Opera.class);
/** java类型- mySQL类型 对应map */
private static Map<Class, String> JAVA_CLASS_TO_MYSQL_FIELDNAME = new HashMap<>();

Expand Down Expand Up @@ -122,7 +125,11 @@ public void createTable(TableProperties tbl) {

// 初始化数据
if (tbl.getTableBean() instanceof InitDataInterface) {
CompletableFuture.runAsync(() -> ((InitDataInterface) tbl.getTableBean()).doInit(jbaTemplate));
CompletableFuture.runAsync(() -> ((InitDataInterface) tbl.getTableBean()).doInit(jbaTemplate))
.exceptionally(ex -> {
LOGGER.error("初始化表[" + tbl.getTableName() + "]数据异常:", ex);
return null;
});
}
}

Expand Down Expand Up @@ -205,8 +212,7 @@ public void updateTable(TableProperties tbl) {
sql.append("ALTER TABLE ").append(tbl.getTableName()).append(" ");
String after = "";
for (ColumnProperties col : tbl.getColumns().values()) {
Optional<ColumnProperties> find = dbColumnList.stream()
.filter(t -> t.colName().equals(col.colName()))
Optional<ColumnProperties> find = dbColumnList.stream().filter(t -> t.colName().equals(col.colName()))
.findFirst();
//存在
if (find.isPresent()) {
Expand Down

0 comments on commit 7bd1db8

Please sign in to comment.