|
@@ -47,7 +47,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
#region 负责人
|
|
|
if (!string.IsNullOrWhiteSpace(dto.Userid))
|
|
|
{
|
|
|
- string sql = string.Format(@"select u1.UsersId,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and u1.UsersId in ({0}) and u1.IsDel = 0", dto.Userid);
|
|
|
+ string sql = string.Format(@"select u1.UsersId as UserId,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and u1.UsersId in ({0}) and u1.IsDel = 0", dto.Userid);
|
|
|
List<AscribedUser> ascribedUsers = await _sqlSugar.SqlQueryable<AscribedUser>(sql).ToListAsync();
|
|
|
if (ascribedUsers.Count != 0)
|
|
|
{
|
|
@@ -70,7 +70,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
#region 业务归属
|
|
|
if (!string.IsNullOrWhiteSpace(dto.Business))
|
|
|
{
|
|
|
- string sql = string.Format(@"select d1.*,d2.Name from Crm_ClientDataAndBusiness d1,Sys_SetData d2 where d1.SetDataId=d2.Id and d1.SetDataId in ({0}) and d1.isdel = 0", dto.Business);
|
|
|
+ string sql = string.Format(@"select d2.Id,d2.Name,d1.NewClientDataId from Crm_ClientDataAndBusiness d1,Sys_SetData d2 where d1.SetDataId=d2.Id and d1.SetDataId in ({0}) and d1.isdel = 0", dto.Business);
|
|
|
List<AscribedDepartment> AscribedDepartment = await _sqlSugar.SqlQueryable<AscribedDepartment>(sql).ToListAsync();
|
|
|
if (AscribedDepartment.Count != 0)
|
|
|
{
|
|
@@ -308,11 +308,11 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
foreach (var item in NewClientDataView)
|
|
|
{
|
|
|
List<AscribedUser> AscribedUser = await _sqlSugar.SqlQueryable<AscribedUser>
|
|
|
- ("select u1.UsersId,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and NewClientDataId=" + item.Id + " AND u1.ISDEL = 0").ToListAsync();
|
|
|
+ ("select u1.UsersId as UserId ,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and NewClientDataId=" + item.Id + " AND u1.ISDEL = 0").ToListAsync();
|
|
|
item.AscribedUser = AscribedUser;
|
|
|
|
|
|
List<AscribedDepartment> AscribedDepartment = await _sqlSugar.SqlQueryable<AscribedDepartment>
|
|
|
- ("select d1.*,d2.Name from Crm_ClientDataAndBusiness d1,Sys_SetData d2 where d1.SetDataId=d2.Id and NewClientDataId=" + item.Id + " AND d1.ISDEL = 0").ToListAsync();
|
|
|
+ ("select d2.Id,d2.Name,d1.NewClientDataId from Crm_ClientDataAndBusiness d1,Sys_SetData d2 where d1.SetDataId=d2.Id and NewClientDataId=" + item.Id + " AND d1.ISDEL = 0").ToListAsync();
|
|
|
item.AscribedDepartment = AscribedDepartment;
|
|
|
}
|
|
|
|
|
@@ -495,10 +495,10 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
{
|
|
|
MapQueryData = _mapper.Map<NewClientDataView>(QueryData);
|
|
|
MapQueryData.AscribedUser = await _sqlSugar.SqlQueryable<AscribedUser>
|
|
|
- ("select u1.UsersId,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and NewClientDataId=" + dto.Id + " and u1.isdel = 0").ToListAsync();
|
|
|
+ ("select u1.UsersId as UserId,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and NewClientDataId=" + dto.Id + " and u1.isdel = 0").ToListAsync();
|
|
|
|
|
|
MapQueryData.AscribedDepartment = await _sqlSugar.SqlQueryable<AscribedDepartment>
|
|
|
- ("select d1.*,d2.Name from Crm_ClientDataAndBusiness d1,Sys_SetData d2 where d1.SetDataId=d2.Id and NewClientDataId=" + dto.Id + " and d1.isdel = 0").ToListAsync();
|
|
|
+ ("select d2.Id,d2.Name,d1.NewClientDataId from Crm_ClientDataAndBusiness d1,Sys_SetData d2 where d1.SetDataId=d2.Id and NewClientDataId=" + dto.Id + " and d1.isdel = 0").ToListAsync();
|
|
|
}
|
|
|
|
|
|
#region 下拉框初始化数据
|
|
@@ -515,19 +515,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
};
|
|
|
_Users.Add(data);
|
|
|
};
|
|
|
- //省域数据
|
|
|
- List<dynamic> _Province = new List<dynamic>();
|
|
|
- List<Sys_SetData> province = _sqlSugar.Queryable<Sys_SetData>()
|
|
|
- .Where(u => u.STid == 42 && u.IsDel == 0).ToList();
|
|
|
- foreach (Sys_SetData item in province)
|
|
|
- {
|
|
|
- var data = new
|
|
|
- {
|
|
|
- Id = item.Id,
|
|
|
- Name = item.Name
|
|
|
- };
|
|
|
- _Province.Add(data);
|
|
|
- };
|
|
|
+
|
|
|
//客户级别数据
|
|
|
List<dynamic> _level = new List<dynamic>();
|
|
|
List<Sys_SetData> level = _sqlSugar.Queryable<Sys_SetData>()
|
|
@@ -574,7 +562,6 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
{
|
|
|
data = MapQueryData,
|
|
|
Users = _Users,
|
|
|
- Province = _Province,
|
|
|
level = _level,
|
|
|
CustomerClass = _CustomerClass,
|
|
|
ServiceClass = _ServiceClass,
|