Merge branch 'master' into net6.0
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Common;
|
||||
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
public class CacheService
|
||||
{
|
||||
#region 用户权限 缓存
|
||||
public static List<string> GetUserPerms(string key)
|
||||
{
|
||||
return (List<string>)CacheHelper.GetCache(key);
|
||||
}
|
||||
|
||||
public static void SetUserPerms(string key, object data)
|
||||
{
|
||||
CacheHelper.SetCache(key, data);
|
||||
}
|
||||
public static void RemoveUserPerms(string key)
|
||||
{
|
||||
CacheHelper.Remove(key);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace ZR.Service.System
|
||||
/// <returns></returns>
|
||||
public int DeleteGenTableByTbName(string tableName)
|
||||
{
|
||||
return GenTableRepository.Delete(f => f.TableName == tableName) ? 1: 0;
|
||||
return GenTableRepository.Delete(f => f.TableName == tableName) ? 1 : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -83,16 +83,24 @@ namespace ZR.Service.System
|
||||
if (options == null) return;
|
||||
|
||||
genTable.ParentMenuId = options.GetValueOrDefault("parentMenuId") ?? null;
|
||||
|
||||
|
||||
genTable.SortType = options.GetValueOrDefault("sortType") ?? "asc";
|
||||
genTable.SortField = options.GetValueOrDefault("sortField") ?? "";
|
||||
|
||||
genTable.TreeParentCode = options.GetValueOrDefault("treeParentCode") ?? "";
|
||||
genTable.TreeName = options.GetValueOrDefault("treeName") ?? "";
|
||||
genTable.TreeCode = options.GetValueOrDefault("treeCode") ?? "";
|
||||
|
||||
|
||||
var checkdBtn = options.GetValueOrDefault("checkedBtn") ?? "";
|
||||
genTable.CheckedBtn = Tools.SpitIntArrary(checkdBtn.ToString());
|
||||
|
||||
var permPrefix = options.GetValueOrDefault("permissionPrefix", "");
|
||||
|
||||
genTable.PermissionPrefix = permPrefix?.ToString();
|
||||
}
|
||||
if (genTable.PermissionPrefix.IsEmpty())
|
||||
{
|
||||
genTable.PermissionPrefix = $"{genTable.ModuleName.ToLower()}:{genTable.ClassName.ToLower()}";//权限
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +110,7 @@ namespace ZR.Service.System
|
||||
/// <param name="genTable"></param>
|
||||
/// <param name="pagerInfo"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<GenTable> GetGenTables(GenTable genTable, Model.PagerInfo pagerInfo)
|
||||
public PagedInfo<GenTable> GetGenTables(GenTable genTable, PagerInfo pagerInfo)
|
||||
{
|
||||
var predicate = Expressionable.Create<GenTable>();
|
||||
predicate = predicate.AndIF(genTable.TableName.IfNotEmpty(), it => it.TableName.Contains(genTable.TableName));
|
||||
@@ -165,7 +173,7 @@ namespace ZR.Service.System
|
||||
GenTableColumnService.Insert(insertColumns);
|
||||
|
||||
List<GenTableColumn> delColumns = tableColumns.FindAll(column => !dbTableColumneNames.Contains(column.ColumnName));
|
||||
if (delColumns!= null && delColumns.Count > 0)
|
||||
if (delColumns != null && delColumns.Count > 0)
|
||||
{
|
||||
GenTableColumnService.Delete(delColumns.Select(f => f.ColumnId).ToList());
|
||||
}
|
||||
|
||||
@@ -9,6 +9,12 @@ namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface ISysLoginService: IBaseService<SysLogininfor>
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="loginBody"></param>
|
||||
/// <param name="logininfor"></param>
|
||||
/// <returns></returns>
|
||||
public SysUser Login(LoginBodyDto loginBody, SysLogininfor logininfor);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository;
|
||||
using ZR.Model.System.Dto;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
@@ -66,5 +61,12 @@ namespace ZR.Service.System.IService
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdatePhoto(SysUser user);
|
||||
|
||||
/// <summary>
|
||||
/// 注册
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
SysUser Register(RegisterDto dto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ZR.Common;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
using ZR.Model.System.Dto;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Service.System.IService;
|
||||
|
||||
@@ -156,5 +160,34 @@ namespace ZR.Service
|
||||
{
|
||||
return UserRepository.UpdatePhoto(user);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册用户
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
public SysUser Register(RegisterDto dto)
|
||||
{
|
||||
//密码md5
|
||||
string password = NETCore.Encrypt.EncryptProvider.Md5(dto.Password);
|
||||
if (!Tools.PasswordStrength(dto.Password))
|
||||
{
|
||||
throw new CustomException("密码强度不符合要求");
|
||||
}
|
||||
SysUser user = new()
|
||||
{
|
||||
Create_time = DateTime.Now,
|
||||
UserName = dto.Username,
|
||||
NickName = dto.Username,
|
||||
Password = password,
|
||||
Status = "0",
|
||||
DeptId = 0,
|
||||
Remark = "用户注册"
|
||||
};
|
||||
|
||||
user.UserId = UserRepository.AddUser(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user