parent
a60a5dc1ac
commit
7957e39f4e
@ -0,0 +1,27 @@
|
||||
<?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="org.sang.mapper.TagsMapper">
|
||||
<delete id="deleteTagsByAid" parameterType="Long">
|
||||
DELETE FROM article_tags WHERE aid=#{aid}
|
||||
</delete>
|
||||
<insert id="saveTags">
|
||||
INSERT IGNORE INTO tags(tagName) VALUES
|
||||
<foreach collection="tags" item="tag" separator=",">
|
||||
(#{tag})
|
||||
</foreach>
|
||||
</insert>
|
||||
<select id="getTagsIdByTagName" resultType="long">
|
||||
SELECT id FROM tags WHERE tagName IN
|
||||
<foreach collection="tagNames" item="tagName" separator="," open="(" close=")">
|
||||
#{tagName}
|
||||
</foreach>
|
||||
</select>
|
||||
<insert id="saveTags2ArticleTags">
|
||||
INSERT INTO article_tags(aid,tid) VALUES
|
||||
<foreach collection="tagIds" item="tagId" separator=",">
|
||||
(#{aid},#{tagId})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
Loading…
Reference in new issue