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.TpLevel;
import com.community.huiju.dao.TpLevelMapper;
import com.community.huiju.service.ITpLevelService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 小区楼层资料表 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-05-15
 */
@Service
public class TpLevelServiceImpl extends ServiceImpl<TpLevelMapper, TpLevel> implements ITpLevelService {

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