图书标签修改-加判断条件
This commit is contained in:
@@ -86,14 +86,30 @@ public class BookLabelAndMarketController {
|
|||||||
|
|
||||||
@RequestMapping(path = "/saveOrUpdateLabel")
|
@RequestMapping(path = "/saveOrUpdateLabel")
|
||||||
public R saveOrUpdateLabel(@RequestBody ShopProductBookLabel label) {
|
public R saveOrUpdateLabel(@RequestBody ShopProductBookLabel label) {
|
||||||
labelService.saveOrUpdate(label);
|
if (label.getIsLast()==1){
|
||||||
return R.ok().put("result",label);
|
labelService.saveOrUpdate(label);
|
||||||
|
return R.ok().put("result",label);
|
||||||
|
}else {
|
||||||
|
return R.error("父标签非最后一集");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(path = "/delLabel")
|
@RequestMapping(path = "/delLabel")
|
||||||
public R delLabel(String id) {
|
public R delLabel(String id) {
|
||||||
labelService.removeById(id);
|
ShopProductBookLabel label = labelService.getById(id);
|
||||||
return R.ok();
|
if (label.getIsLast()==1){
|
||||||
|
MPJLambdaWrapper<ShopProductToBookLabel> wrapper = new MPJLambdaWrapper();
|
||||||
|
wrapper.eq(ShopProductToBookLabel::getBookLabelId,id);
|
||||||
|
List<ShopProductToBookLabel> tolables = toLabelService.list(wrapper);
|
||||||
|
if (tolables.size()>0){
|
||||||
|
return R.error("请先移除商品");
|
||||||
|
}else {
|
||||||
|
labelService.removeById(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return R.error("请先删除子集,设置成最后一集");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(path = "/getMarketById")
|
@RequestMapping(path = "/getMarketById")
|
||||||
@@ -103,14 +119,30 @@ public class BookLabelAndMarketController {
|
|||||||
|
|
||||||
@RequestMapping(path = "/saveOrUpdateMarket")
|
@RequestMapping(path = "/saveOrUpdateMarket")
|
||||||
public R saveOrUpdateMarket(@RequestBody ShopProductBookMarket market) {
|
public R saveOrUpdateMarket(@RequestBody ShopProductBookMarket market) {
|
||||||
marketService.saveOrUpdate(market);
|
if (market.getIsLast()==1){
|
||||||
return R.ok().put("result",market);
|
marketService.saveOrUpdate(market);
|
||||||
|
return R.ok().put("result",market);
|
||||||
|
}else {
|
||||||
|
return R.error("父标签非最后一集");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(path = "/delMarket")
|
@RequestMapping(path = "/delMarket")
|
||||||
public R delMarket(String id) {
|
public R delMarket(String id) {
|
||||||
marketService.removeById(id);
|
ShopProductBookMarket market = marketService.getById(id);
|
||||||
return R.ok();
|
if (market.getIsLast()==1){
|
||||||
|
MPJLambdaWrapper<ShopProductToBookMarket> wrapper = new MPJLambdaWrapper();
|
||||||
|
wrapper.eq(ShopProductToBookMarket::getBookMarketId,id);
|
||||||
|
List<ShopProductToBookMarket> tomarkets = toMarketService.list(wrapper);
|
||||||
|
if (tomarkets.size()>0){
|
||||||
|
return R.error("请先移除商品");
|
||||||
|
}else {
|
||||||
|
marketService.removeById(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return R.error("请先删除子集,设置成最后一集");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -220,4 +252,8 @@ public class BookLabelAndMarketController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user