| | |
| | | && (string.IsNullOrWhiteSpace(searchEntity.DeptType) || a.DeptType == searchEntity.DeptType.Trim()) |
| | | && (string.IsNullOrWhiteSpace(searchEntity.Superior) || (d != null && d.DeptName.Contains(searchEntity.Superior.Trim()))) |
| | | && (string.IsNullOrWhiteSpace(searchEntity.QiyongStatus) || a.QiyongStatus == searchEntity.QiyongStatus.Trim()) |
| | | && (string.IsNullOrWhiteSpace(searchEntity.DeptnullName) || a.DeptName != searchEntity.DeptnullName.Trim()) |
| | | select new HrDeptDTO |
| | | { |
| | | Id = a.Id, |
| | |
| | | public List<HrDeptDTO> GetList() |
| | | { |
| | | |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.Append(" with t as "); |
| | | sql.Append(" ( select b.* from [hr_dept] b where b.[superior] = '' and b.rec_status='A' and b.qiyong_status='A' "); |
| | | sql.Append(" union all "); |
| | | sql.Append(" select a.* from [hr_dept] a join t b on a.[superior]=b.[Id] and a.rec_status='A' and a.qiyong_status='A' ) "); |
| | | sql.Append(" select [Id],[dept_sn], replace(space((CAST([levels] as int)-1)*2)+[dept_name],' ',' ') [dept_name],[director],[dept_type],[levels],[superior],[superior_top],[sort],[rec_status],[creater],[createtime],[modifier],[modifytime],[qiyong_status] "); |
| | | sql.Append(" from t "); |
| | | //StringBuilder sql = new StringBuilder(); |
| | | //sql.Append(" with t as "); |
| | | //sql.Append(" ( select b.* from [hr_dept] b where b.[superior] = '' and b.rec_status='A' and b.qiyong_status='A' "); |
| | | //sql.Append(" union all "); |
| | | //sql.Append(" select a.* from [hr_dept] a join t b on a.[superior]=b.[Id] and a.rec_status='A' and a.qiyong_status='A' ) "); |
| | | //sql.Append(" select [Id],[dept_sn], replace(space((CAST([levels] as int)-1)*2)+[dept_name],' ',' ') [dept_name],[director],[dept_type],[levels],[superior],[superior_top],[sort],[rec_status],[creater],[createtime],[modifier],[modifytime],[qiyong_status] "); |
| | | //sql.Append(" from t "); |
| | | |
| | | |
| | | var listPosition = _context.HrDepts.FromSqlRaw(sql.ToString()).ToList(); |
| | | //var listPosition = _context.HrDepts.FromSqlRaw(sql.ToString()).ToList(); |
| | | |
| | | var listPositionss = departmentRecursion("",listPosition); |
| | | |
| | | var list = _mapper.Map<List<HrDeptDTO>>(listPositionss); |
| | | //var listPositionss = departmentRecursion("",listPosition); |
| | | var listPosition = _context.HrDepts.Where(x=>x.RecStatus =="A" && x.QiyongStatus=="A" && x.DeptName!="公司").OrderBy(x => x.DeptSn).ToList(); |
| | | var list = _mapper.Map<List<HrDeptDTO>>(listPosition); |
| | | return list; |
| | | } |
| | | |