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.PensionOrderEvaluationDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderEvaluationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEvaluationEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderEvaluationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 订单评价表
 *
 * @author zsh 408538940@qq.com
 * @since 1.0.0 2021-03-11
 */
@Service
public class PensionOrderEvaluationServiceImpl extends CrudServiceImpl<PensionOrderEvaluationDao, PensionOrderEvaluationEntity, PensionOrderEvaluationDTO> implements PensionOrderEvaluationService {

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

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

        return wrapper;
    }

    @Autowired
    private PensionOrderEvaluationDao dao;

    @Override
    public PensionOrderEvaluationDTO findByOrderId(Long orderId) {
        return dao.findByOrderId(orderId);
    }
}