diff --git a/iMES.Net/iMES.Custom/IRepositories/Custom/IBase_DesktopMenuRepository.cs b/iMES.Net/iMES.Custom/IRepositories/Custom/IBase_DesktopMenuRepository.cs new file mode 100644 index 0000000..f252987 --- /dev/null +++ b/iMES.Net/iMES.Custom/IRepositories/Custom/IBase_DesktopMenuRepository.cs @@ -0,0 +1,18 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *Repository提供数据库操作,如果要增加数据库操作请在当前目录下Partial文件夹IBase_DesktopMenuRepository编写接口 + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using iMES.Core.BaseProvider; +using iMES.Entity.DomainModels; +using iMES.Core.Extensions.AutofacManager; +namespace iMES.Custom.IRepositories +{ + public partial interface IBase_DesktopMenuRepository : IDependency,IRepository + { + } +} diff --git a/iMES.Net/iMES.Custom/IServices/Custom/IBase_DesktopMenuService.cs b/iMES.Net/iMES.Custom/IServices/Custom/IBase_DesktopMenuService.cs new file mode 100644 index 0000000..cedb46f --- /dev/null +++ b/iMES.Net/iMES.Custom/IServices/Custom/IBase_DesktopMenuService.cs @@ -0,0 +1,12 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + */ +using iMES.Core.BaseProvider; +using iMES.Entity.DomainModels; + +namespace iMES.Custom.IServices +{ + public partial interface IBase_DesktopMenuService : IService + { + } +} diff --git a/iMES.Net/iMES.Custom/IServices/Custom/Partial/IBase_DesktopMenuService.cs b/iMES.Net/iMES.Custom/IServices/Custom/Partial/IBase_DesktopMenuService.cs new file mode 100644 index 0000000..fc5bc27 --- /dev/null +++ b/iMES.Net/iMES.Custom/IServices/Custom/Partial/IBase_DesktopMenuService.cs @@ -0,0 +1,13 @@ +/* +*所有关于Base_DesktopMenu类的业务代码接口应在此处编写 +*/ +using iMES.Core.BaseProvider; +using iMES.Entity.DomainModels; +using iMES.Core.Utilities; +using System.Linq.Expressions; +namespace iMES.Custom.IServices +{ + public partial interface IBase_DesktopMenuService + { + } + } diff --git a/iMES.Net/iMES.Custom/Repositories/Custom/Base_DesktopMenuRepository.cs b/iMES.Net/iMES.Custom/Repositories/Custom/Base_DesktopMenuRepository.cs new file mode 100644 index 0000000..7f6961d --- /dev/null +++ b/iMES.Net/iMES.Custom/Repositories/Custom/Base_DesktopMenuRepository.cs @@ -0,0 +1,24 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *Repository提供数据库操作,如果要增加数据库操作请在当前目录下Partial文件夹Base_DesktopMenuRepository编写代码 + */ +using iMES.Custom.IRepositories; +using iMES.Core.BaseProvider; +using iMES.Core.EFDbContext; +using iMES.Core.Extensions.AutofacManager; +using iMES.Entity.DomainModels; + +namespace iMES.Custom.Repositories +{ + public partial class Base_DesktopMenuRepository : RepositoryBase , IBase_DesktopMenuRepository + { + public Base_DesktopMenuRepository(SysDbContext dbContext) + : base(dbContext) + { + + } + public static IBase_DesktopMenuRepository Instance + { + get { return AutofacContainerModule.GetService(); } } + } +} diff --git a/iMES.Net/iMES.Custom/Services/Custom/Base_DesktopMenuService.cs b/iMES.Net/iMES.Custom/Services/Custom/Base_DesktopMenuService.cs new file mode 100644 index 0000000..e87de9f --- /dev/null +++ b/iMES.Net/iMES.Custom/Services/Custom/Base_DesktopMenuService.cs @@ -0,0 +1,26 @@ +/* + *Author:COCO + *代码由框架生成,此处任何更改都可能导致被代码生成器覆盖 + *所有业务编写全部应在Partial文件夹下Base_DesktopMenuService与IBase_DesktopMenuService中编写 + */ +using iMES.Custom.IRepositories; +using iMES.Custom.IServices; +using iMES.Core.BaseProvider; +using iMES.Core.Extensions.AutofacManager; +using iMES.Entity.DomainModels; + +namespace iMES.Custom.Services +{ + public partial class Base_DesktopMenuService : ServiceBase + , IBase_DesktopMenuService, IDependency + { + public Base_DesktopMenuService(IBase_DesktopMenuRepository repository) + : base(repository) + { + Init(repository); + } + public static IBase_DesktopMenuService Instance + { + get { return AutofacContainerModule.GetService(); } } + } + } diff --git a/iMES.Net/iMES.Custom/Services/Custom/Partial/Base_DesktopMenuService.cs b/iMES.Net/iMES.Custom/Services/Custom/Partial/Base_DesktopMenuService.cs new file mode 100644 index 0000000..c8ccbd2 --- /dev/null +++ b/iMES.Net/iMES.Custom/Services/Custom/Partial/Base_DesktopMenuService.cs @@ -0,0 +1,41 @@ +/* + *所有关于Base_DesktopMenu类的业务代码应在此处编写 +*可使用repository.调用常用方法,获取EF/Dapper等信息 +*如果需要事务请使用repository.DbContextBeginTransaction +*也可使用DBServerProvider.手动获取数据库相关信息 +*用户信息、权限、角色等使用UserContext.Current操作 +*Base_DesktopMenuService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter +*/ +using iMES.Core.BaseProvider; +using iMES.Core.Extensions.AutofacManager; +using iMES.Entity.DomainModels; +using System.Linq; +using iMES.Core.Utilities; +using System.Linq.Expressions; +using iMES.Core.Extensions; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Http; +using iMES.Custom.IRepositories; + +namespace iMES.Custom.Services +{ + public partial class Base_DesktopMenuService + { + private readonly IHttpContextAccessor _httpContextAccessor; + private readonly IBase_DesktopMenuRepository _repository;//访问数据库 + + [ActivatorUtilitiesConstructor] + public Base_DesktopMenuService( + IBase_DesktopMenuRepository dbRepository, + IHttpContextAccessor httpContextAccessor + ) + : base(dbRepository) + { + _httpContextAccessor = httpContextAccessor; + _repository = dbRepository; + //多租户会用到这init代码,其他情况可以不用 + //base.Init(dbRepository); + } + } +} diff --git a/iMES.Net/iMES.Entity/DomainModels/Custom/Base_DesktopMenu.cs b/iMES.Net/iMES.Entity/DomainModels/Custom/Base_DesktopMenu.cs new file mode 100644 index 0000000..72819b0 --- /dev/null +++ b/iMES.Net/iMES.Entity/DomainModels/Custom/Base_DesktopMenu.cs @@ -0,0 +1,129 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *如果数据库字段发生变化,请在代码生器重新生成此Model + */ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using iMES.Entity.SystemModels; + +namespace iMES.Entity.DomainModels +{ + [Entity(TableCnName = "主页菜单配置",TableName = "Base_DesktopMenu",DBServer = "SysDbContext")] + public partial class Base_DesktopMenu:SysEntity + { + /// + ///主页菜单表主键ID + /// + [Key] + [Display(Name ="主页菜单表主键ID")] + [Column(TypeName="int")] + [Editable(true)] + [Required(AllowEmptyStrings=false)] + public int DesktopMenu_Id { get; set; } + + /// + ///菜单 + /// + [Display(Name ="菜单")] + [Column(TypeName="int")] + [Editable(true)] + [Required(AllowEmptyStrings=false)] + public int MenuId { get; set; } + + /// + ///菜单名称 + /// + [Display(Name ="菜单名称")] + [MaxLength(200)] + [Column(TypeName="nvarchar(200)")] + [Editable(true)] + [Required(AllowEmptyStrings=false)] + public string MenuName { get; set; } + + /// + ///路由地址 + /// + [Display(Name ="路由地址")] + [MaxLength(100)] + [Column(TypeName="nvarchar(100)")] + [Editable(true)] + [Required(AllowEmptyStrings=false)] + public string MenuUrl { get; set; } + + /// + ///背景颜色 + /// + [Display(Name ="背景颜色")] + [MaxLength(100)] + [Column(TypeName="nvarchar(100)")] + [Editable(true)] + [Required(AllowEmptyStrings=false)] + public string Color { get; set; } + + /// + ///是否启用 + /// + [Display(Name ="是否启用")] + [Column(TypeName="tinyint")] + [Editable(true)] + [Required(AllowEmptyStrings=false)] + public byte Enable { get; set; } + + /// + ///创建时间 + /// + [Display(Name ="创建时间")] + [Column(TypeName="datetime")] + [Editable(true)] + public DateTime? CreateDate { get; set; } + + /// + ///创建人编号 + /// + [Display(Name ="创建人编号")] + [Column(TypeName="int")] + [Editable(true)] + public int? CreateID { get; set; } + + /// + ///创建人 + /// + [Display(Name ="创建人")] + [MaxLength(200)] + [Column(TypeName="nvarchar(200)")] + [Editable(true)] + public string Creator { get; set; } + + /// + ///修改人 + /// + [Display(Name ="修改人")] + [MaxLength(200)] + [Column(TypeName="nvarchar(200)")] + [Editable(true)] + public string Modifier { get; set; } + + /// + ///修改时间 + /// + [Display(Name ="修改时间")] + [Column(TypeName="datetime")] + [Editable(true)] + public DateTime? ModifyDate { get; set; } + + /// + ///修改人编号 + /// + [Display(Name ="修改人编号")] + [Column(TypeName="int")] + [Editable(true)] + public int? ModifyID { get; set; } + + + } +} \ No newline at end of file diff --git a/iMES.Net/iMES.Entity/DomainModels/Custom/partial/Base_DesktopMenu.cs b/iMES.Net/iMES.Entity/DomainModels/Custom/partial/Base_DesktopMenu.cs new file mode 100644 index 0000000..cd8dfd6 --- /dev/null +++ b/iMES.Net/iMES.Entity/DomainModels/Custom/partial/Base_DesktopMenu.cs @@ -0,0 +1,21 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *如果数据库字段发生变化,请在代码生器重新生成此Model + */ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using iMES.Entity.SystemModels; + +namespace iMES.Entity.DomainModels +{ + + public partial class Base_DesktopMenu + { + //此处配置字段(字段配置见此model的另一个partial),如果表中没有此字段请加上 [NotMapped]属性,否则会异常 + } +} \ No newline at end of file diff --git a/iMES.Net/iMES.Entity/MappingConfiguration/Custom/Base_DesktopMenuMapConfig.cs b/iMES.Net/iMES.Entity/MappingConfiguration/Custom/Base_DesktopMenuMapConfig.cs new file mode 100644 index 0000000..dc2b4f9 --- /dev/null +++ b/iMES.Net/iMES.Entity/MappingConfiguration/Custom/Base_DesktopMenuMapConfig.cs @@ -0,0 +1,16 @@ +using iMES.Entity.MappingConfiguration; +using iMES.Entity.DomainModels; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace iMES.Entity.MappingConfiguration +{ + public class Base_DesktopMenuMapConfig : EntityMappingConfiguration + { + public override void Map(EntityTypeBuilder + builderTable) + { + //b.Property(x => x.StorageName).HasMaxLength(45); + } + } +} + diff --git a/iMES.Net/iMES.WebApi/Controllers/Custom/Base_DesktopMenuController.cs b/iMES.Net/iMES.WebApi/Controllers/Custom/Base_DesktopMenuController.cs new file mode 100644 index 0000000..0698949 --- /dev/null +++ b/iMES.Net/iMES.WebApi/Controllers/Custom/Base_DesktopMenuController.cs @@ -0,0 +1,21 @@ +/* + *代码由框架生成,任何更改都可能导致被代码生成器覆盖 + *如果要增加方法请在当前目录下Partial文件夹Base_DesktopMenuController编写 + */ +using Microsoft.AspNetCore.Mvc; +using iMES.Core.Controllers.Basic; +using iMES.Entity.AttributeManager; +using iMES.Custom.IServices; +namespace iMES.Custom.Controllers +{ + [Route("api/Base_DesktopMenu")] + [PermissionTable(Name = "Base_DesktopMenu")] + public partial class Base_DesktopMenuController : ApiBaseController + { + public Base_DesktopMenuController(IBase_DesktopMenuService service) + : base(service) + { + } + } +} + diff --git a/iMES.Net/iMES.WebApi/Controllers/Custom/Partial/Base_DesktopMenuController.cs b/iMES.Net/iMES.WebApi/Controllers/Custom/Partial/Base_DesktopMenuController.cs new file mode 100644 index 0000000..22f8260 --- /dev/null +++ b/iMES.Net/iMES.WebApi/Controllers/Custom/Partial/Base_DesktopMenuController.cs @@ -0,0 +1,45 @@ +/* + *接口编写处... +*如果接口需要做Action的权限验证,请在Action上使用属性 +*如: [ApiActionPermission("Base_DesktopMenu",Enums.ActionPermissionOptions.Search)] + */ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Http; +using iMES.Entity.DomainModels; +using iMES.Custom.IServices; +using iMES.Core.DBManager; + +namespace iMES.Custom.Controllers +{ + public partial class Base_DesktopMenuController + { + private readonly IBase_DesktopMenuService _service;//访问业务代码 + private readonly IHttpContextAccessor _httpContextAccessor; + + [ActivatorUtilitiesConstructor] + public Base_DesktopMenuController( + IBase_DesktopMenuService service, + IHttpContextAccessor httpContextAccessor + ) + : base(service) + { + _service = service; + _httpContextAccessor = httpContextAccessor; + } + /// + /// 获取首页版本更新记录 + /// + /// + [Route("getDesktopMenu"), HttpGet] + public JsonResult GetDesktopMenu() + { + string sql = " select top 8 * from Base_DesktopMenu where Enable=1 order by CreateDate desc "; + List list = DBServerProvider.SqlDapper.QueryList(sql, new { }); + return JsonNormal(list); + } + } +}