在IDEA中使用groovy脚本生成POJO

news2024/10/6 8:24:13

步骤1:打开Database窗格,新建数据库连接

 数据库连接默认只是当前工程使用,想要所有IDEA窗口共享

步骤2:编辑groovy脚本

步骤3:选择一张或多张表,生成代码

生成效果

:groovy脚本

import com.intellij.database.model.DasTable
import com.intellij.database.model.ObjectKind
import com.intellij.database.util.Case
import com.intellij.database.util.DasUtil


import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

config = [
        impSerializable  : true,
        extendBaseEntity : false,
        extendBaseService: true,
        useLombok        : true, // 使用注解,不生成get、set方法
        ModelNotNULL     : true, // 空值不返回注解
        ModelDate        : true, // 日期类格式注解
        baseMethods      : true, // ServiceImpl生成基础方法

        generateItem     : [
                "Entity",
                "Service",
                "ServiceImpl",
                "Repository",
                "RepositoryCustom",
                "RepositoryImpl",
                "Controller",
                "SOA",
                "Constants",
                "Config",
        ]
]


baseEntityProperties = ["id", "CreatedOn", "LastChangedOn", "version"]

typeMapping = [
        (~/(?i)bool|boolean|tinyint/)     : "Boolean",
        (~/(?i)bigint/)                   : "Long",
        (~/int/)                          : "Integer",
        (~/(?i)float|double|decimal|real|numeric/): "java.math.BigDecimal",
        (~/(?i)datetime|timestamp/)       : "java.util.Date",
        (~/(?i)date/)                     : "java.util.Date",
        (~/(?i)time/)                     : "java.sql.Time",
        (~/(?i)/)                         : "String"
]

FILES.chooseDirectoryAndSave("Choose directory", "Choose where to store generated files") { dir ->
    SELECTION.filter {
        it instanceof DasTable && it.getKind() == ObjectKind.TABLE
    }.each {
        generate(it, dir)
    }
}

// 生成对应的文件
def generate(table, dir) {

    def entityPath = "${dir.toString()}\\entity",
        servicePath = "${dir.toString()}\\service",
        serviceImplPath = "${dir.toString()}\\service\\impl",
        repPath = "${dir.toString()}\\dao",
        controllerPath = "${dir.toString()}\\controller",
        constantsPath = "${dir.toString()}\\constants",
        configPath = "${dir.toString()}\\config"

    mkdirs([entityPath, servicePath, serviceImplPath, repPath, controllerPath, constantsPath, configPath])

    System.out.println(table.getName())
    def entityName = javaName(table.getName(), true)
    def fields = calcFields(table)
    def basePackage = clacBasePackage(dir)

    if (isGenerate("Entity")) {
        genUTF8FileEntity(entityPath, "${entityName}.java").withPrintWriter { out -> genEntity(out, table, entityName, fields, basePackage) }
    }
    if (isGenerate("Service")) {
        // genUTF8FileOtherEntity(servicePath, "${entityName}Service.java").withPrintWriter { out -> genService(out, table, entityName, fields, basePackage) }
    }
    if (isGenerate("ServiceImpl")) {
        // genUTF8FileOtherEntity(serviceImplPath, "${entityName}ServiceImpl.java").withPrintWriter { out -> genServiceImpl(out, table, entityName, fields, basePackage) }
    }
    if (isGenerate("Repository")) {
        genUTF8FileOtherEntity(repPath, "${entityName}Repository.java").withPrintWriter { out -> genRepository(out, table, entityName, fields, basePackage) }
    }

    if (isGenerate("Controller")) {
        //genUTF8FileOtherEntity(controllerPath, "${entityName}Controller.java").withPrintWriter { out -> genController(out, table, entityName, fields, basePackage) }
    }
    if (isGenerate("Constants")) {
        // genUTF8FileOtherEntity(controllerPath, "${entityName}Controller.java").withPrintWriter { out -> genConstants(out, table, entityName, fields, basePackage) }
    }
    if (isGenerate("Config")) {
        //genUTF8FileOtherEntity(controllerPath, "${entityName}Controller.java").withPrintWriter { out -> genSOA(out, table, entityName, fields, basePackage) }
    }

}

// 是否需要被生成
def isGenerate(itemName) {
    config.generateItem.contains(itemName)
}

// 指定文件编码方式,防止中文注释乱码
def genUTF8FileEntity(dir, fileName) {
    new PrintWriter(new OutputStreamWriter(new FileOutputStream(new File(dir, fileName)), "utf-8"))
}

def genUTF8FileOtherEntity(dir, fileName) {
    new PrintWriter(new OutputStreamWriter(new FileOutputStream(new File(dir, fileName)), "utf-8"))

}
// 生成每个字段
def genProperty(out, field) {

    out.println ""

    if (field.comment != null || field.default != null) {

        out.println "    /**"
        if (field.comment != null) {
            out.println "    * ${field.comment}"
        }
        if (field.default != null) {
            out.println "    * Default Values: ${field.default}"
        }
        out.println "    */"
    }


    // 默认表的第一个字段为主键
    if (field.name == "id") {
        // 不继承父类
        out.println "    @Id"
        //out.println "    @GeneratedValue(generator =\"uuid\")"
        //out.println "    @GenericGenerator(name = \"uuid\", strategy = \"uuid2\")"

    }
    if (field.colum == "CreatedOn") {
        out.println "    @Temporal(TemporalType.TIMESTAMP)"
        out.println "    @org.hibernate.annotations.CreationTimestamp"
    }
    if (field.colum == "LastChangedOn") {
        out.println "    @Temporal(TemporalType.TIMESTAMP)"
        out.println "    @org.hibernate.annotations.UpdateTimestamp"
    }
    if (field.colum == "Version") {
        out.println "    @Temporal(TemporalType.TIMESTAMP)"
        out.println "    @org.hibernate.annotations.UpdateTimestamp"
    }
    // 日期类加上注解
    if (field.dataType == "datetime" || field.dataType == "timestamp") {
        if (config.ModelDate) {
            out.println "    @JsonFormat(pattern=\"yyyy-MM-dd HH:mm:ss\")"
        }
    }
    if (field.type == "String") {
        if (field.dataType == "varchar") {
            // 枚举不需要长度
            out.println "    @Column(name = \"${field.colum}\", nullable = ${!field.isNotNull}${field.dataType == "enum" ? "" : field.dataType == "datetime" || field.dataType == "timestamp" ? "" : ", length = $field.len"})"
        } else if (field.dataType == "varchar2") {
            // 枚举不需要长度
            def varchen = field.varlen.replaceAll("VARCHAR2", "").replaceAll(/[^\d]/, "");
            out.println "    @Column(name = \"${field.colum}\", nullable = ${!field.isNotNull}${field.dataType == "enum" ? "" : field.dataType == "datetime" || field.dataType == "timestamp" ? "" : ", length = $varchen"})"
        } else {
            // 枚举不需要长度
            out.println "    @Column(name = \"${field.colum}\", nullable = ${!field.isNotNull}${field.dataType == "enum" ? "" : field.dataType == "datetime" || field.dataType == "timestamp" ? "" : ", length = $field.len"})"
        }

    } else {
        out.println "    @Column(name = \"${field.colum}\", nullable = ${!field.isNotNull})"
    }
    out.println "    private ${field.type} ${field.name};"
}

// 生成get、get方法
def genGetSet(out, field) {

    // get
    out.println "    "
    out.println "    public ${field.type} get${field.name.substring(0, 1).toUpperCase()}${field.name.substring(1)}() {"
    out.println "        return this.${field.name};"
    out.println "    }"

    // set
    out.println "    "
    out.println "    public void set${field.name.substring(0, 1).toUpperCase()}${field.name.substring(1)}(${field.type} ${field.name}) {"
    out.println "        this.${field.name} = ${field.name};"
    out.println "    }"
}

// 生成实体类
def genEntity(out, table, entityName, fields, basePackage) {
    out.println "/**"
    out.println " * 文件名: ${entityName}.java"
    out.println " * 版权: Copyright 2017-2023 Xxx All Rights Reserved."
    out.println " * 描述: Xxx系统"
    out.println " */"
    out.println "package ${basePackage}.entity;"
    out.println ""
    if (config.extendBaseEntity) {
        out.println "import $baseEntityPackage;"
    }
    if (config.useLombok) {
        out.println "import lombok.Data;"
        out.println ""
    }
    if (config.impSerializable) {
        out.println "import java.io.Serializable;"
        out.println ""
    }

    out.println "import javax.persistence.*;"
    if (config.ModelNotNULL) {
        out.println "import com.fasterxml.jackson.annotation.JsonInclude;"
    }
    if (config.ModelDate) {
        out.println "import com.fasterxml.jackson.annotation.JsonFormat;"
    }
    out.println "import org.hibernate.annotations.GenericGenerator;"

    out.println "/** "
    out.println " * @ClassName: $entityName"
    out.println " * @Description: ${table.getName()}表Entity类"
    out.println " * @author: wsdhla"
    out.println " * @date: " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yy-MM-dd HH:mm:ss")).toString() + ""
    out.println " */"
    if (config.useLombok) {
        out.println "@Data"
    }
    if (config.ModelNotNULL) {
        out.println "@JsonInclude(JsonInclude.Include.NON_NULL)"
    }
    out.println "@Entity"
    out.println "@Table(name = \"${table.getName()}\")"
    out.println "public class $entityName${config.extendBaseEntity ? " extends BaseEntity" : ""}${config.impSerializable ? " implements Serializable" : ""} {"

    if (config.extendBaseEntity) {
        fields = fields.findAll { it ->
            !baseEntityProperties.any { it1 -> it1 == it.name }
        }
    }

    fields.each() {
        genProperty(out, it)
    }

    if (!config.useLombok) {
        fields.each() {
            genGetSet(out, it)
        }
    }
    out.println "}"
}

// 生成Service
def genService(out, table, entityName, fields, basePackage) {
    out.println "/**"
    out.println " * 文件名: ${entityName}.java"
    out.println " * 版权: Copyright 2017-2023 Xxx All Rights Reserved."
    out.println " * 描述: Xxx系统"
    out.println " */"
    out.println "package ${basePackage}.service;"
    out.println ""
    // if (config.extendBaseService) {
    //   out.println "import $baseServicePackage;"
    out.println "import ${basePackage}.entity.$entityName;"
//  }
    out.println ""
    out.println ""
    out.println "/** "
    out.println " * @ClassName: $entityName"
    out.println " * @Description: ${entityName} Service"
    out.println " * @author: wsdhla"
    out.println " * @date: " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yy-MM-dd HH:mm:ss")).toString() + ""
    out.println " */"
    out.println "@Repository"
    out.println "public interface ${entityName}Service {"
    out.println ""

    out.println ""
    out.println "}"
}

// 生成ServiceImpl
def genServiceImpl(out, table, entityName, fields, basePackage) {
    out.println "/**"
    out.println " * 文件名: ${entityName}.java"
    out.println " * 版权: Copyright 2017-2023 Xxx All Rights Reserved."
    out.println " * 描述: Xxx系统"
    out.println " */"
    out.println "package ${basePackage}.service.impl;"
    out.println ""
    out.println "import ${basePackage}.repository.${entityName}Repository;"
    out.println "import ${basePackage}.service.${entityName}Service;"
    out.println "import ${basePackage}.entity.$entityName;"
    if (config.baseMethods) {
        out.println "import java.util.List;"
        out.println "import org.springframework.transaction.annotation.Transactional;"
        out.println "import org.springframework.data.domain.*;"
        out.println "import java.util.Optional;"
    }
    out.println "import org.springframework.stereotype.Service;"
    out.println "import java.util.Optional;"
    out.println "import javax.annotation.Resource;"
    out.println ""
    out.println "/** "
    out.println " * @ClassName: $entityName"
    out.println " * @Description: ${entityName}Service实现类"
    out.println " * @author: wsdhla"
    out.println " * @date: " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yy-MM-dd HH:mm:ss")).toString() + ""
    out.println " */"
    out.println "@Service"
    out.println "public class ${entityName}ServiceImpl implements ${entityName}Service {"
    out.println ""
    out.println "    @Resource"
    out.println "    private ${entityName}Repository rep;"
    out.println ""
    out.println ""
    out.println "}"
}

// 生成Repository
def genRepository(out, table, entityName, fields, basePackage) {
    out.println "/**"
    out.println " * 文件名: ${entityName}Repository.java"
    out.println " * 版权: Copyright 2017-2023 Xxx All Rights Reserved."
    out.println " * 描述: Xxx系统"
    out.println " */"
    out.println "package ${basePackage}.dao;"
    out.println ""
    out.println "import ${basePackage}.entity.$entityName;"
    out.println "import org.springframework.data.jpa.repository.JpaRepository;"
    out.println "import org.springframework.stereotype.Repository;"
    out.println ""
    out.println "/** "
    out.println " * @ClassName: ${entityName}Repository"
    out.println " * @Description: ${entityName} Repository"
    out.println " * @author: wsdhla"
    out.println " * @date: " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yy-MM-dd HH:mm:ss")).toString() + ""
    out.println " */"
    out.println "@Repository"
    out.println "public interface ${entityName}Repository extends JpaRepository<$entityName, String> {}"
    out.println ""

}

// 生成RepositoryCustom
def genRepositoryCustom(out, entityName, basePackage) {
    out.println "/**"
    out.println " * 文件名: ${entityName}.java"
    out.println " * 版权: Copyright 2017-2023 Xxx All Rights Reserved."
    out.println " * 描述: Xxx系统"
    out.println " */"
    out.println "package ${basePackage}.dao;"
    out.println ""
    out.println "/** "
    out.println " * @ClassName: $entityName"
    out.println " * @Description: ${entityName} RepositoryCustom"
    out.println " * @author: wsdhla"
    out.println " * @date: " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yy-MM-dd HH:mm:ss")).toString() + ""
    out.println " */"
    out.println "public interface ${entityName}RepositoryCustom {"
    out.println ""
    out.println "}"
}

// 生成RepositoryImpl
def genRepositoryImpl(out, table, entityName, fields, basePackage) {
    out.println "/**"
    out.println " * 文件名: ${entityName}.java"
    out.println " * 版权: Copyright 2017-2023 Xxx All Rights Reserved."
    out.println " * 描述: Xxx系统"
    out.println " */"
    out.println "package ${basePackage}.repository.impl;"
    out.println ""
    out.println "import ${basePackage}.repository.${entityName}RepositoryCustom;"
    out.println "import org.springframework.stereotype.Repository;"
    out.println ""
    out.println "import javax.persistence.EntityManager;"
    out.println "import javax.persistence.PersistenceContext;"
    out.println ""
    out.println "/** "
    out.println " * @ClassName: $entityName"
    out.println " * @Description: ${entityName}RepositoryCustom实现类"
    out.println " * @author: wsdhla"
    out.println " * @date: " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yy-MM-dd HH:mm:ss")).toString() + ""
    out.println " */"
    out.println "@Repository"
    out.println "public class ${entityName}RepositoryImpl implements ${entityName}RepositoryCustom {"
    out.println ""
    out.println "    @PersistenceContext"
    out.println "    private EntityManager em;"
    out.println "}"
}

// 生成Controller
def genController(out, table, entityName, fields, basePackage) {
    out.println "/**"
    out.println " * 文件名: ${entityName}.java"
    out.println " * 版权: Copyright 2017-2023 Xxx All Rights Reserved."
    out.println " * 描述: Xxx系统"
    out.println " */"
    out.println "package ${basePackage}.controller;"
    out.println ""
    out.println " import org.springframework.web.bind.annotation.*; "
    out.println ""
    out.println "/** "
    out.println " * @ClassName: $entityName"
    out.println " * @Description: ${entityName} Controller"
    out.println " * @author: wsdhla"
    out.println " * @date: " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yy-MM-dd HH:mm:ss")).toString() + ""
    out.println " */"
    out.println "@RestController"
    out.println "@RequestMapping(\"/\")"
    out.println "public class ${entityName}Controller {"
    out.println ""
    out.println "}"

}

// 生成文件夹
def mkdirs(dirs) {
    dirs.forEach {
        def f = new File(it)
        if (!f.exists()) {
            f.mkdirs()
        }
    }
}

def clacBasePackage(dir) {
    dir.toString()
            .replaceAll("^.+\\\\src\\\\main\\\\java\\\\", "")
            .replaceAll("\\\\", ".")
}

def isBaseEntityProperty(property) {
    baseEntityProperties.find { it == property } != null
}

// 转换类型
def calcFields(table) {
    DasUtil.getColumns(table).reduce([]) { fields, col ->

        def spec = Case.LOWER.apply(col.getDataType().getSpecification())
        def typeStr = typeMapping.find { p, t -> p.matcher(spec).find() }.value
        fields += [[
                           name     : javaName(col.getName(), false),
                           colum    : col.getName(),
                           type     : typeStr,
                           dataType : col.getDataType().toString().replaceAll(/\(.*\)/, "").toLowerCase(),
                           len      : col.getDataType().toString().replaceAll(/[^\d]/, ""),
                           default  : col.getDefault(),
                           comment  : col.getComment(),
                           isNotNull: col.isNotNull(),
                           position : col.getPosition(),
                           varlen   : col.getDataType().toString(),
                   ]]

    }
}

def javaName(str, capitalize) {
    def s = str.split(/(?<=[^\p{IsLetter}])/).collect { Case.LOWER.apply(it).capitalize() }
            .join("").replaceAll(/[^\p{javaJavaIdentifierPart}]/, "_").replaceAll(/_/, "")
    capitalize || s.length() == 1 ? s : Case.LOWER.apply(s[0]) + s[1..-1]
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/704609.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

POI合并单元格设置单元格样式

文章目录 设置居中设置背景颜色设置边框设置字体合并单元格实际使用运行效果 设置居中 CellStyle centerStyle wb.createCellStyle();centerStyle.setAlignment(HorizontalAlignment.CENTER); // 居中centerStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中设…

桐庐旅行|桐庐团建全攻略「两天一夜行程」

桐庐被《国家地理》评选为全球25个最佳旅行目的地之一 获评「中国最美县城」&#xff0c;热门综艺《向往的生活》拍摄地 浙江的山水精华尽在「桐庐」 今夏绝对不能错过的避暑胜地 交通信息 车程&#xff1a;杭州1.5h 、上海3h、宁波2.5H、南京3.5H 尖峰推荐目的地 深澳古村 始…

原来,这就是铁路隧道R型变压器的工作真相!

铁路作为我们日常交通的重要出行设备&#xff0c;其安全稳定性极为重要。高速铁路具有行车速度快、行车密度高、负荷分布密集、自动化程度高、要求安全、正点运行的特点。铁路隧道对电力系统的供电可靠性也有非常严格的要求。铁路隧道R型变压器在铁路隧道供电系统中的主要功能是…

【线程池】史上最全的ThreadPoolExecutor源码详解

目录 一、线程池框架 1.1 第一层结构 1.2 接口简介 1.3 核心实现类 1.4 辅助类 1.5 完成服务 二、ThreadPoolExecutor的成员属性和内部类 2.1 主要成员属性以及工具方法 2.2 五种内部类 2.2.1 拒绝策略内部类&#xff08;Policy&#xff09; 2.2.2 工作线程内部类&a…

八数码、解华容道(bfs,全局择先,A*搜索)

【问题描述】 题目6&#xff1a;数阵问题 每个局面是三行三列的数字方阵&#xff0c;每个位置为0-8的一个数码且互不相同&#xff0c;求从初始局面&#xff08;自己设定&#xff09;如何“最快”移动到终止局面&#xff08;自己设定&#xff09;。 移动规则&#xff1a;每次只…

【实战】 四、JWT、用户认证与异步请求(上) —— React17+React Hook+TS4 最佳实践,仿 Jira 企业级项目(四)

文章目录 一、项目起航&#xff1a;项目初始化与配置二、React 与 Hook 应用&#xff1a;实现项目列表三、TS 应用&#xff1a;JS神助攻 - 强类型四、JWT、用户认证与异步请求1.login2.middleware of json-server3.jira-dev-tool&#xff08;imooc-jira-tool&#xff09;安装问…

Onlyoffice安装步骤

使用docker安装Onlyoffice社区版 第X章 占位… 文章目录 使用docker安装Onlyoffice社区版说明一、系统需求二、安装步骤1.下载2.安装3.测试4. 升级为HTTPS协议4.1生成私钥4.2 生成CSR,即&#xff1a;证书签名请求文件4.3 使用私钥和CSR签署证书 未完&#xff0c;待续总结 说明…

【程序员面试金典】面试题 17.21. 直方图的水量

【程序员面试金典】面试题 17.21. 直方图的水量 题目描述解题思路 题目描述 描述&#xff1a;给定一个直方图(也称柱状图)&#xff0c;假设有人从上面源源不断地倒水&#xff0c;最后直方图能存多少水量?直方图的宽度为 1。 上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的直…

从数据取地址运算符 从地址取数据运算符* 数组函数传送三种方法

概念 a表示数据本身。 &a表示a对应的地址。 *a表示存a数据的地址。 #include<stdio.h> int main() { int a 10; int *b &a; int* d &a; int c *b; …

Spring Boot 中的 WebSocketSession 是什么,原理,如何使用

Spring Boot 中的 WebSocketSession 是什么&#xff0c;原理&#xff0c;如何使用 介绍 在现代 Web 应用程序中&#xff0c;实时通信是一个非常常见的需求。传统的 HTTP 协议是无法支持实时通信的&#xff0c;因为它是一种无状态协议&#xff0c;每次请求都是独立的&#xff0…

实现数据库版本的留言墙(表白墙)练习

目录 目标 1.创建工程 2.构建目录工程结构 3.设置编码格式 4.查看Maven的配置 6.导入HTML和JS&#xff0c;配置tomcat 7.测试网站是否可以正常访问 8.编写业务代码 目标&#xff1a; 1.熟练掌握前端向后端提交数据2.后端接收数据并校验3.通过JAVA代码进行数据库操作4.返回…

8、Redis哨兵(sentinel)

是什么? 吹哨人巡查监控后台master主机是否故障&#xff0c;如果故障了根据投票数 \textcolor{red}{投票数}投票数自动将某一个从库转换为新主库&#xff0c;继续对外服务 作用&#xff1a;俗称无人值守运维 能干嘛? 主从监控&#xff1a;监控主从redis库运行是否正常 消息…

云原生|kubernetes|离线化部署kubesphere(从网络插件开始记录)

前言&#xff1a; kubesphere的离线化部署指的是通过自己搭建的harbor私有仓库拉取镜像&#xff0c;完全不依赖于外部网络的方式部署。 我的kubernetes集群是一个单master节点&#xff0c;双工作节点&#xff0c;总计三个节点的版本为1.22.16的集群。 该集群只是初始化完成了…

华为、阿里巴巴、字节跳动 100+ Python 面试问题总结(一)

系列文章目录 个人简介&#xff1a;机电专业在读研究生&#xff0c;CSDN内容合伙人&#xff0c;博主个人首页 Python面试专栏&#xff1a;《Python面试》此专栏面向准备面试的2024届毕业生。欢迎阅读&#xff0c;一起进步&#xff01;&#x1f31f;&#x1f31f;&#x1f31f; …

如何在VirtualBox安装CentOS 7

一、简介VirtualBox VirtualBox 是一款开源虚拟机软件。VirtualBox 是由德国 Innotek 公司开发&#xff0c;由Sun Microsystems公司出品的软件&#xff0c;使用Qt编写&#xff0c;在 Sun 被 Oracle 收购后正式更名成 Oracle VM VirtualBox。Innotek 以 GNU General Public Lice…

6、多层感知机:数值稳定性和模型初始化

1、数值稳定性 考虑一个具有 L L L层、输入 x \mathbf{x} x和输出 o \mathbf{o} o的深层网络。每一层 l l l由变换 f l f_l fl​定义&#xff0c;该变换的参数为权重 W ( l ) \mathbf{W}^{(l)} W(l)&#xff0c;其隐藏变量是 h ( l ) \mathbf{h}^{(l)} h(l)&#xff08;令 h …

Java BaseDao

1.创建t_house、t_user、t_address表 t_house t_user表 t_address表 2.创建实体类 House类 User类 Address类 3.创建BaseDao工具类 4.创建HouseDao接口 5.创建HouseDaoImpl实现类 6.创建HouseService接口 7.创建HouseServiceImpl实现类 8.创建Test001测试类

kubectl详解之陈述式资源管理方法

目录 一、陈述式资源管理方法二、基本信息查看2.1 创建 kubectl create命令2.2 发布 kubectl expose命令2.3 service 的 type 类型2.4 K8s 如何查看 Pod 崩溃前的日志&#xff1f;2.5 更新 kubectl set 命令2.6 滚动更新详解2.7 回滚 kubectl rollout2.8 删除 kubectl delete 一…

用IPV6地址远程连接服务器端(Linux系统)

环境&#xff1a;centos7、防火墙放行、selinux放行 目的&#xff1a;用ipv6&#xff0c;ssh远程访问服务器 修改/etc/ssh/sshd_config&#xff08;记得重启服务&#xff09; 查看服务端的ipv6&#xff08;我有两张网卡&#xff0c;记住内网卡ens34的ipv6地址&#xff09; [r…

【解决openGauss安装后yum、ssh命令无法使用】

【解决openGauss安装后yum、ssh命令无法使用】 &#x1f53b; 一、操作系统及数据库版本&#x1f530; 1.1 操作系统版本&#x1f530; 1.2 openGauss数据库版本 &#x1f53b; 二、关于openGauss安装&#x1f53b; 三、问题详情&#x1f530; 3.1 使用yum命令报错&#x1f530…