From 0136435a41a8024ce00b5ce49e6f421d846b10b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BE=E5=87=A0=E6=B5=B7?= Date: Sun, 24 May 2020 22:02:41 +0800 Subject: [PATCH] =?UTF-8?q?dao=E5=B1=82=E4=BF=AE=E6=94=B9=20=20=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- newBlog.sql | 1 - .../resources/mapper/ArticleTagMapper.xml | 76 +++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/mapper/ArticleTagMapper.xml diff --git a/newBlog.sql b/newBlog.sql index 7fc4317..bfaaafd 100644 --- a/newBlog.sql +++ b/newBlog.sql @@ -35,7 +35,6 @@ CREATE TABLE `tag_category` `t_id` bigint(20) primary key auto_increment, `t_name` varchar(255) not null, `is_category` boolean not null default true, - `is_delete` boolean not null default false comment '该数据是否被删除' ) comment '标签和分类表'; CREATE TABLE `comment` diff --git a/src/main/resources/mapper/ArticleTagMapper.xml b/src/main/resources/mapper/ArticleTagMapper.xml new file mode 100644 index 0000000..b8458e1 --- /dev/null +++ b/src/main/resources/mapper/ArticleTagMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + insert into article_tag(a_id, t_id) + values (#{article.id}, #{tag.id}) + + + + + update article_tag + + + a_id = #{article.id}, + + + t_id = #{tag.id}, + + + where at_id = #{tag.id} + + + + + delete + from article_tag + where at_id = #{id}; + + + + delete from article_tag where at_id in + + (#{articleTag.id}) + + + + + + delete + from article_tag + where a_id = #{id} + + + + + + + + \ No newline at end of file