考试中的试卷修改
新增商品修改
This commit is contained in:
@@ -32,8 +32,6 @@ public class ShopProductController {
|
||||
|
||||
@Autowired
|
||||
private ShopProductService shopProductService;
|
||||
@Autowired
|
||||
private ShopProductBookService shopProductBookService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
@@ -61,27 +59,7 @@ public class ShopProductController {
|
||||
@RequestMapping("/addProduct")
|
||||
public R addProduct(@RequestBody ShopProduct shopProduct){
|
||||
shopProduct.setCreateTime(new Date());
|
||||
String bkids = "";
|
||||
for (String s : shopProduct.getBookids()) {
|
||||
bkids += s + ",";
|
||||
}
|
||||
if (bkids != null && !bkids.isEmpty()) {
|
||||
String substring = bkids.substring(0, bkids.length() - 1);
|
||||
shopProduct.setBookId(substring);
|
||||
} else {
|
||||
shopProduct.setBookId("");
|
||||
}
|
||||
shopProductService.save(shopProduct);
|
||||
ShopProductBookEntity shopProductBookEntity = new ShopProductBookEntity();
|
||||
for (String s : shopProduct.getBookids()) {
|
||||
String bookIdList = s;
|
||||
if (bookIdList != null) {
|
||||
Integer product = shopProduct.getProductId();
|
||||
shopProductBookEntity.setProductId(product);
|
||||
shopProductBookEntity.setBookId(Integer.valueOf(bookIdList));
|
||||
shopProductBookService.save(shopProductBookEntity);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user