using Infrastructure.Attribute; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ARW.Model.System.Generate; namespace ARW.Repository.System { [AppService(ServiceLifetime = LifeTime.Transient)] public class GenTableRepository : BaseRepository { } [AppService(ServiceLifetime = LifeTime.Transient)] public class GenTableColumnRepository : BaseRepository { /// /// 根据表id批量删除表字段 /// /// /// public int DeleteGenTableColumn(long[] tableId) { return Context.Deleteable().Where(f => tableId.Contains(f.TableId)).ExecuteCommand(); } /// /// 根据表名删除字段 /// /// /// public int DeleteGenTableColumnByTableName(string tableName) { return Context.Deleteable().Where(f => f.TableName == tableName).ExecuteCommand(); } /// /// 获取表所有字段 /// /// /// public List GenTableColumns(long tableId) { return Context.Queryable().Where(f => f.TableId == tableId).OrderBy(x => x.Sort,OrderByType.Asc).ToList(); } /// /// 插入表字段 /// /// /// public int InsertGenTableColumn(List tableColumn) { return Context.Insertable(tableColumn).IgnoreColumns(x => new { x.Remark }).ExecuteCommand(); } /// /// 批量更新表字段 /// /// /// public int UpdateGenTableColumn(List tableColumn) { return Context.Updateable(tableColumn) .WhereColumns(it => new { it.ColumnId, it.TableId}) .UpdateColumns(it => new { it.ColumnComment, it.CsharpField, it.CsharpType, it.IsQuery, it.IsEdit, it.IsInsert, it.IsList, it.QueryType, it.HtmlType, it.IsRequired, it.Sort, it.Update_time, it.DictType, it.Update_by, it.Remark, it.IsSort }) .ExecuteCommand(); } } }