using Edu.Model.Entity.User; using Edu.Model.ViewModel.User; using System.Collections.Generic; using System.Linq; namespace Edu.Repository.User { /// /// 特殊日期扩展信息 /// public partial class Rb_technicaldatesRepository : BaseRepository { /// /// 获取特殊打卡日期 /// /// 员工id /// 部门id /// 打卡日期 /// public RB_Technicaldates_Extend GetSpecialDate(int empId, int RB_Department_Id, string date) { string where = ""; if (empId > 0) { where += $" or t.EmployeeId={empId} "; } if (RB_Department_Id > 0) { where += $" or t.RB_Department_Id={RB_Department_Id} "; } return Get($@"SELECT * from rb_technicaldates t where DATE(t.Date) = '{date}' and (t.AttendanceId = (SELECT a.Id from rb_attendance a INNER JOIN (SELECT e.RB_Branch_id,e.RB_Group_id from rb_employee e where e.EmployeeId = {empId}) as e on e.RB_Branch_id =a.RB_BranchId and e.RB_Group_id =a.RB_GroupId) {where}) ").ToList().FirstOrDefault(); } /// /// 获取特殊打卡日期列表 ld 2020/05/25 调整 /// /// 员工id /// 打卡日期 /// public List GetSpecialDateList(int empId, string date) { return Get($@"SELECT * from rb_technicaldates t where DATE(t.Date) = '{date}' and t.AttendanceId = (SELECT a.Id from rb_attendance a INNER JOIN (SELECT e.RB_Branch_id,e.RB_Group_id from rb_employee e where e.EmployeeId = {empId}) as e on e.RB_Branch_id =a.RB_BranchId and e.RB_Group_id =a.RB_GroupId)").ToList(); } /// /// 获取公司该天是否需要打卡 /// /// /// /// public RB_Technicaldates_Extend GetSpecialDateToBranch(int Branch, string date) { return Get($@"SELECT * from rb_technicaldates t where DATE(t.Date) = '{date}' and t.AttendanceId = (SELECT a.Id from rb_attendance a where a.RB_BranchId={Branch})").ToList().FirstOrDefault(); } /// /// 获取公司该天是否需要打卡 /// /// /// /// public List GetSpecialDateToBranchList(int Branch, string date) { return Get($@"SELECT * from rb_technicaldates t where DATE(t.Date) = '{date}' and t.AttendanceId = (SELECT a.Id from rb_attendance a where a.RB_BranchId={Branch})").ToList(); } /// /// 获取特殊打卡日期 /// /// 员工id /// public List GetSpecialDateList(int empId) { return Get($@"SELECT * from rb_technicaldates t where t.AttendanceId = (SELECT a.Id from rb_attendance a INNER JOIN (SELECT e.RB_Branch_id,e.RB_Group_id from rb_employee e where e.EmployeeId = {empId}) as e on e.RB_Branch_id =a.RB_BranchId and e.RB_Group_id =a.RB_GroupId)").ToList(); } } }