Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/babyfish-ct/jimmer-doc into…
Browse files Browse the repository at this point in the history
… main
  • Loading branch information
babyfish-ct committed Dec 19, 2024
2 parents a293d56 + b56075d commit 768d7f0
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/quick-view/get-started/create-database.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The examples in this tutorial require the following four entity types:

This tutorial uses MySQL. Create a new SQL file `jimmer-demo.sql` with the following code:

```csharp
```sql title="jimmer-demo.sql"
create database jimmer_demo;
use jimmer_demo;

Expand Down
8 changes: 4 additions & 4 deletions docs/quick-view/get-started/define-entity.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Assume the entity package is "com.example.model". **Ignore associated properties
<Tabs groupId="language">
<TabItem value="java" label="Java">

```java title="Author.java"
```java title="Gender.java"
package com.example.model;

import org.babyfish.jimmer.sql.EnumItem;
Expand All @@ -210,7 +210,7 @@ Assume the entity package is "com.example.model". **Ignore associated properties

<TabItem value="kotlin" label="Kotlin">

```kotlin title="Author.kt"
```kotlin title="Gender.kt"
package com.example.model

import org.babyfish.jimmer.sql.EnumItem
Expand Down Expand Up @@ -325,8 +325,8 @@ package com.example.model;
@Entity
public interface Book {

...other properties omitted...

...other properties omitted...
// highlight-next-line
@ManyToOne
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import TabItem from '@theme/TabItem';

## 概念

随着页码的不断睁大,分页查询的效率会越来越低。为了解决这个问题,Jimmer支持了反排序优化。
随着页码的不断增大,分页查询的效率会越来越低。为了解决这个问题,Jimmer支持了反排序优化。

反排序优化必须在一下前提同时满足时才生效
反排序优化必须在以下前提同时满足时才生效

1. 此功能并不针对只关心页内数据而不关心分页前总行数的的查询,即`limit(limit, offset)`。必须是同时关心页内数据和总行数的查询。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ title: 创建数据库

本教程例子采用MySQL,新建SQL文件`jimmer-demo.sql`,代码如下

```csharp title="jimmer-demo.sql"
```sql title="jimmer-demo.sql"
create database jimmer_demo;
use jimmer_demo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ import TabItem from '@theme/TabItem';
</TabItem>
<TabItem value="kotlin" label="Kotlin">

```kotlin title="Book.kt"
```kotlin title="Author.kt"
package com.example.model

import org.babyfish.jimmer.sql.*
Expand Down Expand Up @@ -200,7 +200,7 @@ import TabItem from '@theme/TabItem';
<Tabs groupId="language">
<TabItem value="java" label="Java">

```java title="Author.java"
```java title="Gender.java"
package com.example.model;

import org.babyfish.jimmer.sql.EnumItem;
Expand All @@ -218,7 +218,7 @@ import TabItem from '@theme/TabItem';
</TabItem>
<TabItem value="kotlin" label="Kotlin">

```kotlin title="Book.kt"
```kotlin title="Gender.kt"
package com.example.model

import org.babyfish.jimmer.sql.EnumItem
Expand Down Expand Up @@ -265,7 +265,7 @@ import TabItem from '@theme/TabItem';
</TabItem>
<TabItem value="kotlin" label="Kotlin">

```kotlin title="Book.kt"
```kotlin title="TreeNode.kt"
package com.example.model

import org.babyfish.jimmer.sql.*
Expand Down Expand Up @@ -401,7 +401,7 @@ public interface BookStore {
</TabItem>
<TabItem value="kotlin" label="Kotlin">

```kotlin title="Book.kt"
```kotlin title="BookStore.kt"
package com.example.model

...省略导入语句...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Precompiler from '../../_shared/precompiler.mdx';
:::caution
注意,上面的代码,仅仅针对初次入门时项目结构没有切分的场景。

如果把实实体的定义剥离成一个独立项目、和其他数据层业务层开,这套代码生成器需要配置到实体定义项目中。
如果把实体的定义剥离成一个独立项目,和其他数据层业务层开,这套代码生成器需要配置到实体定义项目中。
为了保证实体定义项目的简单,原则上讲应该只添加一个最简单的的依赖:`jimmer-core`

Jimmer定义数据类型需要如下4个注解之一
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public interface BookStore {
interface BookStore {

@Id
@@GeneratedValue(strategy = GenerationType.IDENTITY)
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long

val name: String
Expand Down Expand Up @@ -208,4 +208,4 @@ enum class Gender { MALE, FEMALE }
```

</TabItem>
</Tabs>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Jimmer整合了spring data,为Java用户和Kotlin用户各自提供了一个Re

import org.babyfish.jimmer.spring.repository.JRepository;

public interface BookRepository extends JRepository<BookStore, Long> {}
public interface BookStoreRepository extends JRepository<BookStore, Long> {}
```

</TabItem>
Expand All @@ -51,7 +51,7 @@ Jimmer整合了spring data,为Java用户和Kotlin用户各自提供了一个Re

import org.babyfish.jimmer.spring.repository.KRepository

interface BookRepository : KRepository<BookStore, Long>
interface BookStoreRepository : KRepository<BookStore, Long>
```

</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import com.example.model.Book
import org.babyfish.jimmer.spring.repository.KRepository
import org.babyfish.jimmer.sql.kt.ast.expression.*

interface BookRepository : KRepository<BookStore, Long> {
interface BookRepository : KRepository<Book, Long> {

fun find(name: String? = null): List<Book> =
sql ❷
Expand Down Expand Up @@ -257,7 +257,7 @@ import com.example.model.Book
import org.babyfish.jimmer.spring.repository.KRepository
import org.babyfish.jimmer.sql.kt.ast.expression.*

interface BookRepository : KRepository<BookStore, Long> {
interface BookRepository : KRepository<Book, Long> {

fun find(
name: String? = null,
Expand Down Expand Up @@ -413,7 +413,7 @@ import com.example.model.Book
import org.babyfish.jimmer.spring.repository.KRepository
import org.babyfish.jimmer.sql.kt.ast.expression.*

interface BookRepository : KRepository<BookStore, Long> {
interface BookRepository : KRepository<Book, Long> {

fun find(
name: String? = null,
Expand Down Expand Up @@ -597,7 +597,7 @@ import org.babyfish.jimmer.spring.repository.orderBy
import org.babyfish.jimmer.sql.kt.ast.expression.*
import org.springframework.data.domain.Sort

interface BookRepository : KRepository<BookStore, Long> {
interface BookRepository : KRepository<Book, Long> {

fun find(
name: String? = null,
Expand Down Expand Up @@ -825,7 +825,7 @@ import org.babyfish.jimmer.sql.kt.ast.expression.*
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable

interface BookRepository : KRepository<BookStore, Long> {
interface BookRepository : KRepository<Book, Long> {

fun find(
name: String? = null,
Expand Down Expand Up @@ -1117,7 +1117,7 @@ import org.babyfish.jimmer.sql.kt.ast.expression.*
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable

interface BookRepository : KRepository<BookStore, Long> {
interface BookRepository : KRepository<Book, Long> {

fun find(
name: String? = null,
Expand Down

0 comments on commit 768d7f0

Please sign in to comment.