根据查询流程进行分析
该项目在我的GitLab中为开源项目可下载;
http://112.125.89.38/colaintegration/cola-mysql-easyexcel.git
本框架涉及三个接口:
CustomerServiceI client层定义 app层实现;
接收数据adapter层数据,加工数据,通过executor对数据加工,调用用CustomerGateway接口;
CustomerGateway domain层定义 infrastructure层实现;
接收app层中转的数据,对数据加工,调用CustomerMapper接口;
CustomerMapper infrastructure层
本层xml实现;
获取CustomerGateway实现类传入的数据对数据库进行相应的操作,并返回相应的数据;
Start:
Java
Application 程序入口
resources数据库方面
application.properties 数据库设置,调用infrastructure中的TableCreationDDL.sql 创建cuctomer表;
logback-spring.xml 数据库日志设置;
demo-web-infrastructure:
java
DiamondConfig :
CreditGatewayImpl: 实现domain中的CreditGateway接口;实体Credit;
CustomerDO: Customer数据对象;
CustomerGatewayImpl 实现domain层中的 CustomerGateway 接口;实体Customer;
实现Customer类型的getByById()方法调用customerMapper.getById(customerId)从数据库中提取数据(方法实现在cuctomer-mapper.xml),给customerDO赋值;customerDO给(新声明,将返回的)Customer赋值;
App层实现
CustomerMapper 调用CustomerDO返回类型的getById;为CustomerGatewayImpl中customerDO赋值使用;
OrderGatewayImpl 未实现;
resources数据库方面
cuctomer-mapper.xml 实现cuctomer表操作;
mybatis-config.xml mybatis配置文件;
logback-spring.xml 数据库日志设置;
TableCreationDDL.sql 创建cuctomer表,及初始化数据;
demo-web-domain:
Java
CreditChecker 未实现
CreditGateway
CustomerGateway 接口;声明实体Customer类型方法getByById(),在 infrastructure层 CustomerGatewayImpl实现;
Class和Enum
CompanyType enum
Credit class实体类未实现;
Customer class实体类;
CustomerType enum
SourceType enum
demo-web-client:
Java/api
CustomerServiceI 接口;声明
addCustomer(CustomerAddCmd
customerAddCmd)
和listById(CustomerListByIdQry
customerListByIdQry)
两个方法;
CustomerAddCmd类定义于:dto/event
CustomerListByIdQry类定义于:dto/event
Java/dto
CustomerDTO 类
ErrorCode enum
CustomerAddCmd 封装customerDTO
CustomerListByIdQry 类;继承Query(查询)(继承Command继承DTO继承Serializable)
封装customerId;
demo-web-app:
CustomerListByIdQryExe 通过CustomerGateway将CustomerListByIdQry变为List
CustomerAddCmdExe
CustomerServiceImpl 实现demo-web-client层CustomerServiceI接口;
ListById方法中使用到
demo-web-adapter:
CustomerMobileAdaptor 暂空;
CustomerWapAdaptor 暂空;
CustomerController 获取前端post/get操作;
customerListByIdQry CustomerServiceI MultiResponse
customerId customer
提供CustomerServiceI接口以及DTO与前端数据封装类
CustomerGateway
customerId customer
customerId CustomerMapper customerDO