From 3321ba17cf2d1678428e5881d274fbbd24acdc0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=B1=E5=9C=B3=E5=BD=A9=E5=87=A4=E8=BD=AF=E4=BB=B6?= Date: Sat, 16 Sep 2023 15:15:19 +0000 Subject: [PATCH 1/2] update src/main/java/org/teasoft/bee/osql/annotation/JustFetch.java. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 深圳彩凤软件 --- .../bee/osql/annotation/JustFetch.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/teasoft/bee/osql/annotation/JustFetch.java b/src/main/java/org/teasoft/bee/osql/annotation/JustFetch.java index 93a8490..71a100e 100644 --- a/src/main/java/org/teasoft/bee/osql/annotation/JustFetch.java +++ b/src/main/java/org/teasoft/bee/osql/annotation/JustFetch.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 the original author.All rights reserved. + * Copyright 2016-2023 the original author.All rights reserved. * Kingstar(honeysoft@126.com) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,11 +37,28 @@ import java.lang.annotation.Target;

private String name2;

-->select name as name2 +

eg:(since 2.1.8) +

TestUser.java +

@JustFetch() //Only obtain values, do not transfer fields to select/where. +

private String count1; +

+

Condition condition=BF.getCondition(); +

condition.selectFun(FunctionType.COUNT, "*", "count1"); +

condition.selectField("lastName"); +

condition.groupBy("lastName"); +

List list =suid.select(testUser,condition); //select +

+ * @author Kingstar * @since 1.11 */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface JustFetch { - String value() default ""; + + /** + * Since V2.1.8,when value is empty, the corresponding field is parsed and only used to receive the result value + * @return + */ + String value() default ""; } -- Gitee From 0e3a58d36a530f26c073d6e255c87a9acab3f4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=B1=E5=9C=B3=E5=BD=A9=E5=87=A4=E8=BD=AF=E4=BB=B6?= Date: Sat, 16 Sep 2023 15:16:12 +0000 Subject: [PATCH 2/2] update src/main/java/org/teasoft/bee/osql/api/MoreTable.java. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 深圳彩凤软件 --- .../org/teasoft/bee/osql/api/MoreTable.java | 41 ++++++++----------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/src/main/java/org/teasoft/bee/osql/api/MoreTable.java b/src/main/java/org/teasoft/bee/osql/api/MoreTable.java index 7a52d86..4952049 100644 --- a/src/main/java/org/teasoft/bee/osql/api/MoreTable.java +++ b/src/main/java/org/teasoft/bee/osql/api/MoreTable.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 the original author.All rights reserved. + * Copyright 2016-2023 the original author.All rights reserved. * Kingstar(honeysoft@126.com) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -171,43 +171,38 @@ public interface MoreTable extends CommOperate { /** * insert entity. support oneToOne/oneToMany. - * 若主表的主键用于从表的外键,则会自动填入. + * If the primary key of the main table is used for the foreign key of the sub table, it will be automatically filled in. * @param entity table's entity(do not allow null). - * @return + * @return returns the number of affected records in the main table. * @since 2.1.8 */ public int insert(T entity); /** - * 更新符合条件的主实体(主表)和子实体(子表); - * 此方法以主键作为过滤条件确定实体,所以主键字段不能为空. - * 主表,设置所有的外键对应字段时,从表会自动关联更新; - * 主表没有设置所有的外键对应字段时,若从表设置了所有的外键值,从表也会自动关联更新;否则不更新 + * Update the main entity (main table) and the sub-entity (sub table) that meet the conditions. + * This method uses the primary key as the filtering condition to determine the entity, + * so the primary key field of the entity must not be empty. + * When all the foreign key corresponding fields are set in the main table, the sub table will be automatically + * updated in association. + * If not all the foreign key corresponding fields are set in the main table, the sub table will also be automatically + * updated in association if all the foreign key values are set in the sub table; otherwise, it will not be updated. * @param entity - * @return 返回主表被更新的记录条数 + * @return returns the number of affected records in the main table. * @since 2.1.8 */ public int update(T entity); - -// /** -// * 更新符合条件的主实体(主表)和子实体(子表); -// * 主表,设置所有的外键对应字段时,从表会自动关联更新; -// * 主表没有设置所有的外键对应字段时,若从表设置了所有的外键值,从表也会自动关联更新;否则不更新 -// * @param entity -// * @param condition -// * @return -// */ -// public int update(T entity,Condition condition); - //暂不支持;还要考虑 Condition如何区分哪些是主从表的条件. + /** - * 删除符合条件的主实体(主表)和子实体(子表); - * 主表,设置所有的外键对应字段时,从表会自动关联更新; - * 主表没有设置所有的外键对应字段时,若从表设置了所有的外键值,从表也会自动关联更新;否则不更新 + * Delete the main entity (main table) and the sub-entity (sub table) that meet the conditions. + * When all the foreign key corresponding fields are set in the main table, the sub table will be automatically updated + * in association. + * If not all the foreign key corresponding fields are set in the main table, the sub table will also be automatically + * updated in association if all the foreign key values are set in the sub table; otherwise, it will not be updated. * @param entity - * @return 返回主表被删除的记录条数 + * @return returns the number of affected records in the main table. * @since 2.1.8 */ public int delete(T entity); -- Gitee