package io.hmit.modules.serviceOrder.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionOldFamilyDao;
import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO;
import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity;
import io.hmit.modules.serviceOrder.service.PensionOldFamilyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * 老人与家属的关联表
 *
 * @author zsh 408538940@qq.com
 * @since 1.0.0 2021-03-18
 */
@Service
public class PensionOldFamilyServiceImpl extends CrudServiceImpl<PensionOldFamilyDao, PensionOldFamilyEntity, PensionOldFamilyDTO> implements PensionOldFamilyService {

    @Override
    public QueryWrapper<PensionOldFamilyEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<PensionOldFamilyEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }

    @Autowired
    private PensionOldFamilyDao pensionOldFamilyDao;

    @Override
    public List<PensionOldFamilyDTO> findByOldId(Long oldId) {
        return pensionOldFamilyDao.findByOldId(oldId);
    }
}