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

com.zys.mybatis.annotation.validate.Distinct 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.*;

/**
 * 结合判断null一起使用才生效
 * 校验是否重复
 * @author zys
 * @version 1.0
 * @date 2020/12/28 17:53
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER,ElementType.FIELD,ElementType.TYPE})
@Constraint(validatedBy = DistinctClass.class)
public @interface Distinct {

    //主键
    String id() default "id";

    //需要校验的dao class
    Class classes() default BaseDao.class;

    //表名
    String tableName();

    //判断的名称
    String[] columns();

    //是否是添加,默认是
    boolean isAdd() default true;

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

    //消息
    String message();

    //默认字段上面
    ElementType type() default ElementType.FIELD;

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

    Class[] payload() default {};
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy