优化代码
This commit is contained in:
parent
95aba92e93
commit
480843147f
@ -166,97 +166,6 @@ namespace ZR.CodeGenerator
|
|||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// Vue 查询表单
|
|
||||||
///// </summary>
|
|
||||||
///// <param name="dbFieldInfo"></param>
|
|
||||||
///// <returns></returns>
|
|
||||||
//public static string TplQueryFormHtml(GenTableColumn dbFieldInfo)
|
|
||||||
//{
|
|
||||||
// StringBuilder sb = new();
|
|
||||||
// string columnName = dbFieldInfo.CsharpFieldFl;
|
|
||||||
// string labelName = CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnComment, dbFieldInfo.CsharpField);
|
|
||||||
// if (!dbFieldInfo.IsQuery) return sb.ToString();
|
|
||||||
// if (dbFieldInfo.HtmlType == GenConstants.HTML_DATETIME)
|
|
||||||
// {
|
|
||||||
// sb.AppendLine($" <el-form-item label=\"{labelName}\">");
|
|
||||||
// sb.AppendLine($" <el-date-picker v-model=\"dateRange{dbFieldInfo.CsharpField}\" style=\"width: 240px\" value-format=\"yyyy-MM-dd\" type=\"daterange\" range-separator=\"-\" start-placeholder=\"开始日期\"");
|
|
||||||
// sb.AppendLine($" end-placeholder=\"结束日期\" placeholder=\"请选择{dbFieldInfo.ColumnComment}\" :picker-options=\"{{ firstDayOfWeek: 1}}\"></el-date-picker>");
|
|
||||||
// sb.AppendLine(" </el-form-item>");
|
|
||||||
// }
|
|
||||||
// else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT || dbFieldInfo.HtmlType == GenConstants.HTML_RADIO)
|
|
||||||
// {
|
|
||||||
// sb.AppendLine($" <el-form-item label=\"{labelName}\" prop=\"{columnName}\">");
|
|
||||||
// sb.AppendLine($" <el-select v-model=\"queryParams.{columnName}\" placeholder=\"请选择{dbFieldInfo.ColumnComment}\" >");
|
|
||||||
// sb.AppendLine($" <el-option v-for=\"item in {columnName}Options\" :key=\"item.dictValue\" :label=\"item.dictLabel\" :value=\"item.dictValue\"></el-option>");
|
|
||||||
// sb.AppendLine(" </el-select>");
|
|
||||||
// sb.AppendLine(" </el-form-item>");
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// string inputNumTxt = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
|
|
||||||
// sb.AppendLine($" <el-form-item label=\"{ labelName}\" prop=\"{columnName}\">");
|
|
||||||
// sb.AppendLine($" <el-input v-model{inputNumTxt}=\"queryParams.{columnName}\" placeholder=\"请输入{dbFieldInfo.ColumnComment}\" />");
|
|
||||||
// sb.AppendLine(" </el-form-item>");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return sb.ToString();
|
|
||||||
//}
|
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// Vue 查询列表
|
|
||||||
///// </summary>
|
|
||||||
///// <param name="dbFieldInfo"></param>
|
|
||||||
///// <param name="genTable"></param>
|
|
||||||
///// <returns></returns>
|
|
||||||
//public static string TplTableColumn(GenTableColumn dbFieldInfo, GenTable genTable)
|
|
||||||
//{
|
|
||||||
// string columnName = dbFieldInfo.CsharpFieldFl;
|
|
||||||
// string label = CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnComment, columnName);
|
|
||||||
// string showToolTip = ShowToolTip(dbFieldInfo);
|
|
||||||
// string formatter = GetFormatter(dbFieldInfo.HtmlType, columnName);
|
|
||||||
// StringBuilder sb = new StringBuilder();
|
|
||||||
// //自定义排序字段
|
|
||||||
// if (GenConstants.HTML_CUSTOM_INPUT.Equals(dbFieldInfo.HtmlType) && !dbFieldInfo.IsPk)
|
|
||||||
// {
|
|
||||||
// sb.AppendLine($@" <el-table-column prop=""{columnName}"" label=""{label}"" width=""90"" sortable align=""center"">");
|
|
||||||
// sb.AppendLine(@" <template slot-scope=""scope"">");
|
|
||||||
// sb.AppendLine($@" <span v-show=""editIndex != scope.$index"" @click=""editCurrRow(scope.$index,'rowkeY')"">{{{{scope.row.{columnName}}}}}</span>");
|
|
||||||
// sb.AppendLine(@" <el-input :id=""scope.$index+'rowkeY'"" size=""mini"" v-show=""(editIndex == scope.$index)""");
|
|
||||||
// sb.AppendLine($@" v-model=""scope.row.{columnName}"" @blur=""handleChangeSort(scope.row)""></el-input>");
|
|
||||||
// sb.AppendLine(@" </template>");
|
|
||||||
// sb.AppendLine(@" </el-table-column>");
|
|
||||||
// }
|
|
||||||
// else if (dbFieldInfo.IsList && dbFieldInfo.HtmlType.Equals(GenConstants.HTML_IMAGE_UPLOAD))
|
|
||||||
// {
|
|
||||||
// sb.AppendLine($" <el-table-column prop=\"{columnName}\" align=\"center\" label=\"{label}\">");
|
|
||||||
// sb.AppendLine(" <template slot-scope=\"scope\">");
|
|
||||||
// sb.AppendLine($" <el-image class=\"table-td-thumb\" fit=\"contain\" :src=\"scope.row.{columnName}\" :preview-src-list=\"[scope.row.{columnName}]\">");
|
|
||||||
// sb.AppendLine(" <div slot=\"error\"><i class=\"el-icon-document\" /></div>");
|
|
||||||
// sb.AppendLine(" </el-image>");
|
|
||||||
// sb.AppendLine(" </template>");
|
|
||||||
// sb.AppendLine(" </el-table-column>");
|
|
||||||
// }
|
|
||||||
// else if (dbFieldInfo.IsList && !string.IsNullOrEmpty(formatter))
|
|
||||||
// {
|
|
||||||
// sb.AppendLine($@" <el-table-column label=""{label}"" align=""center"" prop=""{columnName}"">");
|
|
||||||
// sb.AppendLine(@" <template slot-scope=""scope"">");
|
|
||||||
// string checkboxHtml = string.Empty;
|
|
||||||
// if (dbFieldInfo.HtmlType == GenConstants.HTML_CHECKBOX)
|
|
||||||
// {
|
|
||||||
// checkboxHtml = $" ? scope.row.{columnName}.split(',') : []";
|
|
||||||
// }
|
|
||||||
// sb.AppendLine($" <dict-tag :options=\"{columnName}Options\" :value=\"scope.row.{columnName}{checkboxHtml}\"/>");
|
|
||||||
// sb.AppendLine(@" </template>");
|
|
||||||
// sb.AppendLine(@" </el-table-column>");
|
|
||||||
// }
|
|
||||||
// else if (dbFieldInfo.IsList)
|
|
||||||
// {
|
|
||||||
// sb.AppendLine($" <el-table-column prop=\"{columnName}\" label=\"{label}\" align=\"center\"{showToolTip}{formatter}/>");
|
|
||||||
// }
|
|
||||||
// return sb.ToString();
|
|
||||||
//}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//模板调用
|
//模板调用
|
||||||
|
|||||||
@ -45,75 +45,14 @@ namespace ZR.Repository
|
|||||||
return Context.Insertable(t).IgnoreColumns(true).ExecuteCommand();
|
return Context.Insertable(t).IgnoreColumns(true).ExecuteCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
//public int Insert(SqlSugarClient client, T t)
|
|
||||||
//{
|
|
||||||
// return client.Insertable(t).ExecuteCommand();
|
|
||||||
//}
|
|
||||||
|
|
||||||
public int Insert(List<T> t)
|
public int Insert(List<T> t)
|
||||||
{
|
{
|
||||||
return Context.Insertable(t).ExecuteCommand();
|
return Context.Insertable(t).ExecuteCommand();
|
||||||
}
|
}
|
||||||
//public long InsertReturnBigIdentity(T t)
|
|
||||||
//{
|
|
||||||
// return Context.Insertable(t).ExecuteReturnBigIdentity();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public int InsertIgnoreNullColumn(List<T> t)
|
|
||||||
//{
|
|
||||||
// return base.Context.Insertable(t).IgnoreColumns(true).ExecuteCommand();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public int InsertIgnoreNullColumn(List<T> t, params string[] columns)
|
|
||||||
//{
|
|
||||||
// return base.Context.Insertable(t).IgnoreColumns(columns).ExecuteCommand();
|
|
||||||
//}
|
|
||||||
public int Insert(T parm, Expression<Func<T, object>> iClumns = null, bool ignoreNull = true)
|
public int Insert(T parm, Expression<Func<T, object>> iClumns = null, bool ignoreNull = true)
|
||||||
{
|
{
|
||||||
return Context.Insertable(parm).InsertColumns(iClumns).IgnoreColumns(ignoreNullColumn: ignoreNull).ExecuteCommand();
|
return Context.Insertable(parm).InsertColumns(iClumns).IgnoreColumns(ignoreNullColumn: ignoreNull).ExecuteCommand();
|
||||||
}
|
}
|
||||||
//public DbResult<bool> InsertTran(T t)
|
|
||||||
//{
|
|
||||||
// var result = base.Context.Ado.UseTran(() =>
|
|
||||||
// {
|
|
||||||
// base.Context.Insertable(t).ExecuteCommand();
|
|
||||||
// });
|
|
||||||
// return result;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public DbResult<bool> InsertTran(List<T> t)
|
|
||||||
//{
|
|
||||||
// var result = base.Context.Ado.UseTran(() =>
|
|
||||||
// {
|
|
||||||
// base.Context.Insertable(t).ExecuteCommand();
|
|
||||||
// });
|
|
||||||
// return result;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public T InsertReturnEntity(T t)
|
|
||||||
//{
|
|
||||||
// return base.Context.Insertable(t).ExecuteReturnEntity();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public T InsertReturnEntity(T t, string sqlWith = SqlWith.UpdLock)
|
|
||||||
//{
|
|
||||||
// return base.Context.Insertable(t).With(sqlWith).ExecuteReturnEntity();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public bool ExecuteCommand(string sql, object parameters)
|
|
||||||
//{
|
|
||||||
// return base.Context.Ado.ExecuteCommand(sql, parameters) > 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public bool ExecuteCommand(string sql, params SugarParameter[] parameters)
|
|
||||||
//{
|
|
||||||
// return base.Context.Ado.ExecuteCommand(sql, parameters) > 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public bool ExecuteCommand(string sql, List<SugarParameter> parameters)
|
|
||||||
//{
|
|
||||||
// return base.Context.Ado.ExecuteCommand(sql, parameters) > 0;
|
|
||||||
//}
|
|
||||||
public IInsertable<T> Insertable(T t)
|
public IInsertable<T> Insertable(T t)
|
||||||
{
|
{
|
||||||
return Context.Insertable<T>(t);
|
return Context.Insertable<T>(t);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user