package cn.iocoder.yudao.module.system.dal.mysql.biz;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.ElderlyBuildFloorActivityTextItemDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.Collections;
import java.util.List;

/**
 * 楼层活动文字记录明细 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface ElderlyBuildFloorActivityTextItemMapper extends BaseMapperX<ElderlyBuildFloorActivityTextItemDO> {

    default List<ElderlyBuildFloorActivityTextItemDO> selectByTextId(Long textId) {
        if (textId == null) {
            return Collections.emptyList();
        }
        return selectList(new LambdaQueryWrapperX<ElderlyBuildFloorActivityTextItemDO>()
                .eq(ElderlyBuildFloorActivityTextItemDO::getTextId, textId)
                .orderByAsc(ElderlyBuildFloorActivityTextItemDO::getId));
    }

    default List<ElderlyBuildFloorActivityTextItemDO> selectByTextIds(List<Long> textIds) {
        if (textIds == null || textIds.isEmpty()) {
            return Collections.emptyList();
        }
        return selectList(new LambdaQueryWrapperX<ElderlyBuildFloorActivityTextItemDO>()
                .in(ElderlyBuildFloorActivityTextItemDO::getTextId, textIds)
                .orderByAsc(ElderlyBuildFloorActivityTextItemDO::getId));
    }

    default void deleteByTextId(Long textId) {
        if (textId == null) {
            return;
        }
        delete(new LambdaQueryWrapperX<ElderlyBuildFloorActivityTextItemDO>()
                .eq(ElderlyBuildFloorActivityTextItemDO::getTextId, textId));
    }
}
