s
This commit is contained in:
parent
1821f463db
commit
1ddd541402
@ -120,8 +120,7 @@ public class EmployeeRepositories : IEmployeeRepositories
|
|||||||
FROM Employee e
|
FROM Employee e
|
||||||
LEFT JOIN Post p ON p.id = e.postid";
|
LEFT JOIN Post p ON p.id = e.postid";
|
||||||
var employees = connection.Query<Employee>(querySelect);
|
var employees = connection.Query<Employee>(querySelect);
|
||||||
_logger.LogDebug("Полученные объекты: {json}",
|
_logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(employees));
|
||||||
JsonConvert.SerializeObject(employees));
|
|
||||||
return employees;
|
return employees;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Accounting_Time_It_Company.Entities;
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Accounting_Time_It_Company.Entities.Enums;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -29,7 +30,7 @@ public class PostRepositories : IPostRepositories
|
|||||||
var queryInsert = @"
|
var queryInsert = @"
|
||||||
INSERT INTO Post
|
INSERT INTO Post
|
||||||
VALUES (DEFAULT, @NamePost, @LevelPost, @Wage)";
|
VALUES (DEFAULT, @NamePost, @LevelPost, @Wage)";
|
||||||
connection.Execute(queryInsert, post);
|
connection.Execute(queryInsert, new { NamePost = post.NamePost.ToString(), post.LevelPost, post.Wage });
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -111,6 +111,7 @@ public class TypeJobRepositories : ITypeJobRepositories
|
|||||||
{
|
{
|
||||||
builder.AddCondition("tj.directorId = @directorId");
|
builder.AddCondition("tj.directorId = @directorId");
|
||||||
}
|
}
|
||||||
|
|
||||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
connection.Open();
|
connection.Open();
|
||||||
var querySelect = @$"SELECT
|
var querySelect = @$"SELECT
|
||||||
@ -129,6 +130,9 @@ public class TypeJobRepositories : ITypeJobRepositories
|
|||||||
LEFT JOIN Employee e ON e.id = wt.employeeid
|
LEFT JOIN Employee e ON e.id = wt.employeeid
|
||||||
{builder.Build()}";
|
{builder.Build()}";
|
||||||
|
|
||||||
|
var ManagerId = connection.Query<int>($"SELECT p.Id FROM Post p WHERE p.NamePost='{(int)TypePost.Manager}'");
|
||||||
|
var DeveloperId = connection.Query<int>($"SELECT p.Id FROM Post p WHERE p.NamePost='{(int)TypePost.Developer}'");
|
||||||
|
|
||||||
var jobDictDev = new Dictionary<int, List<WorkTime>>();
|
var jobDictDev = new Dictionary<int, List<WorkTime>>();
|
||||||
var jobDictMan = new Dictionary<int, List<WorkTime>>();
|
var jobDictMan = new Dictionary<int, List<WorkTime>>();
|
||||||
|
|
||||||
@ -145,8 +149,8 @@ public class TypeJobRepositories : ITypeJobRepositories
|
|||||||
tjwtm = [];
|
tjwtm = [];
|
||||||
jobDictMan.Add(tj.Id, tjwtm);
|
jobDictMan.Add(tj.Id, tjwtm);
|
||||||
}
|
}
|
||||||
if (e.PostId == (int)TypePost.Developer) tjwtd.Add(wt);
|
if (DeveloperId.Any(x => x == e.PostId)) tjwtd.Add(wt);
|
||||||
if (e.PostId == (int)TypePost.Manager) tjwtm.Add(wt);
|
if (ManagerId.Any(x => x == e.PostId)) tjwtm.Add(wt);
|
||||||
return tj;
|
return tj;
|
||||||
}, splitOn: "employeeid, name", param: new { dateFrom, dateTo, productId, directorId });
|
}, splitOn: "employeeid, name", param: new { dateFrom, dateTo, productId, directorId });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user