package com.jwipc.sys.convert;

import com.jwipc.sys.dto.OrgAddOrEditDTO;
import com.jwipc.sys.dto.OrgTreeDTO;
import com.jwipc.sys.entity.Org;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;


@Mapper(componentModel = "spring")
public interface OrgConvert {
    List<OrgTreeDTO> entities2TreeDTOs(List<Org> list);

    @Mapping(source = "state", target = "status")
    @Mapping(source = "parentId", target = "parentCode")
    OrgTreeDTO entity2TreeDTO(Org org);

    OrgAddOrEditDTO entity2EditDTO(Org byId);

    Org editDTO2Entity(OrgAddOrEditDTO orgAddOrEditDTO);
}
