zuoxiang před 4 roky
rodič
revize
5e16435ed8
19 změnil soubory, kde provedl 595 přidání a 17 odebrání
  1. 2 1
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminController.cs
  2. 11 6
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminMediaController.cs
  3. 66 0
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminMiddleLableController.cs
  4. 86 0
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminTeacherController.cs
  5. 6 2
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUtilsController.cs
  6. 2 0
      gx_api/GxPress/Infrastructure/GxPress.Auth/ILoginContext.cs
  7. 10 0
      gx_api/GxPress/Infrastructure/GxPress.Auth/LoginContext.cs
  8. 36 0
      gx_api/GxPress/Model/GxPress.Entity/Navigations/MiddleLable.cs
  9. 5 1
      gx_api/GxPress/Model/GxPress.Entity/tede2/Category/Category.cs
  10. 36 2
      gx_api/GxPress/Model/GxPress.Entity/tede2/Media/Media.cs
  11. 94 0
      gx_api/GxPress/Model/GxPress.Entity/tede2/Teacher/Teacher.cs
  12. 16 0
      gx_api/GxPress/Model/GxPress.Request/Teacher/TeacherRequest.cs
  13. 26 2
      gx_api/GxPress/Model/GxPress.Result/Media/MediaResult.cs
  14. 14 2
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Category/CategoryRepository.cs
  15. 4 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs
  16. 64 0
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Navigation/MiddleLableRepository.cs
  17. 77 0
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Teacher/TeacherRepository.cs
  18. 20 0
      gx_api/GxPress/Repository/GxPress.Repository.Interface/Navigation/IMiddleLableRepository.cs
  19. 20 0
      gx_api/GxPress/Repository/GxPress.Repository.Interface/Teacher/ITeacherRepository.cs

+ 2 - 1
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminController.cs

@@ -47,7 +47,8 @@ namespace GxPress.Api.AdminControllers
             var claims = new[]
             {
                 new Claim(ClaimTypes.NameIdentifier,result.AdminId.ToString()),
-                new Claim(ClaimTypes.Role,AccountTypeConst.Admin.ToString())
+                new Claim(ClaimTypes.Role,AccountTypeConst.Admin.ToString()),
+                 new Claim(ClaimTypes.Actor,result.Name)
             };
             result.Token = TokenHelper.BuildToken(_jwtOptions, claims);
             _logger.LogInformation("admin token:{token}", result.Token);

+ 11 - 6
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminMediaController.cs

@@ -1,23 +1,26 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using System.Collections.Generic;
 using System.Threading.Tasks;
+using GxPress.Auth;
 using GxPress.Repository.Interface.Media;
 using GxPress.Result.Media;
+using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 
 // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
 
 namespace GxPress.Api.AdminControllers
 {
-    [Route("api/[controller]")]
+    [Route("api/admin/media")]
+    [ApiController]
+    [Authorize]
     public class AdminMediaController : Controller
     {
         private readonly IMediaRepository mediaRepository;
-
-        public AdminMediaController(IMediaRepository mediaRepository)
+        private readonly ILoginContext _loginContext;
+        public AdminMediaController(IMediaRepository mediaRepository, ILoginContext _loginContext)
         {
             this.mediaRepository = mediaRepository;
+            this._loginContext = _loginContext;
         }
         /// <summary>
         /// 详情
@@ -47,6 +50,8 @@ namespace GxPress.Api.AdminControllers
         [HttpPost]
         public async Task<bool> InsertAsync(MediaResult result)
         {
+            result.AdminId = _loginContext.AccountId;
+            result.Creator = _loginContext.Name;
             return await mediaRepository.InsertAsync(result);
         }
         /// <summary>

+ 66 - 0
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminMiddleLableController.cs

@@ -0,0 +1,66 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using GxPress.Repository.Interface.Navigation;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace GxPress.Api.AdminControllers
+{
+    /// <summary>
+    /// 导航中间件
+    /// </summary>
+    [Route("api/admin/middle-label")]
+    [ApiController]
+    [Authorize]
+    public class AdminMiddleLableController : ControllerBase
+    {
+        private readonly IMiddleLableRepository middleLableRepository;
+
+        public AdminMiddleLableController(IMiddleLableRepository middleLableRepository)
+        {
+            this.middleLableRepository = middleLableRepository;
+
+        }
+
+
+        /// <summary>
+        /// 列表
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        public async Task<IEnumerable<Entity.Navigations.MiddleLable>> GetList()
+        {
+            return await middleLableRepository.GetAllAsync();
+        }
+        /// <summary>
+        /// 详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpGet("{id}")]
+        public async Task<Entity.Navigations.MiddleLable> GetAsync(int id)
+        {
+            return await middleLableRepository.GetAsync(id);
+        }
+        /// <summary>
+        /// 添加导航中间件
+        /// </summary>
+        /// /// <param name="note"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<int> Insert(Entity.Navigations.MiddleLable note)
+        {
+            return await middleLableRepository.InsertAsync(note);
+        }
+        /// <summary>
+        /// 修改导航中间件
+        /// </summary>
+        /// <param name="note"></param>
+        /// <returns></returns>
+        [HttpPut]
+        public async Task<bool> Update(Entity.Navigations.MiddleLable note)
+        {
+            return await middleLableRepository.UpdateAsync(note);
+        }
+    }
+}

+ 86 - 0
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminTeacherController.cs

@@ -0,0 +1,86 @@
+
+
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using GxPress.Repository.Interface.Teacher;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using GxPress.Common.Page;
+using GxPress.Request.TeacherRequest;
+
+namespace GxPress.Api.AdminControllers
+{
+    /// <summary>
+    /// 名师
+    /// </summary>
+    [Route("/api/admin/teacher")]
+    [ApiController]
+    [Authorize]
+    public class AdminTeacherController : Controller
+    {
+        private readonly ITeacherRepository teacherRepository;
+        public AdminTeacherController(ITeacherRepository teacherRepository)
+        {
+            this.teacherRepository = teacherRepository;
+        }
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpDelete("{id}")]
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await teacherRepository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 获取所有名师
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost("list")]
+        public async Task<PagedList<Entity.tede2.Teacher.Teacher>> GetAllAsync(TeacherRequest request)
+        {
+            return await teacherRepository.GetAllAsync(request);
+        }
+
+        /// <summary>
+        /// 搜索名师
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost("search")]
+        public async Task<IEnumerable<Entity.tede2.Teacher.Teacher>> GetSearchAllAsync(TeacherRequest request)
+        {
+            return await teacherRepository.GetSearchAllAsync(request);
+        }
+        /// <summary>
+        /// 获取名师详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpGet("{id}")]
+        public async Task<Entity.tede2.Teacher.Teacher> GetAsync(int id)
+        {
+            return await teacherRepository.GetAsync(id);
+        }
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="note"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<int> InsertAsync(Entity.tede2.Teacher.Teacher note)
+        {
+            return await teacherRepository.InsertAsync(note);
+        }
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="note"></param>
+        /// <returns></returns>
+        [HttpPut]
+        public async Task<bool> UpdateAsync(Entity.tede2.Teacher.Teacher note)
+        {
+            return await teacherRepository.UpdateAsync(note);
+        }
+    }
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 6 - 2
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUtilsController.cs


+ 2 - 0
gx_api/GxPress/Infrastructure/GxPress.Auth/ILoginContext.cs

@@ -24,5 +24,7 @@ namespace GxPress.Auth
         /// 获取当前用户IP
         /// </summary>
         string Ip { get; }
+
+        string Name { get; }
     }
 }

+ 10 - 0
gx_api/GxPress/Infrastructure/GxPress.Auth/LoginContext.cs

@@ -66,6 +66,16 @@ namespace GxPress.Auth
             ? string.Empty
             : _contextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
 
+        public string Name
+        {
+            get
+            {
+                var value = _contextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.Actor);
+
+                return value.Value;
+            }
+        }
+
         //TODO 其他用户相关信息获取?
 
     }

+ 36 - 0
gx_api/GxPress/Model/GxPress.Entity/Navigations/MiddleLable.cs

@@ -0,0 +1,36 @@
+using Datory.Annotations;
+
+namespace GxPress.Entity.Navigations
+{
+    /// <summary>
+    /// 系统管理
+    /// </summary>
+    [DataTable("tede_middle_lable")]
+    public class MiddleLable : Datory.Entity
+    {
+        /// <summary>
+        /// 导航栏ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Name { get; set; }
+        /// <summary>
+        /// 标签ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string LabelId { get; set; }
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int Sort { get; set; }
+        /// <summary>
+        /// 是否禁用
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsDisable { get; set; }
+    }
+}

+ 5 - 1
gx_api/GxPress/Model/GxPress.Entity/tede2/Category/Category.cs

@@ -34,6 +34,10 @@ namespace GxPress.Entity.tede2.Category
         /// <value></value>
         [DataColumn]
         public int Sort { get; set; }
-
+        /// <summary>
+        /// 是否存在子集
+        /// </summary>
+        /// <value></value>
+        public bool IsChildren{get;set;}
     }
 }

+ 36 - 2
gx_api/GxPress/Model/GxPress.Entity/tede2/Media/Media.cs

@@ -49,7 +49,12 @@ namespace GxPress.Entity.tede2.Media
         /// </summary>
         [DataColumn]
         public string Author { get; set; }
-
+        /// <summary>
+        /// 名师ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int TeacherId { get; set; }
         /// <summary>
         /// 来源
         /// </summary>
@@ -61,7 +66,7 @@ namespace GxPress.Entity.tede2.Media
         /// </summary>
         [DataColumn(Text = true)]
         public string Blocks { get; set; }
-       
+
         /// <summary>
         /// 审核状态
         /// </summary>
@@ -113,5 +118,34 @@ namespace GxPress.Entity.tede2.Media
         /// </summary>
         [DataColumn]
         public string PublishTime { get; set; }
+
+        /// <summary>
+        /// 价格
+        /// </summary>
+        [DataColumn]
+        public decimal Price { get; set; }
+        /// <summary>
+        /// IOS价格
+        /// </summary>
+        [DataColumn]
+        public decimal IosPrice { get; set; }
+        /// <summary>
+        /// 其他价格
+        /// </summary>
+        [DataColumn]
+        public decimal OtherPrice { get; set; }
+        /// <summary>
+        /// 操作人ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int AdminId { get; set; }
+
+        /// <summary>
+        /// 操作人
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Creator { get; set; }
     }
 }

+ 94 - 0
gx_api/GxPress/Model/GxPress.Entity/tede2/Teacher/Teacher.cs

@@ -0,0 +1,94 @@
+using Datory.Annotations;
+
+namespace GxPress.Entity.tede2.Teacher
+{
+    /// <summary>
+    /// 名师
+    /// </summary>
+    [DataTable("tede_teacher")]
+    public class Teacher : Datory.Entity
+    {
+        /// <summary>
+        /// 名称
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+
+        public string Name { get; set; }
+        /// <summary>
+        /// 操作人
+        /// </summary>
+        /// <value></value>
+        public string Creator { get; set; }
+
+        /// <summary>
+        /// 操作人姓名
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int AdminId { get; set; }
+        /// <summary>
+        /// 简介
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+
+        public string Summary { get; set; }
+
+        /// <summary>
+        /// 分类ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string CategoryId { get; set; }
+
+        /// <summary>
+        /// 分类名称
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string CategoryName { get; set; }
+        /// <summary>
+        /// 资源数量
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int ResourceCount { get; set; }
+        /// <summary>
+        /// 收藏数量
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int CollectCount { get; set; }
+        /// <summary>
+        /// 排序
+        /// </summary>
+        [DataColumn]
+        public int Sort { get; set; }
+
+        /// <summary>
+        /// 是否禁用
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsDisable { get; set; }
+        /// <summary>
+        /// 职位
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Job { get; set; }
+        /// <summary>
+        /// 是否推荐
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsRecommend { get; set; }
+
+        /// <summary>
+        /// 图片
+        /// </summary>
+        [DataColumn]
+        public string ImageUrl { get; set; }
+    }
+}

+ 16 - 0
gx_api/GxPress/Model/GxPress.Request/Teacher/TeacherRequest.cs

@@ -0,0 +1,16 @@
+using GxPress.Common.Page;
+
+namespace GxPress.Request.TeacherRequest
+{
+    /// <summary>
+    /// 名师查询
+    /// </summary>
+    public class TeacherRequest:PageParameter
+    {
+        /// <summary>
+        /// 搜索
+        /// </summary>
+        /// <value></value>
+        public string KeyWord { get; set; }
+    }
+}

+ 26 - 2
gx_api/GxPress/Model/GxPress.Result/Media/MediaResult.cs

@@ -48,7 +48,11 @@ namespace GxPress.Result.Media
         /// </summary>
 
         public string Author { get; set; }
-
+        /// <summary>
+        /// 名师ID
+        /// </summary>
+        /// <value></value>
+        public int TeacherId { get; set; }
         /// <summary>
         /// 来源
         /// </summary>
@@ -117,10 +121,28 @@ namespace GxPress.Result.Media
         /// </summary>
         public List<MediaLibraryResult> MediaLibraryRequest { get; set; }
 
-    }
+        /// <summary>
+        ///  操作人ID
+        /// </summary>
+        /// <value></value>
+        public int AdminId { get; set; }
+
+        /// <summary>
+        /// 操作人
+        /// </summary>
+        /// <value></value>
+        public string Creator { get; set; }
 
+    }
+    /// <summary>
+    /// 
+    /// </summary>
     public class MediaLibraryResult
     {
+        /// <summary>
+        /// 媒体ID
+        /// </summary>
+        /// <value></value>
         public int MediaId { get; set; }
         /// <summary>
         /// 文件路径
@@ -136,5 +158,7 @@ namespace GxPress.Result.Media
         /// </summary>
 
         public int Sort { get; set; }
+
+
     }
 }

+ 14 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/Category/CategoryRepository.cs

@@ -50,7 +50,12 @@ namespace GxPress.Repository.Implement.Category
 
         public async Task<IEnumerable<Entity.tede2.Category.Category>> GetCategoryChildrenAsync(int parentId)
         {
-            return await _repository.GetAllAsync(Q.Where(nameof(Entity.tede2.Category.Category.ParentId),parentId));
+            var result = await _repository.GetAllAsync(Q.Where(nameof(Entity.tede2.Category.Category.ParentId), parentId));
+            foreach (var item in result)
+            {
+                item.IsChildren = await IsChildren(item.Id);
+            }
+            return result;
         }
 
         public async Task<int> InsertAsync(Entity.tede2.Category.Category note)
@@ -66,7 +71,14 @@ namespace GxPress.Repository.Implement.Category
 
         public async Task<bool> UpdateAsync(Query query)
         {
-            return await _repository.UpdateAsync(query)>0;
+            return await _repository.UpdateAsync(query) > 0;
+        }
+
+        public async Task<bool> IsChildren(int parentId)
+        {
+            var query = Q.NewQuery();
+            query.Where(nameof(Entity.tede2.Category.Category.ParentId), parentId);
+            return await _repository.CountAsync(query) > 0;
         }
     }
 }

+ 4 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs

@@ -71,7 +71,10 @@ namespace GxPress.Repository.Implement.Media
                             var mediaLibrary = _mapper.Map<Entity.tede2.Media.MediaLibrary>(item);
                             await mediaLibraryRepository.InsertAsync(mediaLibrary);
                         }
-
+                    }
+                    if(result.Id==0&&result.TeacherId==0&&!string.IsNullOrEmpty(result.Author)){
+                        //新增名师
+                        
                     }
                     //提交事务
                     transactionScope.Complete();

+ 64 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/Navigation/MiddleLableRepository.cs

@@ -0,0 +1,64 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using AutoMapper;
+using Datory;
+using GxPress.Common.AppOptions;
+using GxPress.Common.Tools;
+using GxPress.Entity.Navigations;
+using GxPress.Repository.Interface.Navigation;
+using Microsoft.Extensions.Options;
+
+namespace GxPress.Repository.Implement.Navigation
+{
+    public class MiddleLableRepository :IMiddleLableRepository
+    {
+        private readonly Repository<Entity.Navigations.MiddleLable> _repository;
+        private readonly IMapper _mapper;
+        private readonly string _connectionString;
+        private readonly string _databaseTypestr;
+        public MiddleLableRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
+        {
+            _databaseTypestr = dbOptionsAccessor.CurrentValue.DatabaseType;
+            _connectionString = dbOptionsAccessor.CurrentValue.ConnectionString;
+            var databaseType =
+                StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
+            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
+            _repository = new Repository<Entity.Navigations.MiddleLable>(database);
+            _mapper = mapper;
+        }
+
+        public IDatabase Database => _repository.Database;
+        public string TableName => _repository.TableName;
+        public List<TableColumn> TableColumns => _repository.TableColumns;
+
+        public async Task<Entity.Navigations.MiddleLable> GetAsync(int id)
+        {
+            return await _repository.GetAsync(id);
+        }
+
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await _repository.DeleteAsync(id);
+        }
+
+        public async Task<int> InsertAsync(Entity.Navigations.MiddleLable note)
+        {
+            return await _repository.InsertAsync(note);
+        }
+
+        public async Task<bool> UpdateAsync(Entity.Navigations.MiddleLable note)
+        {
+            return await _repository.UpdateAsync(note);
+        }
+        public async Task<bool> UpdateAsync(SqlKata.Query query)
+        {
+            return await _repository.UpdateAsync(query) > 0;
+        }
+
+        public async Task<IEnumerable<Entity.Navigations.MiddleLable>> GetAllAsync()
+        {
+            return await _repository.GetAllAsync(Q.Where(nameof(Entity.Navigations.MiddleLable.IsDisable), false).OrderByDesc(nameof(Entity.Navigations.MiddleLable.Sort)));
+        }
+
+    }
+}

+ 77 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/Teacher/TeacherRepository.cs

@@ -0,0 +1,77 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using AutoMapper;
+using Datory;
+using GxPress.Common.AppOptions;
+using GxPress.Common.Page;
+using GxPress.Common.Tools;
+using GxPress.Repository.Interface.Teacher;
+using GxPress.Request.TeacherRequest;
+using Microsoft.Extensions.Options;
+using SqlKata;
+
+namespace GxPress.Repository.Implement.Teacher
+{
+    public class TeacherRepository : ITeacherRepository
+    {
+        private readonly Repository<Entity.tede2.Teacher.Teacher> _repository;
+        private readonly IMapper _mapper;
+        private readonly string _connectionString;
+        private readonly string _databaseTypestr;
+        public TeacherRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
+        {
+            _databaseTypestr = dbOptionsAccessor.CurrentValue.DatabaseType;
+            _connectionString = dbOptionsAccessor.CurrentValue.ConnectionString;
+            var databaseType =
+                StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
+            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
+            _repository = new Repository<Entity.tede2.Teacher.Teacher>(database);
+            _mapper = mapper;
+        }
+
+        public IDatabase Database => _repository.Database;
+        public string TableName => _repository.TableName;
+        public List<TableColumn> TableColumns => _repository.TableColumns;
+
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await _repository.DeleteAsync(id);
+        }
+
+        public async Task<PagedList<Entity.tede2.Teacher.Teacher>> GetAllAsync(TeacherRequest request)
+        {
+            var result = new PagedList<Entity.tede2.Teacher.Teacher>();
+            var query = Q.NewQuery();
+            result.Items = await _repository.GetAllAsync(query.ForPage(request.Page, request.PerPage));
+            result.Total = await _repository.CountAsync(query);
+            return result;
+        }
+        public async Task<IEnumerable<Entity.tede2.Teacher.Teacher>> GetSearchAllAsync(TeacherRequest request)
+        {
+            var query = Q.NewQuery();
+            query.Where(Q.WhereLike(nameof(Entity.tede2.Teacher.Teacher.Name),$"%{request.KeyWord}%"));
+            var result = await _repository.GetAllAsync(query);
+            return result;
+        }
+        public async Task<Entity.tede2.Teacher.Teacher> GetAsync(int id)
+        {
+            return await _repository.GetAsync(id);
+        }
+
+        public async Task<int> InsertAsync(Entity.tede2.Teacher.Teacher note)
+        {
+
+            return await _repository.InsertAsync(note);
+        }
+
+        public async Task<bool> UpdateAsync(Entity.tede2.Teacher.Teacher note)
+        {
+            return await _repository.UpdateAsync(note);
+        }
+
+        public async Task<bool> UpdateAsync(Query query)
+        {
+            return await _repository.UpdateAsync(query) > 0;
+        }
+    }
+}

+ 20 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/Navigation/IMiddleLableRepository.cs

@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Datory;
+
+namespace GxPress.Repository.Interface.Navigation
+{
+    public interface IMiddleLableRepository : IRepository
+    {
+        Task<Entity.Navigations.MiddleLable> GetAsync(int id);
+        Task<bool> DeleteAsync(int id);
+
+        Task<int> InsertAsync(Entity.Navigations.MiddleLable note);
+
+        Task<bool> UpdateAsync(Entity.Navigations.MiddleLable note);
+        Task<bool> UpdateAsync(SqlKata.Query query);
+
+        Task<IEnumerable<Entity.Navigations.MiddleLable>> GetAllAsync();
+
+    }
+}

+ 20 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/Teacher/ITeacherRepository.cs

@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Datory;
+using GxPress.Common.Page;
+using GxPress.Request.TeacherRequest;
+
+namespace GxPress.Repository.Interface.Teacher
+{
+    public interface ITeacherRepository : IRepository
+    {
+        Task<bool> DeleteAsync(int id);
+        Task<PagedList<Entity.tede2.Teacher.Teacher>> GetAllAsync(TeacherRequest request);
+        Task<Entity.tede2.Teacher.Teacher> GetAsync(int id);
+
+        Task<int> InsertAsync(Entity.tede2.Teacher.Teacher note);
+
+        Task<bool> UpdateAsync(Entity.tede2.Teacher.Teacher note);
+        Task<IEnumerable<Entity.tede2.Teacher.Teacher>> GetSearchAllAsync(TeacherRequest request);
+    }
+}