/**
 */
package com.sifang.modules.order.dao;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.sifang.modules.order.entity.OrderFeedback;

import com.sifang.modules.sys.common.persistence.BaseDao;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * 反馈DAO接口
 * @author Ivan
 * @version 2017-05-13
 */
@Repository
public class OrderFeedbackDao extends BaseDao<OrderFeedback> {

    /**
     * 平台查看工单反馈信息
    */
    public List<Record> getOrderFeedbackRecords(String orderId) {
        StringBuffer sb = new StringBuffer();
        sb.append(" select * from crm_order_feedback a where a.order_id = ?  order by a.feedback_time desc ");
        return Db.find(sb.toString(), orderId);
    }
    /**
     * 服务商查看工单反馈信息
     */
    public List<Record> getServiceOrderFeedbackRecords(String orderId, String siteId) {
        StringBuffer sb = new StringBuffer();
        sb.append(" select a.*,DATE_FORMAT(a.feedback_time,'%Y-%m-%d %H:%i:%s') feedbackTime from crm_order_feedback a where a.order_id = ? and a.site_id = ? order by a.feedback_time desc ");
        return Db.find(sb.toString(), orderId, siteId);
    }
    /**
     * 服务商查看工单反馈信息
     */
    public List<Record> getOrderFeedbackDetail(String orderId, String siteId) {
        StringBuffer sb = new StringBuffer();
        sb.append(" select *,DATE_FORMAT(feedback_time,'%Y-%m-%d %H:%i:%s')feedbackTime from crm_order_feedback a where a.order_id = ? and a.site_id = ? order by a.feedback_time desc ");
        return Db.find(sb.toString(), orderId, siteId);
    }
}
