1
0

Compare commits

...

2 Commits

37 changed files with 403 additions and 215 deletions

268
pom.xml
View File

@@ -2,160 +2,144 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.lanyuanxiaoyao</groupId> <groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-service-template</artifactId> <artifactId>spring-boot-service-template</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties> <modules>
<maven.compiler.source>17</maven.compiler.source> <module>spring-boot-service-template-common</module>
<maven.compiler.target>17</maven.compiler.target> <module>spring-boot-service-template-jpa</module>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <module>spring-boot-service-template-jpa-task</module>
</modules>
<spring-boot.version>3.5.0</spring-boot.version> <properties>
<spring-cloud.version>2025.0.0</spring-cloud.version> <maven.compiler.source>17</maven.compiler.source>
<hibernate.version>6.6.15.Final</hibernate.version> <maven.compiler.target>17</maven.compiler.target>
<fenix.version>3.1.0</fenix.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<querydsl.version>7.0</querydsl.version>
<mapstruct.version>1.6.3</mapstruct.version>
<mapstruct-plus.version>1.5.0</mapstruct-plus.version>
</properties>
<spring-boot.version>3.5.0</spring-boot.version>
<spring-cloud.version>2025.0.0</spring-cloud.version>
<hibernate.version>6.6.15.Final</hibernate.version>
<fenix.version>3.1.0</fenix.version>
<querydsl.version>7.0</querydsl.version>
<mapstruct.version>1.6.3</mapstruct.version>
<mapstruct-plus.version>1.5.0</mapstruct-plus.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-service-template-common</artifactId>
<scope>provided</scope> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-service-template-jpa</artifactId>
</dependency> <version>${project.version}</version>
<dependency> </dependency>
<groupId>com.blinkfox</groupId>
<artifactId>fenix-spring-boot-starter</artifactId>
<version>${fenix.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${querydsl.version}</version>
</dependency>
<dependency> <!-- spring boot 相关依赖 -->
<groupId>org.hibernate.orm</groupId> <dependency>
<artifactId>hibernate-ant</artifactId> <groupId>org.springframework.boot</groupId>
<version>${hibernate.version}</version> <artifactId>spring-boot-dependencies</artifactId>
</dependency> <version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency> <dependency>
<groupId>org.mapstruct</groupId> <groupId>com.blinkfox</groupId>
<artifactId>mapstruct</artifactId> <artifactId>fenix-spring-boot-starter</artifactId>
<version>${mapstruct.version}</version> <version>${fenix.version}</version>
<scope>compile</scope> </dependency>
</dependency> <dependency>
<groupId>io.github.openfeign.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${querydsl.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.hibernate.orm</groupId>
<artifactId>lombok</artifactId> <artifactId>hibernate-ant</artifactId>
</dependency> <version>${hibernate.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.jspecify</groupId> <groupId>org.mapstruct</groupId>
<artifactId>jspecify</artifactId> <artifactId>mapstruct</artifactId>
<version>1.0.0</version> <version>${mapstruct.version}</version>
</dependency> <scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>org.jspecify</groupId>
<artifactId>h2</artifactId> <artifactId>jspecify</artifactId>
<scope>test</scope> <version>1.0.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement>
<dependencyManagement> <build>
<dependencies> <pluginManagement>
<!-- spring boot 相关依赖 --> <plugins>
<dependency> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>spring-boot-dependencies</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>${spring-boot.version}</version> <version>3.3.1</version>
<type>pom</type> </plugin>
<scope>import</scope> <plugin>
</dependency> <groupId>org.apache.maven.plugins</groupId>
<dependency> <artifactId>maven-compiler-plugin</artifactId>
<groupId>org.springframework.cloud</groupId> <version>3.14.0</version>
<artifactId>spring-cloud-dependencies</artifactId> </plugin>
<version>${spring-cloud.version}</version> <plugin>
<type>pom</type> <groupId>org.hibernate</groupId>
<scope>import</scope> <artifactId>hibernate-jpamodelgen</artifactId>
</dependency> <version>${hibernate.version}</version>
</dependencies> </plugin>
</dependencyManagement> <plugin>
<groupId>io.github.openfeign.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
</plugin>
<plugin>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<build> <distributionManagement>
<plugins> <repository>
<plugin> <id>${releases.id}</id>
<groupId>org.apache.maven.plugins</groupId> <name>${releases.name}</name>
<artifactId>maven-source-plugin</artifactId> <url>${releases.url}</url>
<version>3.3.1</version> </repository>
<executions> <snapshotRepository>
<execution> <id>${snapshots.id}</id>
<phase>package</phase> <name>${snapshots.name}</name>
<goals> <url>${snapshots.url}</url>
<goal>jar-no-fork</goal> </snapshotRepository>
</goals> </distributionManagement>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
<path>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate.version}</version>
</path>
<path>
<groupId>io.github.openfeign.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
<classifier>jpa</classifier>
</path>
<path>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.2.0</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Aquerydsl.entityAccessors=true</arg>
<arg>-Aquerydsl.createDefaultVariable=true</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>${releases.id}</id>
<name>${releases.name}</name>
<url>${releases.url}</url>
</repository>
<snapshotRepository>
<id>${snapshots.id}</id>
<name>${snapshots.name}</name>
<url>${snapshots.url}</url>
</snapshotRepository>
</distributionManagement>
</project> </project>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-service-template</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>spring-boot-service-template-common</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.helper; package com.lanyuanxiaoyao.service.template.common.helper;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-service-template</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>spring-boot-service-template-jpa-task</artifactId>
<dependencies>
<dependency>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-service-template-jpa</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
<path>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate.version}</version>
</path>
<path>
<groupId>io.github.openfeign.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
<classifier>jpa</classifier>
</path>
<path>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.2.0</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Aquerydsl.entityAccessors=true</arg>
<arg>-Aquerydsl.createDefaultVariable=true</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-service-template</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>spring-boot-service-template-jpa</artifactId>
<dependencies>
<dependency>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-service-template-common</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.blinkfox</groupId>
<artifactId>fenix-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-ant</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jspecify</groupId>
<artifactId>jspecify</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
<path>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate.version}</version>
</path>
<path>
<groupId>io.github.openfeign.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
<classifier>jpa</classifier>
</path>
<path>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.2.0</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Aquerydsl.entityAccessors=true</arg>
<arg>-Aquerydsl.createDefaultVariable=true</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template; package com.lanyuanxiaoyao.service.template.jpa;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import java.io.IOException; import java.io.IOException;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
/** /**
* 详情控制器接口用于定义统一的获取实体详情的接口规范 * 详情控制器接口用于定义统一的获取实体详情的接口规范

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
import java.util.Map; import java.util.Map;
import lombok.Getter; import lombok.Getter;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
import java.util.Map; import java.util.Map;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
/** /**
* 删除控制器接口用于定义统一的删除实体对象的接口规范 * 删除控制器接口用于定义统一的删除实体对象的接口规范

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
/** /**
* 保存控制器接口用于定义统一的保存实体对象的接口规范 * 保存控制器接口用于定义统一的保存实体对象的接口规范

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
public interface SimpleController<SAVE_ITEM, LIST_ITEM, DETAIL_ITEM> extends SaveController<SAVE_ITEM>, ListController<LIST_ITEM>, DetailController<DETAIL_ITEM>, RemoveController { public interface SimpleController<SAVE_ITEM, LIST_ITEM, DETAIL_ITEM> extends SaveController<SAVE_ITEM>, ListController<LIST_ITEM>, DetailController<DETAIL_ITEM>, RemoveController {
} }

View File

@@ -1,8 +1,8 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
import com.lanyuanxiaoyao.service.template.entity.SimpleEntity; import com.lanyuanxiaoyao.service.template.common.helper.ObjectHelper;
import com.lanyuanxiaoyao.service.template.helper.ObjectHelper; import com.lanyuanxiaoyao.service.template.jpa.entity.SimpleEntity;
import com.lanyuanxiaoyao.service.template.service.SimpleServiceSupport; import com.lanyuanxiaoyao.service.template.jpa.service.SimpleServiceSupport;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;

View File

@@ -1,6 +1,5 @@
package com.lanyuanxiaoyao.service.template.entity; package com.lanyuanxiaoyao.service.template.jpa.entity;
import com.lanyuanxiaoyao.service.template.helper.SnowflakeId;
import jakarta.persistence.EntityListeners; import jakarta.persistence.EntityListeners;
import jakarta.persistence.Id; import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass; import jakarta.persistence.MappedSuperclass;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.entity; package com.lanyuanxiaoyao.service.template.jpa.entity;
import jakarta.persistence.EntityListeners; import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass; import jakarta.persistence.MappedSuperclass;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.helper; package com.lanyuanxiaoyao.service.template.jpa.entity;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.helper; package com.lanyuanxiaoyao.service.template.jpa.entity;
import java.io.Serializable; import java.io.Serializable;
import java.time.Instant; import java.time.Instant;
@@ -9,7 +9,6 @@ import org.hibernate.id.factory.spi.StandardGenerator;
@Slf4j @Slf4j
public class SnowflakeIdGenerator implements IdentifierGenerator, StandardGenerator { public class SnowflakeIdGenerator implements IdentifierGenerator, StandardGenerator {
@Override @Override
public Serializable generate(SharedSessionContractImplementor session, Object object) { public Serializable generate(SharedSessionContractImplementor session, Object object) {
try { try {

View File

@@ -1,12 +1,10 @@
package com.lanyuanxiaoyao.service.template.repository; package com.lanyuanxiaoyao.service.template.jpa.repository;
import com.blinkfox.fenix.jpa.FenixJpaRepository; import com.blinkfox.fenix.jpa.FenixJpaRepository;
import com.blinkfox.fenix.specification.FenixJpaSpecificationExecutor; import com.blinkfox.fenix.specification.FenixJpaSpecificationExecutor;
import org.springframework.data.querydsl.ListQuerydslPredicateExecutor; import org.springframework.data.querydsl.ListQuerydslPredicateExecutor;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.NoRepositoryBean; import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.query.ListQueryByExampleExecutor; import org.springframework.data.repository.query.ListQueryByExampleExecutor;
import org.springframework.data.repository.query.QueryByExampleExecutor;
/** /**
* 简单仓库接口整合多种数据访问功能 * 简单仓库接口整合多种数据访问功能

View File

@@ -1,7 +1,7 @@
package com.lanyuanxiaoyao.service.template.service; package com.lanyuanxiaoyao.service.template.jpa.service;
import com.lanyuanxiaoyao.service.template.controller.Query; import com.lanyuanxiaoyao.service.template.jpa.controller.Query;
import com.lanyuanxiaoyao.service.template.entity.SimpleEntity; import com.lanyuanxiaoyao.service.template.jpa.entity.SimpleEntity;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;

View File

@@ -1,10 +1,10 @@
package com.lanyuanxiaoyao.service.template.service; package com.lanyuanxiaoyao.service.template.jpa.service;
import com.lanyuanxiaoyao.service.template.controller.Query; import com.lanyuanxiaoyao.service.template.common.helper.ObjectHelper;
import com.lanyuanxiaoyao.service.template.entity.IdOnlyEntity; import com.lanyuanxiaoyao.service.template.jpa.controller.Query;
import com.lanyuanxiaoyao.service.template.entity.SimpleEntity; import com.lanyuanxiaoyao.service.template.jpa.entity.IdOnlyEntity;
import com.lanyuanxiaoyao.service.template.helper.ObjectHelper; import com.lanyuanxiaoyao.service.template.jpa.entity.SimpleEntity;
import com.lanyuanxiaoyao.service.template.repository.SimpleRepository; import com.lanyuanxiaoyao.service.template.jpa.repository.SimpleRepository;
import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.CriteriaQuery;
import jakarta.persistence.criteria.Path; import jakarta.persistence.criteria.Path;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template; package com.lanyuanxiaoyao.service.template.jpa;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.HashMap; import java.util.HashMap;

View File

@@ -1,17 +1,17 @@
package com.lanyuanxiaoyao.service.template; package com.lanyuanxiaoyao.service.template.jpa;
import com.blinkfox.fenix.EnableFenix; import com.blinkfox.fenix.EnableFenix;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.lanyuanxiaoyao.service.template.entity.Company; import com.lanyuanxiaoyao.service.template.jpa.entity.Company;
import com.lanyuanxiaoyao.service.template.entity.Company_; import com.lanyuanxiaoyao.service.template.jpa.entity.Company_;
import com.lanyuanxiaoyao.service.template.entity.Employee; import com.lanyuanxiaoyao.service.template.jpa.entity.Employee;
import com.lanyuanxiaoyao.service.template.entity.Employee_; import com.lanyuanxiaoyao.service.template.jpa.entity.Employee_;
import com.lanyuanxiaoyao.service.template.entity.QEmployee; import com.lanyuanxiaoyao.service.template.jpa.entity.QEmployee;
import com.lanyuanxiaoyao.service.template.entity.Report; import com.lanyuanxiaoyao.service.template.jpa.entity.Report;
import com.lanyuanxiaoyao.service.template.entity.Report_; import com.lanyuanxiaoyao.service.template.jpa.entity.Report_;
import com.lanyuanxiaoyao.service.template.repository.EmployeeRepository; import com.lanyuanxiaoyao.service.template.jpa.repository.EmployeeRepository;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import java.util.List; import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;

View File

@@ -1,7 +1,7 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
import com.lanyuanxiaoyao.service.template.entity.Company; import com.lanyuanxiaoyao.service.template.jpa.entity.Company;
import com.lanyuanxiaoyao.service.template.service.CompanyService; import com.lanyuanxiaoyao.service.template.jpa.service.CompanyService;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.function.Function; import java.util.function.Function;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;

View File

@@ -1,8 +1,8 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
import com.lanyuanxiaoyao.service.template.entity.Employee; import com.lanyuanxiaoyao.service.template.jpa.entity.Employee;
import com.lanyuanxiaoyao.service.template.service.CompanyService; import com.lanyuanxiaoyao.service.template.jpa.service.CompanyService;
import com.lanyuanxiaoyao.service.template.service.EmployeeService; import com.lanyuanxiaoyao.service.template.jpa.service.EmployeeService;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.function.Function; import java.util.function.Function;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;

View File

@@ -1,8 +1,8 @@
package com.lanyuanxiaoyao.service.template.controller; package com.lanyuanxiaoyao.service.template.jpa.controller;
import com.lanyuanxiaoyao.service.template.entity.Report; import com.lanyuanxiaoyao.service.template.jpa.entity.Report;
import com.lanyuanxiaoyao.service.template.service.EmployeeService; import com.lanyuanxiaoyao.service.template.jpa.service.EmployeeService;
import com.lanyuanxiaoyao.service.template.service.ReportService; import com.lanyuanxiaoyao.service.template.jpa.service.ReportService;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.function.Function; import java.util.function.Function;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.entity; package com.lanyuanxiaoyao.service.template.jpa.entity;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.ConstraintMode; import jakarta.persistence.ConstraintMode;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.entity; package com.lanyuanxiaoyao.service.template.jpa.entity;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.ConstraintMode; import jakarta.persistence.ConstraintMode;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.entity; package com.lanyuanxiaoyao.service.template.jpa.entity;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.template.entity.vo; package com.lanyuanxiaoyao.service.template.jpa.entity.vo;
public record EmployeeWithCompanyName( public record EmployeeWithCompanyName(
String name, String name,

View File

@@ -1,6 +1,6 @@
package com.lanyuanxiaoyao.service.template.repository; package com.lanyuanxiaoyao.service.template.jpa.repository;
import com.lanyuanxiaoyao.service.template.entity.Company; import com.lanyuanxiaoyao.service.template.jpa.entity.Company;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository

View File

@@ -1,7 +1,7 @@
package com.lanyuanxiaoyao.service.template.repository; package com.lanyuanxiaoyao.service.template.jpa.repository;
import com.lanyuanxiaoyao.service.template.entity.Employee; import com.lanyuanxiaoyao.service.template.jpa.entity.Employee;
import com.lanyuanxiaoyao.service.template.entity.vo.EmployeeWithCompanyName; import com.lanyuanxiaoyao.service.template.jpa.entity.vo.EmployeeWithCompanyName;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
@@ -19,6 +19,6 @@ public interface EmployeeRepository extends SimpleRepository<Employee> {
@Query(value = "select e.name, c.name, e.age, e.role from employee e, company c where e.company_id = c.id", nativeQuery = true) @Query(value = "select e.name, c.name, e.age, e.role from employee e, company c where e.company_id = c.id", nativeQuery = true)
List<EmployeeWithCompanyName> findAllEmployeeWithCompanyNameNative(); List<EmployeeWithCompanyName> findAllEmployeeWithCompanyNameNative();
@Query("select new com.lanyuanxiaoyao.service.template.entity.vo.EmployeeWithCompanyName(employee.name, employee.company.name, employee.age, cast(employee.role as string)) from Employee employee") @Query("select new com.lanyuanxiaoyao.service.template.jpa.entity.vo.EmployeeWithCompanyName(employee.name, employee.company.name, employee.age, cast(employee.role as string)) from Employee employee")
List<EmployeeWithCompanyName> findAllEmployeeWithCompanyName(); List<EmployeeWithCompanyName> findAllEmployeeWithCompanyName();
} }

View File

@@ -1,6 +1,6 @@
package com.lanyuanxiaoyao.service.template.repository; package com.lanyuanxiaoyao.service.template.jpa.repository;
import com.lanyuanxiaoyao.service.template.entity.Report; import com.lanyuanxiaoyao.service.template.jpa.entity.Report;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository

View File

@@ -1,7 +1,7 @@
package com.lanyuanxiaoyao.service.template.service; package com.lanyuanxiaoyao.service.template.jpa.service;
import com.lanyuanxiaoyao.service.template.entity.Company; import com.lanyuanxiaoyao.service.template.jpa.entity.Company;
import com.lanyuanxiaoyao.service.template.repository.CompanyRepository; import com.lanyuanxiaoyao.service.template.jpa.repository.CompanyRepository;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service

View File

@@ -1,7 +1,7 @@
package com.lanyuanxiaoyao.service.template.service; package com.lanyuanxiaoyao.service.template.jpa.service;
import com.lanyuanxiaoyao.service.template.entity.Employee; import com.lanyuanxiaoyao.service.template.jpa.entity.Employee;
import com.lanyuanxiaoyao.service.template.repository.EmployeeRepository; import com.lanyuanxiaoyao.service.template.jpa.repository.EmployeeRepository;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service

View File

@@ -1,7 +1,7 @@
package com.lanyuanxiaoyao.service.template.service; package com.lanyuanxiaoyao.service.template.jpa.service;
import com.lanyuanxiaoyao.service.template.entity.Report; import com.lanyuanxiaoyao.service.template.jpa.entity.Report;
import com.lanyuanxiaoyao.service.template.repository.ReportRepository; import com.lanyuanxiaoyao.service.template.jpa.repository.ReportRepository;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service