Commit 963ff10a authored by 赵啸非's avatar 赵啸非

添加blob,clob数据库映射

parent b6c04ef0
......@@ -401,7 +401,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
this.save(table);
//保存列
List<GentableColumnEntity> genTableColumns = table.getColumns();
//校验是否有主键列,如果没有,默认第一列为主键
GentableColumnEntity columnEntity = genTableColumns.stream().filter(f -> f.getIsPrimaryKey() != null).filter(f -> f.getIsPrimaryKey() == 1).findFirst().orElseGet(() -> null);
if (ObjectUtils.isEmpty(columnEntity)) {
......@@ -411,10 +410,10 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
}
for (GentableColumnEntity column : genTableColumns) {
//初始化列数据
GenUtils.initColumnField(column, table);
gentableColumnService.save(column);
}
}
}
} catch (Exception e) {
......
......@@ -57,6 +57,13 @@ public class GenConstants {
*/
public static final String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"};
/**
* 数据库blob类型
*/
public static final String[] COLUMNTYPE_BLOB = {"blob", "clob"};
/**
* 数据库数字类型
*/
......@@ -166,6 +173,11 @@ public class GenConstants {
*/
public static final String TYPE_DATE = "Date";
/**
* byte[]类型
*/
public static final String TYPE_BYTEARRAY = "byte[]";
/**
* 模糊查询
*/
......
......@@ -64,8 +64,8 @@ public class GenUtils {
Integer htmlType = columnLength >= 255 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? HtmlTypeEnum.HTML_TEXTAREA.getValue() : HtmlTypeEnum.HTML_INPUT.getValue();
column.setHtmlType(htmlType);
} else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) {
//时间类型
column.setJavaType(GenConstants.TYPE_DATE);
column.setHtmlType(HtmlTypeEnum.HTML_DATETIME.getValue());
} else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) {
column.setHtmlType(HtmlTypeEnum.HTML_INPUT.getValue());
......@@ -82,6 +82,10 @@ public class GenUtils {
else {
column.setJavaType(GenConstants.TYPE_LONG);
}
}else if (arraysContains(GenConstants.COLUMNTYPE_BLOB, dataType)) {
//大数据字段
column.setJavaType(GenConstants.TYPE_BYTEARRAY);
column.setHtmlType(HtmlTypeEnum.HTML_TEXTAREA.getValue());
}
// 插入字段(默认所有字段都需要插入)
......@@ -92,7 +96,7 @@ public class GenUtils {
if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && column.getIsPrimaryKey() != YesNo.YES.getValue()) {
column.setIsEdit(GenConstants.REQUIRE);
} else {
column.setIsEdit(GenConstants.NOREQUIRE);
}
}
// 列表字段
......@@ -123,13 +127,11 @@ public class GenUtils {
checkDict(column, temp1);
//checkDict(column, temp2);
if(!ObjectUtils.isEmpty(column.getDict())){
if(column.getDict().size()>2){
column.setHtmlType(HtmlTypeEnum.HTML_SELECT.getValue());
}else{
column.setHtmlType(HtmlTypeEnum.HTML_RADIO.getValue());
}
//radio
}
......
......@@ -10,12 +10,12 @@ package ${packageName}.service.impl;
</#if>
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.${Service};
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import ${packageName}.dao.${ClassName}Dao;
import ${packageName}.model.${ClassName}Entity;
import ${packageName}.service.${ClassName}Service;
<#if table.tplCategory=="sub" || table.tplCategory=="subone">
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import org.springframework.beans.factory.annotation.Autowired;
import ${subPackageName}.model.${subClassName}Entity;
import ${subPackageName}.model.${subClassName}Query;
......
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