Compare commits
11 Commits
v0.0.10
...
35fa531be9
| Author | SHA1 | Date | |
|---|---|---|---|
| 35fa531be9 | |||
|
|
2bec0773ac | ||
| b690656848 | |||
|
|
189005098b | ||
|
|
99cbf30d12 | ||
|
|
3a46327129 | ||
| 6e5f33f641 | |||
|
|
7e917faf03 | ||
|
|
0d145d14fd | ||
| 53b8c4c23f | |||
|
|
b49c1dd515 |
12
pom.xml
12
pom.xml
@@ -7,19 +7,19 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.5.11</version>
|
||||
<version>3.5.13</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<groupId>com.imyeyu.spring</groupId>
|
||||
<artifactId>timi-spring</artifactId>
|
||||
<version>0.0.10</version>
|
||||
<version>0.0.14</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
<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.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -131,17 +131,17 @@
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<version>3.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
<version>2.12.0</version>
|
||||
<version>2.13.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.imyeyu.io</groupId>
|
||||
<artifactId>timi-io</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>0.0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
||||
@@ -346,7 +346,16 @@ public class TimiSpring {
|
||||
* @return 令牌
|
||||
*/
|
||||
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;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.spring.annotation.table.DeleteColumn;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import com.imyeyu.utils.Time;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -16,15 +18,19 @@ import java.io.Serializable;
|
||||
public class BaseEntity implements Serializable, Creatable, Updatable, Deletable {
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected Long createdAt;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected Long updatedAt;
|
||||
|
||||
/** 删除时间 */
|
||||
@DeleteColumn
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
protected Long deletedAt;
|
||||
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return deletedAt != null && deletedAt < Time.now();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.imyeyu.spring.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.spring.annotation.table.Id;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -16,5 +18,6 @@ public class Entity extends BaseEntity implements IDEntity<Long> {
|
||||
|
||||
/** ID */
|
||||
@Id
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected Long id;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.imyeyu.spring.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.java.bean.Language;
|
||||
import com.imyeyu.java.ref.Ref;
|
||||
import com.imyeyu.spring.annotation.table.AutoUUID;
|
||||
import com.imyeyu.spring.annotation.table.Id;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -20,15 +22,23 @@ public class Multilingual extends Language implements IDEntity<String>, Creatabl
|
||||
/** 唯一标识 */
|
||||
@Id
|
||||
@AutoUUID
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected String id;
|
||||
|
||||
/** 业务类型 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected String bizType;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
protected Long createdAt;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
protected Long updatedAt;
|
||||
|
||||
/** 删除时间 */
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
protected Long deletedAt;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.imyeyu.spring.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.spring.annotation.table.AutoUUID;
|
||||
import com.imyeyu.spring.annotation.table.Id;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -18,5 +20,6 @@ public class UUIDEntity extends BaseEntity implements IDEntity<String> {
|
||||
/** ID */
|
||||
@Id
|
||||
@AutoUUID
|
||||
@JsonView(ResponseView.Public.class)
|
||||
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