package org.jeecg.modules.itdmPersonManage.convert;


import org.jeecg.modules.itdmPersonManage.entity.ItdmPersonManage;
import org.jeecg.modules.system.entity.SysUser;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;
import org.springframework.util.CollectionUtils;

import java.util.stream.Collectors;

@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE,imports ={ CollectionUtils.class, Collectors.class})
public interface ItdmPersonManageConvert {

    ItdmPersonManageConvert INSTANCE = Mappers.getMapper(ItdmPersonManageConvert.class);


    @Mapping(target = "name", source = "user.realname")
    @Mapping(target = "userId", source = "user.id")
    @Mapping(target = "position", source = "role")
    ItdmPersonManage convert(SysUser user,String role);

}
