using Dapper;
using NetCore.Model.enums;
using System.Data;
//using Kogel.Dapper.Extension.MySql;
namespace NetCore.BLL
{
///
/// 企业微信订单客户操作
///
public class crm_orderuser_bll
{
private string comcode;
public crm_orderuser_bll(string _comcode)
{
comcode = _comcode;
}
///
/// 订单客户初始化
///
public void InitHgOrderResid()
{
using (IDbConnection con = ConnectionFactory.CreateConnection(ContextType.crmContext, comcode))
{
con.Execute(@" insert into HG_ORDERRESID(resid)
select a.resid from res_customer a
join res_customer b on a.customerid=b.customerid
where exists(
select distinct t.resid from wx_szzyorder t
join res_customer x on t.resid=x.resid
where t.orderstatus in (200, 205, 220, 80, 90)
and t.arrivalpay > 100
and b.resid=t.resid
)
and not exists(select 1 from HG_ORDERRESID zz where zz.resid=a.resid)
", null);
}
}
}
}