parent
2c4b61f340
commit
62875be373
@ -0,0 +1,23 @@
|
||||
package com.mashibing.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author zjw
|
||||
* @description
|
||||
*/
|
||||
@RestController
|
||||
public class ItemStockController {
|
||||
|
||||
private static int stock = 10;
|
||||
|
||||
@GetMapping("/decr")
|
||||
public void decr(){
|
||||
stock--;
|
||||
if(stock < 0){
|
||||
throw new RuntimeException("商品库存不足!");
|
||||
}
|
||||
System.out.println("扣减库存成功!");
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.mashibing.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author zjw
|
||||
* @description
|
||||
*/
|
||||
@RestController
|
||||
public class OrderManageController {
|
||||
|
||||
@GetMapping("create")
|
||||
public void create(){
|
||||
System.out.println("创建订单成功!");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue