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"
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">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-service-template</artifactId>
<version>1.0.0-SNAPSHOT</version>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-service-template</artifactId>
<version>1.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<modules>
<module>spring-boot-service-template-common</module>
<module>spring-boot-service-template-jpa</module>
<module>spring-boot-service-template-jpa-task</module>
</modules>
<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>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<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>
<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>
<version>${fenix.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${querydsl.version}</version>
</dependency>
<dependency>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-service-template-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.lanyuanxiaoyao</groupId>
<artifactId>spring-boot-service-template-jpa</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-ant</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- spring boot 相关依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<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>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
<scope>compile</scope>
</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>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-ant</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.jspecify</groupId>
<artifactId>jspecify</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jspecify</groupId>
<artifactId>jspecify</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencyManagement>
<dependencies>
<!-- spring boot 相关依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<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>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
</plugin>
<plugin>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate.version}</version>
</plugin>
<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>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<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>
<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>
<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>

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.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 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 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;

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.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 {
}

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.helper.ObjectHelper;
import com.lanyuanxiaoyao.service.template.service.SimpleServiceSupport;
import com.lanyuanxiaoyao.service.template.common.helper.ObjectHelper;
import com.lanyuanxiaoyao.service.template.jpa.entity.SimpleEntity;
import com.lanyuanxiaoyao.service.template.jpa.service.SimpleServiceSupport;
import java.util.List;
import java.util.Map;
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.Id;
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.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.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.time.Instant;
@@ -9,7 +9,6 @@ import org.hibernate.id.factory.spi.StandardGenerator;
@Slf4j
public class SnowflakeIdGenerator implements IdentifierGenerator, StandardGenerator {
@Override
public Serializable generate(SharedSessionContractImplementor session, Object object) {
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.specification.FenixJpaSpecificationExecutor;
import org.springframework.data.querydsl.ListQuerydslPredicateExecutor;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.NoRepositoryBean;
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.entity.SimpleEntity;
import com.lanyuanxiaoyao.service.template.jpa.controller.Query;
import com.lanyuanxiaoyao.service.template.jpa.entity.SimpleEntity;
import java.util.List;
import java.util.Set;
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.entity.IdOnlyEntity;
import com.lanyuanxiaoyao.service.template.entity.SimpleEntity;
import com.lanyuanxiaoyao.service.template.helper.ObjectHelper;
import com.lanyuanxiaoyao.service.template.repository.SimpleRepository;
import com.lanyuanxiaoyao.service.template.common.helper.ObjectHelper;
import com.lanyuanxiaoyao.service.template.jpa.controller.Query;
import com.lanyuanxiaoyao.service.template.jpa.entity.IdOnlyEntity;
import com.lanyuanxiaoyao.service.template.jpa.entity.SimpleEntity;
import com.lanyuanxiaoyao.service.template.jpa.repository.SimpleRepository;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
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.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.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.lanyuanxiaoyao.service.template.entity.Company;
import com.lanyuanxiaoyao.service.template.entity.Company_;
import com.lanyuanxiaoyao.service.template.entity.Employee;
import com.lanyuanxiaoyao.service.template.entity.Employee_;
import com.lanyuanxiaoyao.service.template.entity.QEmployee;
import com.lanyuanxiaoyao.service.template.entity.Report;
import com.lanyuanxiaoyao.service.template.entity.Report_;
import com.lanyuanxiaoyao.service.template.repository.EmployeeRepository;
import com.lanyuanxiaoyao.service.template.jpa.entity.Company;
import com.lanyuanxiaoyao.service.template.jpa.entity.Company_;
import com.lanyuanxiaoyao.service.template.jpa.entity.Employee;
import com.lanyuanxiaoyao.service.template.jpa.entity.Employee_;
import com.lanyuanxiaoyao.service.template.jpa.entity.QEmployee;
import com.lanyuanxiaoyao.service.template.jpa.entity.Report;
import com.lanyuanxiaoyao.service.template.jpa.entity.Report_;
import com.lanyuanxiaoyao.service.template.jpa.repository.EmployeeRepository;
import jakarta.annotation.Resource;
import java.util.List;
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.service.CompanyService;
import com.lanyuanxiaoyao.service.template.jpa.entity.Company;
import com.lanyuanxiaoyao.service.template.jpa.service.CompanyService;
import java.time.LocalDateTime;
import java.util.function.Function;
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.service.CompanyService;
import com.lanyuanxiaoyao.service.template.service.EmployeeService;
import com.lanyuanxiaoyao.service.template.jpa.entity.Employee;
import com.lanyuanxiaoyao.service.template.jpa.service.CompanyService;
import com.lanyuanxiaoyao.service.template.jpa.service.EmployeeService;
import java.time.LocalDateTime;
import java.util.function.Function;
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.service.EmployeeService;
import com.lanyuanxiaoyao.service.template.service.ReportService;
import com.lanyuanxiaoyao.service.template.jpa.entity.Report;
import com.lanyuanxiaoyao.service.template.jpa.service.EmployeeService;
import com.lanyuanxiaoyao.service.template.jpa.service.ReportService;
import java.time.LocalDateTime;
import java.util.function.Function;
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.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.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.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(
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;
@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.entity.vo.EmployeeWithCompanyName;
import com.lanyuanxiaoyao.service.template.jpa.entity.Employee;
import com.lanyuanxiaoyao.service.template.jpa.entity.vo.EmployeeWithCompanyName;
import java.util.List;
import java.util.Optional;
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)
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();
}

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;
@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.repository.CompanyRepository;
import com.lanyuanxiaoyao.service.template.jpa.entity.Company;
import com.lanyuanxiaoyao.service.template.jpa.repository.CompanyRepository;
import org.springframework.stereotype.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.repository.EmployeeRepository;
import com.lanyuanxiaoyao.service.template.jpa.entity.Employee;
import com.lanyuanxiaoyao.service.template.jpa.repository.EmployeeRepository;
import org.springframework.stereotype.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.repository.ReportRepository;
import com.lanyuanxiaoyao.service.template.jpa.entity.Report;
import com.lanyuanxiaoyao.service.template.jpa.repository.ReportRepository;
import org.springframework.stereotype.Service;
@Service