搭建service-cmn模块
1 修改配置 pom.xml,引入依赖
2 添加配置文件application.properties
# 服务端口
server.port=8202
# 服务名
spring.application.name=service-cmn
# 环境设置:dev、test、prod
spring.profiles.active=dev
# mysql数据库连接
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/yygh_hosp?characterEncoding=utf-8&serverTimezone=GMT
spring.datasource.username=root
spring.datasource.password=123456
#返回json的全局时间格式
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8
3 添加启动类
@SpringBootApplication
@ComponentScan(basePackages = "com.atguigu")
public class ServiceCmnApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceCmnApplication.class, args);
}
}
4 数据字典列表接口
4.1model模块添加数据字典实体 com.atguigu.yygh.model.cmn.Dict
其中根据element组件要求,树形数据返回列表数据必须包含hasChildren字典,但表中没有这个字段,所以要添加exist=false
//因为数据表里不存在,所以就需要exist=false
@ApiModelProperty(value = "是否包含子节点")
@TableField(exist = false)
private boolean hasChildren;
4.2 添加数据字典mapper
4.3添加数据字典service
4.3.1 添加com.atguigu.yygh.cmn.service.DictService
4.3.2 添加com.atguigu.yygh.cmn.service.impl.DictServiceImpl接口实现
4.4 添加数据字典controller
添加com.atguigu.yygh.cmn.controller.DictController
4.5 添加配置类