Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 35fa531be9 | |||
|
|
2bec0773ac | ||
| b690656848 | |||
|
|
189005098b | ||
|
|
99cbf30d12 | ||
|
|
3a46327129 |
4
pom.xml
4
pom.xml
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.spring</groupId>
|
<groupId>com.imyeyu.spring</groupId>
|
||||||
<artifactId>timi-spring</artifactId>
|
<artifactId>timi-spring</artifactId>
|
||||||
<version>0.0.12</version>
|
<version>0.0.14</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
<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.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|||||||
@@ -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,18 +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;
|
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