Ver código fonte

多数据源加入系统预设表

gaodm 5 anos atrás
pai
commit
24da1dc70b

+ 55 - 14
config-server/src/main/resources/shared/ltkg-service-dev.yml

@@ -6,20 +6,32 @@ spring:
   profiles:
     active: local
   datasource:
-    driver-class-name: org.neo4j.jdbc.Driver
-    url: jdbc:neo4j:http://192.168.3.150:7474
-    username: neo4j
-    password: 12345678
-    #定义初始连接数
-    initialSize: 0
-    #定义最大连接数
-    maxActive: 20
-    #定义最大空闲
-    maxIdle: 20
-    #定义最小空闲
-    minIdle: 1
-    #定义最长等待时间
-    maxWait: 60000
+    dynamic:
+      primary: neo4j
+      # 数据库配置
+      datasource:
+        neo4j:
+          driver-class-name: org.neo4j.jdbc.Driver
+          url: jdbc:neo4j:http://192.168.3.150:7474
+          username: neo4j
+          password: 12345678
+          #定义初始连接数
+          initialSize: 0
+          #定义最大连接数
+          maxActive: 20
+          #定义最大空闲
+          maxIdle: 20
+          #定义最小空闲
+          minIdle: 1
+          #定义最长等待时间
+          maxWait: 60000
+        mysql:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          platform: mysql
+          url: jdbc:mysql://192.168.2.236:3306/sys-ltkg?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+          username: root
+          password: lantone
+
 
   cloud:
     stream:
@@ -48,6 +60,35 @@ mybatis:
   type-aliases-package: com.diagbot.entity
   mapper-locations: classpath:mapper/**/*.xml
 
+#mybatis-plus
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+
 nlprel:
   server:
     address: http://192.168.3.150:3456

+ 54 - 14
config-server/src/main/resources/shared/ltkg-service-local.yml

@@ -6,20 +6,31 @@ spring:
   profiles:
     active: local
   datasource:
-    driver-class-name: org.neo4j.jdbc.Driver
-    url: jdbc:neo4j:http://192.168.3.150:7474
-    username: neo4j
-    password: 12345678
-    #定义初始连接数
-    initialSize: 0
-    #定义最大连接数
-    maxActive: 20
-    #定义最大空闲
-    maxIdle: 20
-    #定义最小空闲
-    minIdle: 1
-    #定义最长等待时间
-    maxWait: 60000
+    dynamic:
+      primary: neo4j
+      # 数据库配置
+      datasource:
+        neo4j:
+          driver-class-name: org.neo4j.jdbc.Driver
+          url: jdbc:neo4j:http://192.168.3.150:7474
+          username: neo4j
+          password: 12345678
+          #定义初始连接数
+          initialSize: 0
+          #定义最大连接数
+          maxActive: 20
+          #定义最大空闲
+          maxIdle: 20
+          #定义最小空闲
+          minIdle: 1
+          #定义最长等待时间
+          maxWait: 60000
+        mysql:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          platform: mysql
+          url: jdbc:mysql://192.168.2.236:3306/sys-ltkg?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+          username: root
+          password: lantone
 
   cloud:
     stream:
@@ -48,6 +59,35 @@ mybatis:
   type-aliases-package: com.diagbot.entity
   mapper-locations: classpath:mapper/**/*.xml
 
+#mybatis-plus
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+
 nlprel:
   server:
     address: http://192.168.3.150:3456

+ 55 - 14
config-server/src/main/resources/shared/ltkg-service-pre.yml

@@ -6,20 +6,32 @@ spring:
   profiles:
     active: local
   datasource:
-    driver-class-name: org.neo4j.jdbc.Driver
-    url: jdbc:neo4j:http://192.168.3.150:7474
-    username: neo4j
-    password: 12345678
-    #定义初始连接数
-    initialSize: 0
-    #定义最大连接数
-    maxActive: 20
-    #定义最大空闲
-    maxIdle: 20
-    #定义最小空闲
-    minIdle: 1
-    #定义最长等待时间
-    maxWait: 60000
+    dynamic:
+      primary: neo4j
+      # 数据库配置
+      datasource:
+        neo4j:
+          driver-class-name: org.neo4j.jdbc.Driver
+          url: jdbc:neo4j:http://192.168.3.150:7474
+          username: neo4j
+          password: 12345678
+          #定义初始连接数
+          initialSize: 0
+          #定义最大连接数
+          maxActive: 20
+          #定义最大空闲
+          maxIdle: 20
+          #定义最小空闲
+          minIdle: 1
+          #定义最长等待时间
+          maxWait: 60000
+        mysql:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          platform: mysql
+          url: jdbc:mysql://192.168.2.121:3306/sys-ltkg?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+          username: teamback
+          password: goTulmLeon
+
 
   cloud:
     stream:
@@ -48,6 +60,35 @@ mybatis:
   type-aliases-package: com.diagbot.entity
   mapper-locations: classpath:mapper/**/*.xml
 
+#mybatis-plus
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+
 nlprel:
   server:
     address: http://192.168.3.150:3456

+ 55 - 14
config-server/src/main/resources/shared/ltkg-service-pro.yml

@@ -6,20 +6,32 @@ spring:
   profiles:
     active: local
   datasource:
-    driver-class-name: org.neo4j.jdbc.Driver
-    url: jdbc:neo4j:http://192.168.3.150:7474
-    username: neo4j
-    password: 12345678
-    #定义初始连接数
-    initialSize: 0
-    #定义最大连接数
-    maxActive: 20
-    #定义最大空闲
-    maxIdle: 20
-    #定义最小空闲
-    minIdle: 1
-    #定义最长等待时间
-    maxWait: 60000
+    dynamic:
+      primary: neo4j
+      # 数据库配置
+      datasource:
+        neo4j:
+          driver-class-name: org.neo4j.jdbc.Driver
+          url: jdbc:neo4j:http://192.168.3.150:7474
+          username: neo4j
+          password: 12345678
+          #定义初始连接数
+          initialSize: 0
+          #定义最大连接数
+          maxActive: 20
+          #定义最大空闲
+          maxIdle: 20
+          #定义最小空闲
+          minIdle: 1
+          #定义最长等待时间
+          maxWait: 60000
+        mysql:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          platform: mysql
+          url: jdbc:mysql://192.168.2.122:3306/sys-ltkg?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+          username: root
+          password: lantone
+
 
   cloud:
     stream:
@@ -48,6 +60,35 @@ mybatis:
   type-aliases-package: com.diagbot.entity
   mapper-locations: classpath:mapper/**/*.xml
 
+#mybatis-plus
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+
 nlprel:
   server:
     address: http://192.168.3.150:3456

+ 55 - 14
config-server/src/main/resources/shared/ltkg-service-test.yml

@@ -6,20 +6,32 @@ spring:
   profiles:
     active: local
   datasource:
-    driver-class-name: org.neo4j.jdbc.Driver
-    url: jdbc:neo4j:http://192.168.3.150:7474
-    username: neo4j
-    password: 12345678
-    #定义初始连接数
-    initialSize: 0
-    #定义最大连接数
-    maxActive: 20
-    #定义最大空闲
-    maxIdle: 20
-    #定义最小空闲
-    minIdle: 1
-    #定义最长等待时间
-    maxWait: 60000
+    dynamic:
+      primary: neo4j
+      # 数据库配置
+      datasource:
+        neo4j:
+          driver-class-name: org.neo4j.jdbc.Driver
+          url: jdbc:neo4j:http://192.168.3.150:7474
+          username: neo4j
+          password: 12345678
+          #定义初始连接数
+          initialSize: 0
+          #定义最大连接数
+          maxActive: 20
+          #定义最大空闲
+          maxIdle: 20
+          #定义最小空闲
+          minIdle: 1
+          #定义最长等待时间
+          maxWait: 60000
+        mysql:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          platform: mysql
+          url: jdbc:mysql://192.168.2.241:3306/sys-ltkg?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+          username: root
+          password: lantone
+
 
   cloud:
     stream:
@@ -48,6 +60,35 @@ mybatis:
   type-aliases-package: com.diagbot.entity
   mapper-locations: classpath:mapper/**/*.xml
 
+#mybatis-plus
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+
 nlprel:
   server:
     address: http://192.168.3.150:3456

+ 40 - 0
ltkg-service/pom.xml

@@ -145,6 +145,46 @@
             <artifactId>caffeine</artifactId>
         </dependency>
 
+        <!-- mybatis-plus begin -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+        </dependency>
+        <!-- mybatis-plus end -->
+
+        <!--&lt;!&ndash; 阿里巴巴druid数据库连接池 &ndash;&gt;-->
+        <!--<dependency>-->
+            <!--<groupId>com.alibaba</groupId>-->
+            <!--<artifactId>druid-spring-boot-starter</artifactId>-->
+        <!--</dependency>-->
+
+        <!-- springboot整合mybatis(核心就这一个) -->
+        <!-- 注意顺序,这个一定要放在最下面 -->
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>${mybatis-spring-boot.version}</version>
+        </dependency>
+
+        <!--多数据源-->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+            <version>3.0.0</version>
+        </dependency>
+
+        <!--mysql-database-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 1 - 1
ltkg-service/src/main/java/com/diagbot/LtkgServiceApplication.java

@@ -20,7 +20,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
  * @author: gaodm
  * @time: 2018/8/7 9:26
  */
-@SpringBootApplication(exclude = { HibernateJpaAutoConfiguration.class,
+@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
         JmxAutoConfiguration.class, ThymeleafAutoConfiguration.class })
 @EnableEurekaClient
 @EnableFeignClients({ "com.diagbot.client" })

+ 33 - 0
ltkg-service/src/main/java/com/diagbot/config/MybatisPlusConfigurer.java

@@ -0,0 +1,33 @@
+package com.diagbot.config;
+
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+/**
+ * @Description: MybatisPlus配置类
+ * @author: gaodm
+ * @time: 2018/8/2 13:39
+ */
+@EnableTransactionManagement
+@Configuration
+@MapperScan("com.diagbot.mapper*")//这个注解,作用相当于下面的@Bean MapperScannerConfigurer,2者配置1份即可
+public class MybatisPlusConfigurer {
+
+    /**
+     * mybatis-plus分页插件<br>
+     * 文档:http://mp.baomidou.com<br>
+     */
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
+        // 设置请求的页面大于最大页后操作,true调回到首页,false继续请求,默认false
+        //paginationInterceptor.setOverflow(false);
+        // 设置最大单页限制数量,默认500条,-1不受限制
+        paginationInterceptor.setLimit(500L);
+        return paginationInterceptor;
+    }
+
+}

+ 23 - 0
ltkg-service/src/main/java/com/diagbot/dto/MrInfoDTO.java

@@ -0,0 +1,23 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/3/30 17:13
+ */
+@Getter
+@Setter
+public class MrInfoDTO {
+    /**
+     * 标题
+     */
+    private String title;
+
+    /**
+     * 内容
+     */
+    private String content;
+}

+ 159 - 0
ltkg-service/src/main/java/com/diagbot/entity/PresetInfo.java

@@ -0,0 +1,159 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 知识平台预设信息
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-03-31
+ */
+@TableName("ltkg_preset_info")
+public class PresetInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 类型 (0:默认,1:病历,20:疾病ICD10)
+     */
+    private Integer type;
+
+    /**
+     * 标题
+     */
+    private String title;
+
+    /**
+     * 内容
+     */
+    private String content;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public LocalDateTime getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(LocalDateTime gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public LocalDateTime getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(LocalDateTime gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "PresetInfo{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", type=" + type +
+            ", title=" + title +
+            ", content=" + content +
+            ", remark=" + remark +
+        "}";
+    }
+}

+ 29 - 0
ltkg-service/src/main/java/com/diagbot/facade/PresetInfoFacade.java

@@ -0,0 +1,29 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.MrInfoDTO;
+import com.diagbot.entity.PresetInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.PresetInfoServiceImpl;
+import com.diagbot.util.BeanUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/3/31 9:16
+ */
+@Component
+public class PresetInfoFacade extends PresetInfoServiceImpl {
+    public List<MrInfoDTO> getMrInfo() {
+        List<MrInfoDTO> mrInfoDTOList = new ArrayList<>();
+        List<PresetInfo> mrInfoList = this.list(new QueryWrapper<PresetInfo>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("type", 1));
+        mrInfoDTOList = BeanUtil.listCopyTo(mrInfoList, MrInfoDTO.class);
+        return mrInfoDTOList;
+    }
+}

+ 16 - 0
ltkg-service/src/main/java/com/diagbot/mapper/PresetInfoMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.PresetInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 知识平台预设信息 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-03-31
+ */
+public interface PresetInfoMapper extends BaseMapper<PresetInfo> {
+
+}

+ 18 - 0
ltkg-service/src/main/java/com/diagbot/service/PresetInfoService.java

@@ -0,0 +1,18 @@
+package com.diagbot.service;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.diagbot.entity.PresetInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 知识平台预设信息 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-03-31
+ */
+@DS("mysql")
+public interface PresetInfoService extends IService<PresetInfo> {
+
+}

+ 20 - 0
ltkg-service/src/main/java/com/diagbot/service/impl/PresetInfoServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.PresetInfo;
+import com.diagbot.mapper.PresetInfoMapper;
+import com.diagbot.service.PresetInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 知识平台预设信息 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-03-31
+ */
+@Service
+public class PresetInfoServiceImpl extends ServiceImpl<PresetInfoMapper, PresetInfo> implements PresetInfoService {
+
+}

+ 39 - 0
ltkg-service/src/main/java/com/diagbot/web/PresetInfoController.java

@@ -0,0 +1,39 @@
+package com.diagbot.web;
+
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.MrInfoDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.PresetInfoFacade;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 知识平台预设信息 前端控制器
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-03-31
+ */
+@RestController
+@RequestMapping("/presetInfo")
+@Api(value = "知识平台预设信息API", tags = { "知识平台预设信息API" })
+@SuppressWarnings("unchecked")
+public class PresetInfoController {
+    @Autowired
+    private PresetInfoFacade presetInfoFacade;
+
+    @ApiOperation(value = "获取所有预设病历", notes = "获取所有预设病历")
+    @PostMapping("/getMrInfo")
+    @SysLogger("getMrInfo")
+    public RespDTO<List<MrInfoDTO>> getMrInfo() {
+        return RespDTO.onSuc(presetInfoFacade.getMrInfo());
+    }
+}

+ 19 - 0
ltkg-service/src/main/resources/mapper/PresetInfoMapper.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.PresetInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.PresetInfo">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="type" property="type" />
+        <result column="title" property="title" />
+        <result column="content" property="content" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>

+ 83 - 83
ltkg-service/src/test/java/com/diagbot/CodeGeneration.java

@@ -1,83 +1,83 @@
-//package com.diagbot;
-//
-//import com.baomidou.mybatisplus.annotation.DbType;
-//import com.baomidou.mybatisplus.generator.AutoGenerator;
-//import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
-//import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-//import com.baomidou.mybatisplus.generator.config.PackageConfig;
-//import com.baomidou.mybatisplus.generator.config.StrategyConfig;
-//import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-//import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
-//
-///**
-// * @Description: 代码生成器
-// * @author: gaodm
-// * @time: 2018/8/2 10:15
-// */
-//public class CodeGeneration {
-//
-//    /**
-//     *
-//     * @Title: main
-//     * @Description: 生成
-//     * @param args
-//     */
-//    public static void main(String[] args) {
-//        AutoGenerator mpg = new AutoGenerator();
-//
-//        // 全局配置
-//        GlobalConfig gc = new GlobalConfig();
-//        gc.setOutputDir("E://code//feedbackservice");
-//        gc.setFileOverride(true);
-//        gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false
-//        gc.setEnableCache(false);// XML 二级缓存
-//        gc.setBaseResultMap(true);// XML ResultMap
-//        gc.setBaseColumnList(false);// XML columList
-//        gc.setAuthor("gaodm");// 作者
-//
-//        // 自定义文件命名,注意 %s 会自动填充表实体属性!
-//        gc.setControllerName("%sController");
-//        gc.setServiceName("%sService");
-//        gc.setServiceImplName("%sServiceImpl");
-//        gc.setMapperName("%sMapper");
-//        gc.setXmlName("%sMapper");
-//        mpg.setGlobalConfig(gc);
-//
-//        // 数据源配置
-//        DataSourceConfig dsc = new DataSourceConfig();
-//        dsc.setDbType(DbType.MYSQL);
-//        dsc.setDriverName("com.mysql.cj.jdbc.Driver");
-//        dsc.setUsername("root");
-//        dsc.setPassword("root");
-//        dsc.setUrl("jdbc:mysql://127.0.0.1:3306/sys-log?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
-//        mpg.setDataSource(dsc);
-//
-//        // 策略配置
-//        StrategyConfig strategy = new StrategyConfig();
-////        strategy.setTablePrefix(new String[] { "sys_" });// 此处可以修改为您的表前缀
-//        strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-//        strategy.setInclude(new String[] { "sys_log" }); // 需要生成的表
-//
-//        strategy.setSuperServiceClass(null);
-//        strategy.setSuperServiceImplClass(null);
-//        strategy.setSuperMapperClass(null);
-//
-//        mpg.setStrategy(strategy);
-//
-//        // 包配置
-//        PackageConfig pc = new PackageConfig();
-//        pc.setParent("com.diagbot");
-//        pc.setController("web");
-//        pc.setService("service");
-//        pc.setServiceImpl("service.impl");
-//        pc.setMapper("mapper");
-//        pc.setEntity("entity");
-//        pc.setXml("resources.mapper");
-//        mpg.setPackageInfo(pc);
-//
-//        // 执行生成
-//        mpg.setTemplateEngine(new FreemarkerTemplateEngine());
-//        mpg.execute();
-//
-//    }
-//}
+package com.diagbot;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
+import com.baomidou.mybatisplus.generator.config.GlobalConfig;
+import com.baomidou.mybatisplus.generator.config.PackageConfig;
+import com.baomidou.mybatisplus.generator.config.StrategyConfig;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
+
+/**
+ * @Description: 代码生成器
+ * @author: gaodm
+ * @time: 2018/8/2 10:15
+ */
+public class CodeGeneration {
+
+    /**
+     *
+     * @Title: main
+     * @Description: 生成
+     * @param args
+     */
+    public static void main(String[] args) {
+        AutoGenerator mpg = new AutoGenerator();
+
+        // 全局配置
+        GlobalConfig gc = new GlobalConfig();
+        gc.setOutputDir("E://code//ltkgservice");
+        gc.setFileOverride(true);
+        gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false
+        gc.setEnableCache(false);// XML 二级缓存
+        gc.setBaseResultMap(true);// XML ResultMap
+        gc.setBaseColumnList(false);// XML columList
+        gc.setAuthor("gaodm");// 作者
+
+        // 自定义文件命名,注意 %s 会自动填充表实体属性!
+        gc.setControllerName("%sController");
+        gc.setServiceName("%sService");
+        gc.setServiceImplName("%sServiceImpl");
+        gc.setMapperName("%sMapper");
+        gc.setXmlName("%sMapper");
+        mpg.setGlobalConfig(gc);
+
+        // 数据源配置
+        DataSourceConfig dsc = new DataSourceConfig();
+        dsc.setDbType(DbType.MYSQL);
+        dsc.setDriverName("com.mysql.cj.jdbc.Driver");
+        dsc.setUsername("root");
+        dsc.setPassword("lantone");
+        dsc.setUrl("jdbc:mysql://192.168.2.236:3306/sys-ltkg?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
+        mpg.setDataSource(dsc);
+
+        // 策略配置
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setTablePrefix(new String[] { "ltkg_" });// 此处可以修改为您的表前缀
+        strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
+        strategy.setInclude(new String[] { "ltkg_preset_info" }); // 需要生成的表
+
+        strategy.setSuperServiceClass(null);
+        strategy.setSuperServiceImplClass(null);
+        strategy.setSuperMapperClass(null);
+
+        mpg.setStrategy(strategy);
+
+        // 包配置
+        PackageConfig pc = new PackageConfig();
+        pc.setParent("com.diagbot");
+        pc.setController("web");
+        pc.setService("service");
+        pc.setServiceImpl("service.impl");
+        pc.setMapper("mapper");
+        pc.setEntity("entity");
+        pc.setXml("resources.mapper");
+        mpg.setPackageInfo(pc);
+
+        // 执行生成
+        mpg.setTemplateEngine(new FreemarkerTemplateEngine());
+        mpg.execute();
+
+    }
+}