考试中的试卷修改

新增商品修改
This commit is contained in:
wuchunlei
2024-09-11 15:40:01 +08:00
parent 00d8d10c2b
commit 50a63e3281
2 changed files with 8 additions and 26 deletions

View File

@@ -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();
}