90 lines
4.7 KiB
Java
90 lines
4.7 KiB
Java
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
package com.qsoft.erp.dominio.mapper;
|
|
|
|
import com.qsoft.erp.dto.CoberturasPlanDTO;
|
|
import com.qsoft.erp.model.CoberturasPlan;
|
|
import org.mapstruct.AfterMapping;
|
|
import org.mapstruct.Mapper;
|
|
import org.mapstruct.Mapping;
|
|
import org.mapstruct.MappingTarget;
|
|
import org.mapstruct.factory.Mappers;
|
|
|
|
/**
|
|
*
|
|
* @author james
|
|
*/
|
|
@Mapper
|
|
public interface CoberturasPlanMapper {
|
|
|
|
CoberturasPlanMapper INSTANCE = Mappers.getMapper(CoberturasPlanMapper.class);
|
|
|
|
@Mapping(source = "detPrestacion", target = "detPrestacion.detCodigo")
|
|
@Mapping(source = "detTipoModalidad", target = "detTipoModalidad.detCodigo")
|
|
@Mapping(source = "detTipo", target = "detTipo.detCodigo")
|
|
@Mapping(source = "detPais", target = "detPais.detCodigo")
|
|
@Mapping(source = "plaCodigo", target = "plaCodigo.plaCodigo")
|
|
@Mapping(source = "modalidadNemonico", target = "detTipoModalidad.detNemonico")
|
|
@Mapping(source = "paisNemonico", target = "detPais.detNemonico")
|
|
@Mapping(source = "tipoNemonico", target = "detTipo.detNemonico")
|
|
@Mapping(source = "prestacionNemonico", target = "detPrestacion.detNemonico")
|
|
@Mapping(source = "modalidadNombre", target = "detTipoModalidad.detNombre")
|
|
@Mapping(source = "paisNombre", target = "detPais.detNombre")
|
|
@Mapping(source = "tipoNombre", target = "detTipo.detNombre")
|
|
@Mapping(source = "prestacionNombre", target = "detPrestacion.detNombre")
|
|
@Mapping(source = "modalidadDescripcion", target = "detTipoModalidad.detDescripcion")
|
|
@Mapping(source = "paisDescripcion", target = "detPais.detDescripcion")
|
|
@Mapping(source = "tipoDescripcion", target = "detTipo.detDescripcion")
|
|
@Mapping(source = "prestacionDescripcion", target = "detPrestacion.detDescripcion")
|
|
@Mapping(source = "detTipoDeducible", target = "detTipoDeducible.detCodigo")
|
|
@Mapping(source = "tipoDeducibleNemonico", target = "detTipoDeducible.detNemonico")
|
|
@Mapping(source = "tipoDeducibleNombre", target = "detTipoDeducible.detNombre")
|
|
CoberturasPlan getEntidad(CoberturasPlanDTO coberturasPlanDTO);
|
|
|
|
@Mapping(target = "detPrestacion", source = "detPrestacion.detCodigo")
|
|
@Mapping(target = "detTipoModalidad", source = "detTipoModalidad.detCodigo")
|
|
@Mapping(target = "detTipo", source = "detTipo.detCodigo")
|
|
@Mapping(target = "detPais", source = "detPais.detCodigo")
|
|
@Mapping(target = "plaCodigo", source = "plaCodigo.plaCodigo")
|
|
@Mapping(target = "prestacionNemonico", source = "detPrestacion.detNemonico")
|
|
@Mapping(target = "modalidadNemonico", source = "detTipoModalidad.detNemonico")
|
|
@Mapping(target = "tipoNemonico", source = "detTipo.detNemonico")
|
|
@Mapping(target = "paisNemonico", source = "detPais.detNemonico")
|
|
@Mapping(target = "modalidadNombre", source = "detTipoModalidad.detNombre")
|
|
@Mapping(target = "paisNombre", source = "detPais.detNombre")
|
|
@Mapping(target = "tipoNombre", source = "detTipo.detNombre")
|
|
@Mapping(target = "prestacionNombre", source = "detPrestacion.detNombre")
|
|
@Mapping(target = "modalidadDescripcion", source = "detTipoModalidad.detDescripcion")
|
|
@Mapping(target = "paisDescripcion", source = "detPais.detDescripcion")
|
|
@Mapping(target = "tipoDescripcion", source = "detTipo.detDescripcion")
|
|
@Mapping(target = "prestacionDescripcion", source = "detPrestacion.detDescripcion")
|
|
@Mapping(target = "detTipoDeducible", source = "detTipoDeducible.detCodigo")
|
|
@Mapping(target = "tipoDeducibleNemonico", source = "detTipoDeducible.detNemonico")
|
|
@Mapping(target = "tipoDeducibleNombre", source = "detTipoDeducible.detNombre")
|
|
CoberturasPlanDTO getDto(CoberturasPlan coberturasPlan);
|
|
|
|
@AfterMapping
|
|
default void validaNulos(CoberturasPlanDTO coberturasPlanDTO, @MappingTarget CoberturasPlan coberturasPlan) {
|
|
|
|
if (coberturasPlan.getDetPrestacion() != null && coberturasPlan.getDetPrestacion().getDetCodigo() == null) {
|
|
coberturasPlan.setDetPrestacion(null);
|
|
}
|
|
if (coberturasPlan.getDetPais() != null && coberturasPlan.getDetPais().getDetCodigo() == null) {
|
|
coberturasPlan.setDetPais(null);
|
|
}
|
|
if (coberturasPlan.getDetTipoModalidad() != null && coberturasPlan.getDetTipoModalidad().getDetCodigo() == null) {
|
|
coberturasPlan.setDetTipoModalidad(null);
|
|
}
|
|
if (coberturasPlan.getDetTipo() != null && coberturasPlan.getDetTipo().getDetCodigo() == null) {
|
|
coberturasPlan.setDetTipo(null);
|
|
}
|
|
if (coberturasPlan.getPlaCodigo() != null && coberturasPlan.getPlaCodigo().getPlaCodigo() == null) {
|
|
coberturasPlan.setPlaCodigo(null);
|
|
}
|
|
}
|
|
|
|
}
|