From 6856e9888536ba067cdd3fd2a72b592d414cc179 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Thu, 14 Nov 2019 17:15:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E6=B3=A8=E8=A7=A3=E5=92=8C=E5=88=87=E7=82=B9=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/AnnotationTest.java | 35 +++++++++++++++++++ .../annotation/CheckBooleanAnnotation.java | 18 ++++++++++ 2 files changed, 53 insertions(+) create mode 100644 cloud-common-plugin/src/test/AnnotationTest.java create mode 100644 cloud-common/src/main/java/com/cm/common/annotation/CheckBooleanAnnotation.java diff --git a/cloud-common-plugin/src/test/AnnotationTest.java b/cloud-common-plugin/src/test/AnnotationTest.java new file mode 100644 index 0000000..c7ba930 --- /dev/null +++ b/cloud-common-plugin/src/test/AnnotationTest.java @@ -0,0 +1,35 @@ +import com.cm.common.exception.ParamsException; +import com.cm.common.exception.base.SystemException; +import com.cm.common.plugin.pojo.vos.database.table.TableVO; +import com.cm.common.utils.annotation.AnnotationUtil; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: AnnotationTest + * @Description: TODO + * @Author: WangGeng + * @Date: 2019/11/14 13:30 + * @Version: 1.0 + **/ +public class AnnotationTest { + + public static void main(String[] args) { + TableVO tableVO = new TableVO(); + tableVO.setTableName("二狗"); + tableVO.setFieldName("1"); + tableVO.setFieldComment("备注"); + tableVO.setFieldType("t1234"); + tableVO.setFieldLength(1); + tableVO.setFieldFloatLength(0); + tableVO.setNull(true); + tableVO.setDefaultValue("123"); + try { + AnnotationUtil.checkField(tableVO); + } catch (SystemException e) { + e.printStackTrace(); + } + } + +} diff --git a/cloud-common/src/main/java/com/cm/common/annotation/CheckBooleanAnnotation.java b/cloud-common/src/main/java/com/cm/common/annotation/CheckBooleanAnnotation.java new file mode 100644 index 0000000..8ec2f38 --- /dev/null +++ b/cloud-common/src/main/java/com/cm/common/annotation/CheckBooleanAnnotation.java @@ -0,0 +1,18 @@ +package com.cm.common.annotation; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: CheckBooleanAnnotation + * @Description: TODO + * @Author: WangGeng + * @Date: 2019/11/14 14:50 + * @Version: 1.0 + **/ +public @interface CheckBooleanAnnotation { + + String name(); + + String[] types() default {}; +}