package com.sifang.modules.sys.util;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

import java.util.List;

public class CrmSiteUtils {

    /**
     * 获取服务商信息，只获取服务商名称和id。
     */
    public static List<Record> getSiteConcise() {
        return Db.find("select id,name from crm_site where status='0'");
    }

    public static Record getSiteById(String id){
        return Db.findFirst("select * from crm_site where status='0' and id=? ",id);
    }
    public static Record getSiteBySiteId(String id){
        return Db.findFirst("select * from crm_site where status !='1' and id=? ",id);
    }
    /**
     * 获取用户地址信息
     * @param orderId
     * @return
     */
    public static Record getUserAddress(String orderId){
        String sql = "select c.* from crm_order c where c.id=? ";
        return Db.findFirst(sql,orderId);
    }

    /**
     * 获取自定义地址信息
     * @param orderId
     * @return
     */
    public static Record getAutoInfo(String orderId){
        String sql = "select f.* from crm_platform_fitting_apply f where f.order_id = ? ORDER BY f.create_time DESC LIMIT 1 ";
        return Db.findFirst(sql,orderId);
    }

}
