✨代码生成添加方法新增可以生成雪花id列
This commit is contained in:
parent
a8fbf4e156
commit
e8812787ad
@ -66,7 +66,7 @@ $end
|
|||||||
{
|
{
|
||||||
var response = _${replaceDto.ModelTypeName}Service.GetInfo(${replaceDto.PKName});
|
var response = _${replaceDto.ModelTypeName}Service.GetInfo(${replaceDto.PKName});
|
||||||
|
|
||||||
var info = response.Adapt<${replaceDto.ModelTypeName}>();
|
var info = response.Adapt<${replaceDto.ModelTypeName}Dto>();
|
||||||
return SUCCESS(info);
|
return SUCCESS(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -117,7 +117,12 @@ $end
|
|||||||
$if(null != genTable.SubTableName && "" != genTable.SubTableName)
|
$if(null != genTable.SubTableName && "" != genTable.SubTableName)
|
||||||
return Context.InsertNav(model).Include(s1 => s1.${genTable.SubTable.ClassName}Nav).ExecuteReturnEntity();
|
return Context.InsertNav(model).Include(s1 => s1.${genTable.SubTable.ClassName}Nav).ExecuteReturnEntity();
|
||||||
$else
|
$else
|
||||||
return Context.Insertable(model).ExecuteReturnEntity();
|
$if(replaceDto.useSnowflakeId)
|
||||||
|
model.${replaceDto.PKName} = Insertable(model).ExecuteReturnSnowflakeId();
|
||||||
|
return model;
|
||||||
|
$else
|
||||||
|
return Insertable(model).ExecuteReturnEntity();
|
||||||
|
$end
|
||||||
$end
|
$end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -267,7 +267,7 @@ $if(column.CsharpType == "int" || column.CsharpType == "long")
|
|||||||
$end
|
$end
|
||||||
|
|
||||||
$if(column.IsPK || column.IsIncrement)
|
$if(column.IsPK || column.IsIncrement)
|
||||||
$if(column.IsPK && column.IsIncrement == false)
|
$if(column.IsPK && column.IsIncrement == false && replaceDto.useSnowflakeId == false)
|
||||||
<el-col :lg="${options.ColNum}">
|
<el-col :lg="${options.ColNum}">
|
||||||
<el-form-item label="${labelName}" prop="${columnName}">
|
<el-form-item label="${labelName}" prop="${columnName}">
|
||||||
<el-input v-model${number}="form.${columnName}" placeholder="请输入${labelName}" :disabled="opertype != 1"/>
|
<el-input v-model${number}="form.${columnName}" placeholder="请输入${labelName}" :disabled="opertype != 1"/>
|
||||||
@ -635,9 +635,11 @@ const state = reactive({
|
|||||||
form: {},
|
form: {},
|
||||||
rules: {
|
rules: {
|
||||||
$foreach(column in genTable.Columns)
|
$foreach(column in genTable.Columns)
|
||||||
$if(column.IsRequired && column.IsIncrement == false)
|
$if(column.IsRequired && column.IsPk && replaceDto.useSnowflakeId)
|
||||||
|
${column.CsharpFieldFl}: [{ required: true, message: "${column.ColumnComment}不能为空", trigger: $if(column.htmlType == "select")"change"$else"blur"$end }],
|
||||||
|
$elseif(column.IsRequired && column.IsIncrement == false)
|
||||||
${column.CsharpFieldFl}: [{ required: true, message: "${column.ColumnComment}不能为空", trigger: $if(column.htmlType == "select")"change"$else"blur"$end
|
${column.CsharpFieldFl}: [{ required: true, message: "${column.ColumnComment}不能为空", trigger: $if(column.htmlType == "select")"change"$else"blur"$end
|
||||||
$if(column.CsharpType == "int" || column.CsharpType == "long"), type: "number"$end }],
|
$if(column.CsharpType == "int" || column.CsharpType == "long"), type: "number" $end }],
|
||||||
$end
|
$end
|
||||||
$end
|
$end
|
||||||
},
|
},
|
||||||
|
|||||||
@ -53,7 +53,8 @@ namespace ZR.CodeGenerator
|
|||||||
ShowBtnMultiDel = dto.GenTable.Options.CheckedBtn.Any(f => f == 7),
|
ShowBtnMultiDel = dto.GenTable.Options.CheckedBtn.Any(f => f == 7),
|
||||||
ShowBtnImport = dto.GenTable.Options.CheckedBtn.Any(f => f == 8),
|
ShowBtnImport = dto.GenTable.Options.CheckedBtn.Any(f => f == 8),
|
||||||
ViewFileName = dto.GenTable.BusinessName.FirstUpperCase(),
|
ViewFileName = dto.GenTable.BusinessName.FirstUpperCase(),
|
||||||
OperBtnStyle = dto.GenTable.Options.OperBtnStyle
|
OperBtnStyle = dto.GenTable.Options.OperBtnStyle,
|
||||||
|
UseSnowflakeId = dto.GenTable.Options.UseSnowflakeId
|
||||||
};
|
};
|
||||||
var columns = dto.GenTable.Columns;
|
var columns = dto.GenTable.Columns;
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace ZR.CodeGenerator.Model
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 首字母小写主键
|
/// 首字母小写主键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FistLowerPk{ get; set; }
|
public string FistLowerPk { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 主键类型
|
/// 主键类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -74,5 +74,9 @@ namespace ZR.CodeGenerator.Model
|
|||||||
/// 操作按钮样式
|
/// 操作按钮样式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int OperBtnStyle { get; set; }
|
public int OperBtnStyle { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否使用雪花id
|
||||||
|
/// </summary>
|
||||||
|
public bool UseSnowflakeId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,5 +132,9 @@ namespace ZR.Model.System.Generate
|
|||||||
/// 操作按钮样式
|
/// 操作按钮样式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int OperBtnStyle { get; set; } = 1;
|
public int OperBtnStyle { get; set; } = 1;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否使用雪花id
|
||||||
|
/// </summary>
|
||||||
|
public bool UseSnowflakeId { get; set; } = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user