Skip to content

快速开始

环境要求

最低需要java21,示例以spring-boot-4.x为例,但可以脱离spring-boot在单独java环境使用

maven配置

maven

xml
<dependencies>
    <dependency>
        <groupId>org.huiche</groupId>
        <artifactId>huiche-spring-boot-starter</artifactId>
        <version>${huiche.version}</version>
    </dependency>
</dependencies>

或使用bom(更推荐)

xml
<dependencies>
    <dependency>
        <groupId>org.huiche</groupId>
        <artifactId>huiche-spring-boot-starter</artifactId>
    </dependency>
</dependencies>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.huiche</groupId>
            <artifactId>huiche-bom</artifactId>
            <version>${huiche.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

然后就可以了. oh~还需要确保添加了数据库驱动,自行配置了jdbc-url

通用Dao

在需要的业务类中注入org.huiche.dao.Dao即可使用

java
@Autowired
private Dao dao;

public void helloworld() {
    List<Artist> list = dao.list(Artist.class);
}

说明

通用Dao类似ActiveRecord模式, 所有操作首先需要传入一个实体类的Class,内置覆盖了常用的增删改查操作,另外可创建每个实体类对应的EntityDao,更贴近使用习惯,点击下一页继续