sku库存接口完善

This commit is contained in:
zhh
2018-04-28 09:26:07 +08:00
parent 17e6a32d02
commit f5f4b49de6
6 changed files with 62 additions and 11 deletions

View File

@@ -7,10 +7,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -18,17 +15,29 @@ import java.util.List;
* sku库存Controller
* Created by macro on 2018/4/27.
*/
@Api("sku商品库存管理")
@Controller
@Api(tags = "PmsSkuStockController", description = "sku商品库存管理")
@RequestMapping("/sku")
public class PmsSkuStockController {
@Autowired
private PmsSkuStockService skuStockService;
@ApiOperation("根据商品编号及编号模糊搜索sku库存")
@RequestMapping("/{id}")
@RequestMapping(value = "/{pid}", method = RequestMethod.GET)
@ResponseBody
public Object getList(@PathVariable Long id, @RequestParam("keyword") String keyword){
List<PmsSkuStock> skuStockList = skuStockService.getList(id,keyword);
public Object getList(@PathVariable Long pid, @RequestParam(value = "keyword",required = false) String keyword) {
List<PmsSkuStock> skuStockList = skuStockService.getList(pid, keyword);
return new CommonResult().success(skuStockList);
}
@ApiOperation("批量更新库存信息")
@RequestMapping(value ="/update/{pid}",method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable Long pid,@RequestBody List<PmsSkuStock> skuStockList){
int count = skuStockService.update(pid,skuStockList);
if(count>0){
return new CommonResult().success(count);
}else{
return new CommonResult().failed();
}
}
}