Skip to content

Commit 847aa95

Browse files
authored
Merge pull request #7 from ClearXs/0.1.x
0.1.x
2 parents 8585049 + 4513b07 commit 847aa95

File tree

7 files changed

+66
-60
lines changed

7 files changed

+66
-60
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<groupId>cc.allio</groupId>
1313
<artifactId>Turbo</artifactId>
14-
<version>0.1.0-beta.1.RELEASE</version>
14+
<version>0.1.0</version>
1515
<name>Turbo</name>
1616
<description>Turbo快速开发平台</description>
1717
<url>https://github.com/ClearXs/Turbo.git</url>
@@ -25,7 +25,7 @@
2525

2626
<properties>
2727
<java.version>21</java.version>
28-
<uno.version>1.1.6-beta.1</uno.version>
28+
<uno.version>1.1.6</uno.version>
2929
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
3030
<maven-plugin.version>3.11.0</maven-plugin.version>
3131
<knife4j.version>4.3.0</knife4j.version>

src/main/java/cc/allio/turbo/common/db/uno/interceptor/TenantInterceptor.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import cc.allio.uno.core.function.lambda.MethodBiConsumer;
44
import cc.allio.uno.data.orm.dsl.Operator;
55
import cc.allio.uno.data.orm.dsl.Table;
6+
import cc.allio.uno.data.orm.dsl.dml.InsertOperator;
67
import cc.allio.uno.data.orm.dsl.dml.QueryOperator;
78
import cc.allio.uno.data.orm.dsl.dml.UpdateOperator;
89
import cc.allio.uno.data.orm.executor.CommandExecutor;
@@ -32,6 +33,19 @@ public class TenantInterceptor implements Interceptor {
3233
public void onQueryBefore(CommandExecutor commandExecutor, Operator<?> operator) {
3334
if (operator instanceof QueryOperator queryOperator) {
3435
Table table = queryOperator.getTable();
36+
allowTenant(table, queryOperator::eq);
37+
}
38+
}
39+
40+
/**
41+
* @param commandExecutor commandExecutor
42+
* @param operator operator
43+
*/
44+
@Override
45+
public void onSaveBefore(CommandExecutor commandExecutor, Operator<?> operator) {
46+
if (operator instanceof InsertOperator insertOperator) {
47+
Table table = insertOperator.getTable();
48+
allowTenant(table, insertOperator::strictFill);
3549
}
3650
}
3751

@@ -43,7 +57,7 @@ public void onQueryBefore(CommandExecutor commandExecutor, Operator<?> operator)
4357
public void onUpdateBefore(CommandExecutor commandExecutor, Operator<?> operator) {
4458
if (operator instanceof UpdateOperator updateOperator) {
4559
Table table = updateOperator.getTable();
46-
allowTenant(table, updateOperator::eq);
60+
allowTenant(table, updateOperator::strictFill);
4761
}
4862
}
4963

src/main/java/cc/allio/turbo/common/web/TurboCrudController.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,6 @@ public void export(@RequestBody QueryParam<T> params, HttpServletResponse respon
166166
interceptor.onExportAfter(service, response, ds);
167167
}
168168

169-
/**
170-
* 导出
171-
*/
172-
@Operation(summary = "导出")
173-
@PostMapping("/export")
174-
public void export(HttpServletResponse response, @RequestBody QueryParam<T> params) {
175-
Class<T> clazz = getEntityType();
176-
QueryWrapper<T> queryWrapper = Conditions.entityQuery(params, clazz);
177-
List<T> list = service.list(queryWrapper);
178-
ExcelUtil.export(response, list, clazz);
179-
}
180-
181169
/**
182170
* 导入
183171
*/

src/main/java/cc/allio/turbo/modules/developer/controller/BoDomainController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public R<DomainEntity> details(@PathVariable("boId") Long boId, @PathVariable("i
8484
public R<List<DomainEntity>> list(@PathVariable("boId") Long boId, @RequestBody QueryParam<DomainEntity> params) throws BizException {
8585
QueryWrapper<DomainEntity> wrapper = Wrappers.query();
8686
domainService.getBoRepositoryOrThrow(boId)
87-
.inspectOn("list", context ->
87+
.aspectOn("list", context ->
8888
Optionals.withBoth(context.getTypeFirst(QueryWrapper.class), context.getTypeFirst(BoSchema.class))
8989
.ifPresent(pair -> {
9090
QueryWrapper<DomainEntity> queryWrapper = pair.getFirst();
@@ -101,7 +101,7 @@ public R<List<DomainEntity>> list(@PathVariable("boId") Long boId, @RequestBody
101101
public R<IPage<DomainEntity>> page(@PathVariable("boId") Long boId, @RequestBody QueryParam<DomainEntity> params) throws BizException {
102102
QueryWrapper<DomainEntity> wrapper = Wrappers.query();
103103
domainService.getBoRepositoryOrThrow(boId)
104-
.inspectOn("page", context ->
104+
.aspectOn("page", context ->
105105
Optionals.withBoth(context.getTypeFirst(QueryWrapper.class), context.getTypeFirst(BoSchema.class))
106106
.ifPresent(pair -> {
107107
QueryWrapper<DomainEntity> queryWrapper = pair.getFirst();

src/main/java/cc/allio/turbo/modules/developer/service/IBoDomainService.java

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -580,75 +580,75 @@ default <Z extends TreeDomain<DomainEntity, Z>> List<Z> tree(Long boId, Wrapper<
580580
interface IDomainCrudTreeRepositoryService extends ITurboCrudTreeRepositoryService<DomainEntity> {
581581

582582
/**
583-
* @see #inspectOn(String, ThrowingMethodConsumer)
583+
* @see #aspectOn(String, ThrowingMethodConsumer)
584584
*/
585-
default <T> void inspectOn(ThrowingMethodConsumer<T> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
585+
default <T> void aspectOn(ThrowingMethodConsumer<T> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
586586
String domainMethodName = domainMethod.getMethodName();
587-
inspectOn(domainMethodName, callback);
587+
aspectOn(domainMethodName, callback);
588588
}
589589

590590
/**
591-
* @see #inspectOn(String, ThrowingMethodConsumer)
591+
* @see #aspectOn(String, ThrowingMethodConsumer)
592592
*/
593-
default <T> void inspectOn(ThrowingMethodSupplier<T> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
593+
default <T> void aspectOn(ThrowingMethodSupplier<T> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
594594
String domainMethodName = domainMethod.getMethodName();
595-
inspectOn(domainMethodName, callback);
595+
aspectOn(domainMethodName, callback);
596596
}
597597

598598
/**
599-
* @see #inspectOn(String, ThrowingMethodConsumer)
599+
* @see #aspectOn(String, ThrowingMethodConsumer)
600600
*/
601-
default <T, R> void inspectOn(ThrowingMethodFunction<T, R> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
601+
default <T, R> void aspectOn(ThrowingMethodFunction<T, R> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
602602
String domainMethodName = domainMethod.getMethodName();
603-
inspectOn(domainMethodName, callback);
603+
aspectOn(domainMethodName, callback);
604604
}
605605

606606
/**
607-
* @see #inspectOn(String, ThrowingMethodConsumer)
607+
* @see #aspectOn(String, ThrowingMethodConsumer)
608608
*/
609-
default <T1, T2> void inspectOn(ThrowingMethodBiConsumer<T1, T2> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
609+
default <T1, T2> void aspectOn(ThrowingMethodBiConsumer<T1, T2> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
610610
String domainMethodName = domainMethod.getMethodName();
611-
inspectOn(domainMethodName, callback);
611+
aspectOn(domainMethodName, callback);
612612
}
613613

614614
/**
615-
* @see #inspectOn(String, ThrowingMethodConsumer)
615+
* @see #aspectOn(String, ThrowingMethodConsumer)
616616
*/
617-
default <T1, T2, R> void inspectOn(ThrowingMethodBiFunction<T1, T2, R> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
617+
default <T1, T2, R> void aspectOn(ThrowingMethodBiFunction<T1, T2, R> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
618618
String domainMethodName = domainMethod.getMethodName();
619-
inspectOn(domainMethodName, callback);
619+
aspectOn(domainMethodName, callback);
620620
}
621621

622622
/**
623-
* @see #inspectOn(String, ThrowingMethodConsumer)
623+
* @see #aspectOn(String, ThrowingMethodConsumer)
624624
*/
625-
default <T1, T2, T3> void inspectOn(ThrowingMethodTerConsumer<T1, T2, T3> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
625+
default <T1, T2, T3> void aspectOn(ThrowingMethodTerConsumer<T1, T2, T3> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
626626
String domainMethodName = domainMethod.getMethodName();
627-
inspectOn(domainMethodName, callback);
627+
aspectOn(domainMethodName, callback);
628628
}
629629

630630
/**
631-
* @see #inspectOn(String, ThrowingMethodConsumer)
631+
* @see #aspectOn(String, ThrowingMethodConsumer)
632632
*/
633-
default <T1, T2, T3, R> void inspectOn(ThrowingMethodTerFunction<T1, T2, T3, R> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
633+
default <T1, T2, T3, R> void aspectOn(ThrowingMethodTerFunction<T1, T2, T3, R> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
634634
String domainMethodName = domainMethod.getMethodName();
635-
inspectOn(domainMethodName, callback);
635+
aspectOn(domainMethodName, callback);
636636
}
637637

638638
/**
639-
* @see #inspectOn(String, ThrowingMethodConsumer)
639+
* @see #aspectOn(String, ThrowingMethodConsumer)
640640
*/
641-
default <T1, T2, T3, T4> void inspectOn(ThrowingMethodQueConsumer<T1, T2, T3, T4> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
641+
default <T1, T2, T3, T4> void aspectOn(ThrowingMethodQueConsumer<T1, T2, T3, T4> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
642642
String domainMethodName = domainMethod.getMethodName();
643-
inspectOn(domainMethodName, callback);
643+
aspectOn(domainMethodName, callback);
644644
}
645645

646646
/**
647-
* @see #inspectOn(String, ThrowingMethodConsumer)
647+
* @see #aspectOn(String, ThrowingMethodConsumer)
648648
*/
649-
default <T1, T2, T3, T4, R> void inspectOn(ThrowingMethodQueFunction<T1, T2, T3, T4, R> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
649+
default <T1, T2, T3, T4, R> void aspectOn(ThrowingMethodQueFunction<T1, T2, T3, T4, R> domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
650650
String domainMethodName = domainMethod.getMethodName();
651-
inspectOn(domainMethodName, callback);
651+
aspectOn(domainMethodName, callback);
652652
}
653653

654654
/**
@@ -663,18 +663,18 @@ default <T1, T2, T3, T4, R> void inspectOn(ThrowingMethodQueFunction<T1, T2, T3,
663663
* @param domainMethod 领域行为
664664
* @param callback 当给定领域行为发生时的回调
665665
*/
666-
void inspectOn(String domainMethod, ThrowingMethodConsumer<OptionalContext> callback);
666+
void aspectOn(String domainMethod, ThrowingMethodConsumer<OptionalContext> callback);
667667

668668
/**
669669
* 获取领域切面的队列
670670
*/
671-
Queue<DomainInspect> getDomainInspects();
671+
Queue<DomainAspect> getDomainAspects();
672672
}
673673

674674
/**
675675
* 领域对象切面
676676
*/
677-
interface DomainInspect {
677+
interface DomainAspect {
678678

679679
/**
680680
* 获取领域行为

src/main/java/cc/allio/turbo/modules/developer/service/impl/BoDomainServiceImpl.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,27 +133,27 @@ IDomainCrudTreeRepositoryService createAopRepository(CommandExecutor commandExec
133133

134134
public static class BoDomainCrudTreeRepositoryServiceImpl extends SimpleTurboCrudTreeRepositoryServiceImpl<DomainEntity> implements IDomainCrudTreeRepositoryService {
135135

136-
private final Queue<DomainInspect> domainInspects;
136+
private final Queue<DomainAspect> domainAspects;
137137

138138
public BoDomainCrudTreeRepositoryServiceImpl(CommandExecutor commandExecutor) {
139139
super(commandExecutor, DomainEntity.class);
140-
this.domainInspects = Queues.newConcurrentLinkedQueue();
140+
this.domainAspects = Queues.newConcurrentLinkedQueue();
141141
}
142142

143143
@Override
144-
public void inspectOn(String domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
145-
this.domainInspects.offer(new DomainInspectImpl(domainMethod, callback));
144+
public void aspectOn(String domainMethod, ThrowingMethodConsumer<OptionalContext> callback) {
145+
this.domainAspects.offer(new DomainInspectImpl(domainMethod, callback));
146146
}
147147

148148
@Override
149-
public Queue<DomainInspect> getDomainInspects() {
150-
return domainInspects;
149+
public Queue<DomainAspect> getDomainAspects() {
150+
return domainAspects;
151151
}
152152
}
153153

154154
@AllArgsConstructor
155155
@Getter
156-
public static class DomainInspectImpl implements DomainInspect {
156+
public static class DomainInspectImpl implements DomainAspect {
157157

158158
private final String domainMethod;
159159
private final ThrowingMethodConsumer<OptionalContext> callback;
@@ -164,8 +164,8 @@ public static class BoDomainLockRepositoryMethodInterceptor extends LockReposito
164164

165165
public BoDomainLockRepositoryMethodInterceptor(BoSchema schema) {
166166
this.schema = schema;
167-
addIgnoreMethod("inspectOn");
168-
addIgnoreMethod("getDomainInspects");
167+
addIgnoreMethod("aspectOn");
168+
addIgnoreMethod("getDomainAspects");
169169
}
170170

171171
@Override
@@ -175,11 +175,11 @@ protected Object doInvoke(MethodInvocation invocation, OptionalContext lockConte
175175
Object theThis = invocation.getThis();
176176
Method method = invocation.getMethod();
177177
if (theThis instanceof IDomainCrudTreeRepositoryService domainCrudTreeRepositoryService) {
178-
Queue<DomainInspect> domainInspects = domainCrudTreeRepositoryService.getDomainInspects();
179-
DomainInspect domainInspect = domainInspects.poll();
178+
Queue<DomainAspect> domainAspects = domainCrudTreeRepositoryService.getDomainAspects();
179+
DomainAspect domainInspect = domainAspects.poll();
180180
if (domainInspect != null && isMatch(domainInspect.getDomainMethod(), method)) {
181181
if (log.isDebugEnabled()) {
182-
log.debug("domain object [{}] inspect domain method [{}]", schema.getName(), domainInspect.getDomainMethod());
182+
log.debug("domain object [{}] aspect domain method [{}]", schema.getName(), domainInspect.getDomainMethod());
183183
}
184184
// 存入参数
185185
Object[] arguments = invocation.getArguments();
@@ -189,7 +189,7 @@ protected Object doInvoke(MethodInvocation invocation, OptionalContext lockConte
189189
callback.accept(immutableContext);
190190
} catch (Throwable ex) {
191191
// ignore
192-
log.warn("domain object [{}] inspect domain method {} encounter error, now just log error and ignore", schema.getName(), domainInspect.getDomainMethod(), ex);
192+
log.warn("domain object [{}] aspect domain method {} encounter error, now just log error and ignore", schema.getName(), domainInspect.getDomainMethod(), ex);
193193
}
194194
}
195195
}

src/main/resources/application.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
server:
22
port: 8600
3+
undertow:
4+
threads:
5+
io: 100
6+
worker: 10
37

48
spring:
59
application:

0 commit comments

Comments
 (0)