优化代码生成模板和默认设置,另修正当没有status字段时误导入了DataEntity的问题。
This commit is contained in:
@@ -31,41 +31,41 @@ import com.jeesite.common.mybatis.mapper.query.QueryType;
|
|||||||
<%
|
<%
|
||||||
var isBase = false, isData = false,
|
var isBase = false, isData = false,
|
||||||
isTree = false, isExtend = false;
|
isTree = false, isExtend = false;
|
||||||
// 生成字段属性
|
// ◆ 生成字段属性
|
||||||
for(c in table.columnList){
|
for(c in table.columnList){
|
||||||
// 如果是BaseEntity类属性
|
// ● 如果是BaseEntity类属性
|
||||||
if(c.isBaseEntityColumn){
|
if(table.isBaseEntity && c.isBaseEntityColumn){
|
||||||
if(!isBase){
|
if(!isBase){
|
||||||
isBase = true;
|
isBase = true;
|
||||||
%>
|
%>
|
||||||
@Column(includeEntity=BaseEntity.class),
|
@Column(includeEntity=BaseEntity.class),
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
// 如果是DataEntity类属性
|
// ● 如果是DataEntity类属性
|
||||||
}else if(c.isDataEntityColumn){
|
}else if(table.isDataEntity && c.isDataEntityColumn){
|
||||||
if(!isData){
|
if(!isData){
|
||||||
isData = true;
|
isData = true;
|
||||||
%>
|
%>
|
||||||
@Column(includeEntity=DataEntity.class),
|
@Column(includeEntity=DataEntity.class),
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
// 如果是TreeEntity类属性
|
// ● 如果是TreeEntity类属性
|
||||||
}else if(c.isTreeEntityColumn){
|
}else if(table.isTreeEntity && c.isTreeEntityColumn){
|
||||||
if(!isTree){
|
if(!isTree){
|
||||||
isTree = true;
|
isTree = true;
|
||||||
%>
|
%>
|
||||||
@Column(includeEntity=TreeEntity.class),
|
@Column(includeEntity=TreeEntity.class),
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
// 如果是Extend类属性
|
// ● 如果是Extend类属性
|
||||||
}else if(c.isExtendColumn){
|
}else if(table.isExtendEntity && c.isExtendColumn){
|
||||||
if(!isExtend){
|
if(!isExtend){
|
||||||
isExtend = true;
|
isExtend = true;
|
||||||
%>
|
%>
|
||||||
@Column(includeEntity=Extend.class, attrName="extend"),
|
@Column(includeEntity=Extend.class, attrName="extend"),
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
// 其它情况下
|
// ● 其它情况下
|
||||||
}else{
|
}else{
|
||||||
// 容错,如果没有设置父表的主键属性,则设置
|
// 容错,如果没有设置父表的主键属性,则设置
|
||||||
if(!@StringUtils.contains(c.attrName, ".")){
|
if(!@StringUtils.contains(c.attrName, ".")){
|
||||||
@@ -84,17 +84,17 @@ import com.jeesite.common.mybatis.mapper.query.QueryType;
|
|||||||
if (c.isPk == @Global.YES){
|
if (c.isPk == @Global.YES){
|
||||||
print(', isPK=true');
|
print(', isPK=true');
|
||||||
}else{
|
}else{
|
||||||
if (c.isInsert == @Global.NO){
|
if (c.isInsert != @Global.YES){
|
||||||
print(', isInsert=false');
|
print(', isInsert=false');
|
||||||
}
|
}
|
||||||
if (c.isUpdate == @Global.NO){
|
if (c.isUpdate != @Global.YES){
|
||||||
print(', isUpdate=false');
|
print(', isUpdate=false');
|
||||||
}
|
}
|
||||||
if (c.isQuery == @Global.YES && @StringUtils.inString(c.queryType,
|
if (c.isQuery == @Global.YES && @StringUtils.inString(c.queryType,
|
||||||
'NE', 'GT', 'GTE', 'LT', 'LTE', 'LIKE', 'LEFT_LIKE', 'RIGHT_LIKE')){
|
'NE', 'GT', 'GTE', 'LT', 'LTE', 'LIKE', 'LEFT_LIKE', 'RIGHT_LIKE')){
|
||||||
print(', queryType=QueryType.'+c.queryType);
|
print(', queryType=QueryType.'+c.queryType);
|
||||||
}
|
}
|
||||||
if (c.isQuery == @Global.NO){
|
if (c.isQuery != @Global.YES){
|
||||||
print(', isQuery=false');
|
print(', isQuery=false');
|
||||||
}
|
}
|
||||||
if (c.attrName == table.treeViewNameAttrName){
|
if (c.attrName == table.treeViewNameAttrName){
|
||||||
@@ -107,7 +107,7 @@ import com.jeesite.common.mybatis.mapper.query.QueryType;
|
|||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
}, <%
|
}, <%
|
||||||
// 关联系统表
|
// ◆ 生成关联表
|
||||||
var joinTables = '';
|
var joinTables = '';
|
||||||
for(c in table.columnList){
|
for(c in table.columnList){
|
||||||
if (c.attrType == 'com.jeesite.modules.sys.entity.User'){
|
if (c.attrType == 'com.jeesite.modules.sys.entity.User'){
|
||||||
@@ -140,6 +140,7 @@ import com.jeesite.common.mybatis.mapper.query.QueryType;
|
|||||||
print(joinTables);
|
print(joinTables);
|
||||||
print('\t}, ');
|
print('\t}, ');
|
||||||
}
|
}
|
||||||
|
// ◆ 生成排序字段
|
||||||
%>orderBy="<% if (isTree){
|
%>orderBy="<% if (isTree){
|
||||||
%>a.tree_sorts<%
|
%>a.tree_sorts<%
|
||||||
for(pk in table.pkList){
|
for(pk in table.pkList){
|
||||||
@@ -163,7 +164,7 @@ public class ${ClassName} extends ${table.isTreeEntity?'Tree':'Data'}Entity<${Cl
|
|||||||
// 生成字段属性
|
// 生成字段属性
|
||||||
for(c in table.columnList){
|
for(c in table.columnList){
|
||||||
// 如果是Extend类属性
|
// 如果是Extend类属性
|
||||||
if(c.isExtendColumn){
|
if(table.isExtendEntity && c.isExtendColumn){
|
||||||
if(!isExtend){
|
if(!isExtend){
|
||||||
isExtend = true;
|
isExtend = true;
|
||||||
%>
|
%>
|
||||||
|
|||||||
Reference in New Issue
Block a user