package com.iailab.module.system.dal.mysql.dept; import com.iailab.framework.mybatis.core.mapper.BaseMapperX; import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; import com.iailab.module.system.dal.dataobject.dept.UserPostDO; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.apache.ibatis.annotations.Mapper; import java.util.Collection; import java.util.List; @Mapper public interface UserPostMapper extends BaseMapperX { default List selectListByUserId(Long userId) { return selectList(UserPostDO::getUserId, userId); } default void deleteByUserIdAndPostId(Long userId, Collection postIds) { delete(new LambdaQueryWrapperX() .eq(UserPostDO::getUserId, userId) .in(UserPostDO::getPostId, postIds)); } default List selectListByPostIds(Collection postIds) { return selectList(UserPostDO::getPostId, postIds); } default void deleteByUserId(Long userId) { delete(Wrappers.lambdaUpdate(UserPostDO.class).eq(UserPostDO::getUserId, userId)); } }