Explorar o código

feat 主流云存储均以支持

hai 4 semanas
pai
achega
35fe9a87f5

+ 19 - 0
edu-travel-common/edu-travel-common-core/src/main/java/edu/travel/BaseApiController.java

@@ -0,0 +1,19 @@
+package edu.travel;
+
+import edu.travel.resp.BaseResponse;
+import org.springframework.validation.Errors;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+public abstract class BaseApiController<T> {
+    public abstract BaseResponse getList();
+
+    public abstract BaseResponse updateTargetById(T target,Errors errors);
+
+    public abstract BaseResponse deleteById(List<String> ids);
+
+    public abstract BaseResponse saveTarget(T target, Errors errors);
+
+    public abstract BaseResponse getById(String id);
+}

+ 8 - 0
edu-travel-common/edu-travel-common-datasource/pom.xml

@@ -43,10 +43,18 @@
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-security</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>edu.travel</groupId>
+            <artifactId>edu-travel-common-resp</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>provided</scope>
         </dependency>
     </dependencies>
 </project>

+ 4 - 0
edu-travel-common/edu-travel-common-datasource/src/main/java/edu/travel/interfaces/InsertGroups.java

@@ -0,0 +1,4 @@
+package edu.travel.interfaces;
+
+public interface InsertGroups {
+}

+ 4 - 0
edu-travel-common/edu-travel-common-datasource/src/main/java/edu/travel/interfaces/UpdateGroups.java

@@ -0,0 +1,4 @@
+package edu.travel.interfaces;
+
+public interface UpdateGroups {
+}

+ 7 - 1
edu-travel-common/edu-travel-common-core/src/main/java/edu/travel/web/BaseController.java → edu-travel-common/edu-travel-common-datasource/src/main/java/edu/travel/web/BaseController.java

@@ -7,6 +7,7 @@ import edu.travel.resp.BaseResponse;
 import edu.travel.resp.PageResponse;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.Errors;
 import org.springframework.validation.ObjectError;
@@ -14,6 +15,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
 
@@ -21,7 +23,11 @@ public class BaseController<T> {
     @Autowired
     @Lazy
     private IService<T> service;
-
+    @GetMapping("/getById")
+    public BaseResponse getById(String id) {
+        T byId = service.getById(id);
+        return PageResponse.out(HttpStatus.OK.value(), HttpStatus.OK.getReasonPhrase(), byId);
+    }
     @PostMapping("/updateById")
     @Transactional
     public BaseResponse<T> updateTargetById(@Validated(UpdateGroups.class) @RequestBody T entity, Errors errors) {

+ 1 - 2
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/commodity/remote/BaseCountryServeRemoteController.java

@@ -2,7 +2,6 @@ package edu.travel.commodity.remote;
 
 import edu.travel.commodity.dto.BaseCountryServeDTO;
 import edu.travel.commodity.vo.BaseCountryServeVo;
-import edu.travel.interfaces.UpdateGroups;
 import edu.travel.resp.BaseResponse;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.validation.Errors;
@@ -13,5 +12,5 @@ import org.springframework.web.bind.annotation.RequestBody;
 @FeignClient(path = "/base_country_serve",name = "commodity")
 public interface BaseCountryServeRemoteController {
     @PostMapping("/updateById")
-    public BaseResponse<BaseCountryServeVo> updateTargetById(@Validated(UpdateGroups.class) @RequestBody BaseCountryServeDTO entity,Errors errors);
+    public BaseResponse<BaseCountryServeVo> updateTargetById(@RequestBody BaseCountryServeDTO entity,Errors errors);
 }

+ 0 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/BaseCountryServeController.java

@@ -1,6 +1,5 @@
 package edu.travel.commodity.web;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import edu.travel.commodity.dto.BaseCountryServeDTO;
 import edu.travel.commodity.entity.BaseCountryServe;
 import edu.travel.commodity.remote.BaseCountryServeRemoteController;