错误码第一版续,分组暂时未加,第二版会添加分组和mq订阅

This commit is contained in:
benpaodeyouyusi
2020-05-10 23:38:20 +08:00
parent 413f75f402
commit 96858fae21
11 changed files with 163 additions and 33 deletions

View File

@@ -0,0 +1,16 @@
package cn.iocoder.mall.system.rpc.convert.errorcode;
import cn.iocoder.mall.system.biz.bo.errorcode.ErrorCodeBO;
import cn.iocoder.mall.system.rpc.response.errorcode.ErrorCodeResponse;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface ErrorCodeConvert {
ErrorCodeConvert INSTANCE = Mappers.getMapper(ErrorCodeConvert.class);
List<ErrorCodeResponse> convert(List<ErrorCodeBO> bean);
}

View File

@@ -0,0 +1,30 @@
package cn.iocoder.mall.system.rpc.rpc.errorcode;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.system.biz.bo.errorcode.ErrorCodeBO;
import cn.iocoder.mall.system.biz.service.errorcode.ErrorCodeService;
import cn.iocoder.mall.system.rpc.api.errorcode.ErrorCodeRPC;
import cn.iocoder.mall.system.rpc.convert.errorcode.ErrorCodeConvert;
import cn.iocoder.mall.system.rpc.convert.user.UserConvert;
import cn.iocoder.mall.system.rpc.response.errorcode.ErrorCodeResponse;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
*
* @author ding
*/
@Service(version = "${dubbo.provider.ErrorCodeRPC.version}", validation = "true")
public class ErrorCodeRPCImpl implements ErrorCodeRPC {
@Autowired
private ErrorCodeService errorCodeService;
@Override
public CommonResult<List<ErrorCodeResponse>> getErrorCode() {
List<ErrorCodeBO> list = errorCodeService.getErrorCodeListAll();
return CommonResult.success(ErrorCodeConvert.INSTANCE.convert(list));
}
}

View File

@@ -25,6 +25,8 @@ dubbo:
version: 1.0.0
UserAddressRPC:
version: 1.0.0
ErrorCodeRPC:
version: 1.0.0
# Dubbo 服务消费者的配置
consumer:
@@ -38,3 +40,5 @@ dubbo:
version: 1.0.0
UserRPC:
version: 1.0.0
ErrorCodeRPC:
version: 1.0.0