|
@ -1,5 +1,7 @@ |
|
|
package org.nl.system.service.generator.dao; |
|
|
package org.nl.system.service.generator.dao; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import com.baomidou.mybatisplus.annotation.IdType; |
|
|
import com.baomidou.mybatisplus.annotation.IdType; |
|
|
import com.baomidou.mybatisplus.annotation.TableId; |
|
|
import com.baomidou.mybatisplus.annotation.TableId; |
|
|
import com.baomidou.mybatisplus.annotation.TableName; |
|
|
import com.baomidou.mybatisplus.annotation.TableName; |
|
@ -9,6 +11,8 @@ import io.swagger.annotations.ApiModelProperty; |
|
|
import lombok.Builder; |
|
|
import lombok.Builder; |
|
|
import lombok.Data; |
|
|
import lombok.Data; |
|
|
import lombok.EqualsAndHashCode; |
|
|
import lombok.EqualsAndHashCode; |
|
|
|
|
|
import org.nl.common.utils.GenUtil; |
|
|
|
|
|
import org.nl.system.service.generator.dto.ColumnInfo; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* <p> |
|
|
* <p> |
|
@ -19,8 +23,6 @@ import lombok.EqualsAndHashCode; |
|
|
* @since 2023-05-03 |
|
|
* @since 2023-05-03 |
|
|
*/ |
|
|
*/ |
|
|
@Data |
|
|
@Data |
|
|
@Builder |
|
|
|
|
|
@EqualsAndHashCode(callSuper = false) |
|
|
|
|
|
@TableName("code_column_config") |
|
|
@TableName("code_column_config") |
|
|
public class CodeColumnConfig implements Serializable { |
|
|
public class CodeColumnConfig implements Serializable { |
|
|
|
|
|
|
|
@ -70,4 +72,24 @@ public class CodeColumnConfig implements Serializable { |
|
|
|
|
|
|
|
|
@ApiModelProperty(value = "日期注解") |
|
|
@ApiModelProperty(value = "日期注解") |
|
|
private String date_annotation; |
|
|
private String date_annotation; |
|
|
|
|
|
|
|
|
|
|
|
// 创建默认的实体
|
|
|
|
|
|
public static CodeColumnConfig createDefault(String tableName, ColumnInfo config) { |
|
|
|
|
|
CodeColumnConfig columnConfig = new CodeColumnConfig(); |
|
|
|
|
|
columnConfig.setColumn_id(IdUtil.getSnowflake(1,1).nextIdStr()); |
|
|
|
|
|
columnConfig.setTable_name(tableName); |
|
|
|
|
|
columnConfig.setColumn_name(config.getColumn_name()); |
|
|
|
|
|
columnConfig.setColumn_type(config.getColumn_type()); |
|
|
|
|
|
columnConfig.setKey_type(config.getKey_type()); |
|
|
|
|
|
columnConfig.setExtra(config.getExtra()); |
|
|
|
|
|
columnConfig.setNot_null((ObjectUtil.isNotEmpty(config.getKey_type()) |
|
|
|
|
|
&&ObjectUtil.isNotEmpty(config.getExtra()) |
|
|
|
|
|
&& GenUtil.PK.equalsIgnoreCase(config.getKey_type()) |
|
|
|
|
|
&&GenUtil.EXTRA.equalsIgnoreCase(config.getExtra())) |
|
|
|
|
|
?false:ObjectUtil.isNotEmpty(config.getNot_null())?config.getNot_null():false); |
|
|
|
|
|
columnConfig.setRemark(ObjectUtil.isNotEmpty(config.getRemark())?config.getRemark():null); |
|
|
|
|
|
columnConfig.setList_show(true); |
|
|
|
|
|
columnConfig.setForm_show(true); |
|
|
|
|
|
return columnConfig; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|