Untitled

mail@pastecode.io avatarunknown
java
a month ago
3.4 kB
1
Indexable
Never
package com.vn.meddental.service.mapper;

import com.vn.meddental.constant.Constants;
import com.vn.meddental.domain.CategoryMedicine;
import com.vn.meddental.service.dto.CategoryMedicineDTO;
import java.util.List;
import org.mapstruct.IterableMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;

/**
 * Mapper for the entity {@link CategoryMedicine} and its DTO {@link CategoryMedicineDTO}.
 */
@Mapper(componentModel = "spring")
public interface CategoryMedicineMapper extends EntityMapper<CategoryMedicineDTO, CategoryMedicine> {
    @Named("toListCategoryMedicineDTO")
    List<CategoryMedicineDTO> toListCategoryMedicineDTO(List<CategoryMedicine> categoryMedicines);

    @Named("toCategoryMedicine")
    @Mapping(target = "createdBy", expression = Constants.EXPRESSION.CURRENT_USER)
    @Mapping(target = "createdDate", expression = Constants.EXPRESSION.CURRENT_DATE)
    @Mapping(target = "lastModifiedBy", expression = Constants.EXPRESSION.CURRENT_USER)
    @Mapping(target = "lastModifiedDate", expression = Constants.EXPRESSION.CURRENT_DATE)
    CategoryMedicine toCategoryMedicine(CategoryMedicineDTO categoryMedicineDTO);

    @Named("toUpdateCategoryMedicine")
    @Mapping(target = "status", expression = "java(com.vn.meddental.constant.Constants.STATUS.ACTIVE)")
    @Mapping(target = "createdBy", expression = Constants.EXPRESSION.CURRENT_USER)
    @Mapping(target = "createdDate", expression = Constants.EXPRESSION.CURRENT_DATE)
    @Mapping(target = "lastModifiedBy", expression = Constants.EXPRESSION.CURRENT_USER)
    @Mapping(target = "lastModifiedDate", expression = Constants.EXPRESSION.CURRENT_DATE)
    CategoryMedicine toUpdateCategoryMedicine(CategoryMedicineDTO categoryMedicineDTO);

    @Named("toUpdateCategoryMedicines")
    @IterableMapping(qualifiedByName = "toUpdateCategoryMedicine")
    List<CategoryMedicine> toUpdateCategoryMedicines(List<CategoryMedicineDTO> categoryMedicineDTOS);
}



package com.vn.meddental.service.mapper;

import com.vn.meddental.constant.Constants;
import com.vn.meddental.domain.SuppliesGroup;
import com.vn.meddental.service.dto.SuppliesGroupDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;

/**
 * Mapper for the entity {@link SuppliesGroup} and its DTO {@link SuppliesGroupDTO}.
 */
@Mapper(componentModel = "spring")
public interface SuppliesGroupMapper extends EntityMapper<SuppliesGroupDTO, SuppliesGroup> {
    @Named("toCreateSuppliesGroup")
    @Mapping(target = "status", expression = "java(com.vn.meddental.constant.Constants.STATUS.ACTIVE)")
    @Mapping(target = "createdBy", expression = Constants.EXPRESSION.CURRENT_USER)
    @Mapping(target = "createdDate", expression = Constants.EXPRESSION.CURRENT_DATE)
    @Mapping(target = "lastModifiedBy", expression = Constants.EXPRESSION.CURRENT_USER)
    @Mapping(target = "lastModifiedDate", expression = Constants.EXPRESSION.CURRENT_DATE)
    SuppliesGroup toCreateSuppliesGroup(SuppliesGroupDTO suppliesGroupDTO);

    @Named("toUpdateSuppliesGroup")
    @Mapping(target = "lastModifiedBy", expression = Constants.EXPRESSION.CURRENT_USER)
    @Mapping(target = "lastModifiedDate", expression = Constants.EXPRESSION.CURRENT_DATE)
    SuppliesGroup toUpdateSuppliesGroup(SuppliesGroupDTO suppliesGroupDTO);
}