package com.xindazhou.business.dal.community.mysql.sensitive;

import com.xindazhou.business.dal.community.dataobject.sensitive.SensitiveWordDO;
import com.xindazhou.framework.mybatis.core.mapper.BaseMapperX;
import com.xindazhou.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 敏感词 Mapper
 *
 * @author xindazhou
 */
@Mapper
public interface SensitiveWordMapper extends BaseMapperX<SensitiveWordDO> {

    default List<SensitiveWordDO> selectListEnabled() {
        return selectList(new LambdaQueryWrapperX<SensitiveWordDO>()
                .eq(SensitiveWordDO::getStatus, 1)
                .orderByDesc(SensitiveWordDO::getId));
    }

    default List<SensitiveWordDO> selectListByType(Integer type) {
        return selectList(new LambdaQueryWrapperX<SensitiveWordDO>()
                .eq(SensitiveWordDO::getStatus, 1)
                .eq(SensitiveWordDO::getType, type)
                .orderByDesc(SensitiveWordDO::getId));
    }

}

