import org.mapstruct.Mapping; import org.mapstruct.Mappings; import org.mapstruct.factory.Mappers; import java.util.List; @Mapper public interface PersonConverter { PersonConverter INSTANCE = Mappers.getMapper(PersonConverter.class); @Mappings({ @Mapping(target = "age" ,expression = "java(versionConvert(demo.getAge()))"), @Mapping(target = "hobby" , source ="love") Demo0 domain2dto(Demo demo); List domain2dt(List demo); //转换versionTitle default Long versionConvert(Integer age){ return Long.valueOf(age);
public class PersonConverterImpl implements PersonConverter {
    public PersonConverterImpl() {
    public Demo0 domain2dto(Demo demo) {
        if (demo == null) {
            return null;
        } else {
            Demo0 demo0 = new Demo0();
            demo0.setHobby(demo.getLove());
            demo0.setName(demo.getName());
            demo0.setAge(this.versionConvert(demo.getAge()));
            return demo0;
    public List<Demo0> domain2dt(List<Demo> demo) {
        if (demo == null) {
            return null;
        } else {
            List<Demo0> list = new ArrayList(demo.size());
            Iterator var3 = demo.iterator();
            while(var3.hasNext()) {
                Demo demo1 = (Demo)var3.next();
                list.add(this.domain2dto(demo1));
            return list;