All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zys.mybatis.annotation.validate.Exist Maven / Gradle / Ivy

There is a newer version: 0.2.7
Show newest version
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 classes() default BaseDao.class;

    String fieldNames();

    String message() default "";

    String tableName();

    /**
     * true 存在通过 false存在不通过
     * @return
     */
    boolean flag() default false;

    //约束注释
    Class[] groups() default {};
    Class[] payload() default {};

    @Documented
    @Retention(RetentionPolicy.RUNTIME)
    @Target({ElementType.PARAMETER,ElementType.FIELD})
    @interface List {

        Exist[] value();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy