using JNPF.Common.Models.User;
using JNPF.Systems.Entitys.Dto.Department;
using JNPF.Systems.Entitys.Dto.Organize;
using JNPF.Systems.Entitys.Dto.OrganizeAdministrator;
using JNPF.Systems.Entitys.Dto.User;
using JNPF.Systems.Entitys.Permission;
using Mapster;
namespace JNPF.Systems.Entitys.Mapper;
///
/// 权限模块对象映射 .
///
public class PermissionMapper : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.ForType()
.Map(dest => dest.userId, src => src.Id)
.Map(dest => dest.userAccount, src => src.Account)
.Map(dest => dest.userName, src => src.RealName)
.Map(dest => dest.headIcon, src => "/api/File/Image/userAvatar/" + src.HeadIcon)
.Map(dest => dest.prevLoginTime, src => src.PrevLogTime)
.Map(dest => dest.prevLoginIPAddress, src => src.PrevLogIP);
config.ForType()
.Map(dest => dest.headIcon, src => "/api/File/Image/userAvatar/" + src.HeadIcon);
config.ForType()
.Map(dest => dest.fullName, src => src.RealName + "/" + src.Account)
.Map(dest => dest.type, src => "user")
.Map(dest => dest.parentId, src => src.OrganizeId);
config.ForType()
.Map(dest => dest.type, src => src.Category)
.Map(dest => dest.icon, src => "icon-ym icon-ym-tree-organization3");
config.ForType()
.Map(dest => dest.type, src => src.Category);
config.ForType()
.Ignore(dest => dest.UserId);
config.ForType()
.Ignore(dest => dest.organizeIdTree)
.NameMatchingStrategy(NameMatchingStrategy.IgnoreCase); //modified by ly on 20230420
config.ForType()
.Ignore(dest => dest.organizeIdTree);
//modified by ly on 20230420
config.ForType()
.NameMatchingStrategy(NameMatchingStrategy.IgnoreCase); //忽略字段大小写
}
}