Coder Social home page Coder Social logo

ddd-framework's Issues

通过mapstruce转换失败的改动

这个东西不需要你手动实现,写上接口,然后maven重新打包,运行就会自动生成实现类
`package com.ddd.api.converter;

import com.ddd.api.model.req.AuthorizeCreateReq;
import com.ddd.api.model.req.AuthorizeUpdateReq;
import com.ddd.api.model.vo.UserAuthorizeVO;
import com.ddd.applicaiton.dto.UserRoleDTO;
import org.mapstruct.Mapper;

/**

  • UserVO转换器

  • @author louzai

  • @SInCE 2021/11/20
    */
    @Mapper(componentModel = "spring")
    public interface AuthorizeConverter {

    /**

    • 转换UserRoleDTO
    • @param authorizeCreateReq 请求
    • @return 对象
      */
      UserRoleDTO toDTO(AuthorizeCreateReq authorizeCreateReq);

    /**

    • 转换UserRoleDTO
    • @param authorizeUpdateReq 请求
    • @return 对象
      */
      UserRoleDTO toDTO(AuthorizeUpdateReq authorizeUpdateReq);

    /**

    • 转换UserAuthorizeVO
    • @param userRoleDTO 对象
    • @return 对象
      */
      UserAuthorizeVO toVO(UserRoleDTO userRoleDTO);
      }`

这是自动生成实现类的代码
`package com.ddd.api.converter;

import com.ddd.api.model.req.AuthorizeCreateReq;
import com.ddd.api.model.req.AuthorizeUpdateReq;
import com.ddd.api.model.vo.UserAuthorizeVO;
import com.ddd.applicaiton.dto.RoleInfoDTO;
import com.ddd.applicaiton.dto.UserRoleDTO;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import org.springframework.stereotype.Component;

@generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-10-28T10:54:06+0800",
comments = "version: 1.5.2.Final, compiler: javac, environment: Java 1.8.0_351 (Oracle Corporation)"
)
@component
public class AuthorizeConverterImpl implements AuthorizeConverter {

@Override
public UserRoleDTO toDTO(AuthorizeCreateReq authorizeCreateReq) {
    if ( authorizeCreateReq == null ) {
        return null;
    }

    UserRoleDTO userRoleDTO = new UserRoleDTO();

    userRoleDTO.setUserId( authorizeCreateReq.getUserId() );
    List<RoleInfoDTO> list = authorizeCreateReq.getRoles();
    if ( list != null ) {
        userRoleDTO.setRoles( new ArrayList<RoleInfoDTO>( list ) );
    }
    userRoleDTO.setUserName( authorizeCreateReq.getUserName() );
    userRoleDTO.setRealName( authorizeCreateReq.getRealName() );
    userRoleDTO.setPhone( authorizeCreateReq.getPhone() );
    userRoleDTO.setPassword( authorizeCreateReq.getPassword() );
    userRoleDTO.setUnitId( authorizeCreateReq.getUnitId() );
    userRoleDTO.setProvince( authorizeCreateReq.getProvince() );
    userRoleDTO.setCity( authorizeCreateReq.getCity() );
    userRoleDTO.setCounty( authorizeCreateReq.getCounty() );

    return userRoleDTO;
}

@Override
public UserRoleDTO toDTO(AuthorizeUpdateReq authorizeUpdateReq) {
    if ( authorizeUpdateReq == null ) {
        return null;
    }

    UserRoleDTO userRoleDTO = new UserRoleDTO();

    userRoleDTO.setUserId( authorizeUpdateReq.getUserId() );
    List<RoleInfoDTO> list = authorizeUpdateReq.getRoles();
    if ( list != null ) {
        userRoleDTO.setRoles( new ArrayList<RoleInfoDTO>( list ) );
    }
    userRoleDTO.setUserName( authorizeUpdateReq.getUserName() );
    userRoleDTO.setRealName( authorizeUpdateReq.getRealName() );
    userRoleDTO.setPhone( authorizeUpdateReq.getPhone() );
    userRoleDTO.setPassword( authorizeUpdateReq.getPassword() );
    userRoleDTO.setUnitId( authorizeUpdateReq.getUnitId() );
    userRoleDTO.setProvince( authorizeUpdateReq.getProvince() );
    userRoleDTO.setCity( authorizeUpdateReq.getCity() );
    userRoleDTO.setCounty( authorizeUpdateReq.getCounty() );

    return userRoleDTO;
}

@Override
public UserAuthorizeVO toVO(UserRoleDTO userRoleDTO) {
    if ( userRoleDTO == null ) {
        return null;
    }

    UserAuthorizeVO userAuthorizeVO = new UserAuthorizeVO();

    userAuthorizeVO.setUserId( userRoleDTO.getUserId() );
    List<RoleInfoDTO> list = userRoleDTO.getRoles();
    if ( list != null ) {
        userAuthorizeVO.setRoles( new ArrayList<RoleInfoDTO>( list ) );
    }
    userAuthorizeVO.setUserName( userRoleDTO.getUserName() );
    userAuthorizeVO.setRealName( userRoleDTO.getRealName() );
    userAuthorizeVO.setPhone( userRoleDTO.getPhone() );
    userAuthorizeVO.setPassword( userRoleDTO.getPassword() );
    userAuthorizeVO.setUnitId( userRoleDTO.getUnitId() );
    userAuthorizeVO.setUnitName( userRoleDTO.getUnitName() );
    userAuthorizeVO.setProvince( userRoleDTO.getProvince() );
    userAuthorizeVO.setCity( userRoleDTO.getCity() );
    userAuthorizeVO.setCounty( userRoleDTO.getCounty() );

    return userAuthorizeVO;
}

}`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.