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.PensionOrderDocumentDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderDocumentEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderDocumentService;
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-11
 */
@Service
public class PensionOrderDocumentServiceImpl extends CrudServiceImpl<PensionOrderDocumentDao, PensionOrderDocumentEntity, PensionOrderDocumentDTO> implements PensionOrderDocumentService {

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

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

        return wrapper;
    }

    @Autowired
    private PensionOrderDocumentDao dao;

    @Override
    public List<PensionOrderDocumentDTO> findByOrderIdAndRemark(Long id, String remark) {
        return dao.findByOrderIdAndRemark(id, remark);
    }

    @Override
    public PensionOrderDocumentDTO findStaffVoiceId(Long orderId) {
        return dao.findStaffVoiceId(orderId);
    }
}