- demo 项目,增加 redis 库
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package cn.iocoder.mall.demo.rpc.convert;
|
||||
|
||||
import cn.iocoder.mall.demo.business.bo.user.DemoUserBO;
|
||||
import cn.iocoder.mall.demo.rpc.vo.DemoUserVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface DemoUserConvert {
|
||||
|
||||
DemoUserConvert INSTANCE = Mappers.getMapper(DemoUserConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
DemoUserVO convert(DemoUserBO object);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.mall.demo.rpc.service;
|
||||
|
||||
import cn.iocoder.mall.demo.business.api.DemoUserService;
|
||||
import cn.iocoder.mall.demo.business.bo.user.DemoUserBO;
|
||||
import cn.iocoder.mall.demo.rpc.api.DemoUserRpcService;
|
||||
import cn.iocoder.mall.demo.rpc.convert.DemoUserConvert;
|
||||
import cn.iocoder.mall.demo.rpc.vo.DemoUserVO;
|
||||
import org.apache.dubbo.config.annotation.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Service(validation = "true", version = "${dubbo.provider.DemoUserRpcService.version}")
|
||||
public class DemoUserRpcServiceImpl implements DemoUserRpcService {
|
||||
|
||||
@Autowired
|
||||
private DemoUserService demoUserService;
|
||||
|
||||
@Override
|
||||
public DemoUserVO get(Integer id) {
|
||||
DemoUserBO userBO = demoUserService.get(id);
|
||||
return DemoUserConvert.INSTANCE.convert(userBO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,3 +16,5 @@ dubbo:
|
||||
# filter: -exception
|
||||
DemoProductRpcService:
|
||||
version: 1.0.0
|
||||
DemoUserRpcService:
|
||||
version: 1.0.0
|
||||
|
||||
Reference in New Issue
Block a user