Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b690656848 | |||
|
|
189005098b | ||
|
|
99cbf30d12 | ||
|
|
3a46327129 | ||
| 6e5f33f641 | |||
|
|
7e917faf03 | ||
|
|
0d145d14fd | ||
| 53b8c4c23f | |||
|
|
b49c1dd515 | ||
| f8beb03362 | |||
|
|
237f6d3890 |
15
pom.xml
15
pom.xml
@@ -7,19 +7,19 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.5.11</version>
|
<version>3.5.13</version>
|
||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>com.imyeyu.spring</groupId>
|
<groupId>com.imyeyu.spring</groupId>
|
||||||
<artifactId>timi-spring</artifactId>
|
<artifactId>timi-spring</artifactId>
|
||||||
<version>0.0.9</version>
|
<version>0.0.13</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>21</java.version>
|
<java.version>21</java.version>
|
||||||
<maven.test.skip>true</maven.test.skip>
|
<maven.test.skip>true</maven.test.skip>
|
||||||
<springboot.version>3.5.11</springboot.version>
|
<springboot.version>3.5.13</springboot.version>
|
||||||
<maven.compiler.source>21</maven.compiler.source>
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
<maven.compiler.target>21</maven.compiler.target>
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
@@ -131,18 +131,23 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>3.0.3</version>
|
<version>3.0.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-pool2</artifactId>
|
<artifactId>commons-pool2</artifactId>
|
||||||
<version>2.12.0</version>
|
<version>2.13.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.imyeyu.io</groupId>
|
<groupId>com.imyeyu.io</groupId>
|
||||||
<artifactId>timi-io</artifactId>
|
<artifactId>timi-io</artifactId>
|
||||||
<version>0.0.3</version>
|
<version>0.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.imyeyu.java</groupId>
|
||||||
|
<artifactId>timi-java</artifactId>
|
||||||
|
<version>0.0.3</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
|
|||||||
@@ -346,7 +346,16 @@ public class TimiSpring {
|
|||||||
* @return 令牌
|
* @return 令牌
|
||||||
*/
|
*/
|
||||||
public static String getToken() {
|
public static String getToken() {
|
||||||
return TimiJava.firstNotEmpty(getHeader("Token"), getHeader("token"), getRequestArg("token"), getRequestArg("Token"));
|
return TimiJava.firstNotEmpty(getHeader("Token"), getHeader("token"), getRequestArg("Token"), getRequestArg("token"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取请求密钥,键为 Key 或 key,包括请求头和 URI
|
||||||
|
*
|
||||||
|
* @return 密钥
|
||||||
|
*/
|
||||||
|
public static String getKey() {
|
||||||
|
return TimiJava.firstNotEmpty(getHeader("Key"), getHeader("key"), getRequestArg("Key"), getRequestArg("key"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.imyeyu.spring.entity;
|
package com.imyeyu.spring.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonView;
|
||||||
import com.imyeyu.spring.annotation.table.DeleteColumn;
|
import com.imyeyu.spring.annotation.table.DeleteColumn;
|
||||||
|
import com.imyeyu.spring.util.ResponseView;
|
||||||
import com.imyeyu.utils.Time;
|
import com.imyeyu.utils.Time;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -16,15 +18,19 @@ import java.io.Serializable;
|
|||||||
public class BaseEntity implements Serializable, Creatable, Updatable, Deletable {
|
public class BaseEntity implements Serializable, Creatable, Updatable, Deletable {
|
||||||
|
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
|
@JsonView(ResponseView.Public.class)
|
||||||
protected Long createdAt;
|
protected Long createdAt;
|
||||||
|
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
|
@JsonView(ResponseView.Public.class)
|
||||||
protected Long updatedAt;
|
protected Long updatedAt;
|
||||||
|
|
||||||
/** 删除时间 */
|
/** 删除时间 */
|
||||||
@DeleteColumn
|
@DeleteColumn
|
||||||
|
@JsonView(ResponseView.Admin.class)
|
||||||
protected Long deletedAt;
|
protected Long deletedAt;
|
||||||
|
|
||||||
|
@JsonView(ResponseView.Admin.class)
|
||||||
@Override
|
@Override
|
||||||
public boolean isDeleted() {
|
public boolean isDeleted() {
|
||||||
return deletedAt != null && deletedAt < Time.now();
|
return deletedAt != null && deletedAt < Time.now();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.imyeyu.spring.entity;
|
package com.imyeyu.spring.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonView;
|
||||||
import com.imyeyu.spring.annotation.table.Id;
|
import com.imyeyu.spring.annotation.table.Id;
|
||||||
|
import com.imyeyu.spring.util.ResponseView;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -16,5 +18,6 @@ public class Entity extends BaseEntity implements IDEntity<Long> {
|
|||||||
|
|
||||||
/** ID */
|
/** ID */
|
||||||
@Id
|
@Id
|
||||||
|
@JsonView(ResponseView.Public.class)
|
||||||
protected Long id;
|
protected Long id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.imyeyu.spring.entity;
|
package com.imyeyu.spring.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonView;
|
||||||
import com.imyeyu.java.bean.Language;
|
import com.imyeyu.java.bean.Language;
|
||||||
import com.imyeyu.java.ref.Ref;
|
import com.imyeyu.java.ref.Ref;
|
||||||
import com.imyeyu.spring.annotation.table.AutoUUID;
|
import com.imyeyu.spring.annotation.table.AutoUUID;
|
||||||
import com.imyeyu.spring.annotation.table.Id;
|
import com.imyeyu.spring.annotation.table.Id;
|
||||||
|
import com.imyeyu.spring.util.ResponseView;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -20,15 +22,23 @@ public class Multilingual extends Language implements IDEntity<String>, Creatabl
|
|||||||
/** 唯一标识 */
|
/** 唯一标识 */
|
||||||
@Id
|
@Id
|
||||||
@AutoUUID
|
@AutoUUID
|
||||||
|
@JsonView(ResponseView.Public.class)
|
||||||
protected String id;
|
protected String id;
|
||||||
|
|
||||||
|
/** 业务类型 */
|
||||||
|
@JsonView(ResponseView.Public.class)
|
||||||
|
protected String bizType;
|
||||||
|
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
|
@JsonView(ResponseView.Admin.class)
|
||||||
protected Long createdAt;
|
protected Long createdAt;
|
||||||
|
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
|
@JsonView(ResponseView.Admin.class)
|
||||||
protected Long updatedAt;
|
protected Long updatedAt;
|
||||||
|
|
||||||
/** 删除时间 */
|
/** 删除时间 */
|
||||||
|
@JsonView(ResponseView.Admin.class)
|
||||||
protected Long deletedAt;
|
protected Long deletedAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.imyeyu.spring.entity;
|
package com.imyeyu.spring.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonView;
|
||||||
import com.imyeyu.spring.annotation.table.AutoUUID;
|
import com.imyeyu.spring.annotation.table.AutoUUID;
|
||||||
import com.imyeyu.spring.annotation.table.Id;
|
import com.imyeyu.spring.annotation.table.Id;
|
||||||
|
import com.imyeyu.spring.util.ResponseView;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -18,5 +20,6 @@ public class UUIDEntity extends BaseEntity implements IDEntity<String> {
|
|||||||
/** ID */
|
/** ID */
|
||||||
@Id
|
@Id
|
||||||
@AutoUUID
|
@AutoUUID
|
||||||
|
@JsonView(ResponseView.Public.class)
|
||||||
protected String id;
|
protected String id;
|
||||||
}
|
}
|
||||||
|
|||||||
30
src/main/java/com/imyeyu/spring/util/ResponseView.java
Normal file
30
src/main/java/com/imyeyu/spring/util/ResponseView.java
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package com.imyeyu.spring.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author 夜雨
|
||||||
|
* @since 2026-02-25 15:46
|
||||||
|
*/
|
||||||
|
public interface ResponseView {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author 夜雨
|
||||||
|
* @since 2026-02-25 15:46
|
||||||
|
*/
|
||||||
|
interface Public {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author 夜雨
|
||||||
|
* @since 2026-02-25 15:46
|
||||||
|
*/
|
||||||
|
interface Admin extends Public {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user