save follow

This commit is contained in:
aisensiy
2017-08-16 16:25:08 +08:00
parent 13571f2f5e
commit daaf2070c7
8 changed files with 98 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
package io.spring.infrastructure.user;
import io.spring.core.user.FollowRelation;
import io.spring.core.user.User;
import io.spring.core.user.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,4 +40,14 @@ public class MyBatisUserRepository implements UserRepository {
public Optional<User> findByEmail(String email) {
return Optional.ofNullable(userMapper.findByEmail(email));
}
@Override
public void saveRelation(FollowRelation followRelation) {
userMapper.saveRelation(followRelation);
}
@Override
public Optional<FollowRelation> findRelation(String userId, String targetId) {
return Optional.ofNullable(userMapper.findRelation(userId, targetId));
}
}

View File

@@ -1,5 +1,6 @@
package io.spring.infrastructure.user;
import io.spring.core.user.FollowRelation;
import io.spring.core.user.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -16,4 +17,8 @@ public interface UserMapper {
User findById(@Param("id") String id);
void update(@Param("user") User user);
FollowRelation findRelation(@Param("userId") String userId, @Param("targetId") String targetId);
void saveRelation(@Param("followRelation") FollowRelation followRelation);
}