This commit is contained in:
wangjinlei
2023-09-20 15:14:30 +08:00
parent f0f7e3827a
commit e0a103358c
7 changed files with 93 additions and 1 deletions

View File

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

View File

@@ -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<ShopProductLabelEntity> {
}

View File

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

View File

@@ -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<ShopProductLabelEntity> {
}

View File

@@ -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<ShopProductLabelDao, ShopProductLabelEntity> implements ShopProductLabelService {
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.peanut.modules.book.dao.ShopProductLabelMapper">
</mapper>

View File

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