39 lines
1.1 KiB
XML
Raw Normal View History

2020-05-24 20:40:55 +08:00
<?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">
2021-07-28 18:07:25 +08:00
<mapper namespace="com.xhpc.system.mapper.SysUserPostMapper">
2020-05-24 20:40:55 +08:00
<resultMap type="SysUserPost" id="SysUserPostResult">
2021-07-28 18:07:25 +08:00
<result property="userId" column="user_id"/>
<result property="postId" column="post_id"/>
2020-05-24 20:40:55 +08:00
</resultMap>
<delete id="deleteUserPostByUserId" parameterType="Long">
2021-07-28 18:07:25 +08:00
delete
from sys_user_post
where user_id = #{userId}
2020-05-24 20:40:55 +08:00
</delete>
2021-07-28 18:07:25 +08:00
2020-05-24 20:40:55 +08:00
<select id="countUserPostById" resultType="Integer">
2021-07-28 18:07:25 +08:00
select count(1)
from sys_user_post
where post_id = #{postId}
2020-05-24 20:40:55 +08:00
</select>
2021-07-28 18:07:25 +08:00
2020-05-24 20:40:55 +08:00
<delete id="deleteUserPost" parameterType="Long">
delete from sys_user_post where user_id in
2021-07-28 18:07:25 +08:00
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
2020-05-24 20:40:55 +08:00
<insert id="batchUserPost">
insert into sys_user_post(user_id, post_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.postId})
</foreach>
</insert>
2021-07-28 18:07:25 +08:00
</mapper>