增加数据源的远程调用模块
parent
a1ff33d35a
commit
833b4e8ff4
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.source.remote;
|
||||
|
||||
import com.muyu.source.remote.factory.RemoteDataSourceFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-10:50
|
||||
* @ Version:1.0
|
||||
* @ Description:数据源远程调用
|
||||
* @author Lenovo
|
||||
*/
|
||||
@FeignClient(contextId = "RemoteDataSourceService",value = ServiceNameConstants.SOURCE_SERVICE,fallbackFactory = RemoteDataSourceFactory.class, path = "/dataSource")
|
||||
public interface RemoteDataSourceService {
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.source.remote.factory;
|
||||
|
||||
import com.muyu.source.remote.RemoteDataSourceService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-10:54
|
||||
* @ Version:1.0
|
||||
* @ Description:电费
|
||||
* @author Lenovo
|
||||
*/
|
||||
public class RemoteDataSourceFactory implements FallbackFactory<RemoteDataSourceService> {
|
||||
@Override
|
||||
public RemoteDataSourceService create(Throwable cause) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
|
||||
com.muyu.source.remote.factory.RemoteDataSourceFactory
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package com.muyu.source.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
|
||||
import com.dtflys.forest.annotation.Post;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.source.domain.DataSource;
|
||||
|
@ -43,12 +40,19 @@ public class DataSourceController extends BaseController {
|
|||
List<DataSource> list =dataSourceService.list();
|
||||
return Result.success(list);
|
||||
}
|
||||
@PutMapping("/update")
|
||||
public Result<?> update(@RequestBody DataSource dataSource){
|
||||
UpdateChainWrapper<DataSource> update = dataSourceService.update();
|
||||
|
||||
/**
|
||||
* 添加数据源
|
||||
* @param dataSource
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/insert")
|
||||
public Result<String> insert(@RequestBody DataSource dataSource){
|
||||
dataSourceService.save(dataSource);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue