parent
683b9a7a19
commit
580b23885d
@ -0,0 +1,13 @@
|
||||
dubbo:
|
||||
application:
|
||||
name: demo-service
|
||||
registry:
|
||||
address: zookeeper://127.0.0.1:2181
|
||||
protocol:
|
||||
port: -1
|
||||
name: dubbo
|
||||
scan:
|
||||
base-packages: cn.iocoder.mall.demo.rpc.service
|
||||
consumer:
|
||||
DemoProductRpcService:
|
||||
version: 1.0.0
|
||||
@ -0,0 +1,4 @@
|
||||
package cn.iocoder.mall.demo.job.handler;
|
||||
|
||||
public class DemoJobHandler {
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
package cn.iocoder.mall.demo.job;
|
||||
@ -0,0 +1 @@
|
||||
package cn.iocoder.mall.demo.mq;
|
||||
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.mall.demo.rpc.api;
|
||||
|
||||
import cn.iocoder.mall.demo.rpc.vo.DemoProductVO;
|
||||
|
||||
public interface DemoProductRpcService {
|
||||
|
||||
DemoProductVO get(Integer id);
|
||||
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
package cn.iocoder.mall.demo.rpc;
|
||||
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.mall.demo.rpc.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("Demo 商品 BO")
|
||||
@Data
|
||||
public class DemoProductVO {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "华为 Mate30 Pro", required = true, example = "小王")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "价格,单位:分", required = true, example = "10")
|
||||
private Integer price;
|
||||
@ApiModelProperty(value = "库存数量", required = true, example = "100")
|
||||
private Integer quantity;
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.mall.demo.rpc.convert;
|
||||
|
||||
import cn.iocoder.mall.demo.business.bo.product.DemoProductBO;
|
||||
import cn.iocoder.mall.demo.rpc.vo.DemoProductVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface DemoProductConvert {
|
||||
|
||||
DemoProductConvert INSTANCE = Mappers.getMapper(DemoProductConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
DemoProductVO convert(DemoProductBO object);
|
||||
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
package cn.iocoder.mall.demo.rpc;
|
||||
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.mall.demo.rpc.service;
|
||||
|
||||
import cn.iocoder.mall.demo.business.api.DemoProductService;
|
||||
import cn.iocoder.mall.demo.business.bo.product.DemoProductBO;
|
||||
import cn.iocoder.mall.demo.rpc.api.DemoProductRpcService;
|
||||
import cn.iocoder.mall.demo.rpc.convert.DemoProductConvert;
|
||||
import cn.iocoder.mall.demo.rpc.vo.DemoProductVO;
|
||||
import org.apache.dubbo.config.annotation.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Service(validation = "true", version = "${dubbo.provider.DemoProductRpcService.version}")
|
||||
public class DemoProductRpcServiceImpl implements DemoProductRpcService {
|
||||
|
||||
@Autowired
|
||||
private DemoProductService productService;
|
||||
|
||||
@Override
|
||||
public DemoProductVO get(Integer id) {
|
||||
DemoProductBO product = productService.get(id);
|
||||
return DemoProductConvert.INSTANCE.convert(product);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
# dubbo
|
||||
dubbo:
|
||||
application:
|
||||
name: demo-service
|
||||
registry:
|
||||
address: zookeeper://127.0.0.1:2181
|
||||
protocol:
|
||||
port: -1
|
||||
name: dubbo
|
||||
scan:
|
||||
base-packages: cn.iocoder.mall.demo.rpc.service
|
||||
# consumer:
|
||||
# ProductSpuService:
|
||||
# version: 1.0.0
|
||||
provider:
|
||||
# filter: -exception
|
||||
DemoProductRpcService:
|
||||
version: 1.0.0
|
||||
Loading…
Reference in new issue