system:简化 mapper 的实现

This commit is contained in:
YunaiV 2023-02-04 00:34:03 +08:00
parent f6d259b620
commit df65b88fe9
2 changed files with 4 additions and 7 deletions

View File

@ -13,8 +13,7 @@ import java.util.List;
public interface UserPostMapper extends BaseMapperX<UserPostDO> { public interface UserPostMapper extends BaseMapperX<UserPostDO> {
default List<UserPostDO> selectListByUserId(Long userId) { default List<UserPostDO> selectListByUserId(Long userId) {
return selectList(new LambdaQueryWrapperX<UserPostDO>() return selectList(UserPostDO::getUserId, userId);
.eq(UserPostDO::getUserId, userId));
} }
default void deleteByUserIdAndPostId(Long userId, Collection<Long> postIds) { default void deleteByUserIdAndPostId(Long userId, Collection<Long> postIds) {
@ -24,8 +23,7 @@ public interface UserPostMapper extends BaseMapperX<UserPostDO> {
} }
default List<UserPostDO> selectListByPostIds(Collection<Long> postIds) { default List<UserPostDO> selectListByPostIds(Collection<Long> postIds) {
return selectList(new LambdaQueryWrapperX<UserPostDO>() return selectList(UserPostDO::getPostId, postIds);
.in(UserPostDO::getPostId, postIds));
} }
default void deleteByUserId(Long userId) { default void deleteByUserId(Long userId) {

View File

@ -24,9 +24,8 @@ public interface SocialUserBindMapper extends BaseMapperX<SocialUserBindDO> {
} }
default SocialUserBindDO selectByUserTypeAndSocialUserId(Integer userType, Long socialUserId) { default SocialUserBindDO selectByUserTypeAndSocialUserId(Integer userType, Long socialUserId) {
return selectOne(new LambdaQueryWrapperX<SocialUserBindDO>() return selectOne(SocialUserBindDO::getUserType, userType,
.eq(SocialUserBindDO::getUserType, userType) SocialUserBindDO::getSocialUserId, socialUserId);
.eq(SocialUserBindDO::getSocialUserId, socialUserId));
} }
default List<SocialUserBindDO> selectListByUserIdAndUserType(Long userId, Integer userType) { default List<SocialUserBindDO> selectListByUserIdAndUserType(Long userId, Integer userType) {