From 31e3a73188d3d8862ff835be4b00991a96be0492 Mon Sep 17 00:00:00 2001 From: little3201 Date: Thu, 25 Nov 2021 18:30:44 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=B0=8F=E6=9B=B4=E6=96=B0=EF=BC=9A?= =?UTF-8?q?=E4=BC=98=E5=8C=96TreeNode=EF=BC=9BExcel=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 3 +- .../java/top/leafage/common/ExcelReader.java | 3 ++ .../common/basic/AbstractTreeNodeService.java | 4 +- .../top/leafage/common/basic/AbstractVO.java | 40 +++++++++++++++++++ .../top/leafage/common/basic/TreeNode.java | 11 +++-- 5 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 src/main/java/top/leafage/common/basic/AbstractVO.java diff --git a/pom.xml b/pom.xml index e0a8c1b..fc47572 100644 --- a/pom.xml +++ b/pom.xml @@ -10,14 +10,13 @@ leafage-common - 0.1.5 + 0.1.6 jar leafage-common common for leafage - 11 5.0.0 diff --git a/src/main/java/top/leafage/common/ExcelReader.java b/src/main/java/top/leafage/common/ExcelReader.java index aca7864..7829bb1 100644 --- a/src/main/java/top/leafage/common/ExcelReader.java +++ b/src/main/java/top/leafage/common/ExcelReader.java @@ -167,6 +167,9 @@ private static T mapping(Row row, Class clazz) { private static void writeData(T t, Cell cell, PropertyDescriptor descriptor) { try { switch (cell.getCellType()) { + case BLANK: // 空字符串 + case _NONE: // null + break; case NUMERIC: // 数字 descriptor.getWriteMethod().invoke(t, cell.getNumericCellValue()); break; diff --git a/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java b/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java index e455936..4dd1b0a 100644 --- a/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java +++ b/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java @@ -28,13 +28,13 @@ public abstract class AbstractTreeNodeService extends AbstractBasicService { */ protected void expand(TreeNode treeNode, Class clazz, T t, Set expand) { if (expand != null && !expand.isEmpty()) { - Map map = new HashMap<>(expand.size()); + Map map = new HashMap<>(expand.size()); expand.forEach(filed -> { try { PropertyDescriptor superIdDescriptor = new PropertyDescriptor(filed, clazz); Object value = superIdDescriptor.getReadMethod().invoke(t); - map.put(filed, value != null ? value.toString() : null); + map.put(filed, value); } catch (IllegalAccessException | InvocationTargetException | IntrospectionException e) { log.error("expand data error.", e); } diff --git a/src/main/java/top/leafage/common/basic/AbstractVO.java b/src/main/java/top/leafage/common/basic/AbstractVO.java new file mode 100644 index 0000000..48dcf9c --- /dev/null +++ b/src/main/java/top/leafage/common/basic/AbstractVO.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021. Leafage All Right Reserved. + */ +package top.leafage.common.basic; + +import java.time.LocalDateTime; + +/** + * abstract vo + * + * @author liwenqiang 2020-10-06 22:09 + */ +public abstract class AbstractVO { + + /** + * 代码 + */ + private C code; + + /** + * 修改时间 + */ + private LocalDateTime modifyTime; + + public C getCode() { + return code; + } + + public void setCode(C code) { + this.code = code; + } + + public LocalDateTime getModifyTime() { + return modifyTime; + } + + public void setModifyTime(LocalDateTime modifyTime) { + this.modifyTime = modifyTime; + } +} diff --git a/src/main/java/top/leafage/common/basic/TreeNode.java b/src/main/java/top/leafage/common/basic/TreeNode.java index c1c9f83..88ab205 100644 --- a/src/main/java/top/leafage/common/basic/TreeNode.java +++ b/src/main/java/top/leafage/common/basic/TreeNode.java @@ -1,9 +1,12 @@ package top.leafage.common.basic; +import java.io.Serializable; import java.util.List; import java.util.Map; -public class TreeNode { +public class TreeNode implements Serializable { + + private static final long serialVersionUID = 3977470984616592112L; /** * 代码 @@ -20,7 +23,7 @@ public class TreeNode { /** * 扩展属性 */ - private Map expand; + private Map expand; private List children; @@ -41,7 +44,7 @@ public String getSuperior() { return superior; } - public Map getExpand() { + public Map getExpand() { return expand; } @@ -61,7 +64,7 @@ public void setSuperior(String superior) { this.superior = superior; } - public void setExpand(Map expand) { + public void setExpand(Map expand) { this.expand = expand; } From 57ffdde606b1ad833e74aee2de63a6321968694f Mon Sep 17 00:00:00 2001 From: little3201 Date: Fri, 26 Nov 2021 08:50:25 +0800 Subject: [PATCH 2/6] =?UTF-8?q?javadoc:=20=E5=AE=8C=E5=96=84=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/top/leafage/common/ExcelReader.java | 1 + .../top/leafage/common/basic/AbstractBasicService.java | 6 ++++++ .../top/leafage/common/basic/AbstractTreeNodeService.java | 7 +++++++ src/main/java/top/leafage/common/basic/AbstractVO.java | 3 ++- src/main/java/top/leafage/common/basic/TreeNode.java | 5 +++++ .../common/reactive/ReactiveAbstractTreeNodeService.java | 7 +++++++ .../top/leafage/common/reactive/ReactiveBasicService.java | 3 ++- .../common/servlet/ServletAbstractTreeNodeService.java | 8 +++++++- .../top/leafage/common/servlet/ServletBasicService.java | 3 ++- 9 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/main/java/top/leafage/common/ExcelReader.java b/src/main/java/top/leafage/common/ExcelReader.java index 7829bb1..404496c 100644 --- a/src/main/java/top/leafage/common/ExcelReader.java +++ b/src/main/java/top/leafage/common/ExcelReader.java @@ -26,6 +26,7 @@ * 读取excel文件,并解析为指定类型的对象 * * @author liwenqiang 2021/8/26 9:37 + * @since 0.1.4 */ public class ExcelReader { diff --git a/src/main/java/top/leafage/common/basic/AbstractBasicService.java b/src/main/java/top/leafage/common/basic/AbstractBasicService.java index 9a35d2a..9c1e262 100644 --- a/src/main/java/top/leafage/common/basic/AbstractBasicService.java +++ b/src/main/java/top/leafage/common/basic/AbstractBasicService.java @@ -6,6 +6,12 @@ import java.util.Collections; import java.util.List; +/** + * Product random code + * + * @author liwenqiang 2020-10-06 22:09 + * @since 0.1.0 + */ public abstract class AbstractBasicService { private static final List SEED_LIST = Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", diff --git a/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java b/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java index 4dd1b0a..14d6a38 100644 --- a/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java +++ b/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java @@ -9,6 +9,13 @@ import java.util.Map; import java.util.Set; +/** + * Construct tree + * + * @param + * @author liwenqiang 2021-07-21 20:08 + * @since 0.1.3 + */ public abstract class AbstractTreeNodeService extends AbstractBasicService { private static final String ID = "id"; diff --git a/src/main/java/top/leafage/common/basic/AbstractVO.java b/src/main/java/top/leafage/common/basic/AbstractVO.java index 48dcf9c..66eb4f1 100644 --- a/src/main/java/top/leafage/common/basic/AbstractVO.java +++ b/src/main/java/top/leafage/common/basic/AbstractVO.java @@ -6,9 +6,10 @@ import java.time.LocalDateTime; /** - * abstract vo + * Abstract vo * * @author liwenqiang 2020-10-06 22:09 + * @since 0.1.6 */ public abstract class AbstractVO { diff --git a/src/main/java/top/leafage/common/basic/TreeNode.java b/src/main/java/top/leafage/common/basic/TreeNode.java index 88ab205..79dc2b6 100644 --- a/src/main/java/top/leafage/common/basic/TreeNode.java +++ b/src/main/java/top/leafage/common/basic/TreeNode.java @@ -4,6 +4,11 @@ import java.util.List; import java.util.Map; +/** + * Tree node + * + * @author liwenqiang 2021-07-02 17:18 + */ public class TreeNode implements Serializable { private static final long serialVersionUID = 3977470984616592112L; diff --git a/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java b/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java index 1b78511..b2c18cc 100644 --- a/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java +++ b/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java @@ -5,6 +5,13 @@ import top.leafage.common.basic.TreeNode; import java.util.Set; +/** + * For reactive to construct tree + * + * @param + * @author liwenqiang 2021-07-21 20:08 + * @since 0.1.3 + */ public abstract class ReactiveAbstractTreeNodeService extends AbstractTreeNodeService { /** diff --git a/src/main/java/top/leafage/common/reactive/ReactiveBasicService.java b/src/main/java/top/leafage/common/reactive/ReactiveBasicService.java index 55c4807..fe0a654 100644 --- a/src/main/java/top/leafage/common/reactive/ReactiveBasicService.java +++ b/src/main/java/top/leafage/common/reactive/ReactiveBasicService.java @@ -10,7 +10,8 @@ * V —— VO * C —— code type * - * @author liwenqiang 2021/7/27 23:14 + * @author liwenqiang 2021/7/20 23:14 + * @since 0.1.2 **/ public interface ReactiveBasicService { diff --git a/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java b/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java index 563a7aa..b1d9378 100644 --- a/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java +++ b/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java @@ -5,7 +5,13 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; - +/** + * For servlet to construct tree + * + * @param + * @author liwenqiang 2021-07-21 20:08 + * @since 0.1.3 + */ public abstract class ServletAbstractTreeNodeService extends AbstractTreeNodeService { /** diff --git a/src/main/java/top/leafage/common/servlet/ServletBasicService.java b/src/main/java/top/leafage/common/servlet/ServletBasicService.java index bafa441..c1dc2ea 100644 --- a/src/main/java/top/leafage/common/servlet/ServletBasicService.java +++ b/src/main/java/top/leafage/common/servlet/ServletBasicService.java @@ -12,7 +12,8 @@ * V —— VO * C —— code type * - * @author liwenqiang 2018/7/27 23:14 + * @author liwenqiang 2021/7/20 23:14 + * @since 0.1.2 **/ public interface ServletBasicService { From 46f4a51217670399f44153985b55f19a15806c7b Mon Sep 17 00:00:00 2001 From: little3201 Date: Fri, 26 Nov 2021 09:39:59 +0800 Subject: [PATCH 3/6] =?UTF-8?q?javadoc:=20=E6=B3=A8=E9=87=8A=E5=AE=8C?= =?UTF-8?q?=E5=96=84=EF=BC=9B=20=E5=8D=87=E7=BA=A7poi=E5=88=B05.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- src/main/java/top/leafage/common/ExcelReader.java | 12 ++++++------ .../common/basic/AbstractTreeNodeService.java | 8 ++++---- .../reactive/ReactiveAbstractTreeNodeService.java | 1 - .../servlet/ServletAbstractTreeNodeService.java | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index fc47572..fe4d069 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ common for leafage - 5.0.0 + 5.1.0 diff --git a/src/main/java/top/leafage/common/ExcelReader.java b/src/main/java/top/leafage/common/ExcelReader.java index 404496c..c2dd0bf 100644 --- a/src/main/java/top/leafage/common/ExcelReader.java +++ b/src/main/java/top/leafage/common/ExcelReader.java @@ -1,14 +1,14 @@ package top.leafage.common; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.status.StatusLogger; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.io.File; @@ -30,14 +30,14 @@ */ public class ExcelReader { - private ExcelReader() { - } - - private static final Logger log = LoggerFactory.getLogger(ExcelReader.class); + private static final Logger log = StatusLogger.getLogger(); private static final String XLS = ".xls"; private static final String XLSX = ".xlsx"; + private ExcelReader() { + } + /** * 根据文件后缀名类型获取对应的工作簿对象 * diff --git a/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java b/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java index 14d6a38..e99c163 100644 --- a/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java +++ b/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java @@ -1,7 +1,8 @@ package top.leafage.common.basic; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.status.StatusLogger; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; @@ -12,7 +13,6 @@ /** * Construct tree * - * @param * @author liwenqiang 2021-07-21 20:08 * @since 0.1.3 */ @@ -23,7 +23,7 @@ public abstract class AbstractTreeNodeService extends AbstractBasicService { private static final String CODE = "code"; private static final String SUPERIOR = "superior"; - private static final Logger log = LoggerFactory.getLogger(AbstractTreeNodeService.class); + private static final Logger log = StatusLogger.getLogger(); /** * 扩展数据 diff --git a/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java b/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java index b2c18cc..e1bd297 100644 --- a/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java +++ b/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java @@ -8,7 +8,6 @@ /** * For reactive to construct tree * - * @param * @author liwenqiang 2021-07-21 20:08 * @since 0.1.3 */ diff --git a/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java b/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java index b1d9378..5c81625 100644 --- a/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java +++ b/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java @@ -5,10 +5,10 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; + /** * For servlet to construct tree * - * @param * @author liwenqiang 2021-07-21 20:08 * @since 0.1.3 */ From a894051e543b1c5b1223f57d14e32a78118eb552 Mon Sep 17 00:00:00 2001 From: little3201 Date: Fri, 3 Dec 2021 17:04:00 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0parent=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fe4d069..34eab60 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ top.leafage leafage-starter-parent - 0.1.1 + 0.1.2 From 9e857f12910521289b7f34bff3d3754ed243baee Mon Sep 17 00:00:00 2001 From: little3201 Date: Wed, 15 Dec 2021 18:36:52 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9TreeNode=E6=9E=84?= =?UTF-8?q?=E9=80=A0=E6=97=B6=EF=BC=8Csuperior=E6=95=B0=E6=8D=AE=E5=A1=AB?= =?UTF-8?q?=E5=85=85=E4=BF=AE=E6=94=B9=E4=B8=BAcode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../common/basic/AbstractTreeNodeService.java | 26 ++++++++++++++++++- .../ReactiveAbstractTreeNodeService.java | 13 ++-------- .../ServletAbstractTreeNodeService.java | 13 ++-------- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/pom.xml b/pom.xml index 34eab60..5f46a49 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ leafage-common - 0.1.6 + 0.1.7 jar leafage-common diff --git a/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java b/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java index e99c163..a04a8a9 100644 --- a/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java +++ b/src/main/java/top/leafage/common/basic/AbstractTreeNodeService.java @@ -8,6 +8,7 @@ import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.Set; /** @@ -25,6 +26,29 @@ public abstract class AbstractTreeNodeService extends AbstractBasicService { private static final Logger log = StatusLogger.getLogger(); + /** + * 构造 TreeNode 对象 + * + * @param superiorCode superior code + * @param t 实例数据 + * @param expand 扩展字段 + * @return TreeNode 对象 + * @since 0.1.7 + */ + protected TreeNode construct(Object superiorCode, T t, Set expand) { + Class childClass = t.getClass(); + Object code = this.getCode(t, childClass); + Object name = this.getName(t, childClass); + + TreeNode treeNode = new TreeNode(Objects.nonNull(code) ? String.valueOf(code) : null, + Objects.nonNull(name) ? String.valueOf(name) : null); + treeNode.setSuperior(Objects.nonNull(superiorCode) ? String.valueOf(superiorCode) : null); + + // deal expand + this.expand(treeNode, childClass, t, expand); + return treeNode; + } + /** * 扩展数据 * @@ -33,7 +57,7 @@ public abstract class AbstractTreeNodeService extends AbstractBasicService { * @param t 数据实例 * @param expand 扩展字段 */ - protected void expand(TreeNode treeNode, Class clazz, T t, Set expand) { + private void expand(TreeNode treeNode, Class clazz, T t, Set expand) { if (expand != null && !expand.isEmpty()) { Map map = new HashMap<>(expand.size()); expand.forEach(filed -> { diff --git a/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java b/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java index e1bd297..6ae1dbe 100644 --- a/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java +++ b/src/main/java/top/leafage/common/reactive/ReactiveAbstractTreeNodeService.java @@ -36,19 +36,10 @@ protected Flux children(T superior, Flux children, Set expa Class aClass = superior.getClass(); // ID是集成基础父类的,所以要通过superClass获取 Object superiorId = this.getId(superior, aClass); - Object superiorName = this.getName(superior, aClass); + Object superiorCode = this.getCode(superior, aClass); return children.filter(child -> this.check(superiorId, child)).flatMap(child -> { - Class childClass = child.getClass(); - Object code = this.getCode(child, childClass); - Object name = this.getName(child, childClass); - - TreeNode treeNode = new TreeNode(code != null ? code.toString() : null, - name != null ? name.toString() : null); - treeNode.setSuperior(superiorName != null ? superiorName.toString() : null); - - // deal expand - this.expand(treeNode, childClass, child, expand); + TreeNode treeNode = this.construct(superiorCode, child, expand); return this.children(child, children, expand).collectList().map(treeNodes -> { treeNode.setChildren(treeNodes); diff --git a/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java b/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java index 5c81625..364ce6d 100644 --- a/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java +++ b/src/main/java/top/leafage/common/servlet/ServletAbstractTreeNodeService.java @@ -36,19 +36,10 @@ protected List children(T superior, List children) { protected List children(T superior, List children, Set expand) { Class aClass = superior.getClass(); Object superiorId = this.getId(superior, aClass); - Object superiorName = this.getName(superior, aClass); + Object superiorCode = this.getCode(superior, aClass); return children.stream().filter(child -> this.check(superiorId, child)).map(child -> { - Class childClass = child.getClass(); - Object code = this.getCode(child, childClass); - Object name = this.getName(child, childClass); - - TreeNode treeNode = new TreeNode(code == null ? null : code.toString(), - name == null ? null : name.toString()); - treeNode.setSuperior(superiorName == null ? null : superiorName.toString()); - - // deal expand - this.expand(treeNode, childClass, child, expand); + TreeNode treeNode = this.construct(superiorCode, child, expand); treeNode.setChildren(this.children(child, children, expand)); From 5355cafd52e8d14d9e3351bc52972ae7e539576d Mon Sep 17 00:00:00 2001 From: little3201 Date: Wed, 13 Apr 2022 18:59:07 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B8=B8=E9=87=8F?= =?UTF-8?q?=E7=B1=BB=EF=BC=9B=20=E4=BF=AE=E6=94=B9ReactiveBasicService?= =?UTF-8?q?=EF=BC=8C=E5=8E=BB=E6=8E=89=E4=B8=80=E4=BA=9B=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 +- .../leafage/common/basic/ValidMessage.java | 59 +++++++++++++++++++ .../common/reactive/ReactiveBasicService.java | 48 +++------------ .../common/servlet/ServletBasicService.java | 14 ++--- 4 files changed, 77 insertions(+), 50 deletions(-) create mode 100644 src/main/java/top/leafage/common/basic/ValidMessage.java diff --git a/pom.xml b/pom.xml index 5f46a49..479b308 100644 --- a/pom.xml +++ b/pom.xml @@ -5,19 +5,19 @@ top.leafage leafage-starter-parent - 0.1.2 + 0.1.3 leafage-common - 0.1.7 + 0.1.8 jar leafage-common common for leafage - 5.1.0 + 5.2.2 diff --git a/src/main/java/top/leafage/common/basic/ValidMessage.java b/src/main/java/top/leafage/common/basic/ValidMessage.java new file mode 100644 index 0000000..c52e68e --- /dev/null +++ b/src/main/java/top/leafage/common/basic/ValidMessage.java @@ -0,0 +1,59 @@ +package top.leafage.common.basic; + +import java.io.Serializable; + +/** + * 参数校验信息 + * + * @author liwenqiang 2022/4/13 17:13 + * @since 0.1.8 + **/ +public class ValidMessage implements Serializable { + + private static final long serialVersionUID = 3385684846039604779L; + + /** + * code + */ + private static final String CODE = "code"; + + /** + * name + */ + private static final String NAME = "name"; + + /** + * username + */ + private static final String USERNAME = "username"; + + /** + * not blank + */ + private static final String NOT_BLANK = " must not be blank."; + + /** + * non null + */ + private static final String NON_NULL = " must not be null."; + + /** + * code must not be blank + */ + public static final String CODE_NOT_BLANK = CODE + NOT_BLANK; + + /** + * code must not be null + */ + public static final String CODE_NOT_NULL = CODE + NON_NULL; + + /** + * name must not be blank + */ + public static final String NAME_NOT_BLANK = NAME + NOT_BLANK; + + /** + * username must not be blank + */ + public static final String USERNAME_NOT_BLANK = USERNAME + NOT_BLANK; +} diff --git a/src/main/java/top/leafage/common/reactive/ReactiveBasicService.java b/src/main/java/top/leafage/common/reactive/ReactiveBasicService.java index fe0a654..35cde22 100644 --- a/src/main/java/top/leafage/common/reactive/ReactiveBasicService.java +++ b/src/main/java/top/leafage/common/reactive/ReactiveBasicService.java @@ -25,40 +25,7 @@ default Flux retrieve() { } /** - * 分页获取entities - * - * @param page 页码 - * @param size 分页大小 - * @return a flux containing the elements of this list - */ - default Flux retrieve(int page, int size) { - return Flux.empty(); - } - - /** - * 分页获取排序后的entities - * - * @param page 页码 - * @param size 分页大小 - * @param sort 排序字段 - * @return a flux containing the elements of this list - */ - default Flux retrieve(int page, int size, String sort) { - return Flux.empty(); - } - - /** - * 名称是否存在 - * - * @param name 名称 - * @return true-exist, false-not exist - */ - default Mono exist(String name) { - return Mono.empty(); - } - - /** - * 根据code获取entity + * 根据code查询 * * @param code 代码 * @return a element instanceof vo @@ -68,16 +35,17 @@ default Mono fetch(C code) { } /** - * 统计记录数 + * 是否存在 * - * @return the count of elements + * @param param 属性 + * @return true-exist, false-not exist */ - default Mono count() { + default Mono exist(String param) { return Mono.empty(); } /** - * 根据code删除entity + * 删除 * * @param code 代码 * @return Void no return @@ -97,7 +65,7 @@ default Mono removeAll(List dList) { } /** - * 新增entity + * 添加 * * @param d 实例 * @return a element instanceof vo @@ -107,7 +75,7 @@ default Mono create(D d) { } /** - * 编辑entity + * 修改 * * @param code 代码 * @param d 实例 diff --git a/src/main/java/top/leafage/common/servlet/ServletBasicService.java b/src/main/java/top/leafage/common/servlet/ServletBasicService.java index c1dc2ea..8b7d92f 100644 --- a/src/main/java/top/leafage/common/servlet/ServletBasicService.java +++ b/src/main/java/top/leafage/common/servlet/ServletBasicService.java @@ -27,7 +27,7 @@ default List retrieve() { } /** - * 根据唯一标识获取 + * 根据code查询 * * @param code 代码 * @return a element instanceof vo @@ -37,17 +37,17 @@ default V fetch(C code) { } /** - * 名称是否存在 + * 是否存在 * - * @param name 名称 + * @param param 名称 * @return true-exist, false-not exist */ - default boolean exist(String name) { + default boolean exist(String param) { return false; } /** - * 根据唯一标识删除entity + * 删除 * * @param code 代码 */ @@ -63,7 +63,7 @@ default void removeAll(List dList) { } /** - * 添加对象 + * 添加 * * @param d 入参 * @return a element instanceof vo @@ -73,7 +73,7 @@ default V create(D d) { } /** - * 修改对象 + * 修改 * * @param code 唯一标识 * @param d 入参