53 lines
1.6 KiB
XML
53 lines
1.6 KiB
XML
<?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.jacklei.poetry.mapper.AttentionDao">
|
|
|
|
<resultMap id="UserResultMap" type="com.jacklei.poetry.entities.User">
|
|
<id property="userId" column="user_id" />
|
|
<result property="username" column="username"/>
|
|
<result property="password" column="password"/>
|
|
<result property="email" column="email"/>
|
|
</resultMap>
|
|
|
|
<insert id="UserAttention">
|
|
insert into t_followers (followers,by_followers,`time` ) values (#{followers},#{byFollowers},#{time});
|
|
</insert>
|
|
<delete id="UserUnfollow">
|
|
delete from t_followers where attention_id=#{attentionId}
|
|
</delete>
|
|
<select id="UserFollowersList" useCache="true" resultMap="UserResultMap">
|
|
select
|
|
user_id,
|
|
username,
|
|
email
|
|
from t_user
|
|
where user_id in (
|
|
select
|
|
by_followers
|
|
from t_followers
|
|
where
|
|
followers=#{followers}
|
|
)
|
|
</select>
|
|
|
|
<select id="SeeAttention" resultMap="UserResultMap">
|
|
select
|
|
user_id,
|
|
username,
|
|
email
|
|
from t_user
|
|
where user_id in (
|
|
select
|
|
by_followers
|
|
from t_followers
|
|
where
|
|
followers=#{followers} and by_followers=#{byFollowers}
|
|
)
|
|
</select>
|
|
|
|
<delete id="userCancelAttention" >
|
|
delete from t_followers where followers=#{followers} and by_followers=#{byFollowers}
|
|
</delete>
|
|
</mapper> |