diff --git a/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java b/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java new file mode 100644 index 00000000..4faf5224 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java @@ -0,0 +1,28 @@ +package com.peanut.modules.book.controller; + +import com.peanut.common.utils.R; +import com.peanut.modules.book.entity.ShopProductLabelEntity; +import com.peanut.modules.book.service.ShopProductLabelService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("book/label") +public class ShopProductLabelController { + + @Autowired + private ShopProductLabelService shopProductLabelService; + + + @RequestMapping("/addLabel") + public R addLabel(@RequestParam String labelName){ + ShopProductLabelEntity shopProductLabelEntity = new ShopProductLabelEntity(); + shopProductLabelEntity.setLabelName(labelName); + shopProductLabelService.save(shopProductLabelEntity); + return R.ok(); + } + +} diff --git a/src/main/java/com/peanut/modules/book/dao/ShopProductLabelDao.java b/src/main/java/com/peanut/modules/book/dao/ShopProductLabelDao.java new file mode 100644 index 00000000..e8751352 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/dao/ShopProductLabelDao.java @@ -0,0 +1,9 @@ +package com.peanut.modules.book.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.peanut.modules.book.entity.ShopProductLabelEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ShopProductLabelDao extends BaseMapper { +} diff --git a/src/main/java/com/peanut/modules/book/entity/ShopProductLabelEntity.java b/src/main/java/com/peanut/modules/book/entity/ShopProductLabelEntity.java new file mode 100644 index 00000000..eaa17018 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/entity/ShopProductLabelEntity.java @@ -0,0 +1,31 @@ +package com.peanut.modules.book.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +@Data +@TableName("shop_product_label") +public class ShopProductLabelEntity { + + private static final long serialVersionUID = 1L; + + /** + * + */ + @TableId + private Integer splId; + + private String labelName; + + private Date ctime; + + + @TableField("del_flag") + @TableLogic + private Integer delFlag; +} diff --git a/src/main/java/com/peanut/modules/book/service/ShopProductLabelService.java b/src/main/java/com/peanut/modules/book/service/ShopProductLabelService.java new file mode 100644 index 00000000..7558a577 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/service/ShopProductLabelService.java @@ -0,0 +1,7 @@ +package com.peanut.modules.book.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.peanut.modules.book.entity.ShopProductLabelEntity; + +public interface ShopProductLabelService extends IService { +} diff --git a/src/main/java/com/peanut/modules/book/service/impl/ShopProductLabelServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ShopProductLabelServiceImpl.java new file mode 100644 index 00000000..fc44fc65 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/service/impl/ShopProductLabelServiceImpl.java @@ -0,0 +1,12 @@ +package com.peanut.modules.book.service.impl; + +import com.peanut.modules.book.dao.ShopProductLabelDao; +import com.peanut.modules.book.entity.ShopProductLabelEntity; +import com.peanut.modules.book.service.ShopProductLabelService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service("ShopProductLabelService") +public class ShopProductLabelServiceImpl extends ServiceImpl implements ShopProductLabelService { + +} diff --git a/src/main/resources/mapper/ShopProductLabelMapper.xml b/src/main/resources/mapper/ShopProductLabelMapper.xml new file mode 100644 index 00000000..861aad8c --- /dev/null +++ b/src/main/resources/mapper/ShopProductLabelMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/test/java/io/Test.java b/src/test/java/io/Test.java index 444f1c3d..37c8ef4b 100644 --- a/src/test/java/io/Test.java +++ b/src/test/java/io/Test.java @@ -6,7 +6,7 @@ public class Test { public void test01(){ String a = "dsadasdasdas"; String substring = a.substring(5, 1); - System.out.println(substring); + System.out.println(a); } }