添加对mall-portal服务的调用
This commit is contained in:
@@ -7,13 +7,10 @@ package com.macro.mall.demo.controller;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.demo.dto.UmsAdminLoginParam;
|
||||
import com.macro.mall.demo.service.FeignAdminService;
|
||||
import com.macro.mall.model.PmsBrand;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Feign调用mall-admin接口示例
|
||||
*/
|
||||
@@ -29,7 +26,7 @@ public class FeignAdminController {
|
||||
return adminService.login(loginParam);
|
||||
}
|
||||
|
||||
@GetMapping("/brand/listAll")
|
||||
@GetMapping("/getBrandList")
|
||||
public CommonResult getBrandList(){
|
||||
return adminService.getList();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.macro.mall.demo.controller;
|
||||
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
import com.macro.mall.demo.service.FeignPortalService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* Feign调用mall-portal接口示例
|
||||
* Created by macro on 2019/10/18.
|
||||
*/
|
||||
@Api(tags = "FeignPortalController", description = "Feign调用mall-portal接口示例")
|
||||
@RestController
|
||||
@RequestMapping("/feign/portal")
|
||||
public class FeignPortalController {
|
||||
|
||||
@Autowired
|
||||
private FeignPortalService portalService;
|
||||
|
||||
@PostMapping("/login")
|
||||
public CommonResult login(@RequestParam String username, @RequestParam String password) {
|
||||
return portalService.login(username,password);
|
||||
}
|
||||
|
||||
@GetMapping("/cartList")
|
||||
public CommonResult cartList() {
|
||||
return portalService.list();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.macro.mall.demo.service;
|
||||
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
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.RequestParam;
|
||||
|
||||
/**
|
||||
* Created by macro on 2019/10/18.
|
||||
*/
|
||||
@FeignClient("mall-portal")
|
||||
public interface FeignPortalService {
|
||||
|
||||
@PostMapping("/sso/login")
|
||||
CommonResult login(@RequestParam String username, @RequestParam String password);
|
||||
|
||||
@GetMapping("/cart/list")
|
||||
CommonResult list();
|
||||
}
|
||||
Reference in New Issue
Block a user