package org.springblade.manager.service.impl;

import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.manager.entity.ProjectContractArea;
import org.springblade.manager.mapper.ProjectContractAreaMapper;
import org.springblade.manager.service.ProjectContractAreaService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ProjectContractAreaServiceImpl extends BaseServiceImpl<ProjectContractAreaMapper, ProjectContractArea> implements ProjectContractAreaService {

    @Override
    public List<ProjectContractArea> queryAllContractArea() {
        return this.baseMapper.queryAllContractArea();
    }

    @Override
    public ProjectContractArea queryContractAreaByContractId(String contractId) {
        Map<String,Object> queryMap = new HashMap<>();
        queryMap.put("contract_id", contractId);
        List<ProjectContractArea> result = this.baseMapper.selectByMap(queryMap);
        return result != null && result.size() != 0 ? result.get(0) : new ProjectContractArea();
    }
}
