package com.huiju.estateagents.third.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huiju.estateagents.common.CommConstant;
import com.huiju.estateagents.third.entity.TaMpInfo;
import com.huiju.estateagents.third.mapper.TaMpInfoMapper;
import com.huiju.estateagents.third.service.ITaMpInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *   服务实现类
 * </p>
 *
 * @author fxf
 * @since 2020-06-02
 */
@Service
public class TaMpInfoServiceImpl extends ServiceImpl<TaMpInfoMapper, TaMpInfo> implements ITaMpInfoService {

    @Override
    public List<TaMpInfo> getAllAvaliable() {
        QueryWrapper<TaMpInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("status", CommConstant.STATUS_NORMAL);

        return list(queryWrapper);
    }

    @Override
    public TaMpInfo getByOrgId(Integer orgId) {
        QueryWrapper<TaMpInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("org_id", orgId);
        queryWrapper.eq("status", CommConstant.STATUS_NORMAL);

        return getOne(queryWrapper);
    }
}
