5、编写数据库xml
在xml中批量添加和删除用到了个知识点的用法 。
的主要用在构建in条件中,它可以在SQL语句中进行迭代一个集合 。元素的属性主要有 item,index,,open,,close 。
item表示集合中每一个元素进行迭代时的别名,
index指 定一个名字,用于表示在迭代过程中,每次迭代到的位置,
open表示该语句以什么开始,
表示在每次进行迭代之间以什么符号作为分隔 符,
close表示以什么结束 。
其中我们使用的属性是最重要的,这个要看你传参的类型是什么才能给它赋什么样的值 。我们都把参数转成了List进行添加和删除的,所以我们这里要使用list作为属性值 。
1、如果传入的是单参数且参数类型是一个List的时候,属性值为list
2、如果传入的是单参数且参数类型是一个array数组的时候,的属性值为array
3、如果传入的参数是多个的时候,我们就需要把它们封装成一个Map了,当然单参数也可以封装成map 。
完整代码如下:
6、编写接口层
编写层类:.java
package com.blog.personalblog.controller;import com.blog.personalblog.config.page.PageRequest;import com.blog.personalblog.config.page.PageResult;import com.blog.personalblog.entity.Tag;import com.blog.personalblog.service.TagService;import com.blog.personalblog.util.JsonResult;import com.blog.personalblog.util.PageUtil;import com.github.pagehelper.PageInfo;import io.swagger.annotations.Api;import io.swagger.annotations.ApiOperation;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.*;import javax.validation.Valid;import java.util.List;/*** @author: SuperMan* @create: 2021-11-28*/@Api(tags = "标签管理")@RestController@RequestMapping("/tag")public class TagController {@AutowiredTagService tagService;/*** 分页查询列表* @param pageRequest* @return*/@ApiOperation(value = "http://www.kingceram.com/post/标签列表")@PostMapping("list")public JsonResult
- 盘点Spring/Boot的那些常用扩展点
- 三万字盘点Spring/Boot的那些常用扩展点
- 【独立版】智慧城市同城V4_2.2.7全开源全插件VUE版
- 【独立版】智慧城市同城V4_2.1.4全开源全插件VUE版
- vue body的背景图片属性设置
- springboot集成redis模拟手机发送验证码进行验证
- Spring Cloud应用接入华为云微服务CSE
- 基于Spring Boot 2.0的IoT应用集成和使用CSE实践
- Spring Boot 2.0集成和使用CSE
- Vue 不睡觉教程1-从最土开始