Token导航 LogoToken导航TokenDH.com
效率只读clawhub未标认证来源可访问clear审计通过

sql-to-javaSQL TO Java 测试

Agent Skill

用于辅助 Java 项目开发、面向对象设计、Spring 生态、Maven 或 Gradle 依赖和后端工程实践。它适合让 Agent 分析类结构、设计接口、整理服务分层、生成测试或检查常见代码坏味道。使用时需要结合项目已有架构、包结构和依赖版本,不应只按通用教程改代码;涉及数据库、事务、并发或框架配置时,应先确认运行环境和回归测试范围。

总安装

4,560

周安装

190

GitHub Stars

公开资料未说明

下载量

1,520
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:sql-to-java(SQL TO Java 测试)
来源仓库:https://github.com/coder-myj/sql-to-java
安装命令:
openclaw skills install sql-to-java
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install sql-to-java

简介

按框架约定将 MySQL DDL 转为 Java 实体类。

  • 支持主流 Java 框架的字段映射规则。
  • 适用于后端模型和持久层代码生成。sql-to-java 属于效率类 Skill,可作为该场景下的辅助能力补充。
  • 需结合项目包结构和依赖版本进行调整。适用宿主包括 OpenClaw,接入前应确认版本、权限和运行环境要求。
  • 提升 Java 项目数据库模型开发速度。

SKILL.md

name
sql-to-java-entity
description
Convert MySQL CREATE TABLE statements to Java entity classes following framework conventions. Use when converting SQL DDL to Java entity definitions, generating ORM models from database schemas, or creating JPA/MyBatis-Plus entity classes from MySQL tables. Supports MySQL to Java type mapping, snake_case to camelCase conversion, and automatic annotation generation with MyBatis-Plus and JPA annotations.

SQL to Java Entity

Quick Start

Convert a MySQL CREATE TABLE statement to a Java entity class:

  1. Parse the CREATE TABLE statement to extract table name, columns, and constraints
  2. Map each MySQL column type to corresponding Java type
  3. Convert snake_case column names to camelCase field names
  4. Generate entity class with @TableName, @TableId, and JPA annotations
  5. Generate getter/setter methods

Configuration

Before generating the entity class, determine the following:

  • Package name: Ask the user for the target package (e.g., com.example.entity)
  • Base class: Ask if the entity should extend a base class
  • Annotation style: Confirm whether to use MyBatis-Plus annotations (default) or JPA annotations

If the user doesn't specify, use sensible defaults based on the project context.

Type Mapping

For complete MySQL to Java type mappings, see type_mappings.md.

Quick Reference

MySQLJavaNotes
INTInteger
BIGINTLong
VARCHARString
TEXTString
DATETIMELocalDateTimejava.time.LocalDateTime
TIMESTAMPLocalDateTimejava.time.LocalDateTime
TINYINT(1)Integer
DECIMALBigDecimaljava.math.BigDecimal

Column Name Conversion

Convert snake_case to camelCase:

user_name    → userName
created_at   → createdAt
user_id      → userId
is_active    → isActive

Class name conversion (PascalCase):

user_info    → UserInfo
order_detail → OrderDetail

Annotation Generation

MyBatis-Plus Annotations

ConstraintAnnotation
Table name@TableName("table_name")
Primary key@TableId(type = IdType.AUTO)
Column name@TableField("column_name") (only if different from field name)
Not mapped@TableField(exist = false)

JPA Annotations (if needed)

ConstraintAnnotation
Primary key@Id
Auto increment@GeneratedValue(strategy = GenerationType.IDENTITY)
Column name@Column(name = "column_name")
Not null@Column(nullable = false)
Unique@Column(unique = true)
Length@Column(length = 50)

Example

Input

CREATE TABLE `user_info` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL,
    `age` int DEFAULT NULL,
    `email` varchar(100) NOT NULL,
    `salary` decimal(10,2) DEFAULT NULL,
    `description` text,
    `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
    `is_active` tinyint(1) DEFAULT '1',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='User Table';

Output

package com.example.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@TableName("user_info")
public class UserInfo {

    @TableId(type = IdType.AUTO)
    private Long id;

    private String name;

    private Integer age;

    private String email;

    private BigDecimal salary;

    private String description;

    private LocalDateTime createdAt;

    private Integer isActive;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public BigDecimal getSalary() {
        return salary;
    }

    public void setSalary(BigDecimal salary) {
        this.salary = salary;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public Integer getIsActive() {
        return isActive;
    }

    public void setIsActive(Integer isActive) {
        this.isActive = isActive;
    }
}

Workflow

  1. Extract table info: Get table name, column definitions, constraints, comment
  2. Apply type mappings: See type_mappings.md for reference
  3. Generate class name: Convert snake_case table name to PascalCase
  4. Generate field names: Convert snake_case columns to camelCase
  5. Add annotations: Generate @TableName, @TableId, @TableField based on column attributes
  6. Generate getters/setters: Create standard getter and setter methods
  7. Add imports: Include necessary imports for types and annotations

Package Structure

Entity classes should be placed in a package specified by the user. Common conventions:

  • Generic project: com.{company}.{module}.entity or com.{company}.{module}.model

Class Comment

Use table comment as class comment:

/**
 * User Table
 */
@TableName("user_info")
public class UserInfo extends EntityBean {
}

Base Class

The entity may extend a framework base class if required:

  • Framework: May extend BaseEntity, AbstractEntity, or no base class

Primary Key Strategy

MySQL Column DefinitionIdType
AUTO_INCREMENTIdType.AUTO
Manual assignmentIdType.INPUT
UUIDIdType.ASSIGN_UUID
Snowflake algorithmIdType.ASSIGN_ID

Nullable Columns

For nullable columns (allows NULL), use wrapper types:

  • Integer instead of int
  • Long instead of long
  • Boolean instead of boolean

Important Notes

  1. Always use wrapper types (Integer, Long, Boolean) for nullable columns
  2. Use BigDecimal for DECIMAL/NUMERIC types to maintain precision
  3. Use LocalDateTime for DATETIME/TIMESTAMP types
  4. Table name in @TableName should match the actual database table name exactly
  5. The id field should use IdType.AUTO for auto-increment columns
  6. Generate complete getter/setter methods for all fields
  7. Follow framework conventions and package structure

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

90.63%
按下载量换算1,378

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills