com.zys.mybatis.annotation.validate.Exist Maven / Gradle / Ivy
package com.zys.mybatis.annotation.validate;
import com.zys.mybatis.dao.base.BaseDao;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;
/**
*
* 判断是否存在或不存在
* @author zys
* @version 1.0
* @date 2020/12/29 15:56
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER,ElementType.FIELD})
@Repeatable(Exist.List.class)
@Constraint(validatedBy = ExistClass.class)
public @interface Exist {
//传入的classes 必须和fieldNames 对应 message 校验失败的提示信息
Class extends BaseDao> classes() default BaseDao.class;
String fieldNames();
String message() default "";
String tableName();
/**
* true 存在通过 false存在不通过
* @return
*/
boolean flag() default false;
//约束注释
Class>[] groups() default {};
Class extends Payload>[] payload() default {};
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER,ElementType.FIELD})
@interface List {
Exist[] value();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy