新版
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.ShopProductLabelEntity;
|
||||
import com.peanut.modules.book.service.ShopProductLabelService;
|
||||
@@ -19,10 +20,24 @@ public class ShopProductLabelController {
|
||||
|
||||
@RequestMapping("/addLabel")
|
||||
public R addLabel(@RequestParam String labelName){
|
||||
|
||||
//同名不能添加
|
||||
QueryWrapper<ShopProductLabelEntity> shopProductLabelEntityQueryWrapper = new QueryWrapper<ShopProductLabelEntity>();
|
||||
shopProductLabelEntityQueryWrapper.eq("label_name",labelName);
|
||||
ShopProductLabelEntity shopProductLabelEntity_check = shopProductLabelService.getBaseMapper().selectOne(shopProductLabelEntityQueryWrapper);
|
||||
if(shopProductLabelEntity_check!=null){
|
||||
return R.error("不可添加已存在的项目");
|
||||
}
|
||||
|
||||
ShopProductLabelEntity shopProductLabelEntity = new ShopProductLabelEntity();
|
||||
shopProductLabelEntity.setLabelName(labelName);
|
||||
shopProductLabelService.save(shopProductLabelEntity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/delLabel")
|
||||
public R delLabel(@RequestParam Integer splId){
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public class ShopProductLabelEntity {
|
||||
@TableId
|
||||
private Integer splId;
|
||||
|
||||
@TableField("label_name")
|
||||
private String labelName;
|
||||
|
||||
private Date ctime;
|
||||
|
||||
Reference in New Issue
Block a user