Explorar o código

国家新增、修改,成功传(修复时间格式不统一造成无法更新的bug)

Sakana hai 2 semanas
pai
achega
11a23418a7

+ 13 - 0
edu-travel-remote/edu-travel-remote-country/src/main/java/edu/travel/dto/BaseCountryDto.java

@@ -1,8 +1,11 @@
 package edu.travel.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import edu.travel.po.PagePO;
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * 国家表
  */
@@ -40,5 +43,15 @@ public class BaseCountryDto extends PagePO {
      * 国家区号
      */
     private Integer areaCode;
+    /**
+     * 创建时间
+     */
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
 
+    /**
+     * 更新时间
+     */
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
 }

+ 16 - 0
edu-travel-remote/edu-travel-remote-country/src/main/java/edu/travel/remote/BaseCountryRemoteController.java

@@ -7,15 +7,31 @@ import edu.travel.rpc.RPCBaseResponse;
 import edu.travel.vo.BaseCountryVo;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
 
 @FeignClient(path = "/base_country",name = "commodity")
 public interface BaseCountryRemoteController extends RemoteBaseController<BaseCountryVo, BaseCountryDto> {
+
+
+
+
     //国家树
     @GetMapping("/getCountryTree")
     public RPCBaseResponse<List<BaseCountryVo>> getCountryTree();
     //国家分页
     @GetMapping("/getCountryPage")
     public RPCBaseResponse<IPage<BaseCountryVo>> getCountryPage(BaseCountryDto baseCountryDTO);
+    @GetMapping("/getCountryFormId")
+    public RPCBaseResponse<BaseCountryVo> getFormId(String id);
+    @PostMapping("/updateCountryFormId")
+    public RPCBaseResponse<BaseCountryVo> updateTargetFormId(@RequestBody BaseCountryDto entity);
+    @PostMapping("/saveCountryForm")
+    public RPCBaseResponse<BaseCountryVo> saveFormTarget(@RequestBody BaseCountryDto entity);
+    @PostMapping("/deleteCountryFormId")
+    public RPCBaseResponse<BaseCountryVo> deleteTargetFormId(@RequestBody List<String> ids);
+    @GetMapping("/CountrylistForm")
+    public RPCBaseResponse<List<BaseCountryVo>> getAllForm();
 }

+ 29 - 10
edu-travel-service/edu-travel-service-country/src/main/java/edu/travel/country/web/BaseCountryController.java

@@ -1,16 +1,14 @@
 package edu.travel.country.web;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import edu.travel.country.entity.BaseCountry;
 import edu.travel.country.service.BaseCountryService;
 import edu.travel.dto.BaseCountryDto;
 import edu.travel.remote.BaseCountryRemoteController;
 import edu.travel.rpc.RPCBaseResponse;
-import edu.travel.utils.tree.ModelMapperUtil;
 import edu.travel.vo.BaseCountryVo;
 import edu.travel.web.BaseController;
 import org.springframework.beans.BeanUtils;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -31,21 +29,30 @@ public class BaseCountryController extends BaseController<BaseCountry> implement
     @Autowired
     private BaseCountryService baseCountryService;
 
-
+    /**
+     * 生成国家树
+     *
+     * @return
+     */
     //国家树
     @GetMapping("/getCountryTree")
     public RPCBaseResponse<List<BaseCountryVo>> getCountryTree() {
         return baseCountryService.getCountryTree();
     }
 
-    //国家分页
+    /**
+     * 国家分页
+     */
     @GetMapping("/getCountryPage")
     public RPCBaseResponse<IPage<BaseCountryVo>> getCountryPage(BaseCountryDto baseCountryDTO) {
         return baseCountryService.getCountryPage(baseCountryDTO);
     }
 
+    /**
+     * 通过id查询国家
+     */
     @Override
-    @GetMapping("/getFormId")
+    @GetMapping("/getCountryFormId")
     public RPCBaseResponse<BaseCountryVo> getFormId(String id) {
         RPCBaseResponse<BaseCountry> countryRPCBaseResponse = super.getId(id);
         RPCBaseResponse<BaseCountryVo> baseCountryVoRPCBaseResponse = new RPCBaseResponse<>();
@@ -53,8 +60,11 @@ public class BaseCountryController extends BaseController<BaseCountry> implement
         return baseCountryVoRPCBaseResponse;
     }
 
+    /**
+     * 更新国家信息
+     */
     @Override
-    @PostMapping("/updateFormId")
+    @PostMapping("/updateCountryFormId")
     public RPCBaseResponse<BaseCountryVo> updateTargetFormId(@RequestBody BaseCountryDto entity) {
         BaseCountry baseCountry = new BaseCountry();
         BeanUtils.copyProperties(entity, baseCountry);
@@ -64,8 +74,11 @@ public class BaseCountryController extends BaseController<BaseCountry> implement
         return baseCountryVoRPCBaseResponse;
     }
 
+    /**
+     * 新增国家信息
+     */
     @Override
-    @PostMapping("/saveForm")
+    @PostMapping("/saveCountryForm")
     public RPCBaseResponse<BaseCountryVo> saveFormTarget(@RequestBody BaseCountryDto entity) {
         BaseCountry baseCountry = new BaseCountry();
         BeanUtils.copyProperties(entity, baseCountry);
@@ -75,8 +88,11 @@ public class BaseCountryController extends BaseController<BaseCountry> implement
         return baseCountryVoRPCBaseResponse;
     }
 
+    /**
+     * 删除国家
+     */
     @Override
-    @PostMapping("/deleteFormId")
+    @PostMapping("/deleteCountryFormId")
     public RPCBaseResponse<BaseCountryVo> deleteTargetFormId(@RequestBody List<String> ids) {
         RPCBaseResponse<BaseCountry> baseCountryRPCBaseResponse = super.deleteTargetById(ids);
         RPCBaseResponse<BaseCountryVo> baseCountryVoRPCBaseResponse = new RPCBaseResponse<>();
@@ -84,8 +100,11 @@ public class BaseCountryController extends BaseController<BaseCountry> implement
         return baseCountryVoRPCBaseResponse;
     }
 
+    /**
+     * 获取国家表
+     */
     @Override
-    @GetMapping("/listForm")
+    @GetMapping("/CountrylistForm")
     public RPCBaseResponse<List<BaseCountryVo>> getAllForm() {
         RPCBaseResponse<List<BaseCountry>> listRPCBaseResponse = super.listAll();
         RPCBaseResponse<List<BaseCountryVo>> baseCountryVoRPCBaseResponse = new RPCBaseResponse<>();