package com.community.huiju.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.community.huiju.common.base.ResponseBean;
import com.community.huiju.model.TpUnit;
import com.community.huiju.dao.TpUnitMapper;
import com.community.huiju.service.ITpUnitService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 小区单元资料表 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-05-15
 */
@Service
public class TpUnitServiceImpl extends ServiceImpl<TpUnitMapper, TpUnit> implements ITpUnitService {

    @Override
    public ResponseBean getUnit(Integer communityId, Integer phaseId, Integer buildingId) {
        ResponseBean responseBean = new ResponseBean();
        QueryWrapper<TpUnit> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("community_id", communityId);
        queryWrapper.eq("phase_id", phaseId);
        queryWrapper.eq("building_id", buildingId);
        List<TpUnit> list = this.list(queryWrapper);
        responseBean.addSuccess(list);
        return responseBean;
    }
}
