Initial project
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.imyeyu.spring.annotation.table;
|
||||
|
||||
import com.imyeyu.spring.util.SQLProvider;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 自动生成 UUID,在 {@link SQLProvider} 代理器中的方法会对此注解字段自动生成 UUID
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2025-02-05 23:44
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface AutoUUID {
|
||||
|
||||
/**
|
||||
* 是否全大写 UUID
|
||||
*
|
||||
* @return true 为使用全大写 UUID
|
||||
*/
|
||||
boolean upper() default false;
|
||||
}
|
||||
21
src/main/java/com/imyeyu/spring/annotation/table/Column.java
Normal file
21
src/main/java/com/imyeyu/spring/annotation/table/Column.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.imyeyu.spring.annotation.table;
|
||||
|
||||
import com.imyeyu.spring.util.SQLProvider;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 指定列名,在 {@link SQLProvider} 代理器中的方法无法简单将字段转为数据库列名时,使用此注解指定
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2025-01-29 09:53
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Column {
|
||||
|
||||
String value();
|
||||
}
|
||||
25
src/main/java/com/imyeyu/spring/annotation/table/Id.java
Normal file
25
src/main/java/com/imyeyu/spring/annotation/table/Id.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.imyeyu.spring.annotation.table;
|
||||
|
||||
import com.imyeyu.spring.util.SQLProvider;
|
||||
import org.apache.ibatis.builder.annotation.ProviderContext;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 标记为 ID 字段,在 {@link SQLProvider} 代理器中的方法使用此字段进行以下操作
|
||||
* <ul>
|
||||
* <li>{@link SQLProvider#select(ProviderContext, Object)}</li>
|
||||
* <li>{@link SQLProvider#delete(ProviderContext, Object)}</li>
|
||||
* <li>{@link SQLProvider#destroy(ProviderContext, Object)}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2025-01-29 09:54
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Id {
|
||||
}
|
||||
21
src/main/java/com/imyeyu/spring/annotation/table/Table.java
Normal file
21
src/main/java/com/imyeyu/spring/annotation/table/Table.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.imyeyu.spring.annotation.table;
|
||||
|
||||
import com.imyeyu.spring.util.SQLProvider;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 指定表名,在 {@link SQLProvider} 代理器中的方法无法简单将实体类名转为数据库表名时,使用此注解指定
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2025-01-29 09:53
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Table {
|
||||
|
||||
String value();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.imyeyu.spring.annotation.table;
|
||||
|
||||
import com.imyeyu.spring.util.SQLProvider;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* 忽略字段或表示非表实体,在 {@link SQLProvider} 代理器中的方法无需处理该字段时,使用此注解标记,不标记的字段均视为映射数据库列
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2025-02-06 17:46
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Transient {
|
||||
}
|
||||
Reference in New Issue
Block a user