package com.huiju.estateagents.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huiju.estateagents.base.ResponseBean;
import com.huiju.estateagents.entity.TaPersonIntentionRecord;
import com.huiju.estateagents.mapper.TaPersonIntentionRecordMapper;
import com.huiju.estateagents.service.ITaPersonIntentionRecordService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户意向流水  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-08-07
 */
@Service
public class TaPersonIntentionRecordServiceImpl extends ServiceImpl<TaPersonIntentionRecordMapper, TaPersonIntentionRecord> implements ITaPersonIntentionRecordService {

    @Autowired
    private TaPersonIntentionRecordMapper taPersonIntentionRecordMapper;

    @Override
    public ResponseBean selectAll(IPage<TaPersonIntentionRecord> pg, String buildingId) {
        ResponseBean responseBean = new ResponseBean();
        QueryWrapper<TaPersonIntentionRecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotBlank(buildingId),"building_id", buildingId);
        IPage<TaPersonIntentionRecord> taPersonIntentionRecordIPage = taPersonIntentionRecordMapper.selectPage(pg, queryWrapper);
        responseBean.addSuccess(taPersonIntentionRecordIPage);
        return responseBean;
    }
}
