mxd 3 years ago
parent
commit
1d98835d24

+ 1 - 0
magic-api-spring-boot-starter/src/main/java/org/ssssssss/magicapi/spring/boot/starter/MagicAPIAutoConfiguration.java

@@ -389,6 +389,7 @@ public class MagicAPIAutoConfiguration implements WebMvcConfigurer, WebSocketCon
 	 * 注入API调用Service
 	 */
 	@Bean
+	@ConditionalOnMissingBean
 	public MagicAPIService magicAPIService(MappingHandlerMapping mappingHandlerMapping,
 										   ApiServiceProvider apiServiceProvider,
 										   FunctionServiceProvider functionServiceProvider,

+ 1 - 1
magic-api/src/main/java/org/ssssssss/magicapi/modules/SQLModule.java

@@ -523,7 +523,7 @@ public class SQLModule extends HashMap<String, SQLModule> implements MagicModule
 
 	@Comment("指定table,进行单表操作")
 	public NamedTable table(String tableName) {
-		return new NamedTable(tableName, this, rowMapColumnMapper);
+		return new NamedTable(tableName, this, rowMapColumnMapper, namedTableInterceptors);
 	}
 
 	private BoundSql buildPageBoundSql(Dialect dialect, BoundSql boundSql, long offset, long limit) {

+ 3 - 1
magic-api/src/main/java/org/ssssssss/magicapi/modules/table/NamedTable.java

@@ -58,10 +58,11 @@ public class NamedTable extends Attributes<Object> {
 
 	Where where = new Where(this);
 
-	public NamedTable(String tableName, SQLModule sqlModule, Function<String, String> rowMapColumnMapper) {
+	public NamedTable(String tableName, SQLModule sqlModule, Function<String, String> rowMapColumnMapper, List<NamedTableInterceptor> namedTableInterceptors) {
 		this.tableName = tableName;
 		this.sqlModule = sqlModule;
 		this.rowMapColumnMapper = rowMapColumnMapper;
+		this.namedTableInterceptors = namedTableInterceptors;
 		this.logicDeleteColumn = sqlModule.getLogicDeleteColumn();
 		String deleteValue = sqlModule.getLogicDeleteValue();
 		this.logicDeleteValue = deleteValue;
@@ -102,6 +103,7 @@ public class NamedTable extends Attributes<Object> {
 		namedTable.withBlank = this.withBlank;
 		namedTable.where = this.where == null ? null : this.where.clone();
 		namedTable.namedTableInterceptors = this.namedTableInterceptors;
+		namedTable.properties = this.properties;
 		return namedTable;
 	}