package io.renren.service.impl;

import java.util.Map;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import io.renren.common.constant.Constant;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.dao.ScopeCityCompanyDao;
import io.renren.dto.ScopeCityCompanyDTO;
import io.renren.entity.ScopeCityCompanyEntity;
import io.renren.service.ScopeCityCompanyService;

/**
 * 落地城市公司明细表
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2022-05-28
 */
@Service
public class ScopeCityCompanyServiceImpl extends CrudServiceImpl<ScopeCityCompanyDao, ScopeCityCompanyEntity, ScopeCityCompanyDTO> implements ScopeCityCompanyService {

    @Override
    public QueryWrapper<ScopeCityCompanyEntity> getWrapper(Map<String, Object> params){
    	Long scopeCityId = (Long)params.get("scopeCityId");
    	Long companyId = (Long)params.get("companyId");

        QueryWrapper<ScopeCityCompanyEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("status", Constant.Status.ENABLE.getValue())
                .eq(null != scopeCityId, "scope_city_id", scopeCityId)
                .eq(null != companyId, "company_id", companyId);

        return wrapper;
    }

}