TG.WXCRM.V4/WX.CRM.DataSynFactory/Cmd/Server_WwextUserResid_IMP.cs

41 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Dapper;
using System;
using WX.CRM.Common;
using WX.CRM.DataSynFactory.Dao;
using WX.CRM.DataSynFactory.Templates;
namespace WX.CRM.DataSynFactory.Cmd
{
public class Server_WwextUserResid_IMP : Interfaces.IDataImportSvr<Server_WwextUserResid>
{
public bool GenerateBusinessOne(Server_WwextUserResid t)
{
try
{
if (string.IsNullOrWhiteSpace(t.deptcode))
{
LogHelper.Error($"{t.ToJson()}事业部为空");
return true;
}
using (var db = ZxdStore.GetConnection())
{
var sql = @"
INSERT INTO ww_extuser_resid(resid,userid,deptcode)
values(@resid,@userid,@deptcode)
on duplicate key update putnum = putnum+1; ";
if (t.type == "unbind")
{
sql = "delete from ww_extuser_resid where resid=@resid and userid=@userid and deptcode=@deptcode";
}
db.Execute(sql, t);
}
return true;
}
catch (Exception ex)
{
LogHelper.Error("Server_WwextUserResid_IMP" + ex.ToString());
return false;
}
}
}
}