Skip to content

Commit

Permalink
Merge pull request #245 from erupts/develop
Browse files Browse the repository at this point in the history
1.12.12
  • Loading branch information
erupts committed Apr 28, 2024
2 parents 1c9f52f + 75a6e3b commit ae45638
Show file tree
Hide file tree
Showing 52 changed files with 119 additions and 96 deletions.
2 changes: 1 addition & 1 deletion erupt-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-annotation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
@Setter
public class PowerObject {

private boolean add;
private boolean add = true;

private boolean delete;
private boolean edit = true;

private boolean edit;
private boolean delete = true;

private boolean query;
private boolean query = true;

private boolean viewDetails;
private boolean viewDetails = true;

private boolean export;
private boolean export = true;

private boolean importable;
private boolean importable = true;

public PowerObject(Power power) {
this.add = power.add();
Expand All @@ -37,6 +37,6 @@ public PowerObject(Power power) {
}

public PowerObject() {

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
*/
public @interface Link {

@Comment("要关联的erupt类,注意:该类需要配置访问权限")
@Comment("erupt class to associate with. Note that this class needs to be configured with access permissions")
Class<?> linkErupt();

@Transient
@Comment("被关联列,this.joinColumn = linkErupt.column")
String column() default "id";

@Transient
@Comment("需要关联的列,this.joinColumn = linkErupt.column ")
@Comment("Column in linkErupt → this.column = linkErupt.joinColumn")
String joinColumn();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public enum EditType {
@EditTypeSearch(vagueMethod = QueryExpression.RANGE)
@EditTypeMapping(mapping = SliderType.class, desc = "数字滑块", allowType = {JavaTypeEnum.number})
SLIDER,
@EditTypeMapping(desc = "颜色选择", allowType = {JavaTypeEnum.String})
COLOR,
@EditTypeSearch(vagueMethod = QueryExpression.RANGE)
@EditTypeMapping(mapping = RateType.class, desc = "评分", allowType = {JavaTypeEnum.number})
RATE,
Expand Down Expand Up @@ -66,6 +68,7 @@ public enum EditType {

@Comment("==================================")
@Comment("以下组件修饰于复杂对象上")
@Comment("==================================")

@EditTypeSearch
@EditTypeMapping(mapping = ReferenceTreeType.class, desc = "树引用(多对一)", allowType = {JavaTypeEnum.object})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
public enum ViewType {
@Comment("根据返回值等特征自动判断")
AUTO,
@Comment("普通文文本")
@Comment("普通文本")
TEXT,
@Comment("颜色")
COLOR,
@Comment("安全文本渲染")
SAFE_TEXT,
@Comment("图片")
Expand Down
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-node-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-node/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,15 @@ public class NodePowerInvoke implements PowerHandler {
@Override
public void handler(PowerObject power) {
EruptModel eruptModel = EruptCoreService.getErupt(MetaContext.getErupt().getName());
if (!eruptModel.getErupt().authVerify()) {
return;
}
String powerObjectString = HttpUtil.createGet(eruptNodeProp.getBalanceAddress() + CloudRestApiConst.ERUPT_POWER)
.form("nodeName", eruptNodeProp.getNodeName())
.form("eruptName", eruptModel.getEruptName())
.header(EruptMutualConst.TOKEN, MetaContext.getToken()).execute().body();
PowerObject remotePowerObject = GsonFactory.getGson().fromJson(powerObjectString, PowerObject.class);
if (power.isAdd()) {
power.setAdd(remotePowerObject.isAdd());
}
if (power.isDelete()) {
power.setDelete(remotePowerObject.isDelete());
}
if (power.isEdit()) {
power.setEdit(remotePowerObject.isEdit());
}
if (power.isViewDetails()) {
power.setViewDetails(remotePowerObject.isViewDetails());
}
if (power.isExport()) {
power.setExport(remotePowerObject.isExport());
}
if (power.isImportable()) {
power.setImportable(remotePowerObject.isImportable());
}
PowerObject remotePowerObject = GsonFactory.getGson().fromJson(HttpUtil.createGet(eruptNodeProp.getBalanceAddress() + CloudRestApiConst.ERUPT_POWER)
.form("nodeName", eruptNodeProp.getNodeName()).form("eruptName", eruptModel.getEruptName())
.header(EruptMutualConst.TOKEN, MetaContext.getToken()).execute().body(), PowerObject.class);
if (power.isAdd()) power.setAdd(remotePowerObject.isAdd());
if (power.isDelete()) power.setDelete(remotePowerObject.isDelete());
if (power.isEdit()) power.setEdit(remotePowerObject.isEdit());
if (power.isViewDetails()) power.setViewDetails(remotePowerObject.isViewDetails());
if (power.isExport()) power.setExport(remotePowerObject.isExport());
if (power.isImportable()) power.setImportable(remotePowerObject.isImportable());
}

}
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
20 changes: 12 additions & 8 deletions erupt-core/src/main/java/xyz/erupt/core/invoke/PowerInvoke.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@ public static void registerPowerHandler(Class<? extends PowerHandler> powerHandl
powerHandlerStack.add(powerHandler);
}

//动态获取erupt power值
//The erupt power value is processed dynamically
public static PowerObject getPowerObject(EruptModel eruptModel) {
Power power = eruptModel.getErupt().power();
PowerObject powerBean = new PowerObject(power);
if (eruptModel.getErupt().authVerify()) {
PowerObject powerBean = new PowerObject(power);
if (eruptModel.getErupt().authVerify()) {
powerHandlerStack.forEach(ph -> EruptSpringUtil.getBean(ph).handler(powerBean));
}
powerHandlerStack.forEach(ph -> EruptSpringUtil.getBean(ph).handler(powerBean));
if (!power.powerHandler().isInterface()) EruptSpringUtil.getBean(power.powerHandler()).handler(powerBean);
return powerBean;
} else {
return new PowerObject(power);
}
PowerObject processorMaster = DataProcessorManager.getEruptDataProcessor(eruptModel.getClazz()).power();
if (!processorMaster.isAdd()) powerBean.setAdd(false);
if (!processorMaster.isDelete()) powerBean.setDelete(false);
if (!processorMaster.isEdit()) powerBean.setEdit(false);
if (!processorMaster.isQuery()) powerBean.setQuery(false);
if (!processorMaster.isViewDetails()) powerBean.setViewDetails(false);
if (!processorMaster.isExport()) powerBean.setExport(false);
if (!processorMaster.isImportable()) powerBean.setImportable(false);
return powerBean;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ protected Object invocation(MethodInvocation invocation) {
return ViewType.CODE;
case MAP:
return ViewType.MAP;
case COLOR:
return ViewType.COLOR;
case TAB_TABLE_ADD:
case TAB_TREE:
case TAB_TABLE_REFER:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package xyz.erupt.core.service;

import xyz.erupt.annotation.config.Comment;
import xyz.erupt.annotation.fun.PowerObject;
import xyz.erupt.core.query.Column;
import xyz.erupt.core.query.EruptQuery;
import xyz.erupt.core.view.EruptModel;
Expand All @@ -16,6 +17,11 @@
*/
public interface IEruptDataService {

@Comment("定义数据源能力")
default PowerObject power() {
return new PowerObject();
}

@Comment("根据主键id获取数据")
Object findDataById(EruptModel eruptModel, @Comment("主键值") Object id);

Expand Down
2 changes: 1 addition & 1 deletion erupt-data/erupt-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import xyz.erupt.linq.lambda.SFunction;

import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.Query;
import java.util.*;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -40,7 +41,7 @@ public <R> EruptLambdaQuery<T> isNotNull(SFunction<T, R> field) {
return this;
}

public <R> EruptLambdaQuery<T> eq(SFunction<T, R> field, Object val) {
public <E, R> EruptLambdaQuery<T> eq(SFunction<E, R> field, Object val) {
String placeholder = this.genePlaceholder();
querySchema.getWheres().add(geneField(field) + " = :" + placeholder);
querySchema.getParams().put(placeholder, val);
Expand Down Expand Up @@ -122,6 +123,17 @@ public EruptLambdaQuery<T> addCondition(String condition) {
return this;
}

public EruptLambdaQuery<T> addCondition(String condition, Map<String, Object> params) {
querySchema.getWheres().add(condition);
Optional.ofNullable(params).ifPresent(it -> querySchema.getParams().putAll(params));
return this;
}

public EruptLambdaQuery<T> addParam(String key, Object val) {
querySchema.getParams().put(key, val);
return this;
}

public EruptLambdaQuery<T> orderBy(SFunction<T, ?> field) {
querySchema.getOrders().add(LambdaSee.info(field).getField() + " asc");
return this;
Expand All @@ -143,7 +155,11 @@ public EruptLambdaQuery<T> offset(Integer offset) {
}

public T one() {
return (T) this.geneQuery().getSingleResult();
try {
return (T) this.geneQuery().getSingleResult();
} catch (NoResultException e) {
return null;
}
}

public List<T> list() {
Expand Down
2 changes: 1 addition & 1 deletion erupt-data/erupt-mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-excel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public enum GeneratorType {
INPUT(EditType.INPUT, "文本输入", String.class.getSimpleName(), "inputType = @InputType"),
PASSWORD(EditType.INPUT, "密码输入", String.class.getSimpleName(), "inputType = @InputType(type = \"password\")"),
COLOR(EditType.INPUT, "颜色选择", String.class.getSimpleName(), "inputType = @InputType(type = \"color\")"),
COLOR(EditType.COLOR, "颜色选择", String.class.getSimpleName(), null),
NUMBER(EditType.NUMBER, "数值框", Integer.class.getSimpleName(), "numberType = @NumberType"),
SLIDER(EditType.SLIDER, "数字滑块", Integer.class.getSimpleName(), "sliderType = @SliderType(max = 999)"),
RATE(EditType.RATE, "评分", Short.class.getSimpleName(), "rateType = @RateType(count = 10)"),
Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-job/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-magic-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-monitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.11</version>
<version>1.12.12</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Loading

0 comments on commit ae45638

Please sign in to comment.