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