一、该问题的重现步骤是什么?
1. 数据源管理
2. 数据模型设计
3.代码生成
4.实体类
5.数据库
二、你期待的结果是什么?实际看到的又是什么?
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
3.0.1Boot版本,win10系统
四、请提供详细的错误堆栈信息,这很重要。
并无报错信息
五、若有更多详细信息,请在下面提供。
在org.springblade.develop.support.BladeCodeGenerator#getCustomMap这个方法打下断点看看,是不是数据是空的。
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package $!{package.Entity};
#foreach($pkg in $!{table.importPackages})
import $!{pkg};
#end
#if($!{entityLombokModel})
import lombok.Data;
import lombok.EqualsAndHashCode;
#end
#if($!{swagger2})
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
#end
/**
* $!{table.comment}实体类
*
* @author $!{author}
* @since $!{date}
*/
#if($!{entityLombokModel})
@Data
#end
#if($!{table.convert})
@TableName("$!{table.name}")
#end
#if($!{superEntityClass})
@EqualsAndHashCode(callSuper = true)
#end
#if($!{swagger2})
@ApiModel(value = "$!{entity}对象", description = #if ("$!{table.comment}"=="")"$!{entity}对象"#else"$!{table.comment}"#end)
#end
#if($!{superEntityClass})
public class $!{entity} extends $!{superEntityClass}#if($!{activeRecord})<$!{entity}>#end {
#elseif($!{activeRecord})
@Accessors(chain = true)
public class $!{entity} extends Model<$!{entity}> {
#else
public class $!{entity} implements Serializable {
#end
private static final long serialVersionUID = 1L;
## ---------- BEGIN 字段循环遍历 ----------
#foreach($field in $!{table.fields})
#if($!{field.name}!=$!{cfg.tenantColumn})
#if($!{field.keyFlag})
#set($keyPropertyName=$!{field.propertyName})
#end
#if("$!field.comment" != "")
/**
* $!{field.comment}
*/
#if($!{swagger2})
@ApiModelProperty(value = "$!{field.comment}")
#end
#end
#if($!{field.keyFlag})
## 主键
#if($!{field.keyIdentityFlag})
@TableId(value = "$!{field.name}", type = IdType.AUTO)
#elseif(!$null.isNull($!{idType}) && "$!idType" != "")
@TableId(value = "$!{field.name}", type = IdType.$!{idType})
#elseif($!{field.convert})
@TableId("$!{field.name}")
#end
## 普通字段
#elseif($!{field.fill})
## ----- 存在字段填充设置 -----
#if($!{field.convert})
@TableField(value = "$!{field.name}", fill = FieldFill.$!{field.fill})
#else
@TableField(fill = FieldFill.$!{field.fill})
#end
#elseif($!{field.convert})
@TableField("$!{field.name}")
#end
## 乐观锁注解
#if($!{versionFieldName}==$!{field.name})
@Version
#end
## 逻辑删除注解
#if($!{logicDeleteFieldName}==$!{field.name})
@TableLogic
#end
private $!{field.propertyType} $!{field.propertyName};
#end
#end
## ---------- END 字段循环遍历 ----------
#if(!$!{entityLombokModel})
#foreach($field in $!{table.fields})
#if($!{field.propertyType.equals("boolean")})
#set($getprefix="is")
#else
#set($getprefix="get")
#end
public $!{field.propertyType} $!{getprefix}$!{field.capitalName}() {
return $!{field.propertyName};
}
#if($!{entityBuilderModel})
public $!{entity} set$!{field.capitalName}($!{field.propertyType} $!{field.propertyName}) {
#else
public void set$!{field.capitalName}($!{field.propertyType} $!{field.propertyName}) {
#end
this.$!{field.propertyName} = $!{field.propertyName};
#if($!{entityBuilderModel})
return this;
#end
}
#end
#end
#if($!{entityColumnConstant})
#foreach($field in $!{table.fields})
public static final String $!{field.name.toUpperCase()} = "$!{field.name}";
#end
#end
#if($!{activeRecord})
@Override
protected Serializable pkVal() {
#if($!{keyPropertyName})
return this.$!{keyPropertyName};
#else
return this.id;
#end
}
#end
#if(!$!{entityLombokModel})
@Override
public String toString() {
return "$!{entity}{" +
#foreach($field in $!{table.fields})
#if($!{velocityCount}==1)
"$!{field.propertyName}=" + $!{field.propertyName} +
#else
", $!{field.propertyName}=" + $!{field.propertyName} +
#end
#end
"}";
}
#end
}
但是这部分有点看不懂,然后字段读取确实是空的
# 刚刚还是发现问题了,这东西你还是得在模型配置里头点一下提交
多谢各位的指导,按照楼上的方法做好了
扫一扫访问 Blade技术社区 移动端