Browse Source

2023-3-20 16:59:45

wangh 2 years ago
parent
commit
d26ae6f2b3

+ 44 - 0
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -0,0 +1,44 @@
+
+using MySqlX.XDevAPI.Common;
+using OASystem.Domain.Dtos;
+using OASystem.Domain.Entities.System;
+using OASystem.Domain.ViewModels.System;
+using OASystem.Infrastructure.Repositories.System;
+
+namespace OASystem.API.Controllers
+{
+    /// <summary>
+    /// 系统设置
+    /// </summary>
+    [Route("[controller]/[action]")]
+    public class SystemController : ControllerBase
+    {
+        readonly Sys_DepartmentRepository _sysDepRep;
+        readonly IMapper _mapper;
+
+        public SystemController(Sys_DepartmentRepository sysDepRep, IMapper mapper)
+        {
+            _sysDepRep = sysDepRep;
+            _mapper = mapper;
+        }
+
+
+        //[Authorize]
+        [HttpPost]
+        [ProducesResponseType(typeof(LoginView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> fnQueryDepartment(Sys_DepartmentDto dto)
+        {
+            _sysDepRep.BeginTran();
+            var result = _sysDepRep.QueryDto<Sys_Department,Sys_DepartmentView>(s => s.CompanyId == dto.CompanyId).ToList();
+            foreach (var item in result)
+            {
+                item.a = "123";
+            }
+            //string sql = "select * from Sys_Department where CompanyId='2'";
+            //var result2 = _sysDepRep.GetListBySqlWithNolock(sql);
+            //List<Sys_DepartmentView> dep = _mapper.Map<List<Sys_DepartmentView>>(result2);
+           
+            return Ok(JsonView(0, "调用完成:", result));
+        }
+    }
+}

+ 1 - 0
OASystem/OASystem.Api/GlobalUsings.cs

@@ -46,6 +46,7 @@ global using System.Drawing.Imaging;
 global using System;
 global using System.Collections.Generic;
 global using System.Linq;
+global using OASystem.Domain;
 
 
 

+ 10 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -2,6 +2,7 @@
 using OASystem.Domain.Entities;
 using OASystem.Domain.Entities.System;
 using OASystem.Domain.ViewModels;
+using OASystem.Domain.ViewModels.System;
 
 namespace OASystem.Domain.AutoMappers
 {
@@ -14,6 +15,15 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<LoginDto, Sys_Users>();
             #endregion
 
+            #region 系统设置
+
+           
+            #region 部门
+            CreateMap<Sys_DepartmentDto, Sys_Department>();
+            CreateMap<Sys_Department, Sys_DepartmentView>();
+            #endregion
+
+            #endregion
         }
     }
 }

+ 17 - 0
OASystem/OASystem.Domain/Dtos/Sys_DepartmentDto.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos
+{
+    public class Sys_DepartmentDto
+    {
+        /// <summary>
+        /// 公司Id
+        /// </summary>
+        public int CompanyId { get; set; }
+    }
+}

+ 11 - 7
OASystem/OASystem.Domain/Entities/EntityBase.cs

@@ -20,12 +20,6 @@
         /// </summary>
         [SugarColumn(ColumnDescription = "创建时间", IsNullable = true,ColumnDataType = "DateTime")]
         public DateTime CreateTime { get; set; } = DateTime.Now;
-       
-        /// <summary>
-        /// 是否删除
-        /// </summary>
-        [SugarColumn(ColumnDescription = "是否删除", IsNullable = true,ColumnDataType ="int")]
-        public bool IsDel { get; set; }
         /// <summary>
         /// 删除者Id
         /// </summary>
@@ -34,8 +28,18 @@
         /// <summary>
         /// 删除时间
         /// </summary>
-        [SugarColumn(ColumnDescription = "删除时间",IsNullable = true,ColumnDataType = "DateTime")]
+        [SugarColumn(ColumnDescription = "删除时间",IsNullable = true,ColumnDataType = "varchar(30)")]
         public string DeleteTime { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        [SugarColumn(IsNullable =true,ColumnDataType ="varchar(500)")]
+        public string Remark { get; set; }
+        /// <summary>
+        /// 是否删除
+        /// </summary>
+        [SugarColumn(ColumnDescription = "是否删除", IsNullable = true, ColumnDataType = "int")]
+        public int IsDel { get; set; }
     }
 
 }

+ 1 - 1
OASystem/OASystem.Domain/Entities/System/Sys_JobPost.cs

@@ -20,7 +20,7 @@ namespace OASystem.Domain.Entities.System
         /// <summary>
         /// 岗位名称
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(20)")]
         public string JobName { get; set; }
        
     }

+ 31 - 0
OASystem/OASystem.Domain/Entities/System/Sys_JobPostAuthority.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.System
+{
+    /// <summary>
+    /// 岗位权限设置
+    /// </summary>
+    [SugarTable("Sys_JobPostAuthority")]
+    public class Sys_JobPostAuthority
+    {
+        /// <summary>
+        /// 岗位表Id
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int JpId { get; set; }
+        /// <summary>
+        /// 页面权限Id
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int SmId { get; set; }
+        /// <summary>
+        /// 页面功能Id
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int FId { get; set; }
+    }
+}

+ 1 - 1
OASystem/OASystem.Domain/Entities/System/Sys_PageFunctionPermission.cs

@@ -21,6 +21,6 @@ namespace OASystem.Domain.Entities.System
         /// 是否启用0否1是
         /// </summary>
         [SugarColumn(IsNullable = true,ColumnDataType ="int")]
-        public string IsEnable { get; set; }
+        public int IsEnable { get; set; }
     }
 }

+ 31 - 0
OASystem/OASystem.Domain/Entities/System/Sys_UserAuthority.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.System
+{
+    /// <summary>
+    /// 系统用户权限设置(个人级)
+    /// </summary>
+    [SugarTable("Sys_UserAuthority")]
+    public class Sys_UserAuthority
+    {
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        [SugarColumn(IsNullable =true,ColumnDataType ="int")]
+        public int UId { get; set; }
+        /// <summary>
+        /// 页面权限Id
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int SmId { get; set; }
+        /// <summary>
+        /// 页面功能Id
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int FId { get; set; }
+    }
+}

+ 16 - 0
OASystem/OASystem.Domain/ViewModels/System/Sys_DepartmentView.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.System
+{
+    public class Sys_DepartmentView
+    {
+        public int Id { get; set; }
+        public string DepName { get; set; }
+
+        public string a { get; set; }
+    }
+}

+ 0 - 20
OASystem/OASystem.Infrastructure/CDUR/PaymentCDUR.cs

@@ -1,20 +0,0 @@
-using AutoMapper;
-using OASystem.Domain.Dtos;
-using Newtonsoft.Json;
-using OASystem.Infrastructure.Repositories;
-
-namespace OASystem.Infrastructure.CDUR
-{
-    public class PaymentCDUR
-    {
-        readonly IMapper _mapper;
-
-        //public PaymentCDUR(IMapper mapper, OrderRepository orderRep, CMBPaymentDetailRepository orderDetailRep)
-        //{
-        //    _mapper = mapper;
-        //    _orderRep = orderRep;
-        //    _orderDetailRep = orderDetailRep;
-        //}
-
-    }
-}

+ 17 - 13
OASystem/OASystem.Infrastructure/Repositories/BaseRepository.cs

@@ -99,6 +99,10 @@ namespace OASystem.Infrastructure.Repositories
         {
             return await _sqlSugar.SqlQueryable<TEntity>(sql).ToListAsync();
         }
+        public virtual List<TEntity> GetListBySqlWithNolock(string sql)
+        {
+            return _sqlSugar.SqlQueryable<TEntity>(sql).ToList();
+        }
 
         /// <summary>
         /// 添加返回主键Id
@@ -119,15 +123,15 @@ namespace OASystem.Infrastructure.Repositories
         }
         public virtual ISugarQueryable<TEntity> Query(Expression<Func<TEntity, bool>> exp)
         {
-            return _sqlSugar.Queryable<TEntity>().Where(a => !a.IsDel).Where(exp);
+            return _sqlSugar.Queryable<TEntity>().Where(a => a.IsDel < 1).Where(exp);
         }
         public virtual ISugarQueryable<TDto> QueryDto(Expression<Func<TEntity, bool>> exp)
         {
-            return _sqlSugar.Queryable<TEntity>().Where(a => !a.IsDel).Where(exp).Select<TDto>();
+            return _sqlSugar.Queryable<TEntity>().Where(a => a.IsDel < 1).Where(exp).Select<TDto>();
         }
         public virtual Task<TDto> GetDtoAsync(Expression<Func<TEntity, bool>> exp)
         {
-            return _sqlSugar.Queryable<TEntity>().Where(s => !s.IsDel).Where(exp).Select<TDto>().FirstAsync();
+            return _sqlSugar.Queryable<TEntity>().Where(s => s.IsDel < 1).Where(exp).Select<TDto>().FirstAsync();
         }
         public virtual Task<int> AddAsync(TEntity entity)
         {
@@ -151,7 +155,7 @@ namespace OASystem.Infrastructure.Repositories
         {
             var result = await _sqlSugar.Updateable<TEntity>().Where(a => a.Id.Equals(id)).SetColumns(a => new TEntity()
             {
-                IsDel = true,
+                IsDel = 1,
                 DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
             }).ExecuteCommandAsync();
             return result > 0;
@@ -160,7 +164,7 @@ namespace OASystem.Infrastructure.Repositories
         {
             var result = await _sqlSugar.Updateable<TEntity>().Where(wherexp).SetColumns(a => new TEntity()
             {
-                IsDel = true,
+                IsDel = 1,
                 DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
             }).ExecuteCommandAsync();
             return result > 0;
@@ -169,15 +173,15 @@ namespace OASystem.Infrastructure.Repositories
         #region 泛型CRUD
         public virtual Task<bool> AnyAsync<T>(Expression<Func<T, bool>> exp) where T : EntityBase, new()
         {
-            return _sqlSugar.Queryable<T>().Where(s => !s.IsDel).AnyAsync(exp);
+            return _sqlSugar.Queryable<T>().Where(s => s.IsDel < 1).AnyAsync(exp);
         }
         public virtual Task<Dto> GetDtoAsync<T, Dto>(Expression<Func<T, bool>> exp) where T : EntityBase, new()
         {
-            return _sqlSugar.Queryable<T>().Where(s => !s.IsDel).Where(exp).Select<Dto>().FirstAsync();
+            return _sqlSugar.Queryable<T>().Where(s => s.IsDel < 1).Where(exp).Select<Dto>().FirstAsync();
         }
         public virtual ISugarQueryable<Dto> QueryDto<T, Dto>(Expression<Func<T, bool>> exp) where T : EntityBase, new()
         {
-            return _sqlSugar.Queryable<T>().Where(a => !a.IsDel).Where(exp).Select<Dto>();
+            return _sqlSugar.Queryable<T>().Where(a => a.IsDel < 1).Where(exp).Select<Dto>();
         }
         public virtual Task<int> AddAsync<T>(T entity) where T : EntityBase, new()
         {
@@ -185,15 +189,15 @@ namespace OASystem.Infrastructure.Repositories
         }
         public virtual ISugarQueryable<T> Query<T>(Expression<Func<T, bool>> exp) where T : EntityBase, new()
         {
-            return _sqlSugar.Queryable<T>().Where(s => !s.IsDel).Where(exp);
+            return _sqlSugar.Queryable<T>().Where(s => s.IsDel < 1).Where(exp);
         }
         public virtual Task<T> GetAsync<T>(Expression<Func<T, bool>> exp) where T : EntityBase, new()
         {
-            return _sqlSugar.Queryable<T>().Where(s => !s.IsDel).Where(exp).FirstAsync();
+            return _sqlSugar.Queryable<T>().Where(s => s.IsDel < 1).Where(exp).FirstAsync();
         }
         public virtual T Get<T>(Expression<Func<T, bool>> exp) where T : EntityBase, new()
         {
-            return _sqlSugar.Queryable<T>().Where(s => !s.IsDel).Where(exp).First();
+            return _sqlSugar.Queryable<T>().Where(s => s.IsDel < 1).Where(exp).First();
         }
 
         public virtual async Task<bool> UpdateAsync<T>(Expression<Func<T, bool>> wherexp, Expression<Func<T, T>> upexp) where T : EntityBase, new()
@@ -210,7 +214,7 @@ namespace OASystem.Infrastructure.Repositories
         {
             var result = await _sqlSugar.Updateable<TEntity>().Where(a => a.Id.Equals(id)).SetColumns(a => new TEntity()
             {
-                IsDel = true,
+                IsDel = 1,
                 DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
             }).ExecuteCommandAsync();
             return result > 0;
@@ -219,7 +223,7 @@ namespace OASystem.Infrastructure.Repositories
         {
             var result = await _sqlSugar.Updateable<TEntity>().Where(wherexp).SetColumns(a => new TEntity()
             {
-                IsDel = true,
+                IsDel = 1,
                 DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
             }).ExecuteCommandAsync();
             return result > 0;

+ 0 - 12
OASystem/OASystem.Infrastructure/Repositories/CustomerAccount/CashPrepayRepository.cs

@@ -1,12 +0,0 @@
-
-using OASystem.Infrastructure.Repositories;
-
-namespace OASystem.Infrastructure.Repositories.CustomerAccount
-{
-    //public class CashPrepayRepository : BaseRepository<CashPrepayInfo, CashPrepayView>
-    //{
-    //    public CashPrepayRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
-    //    {
-    //    }
-    //}
-}

+ 0 - 20
OASystem/OASystem.Infrastructure/Repositories/OrderRepository.cs

@@ -1,20 +0,0 @@
-using OASystem.Domain.Entities;
-using OASystem.Domain.ViewModels;
-
-namespace OASystem.Infrastructure.Repositories
-{
-    //public class OrderRepository : BaseRepository<Order, OrderView>
-    //{
-    //    public OrderRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
-    //    {
-    //    }
-
-    //    public string GetNextPayNo()
-    //    {
-    //        SugarParameter[] param = new SugarParameter[] { };
-    //        int rst = _sqlSugar.Ado.UseStoredProcedure().GetInt("GetNextPayNo", param);
-    //        return DateTime.Now.ToString("yyyyMMddHHmmss") + rst.ToString("D5");
-    //    }
-
-    //}
-}

+ 18 - 0
OASystem/OASystem.Infrastructure/Repositories/System/Sys_DepartmentRepository.cs

@@ -0,0 +1,18 @@
+using OASystem.Domain.Dtos;
+using OASystem.Domain.Entities.System;
+using OASystem.Domain.ViewModels.System;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Infrastructure.Repositories.System
+{
+    public class Sys_DepartmentRepository : BaseRepository<Sys_Department, Sys_DepartmentView>
+    {
+        public Sys_DepartmentRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
+        {
+        }
+    }
+}