From 8db98fe1142211c9941d9c7d944394c5d7a33159 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期一, 21 六月 2021 09:17:53 +0800
Subject: [PATCH] 提交

---
 zhengcaioa/Services/HrJixiaotichengService.cs |  207 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 207 insertions(+), 0 deletions(-)

diff --git a/zhengcaioa/Services/HrJixiaotichengService.cs b/zhengcaioa/Services/HrJixiaotichengService.cs
new file mode 100644
index 0000000..e549023
--- /dev/null
+++ b/zhengcaioa/Services/HrJixiaotichengService.cs
@@ -0,0 +1,207 @@
+锘縰sing AutoMapper;
+using DTO;
+using IServices;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using zhengcaioa.Models;
+
+
+namespace Services
+{
+    public class HrJixiaotichengService : IHrJixiaotichengService
+    {
+        private readonly zhengcaioaContext _context;
+        private readonly IMapper _mapper;
+        public HrJixiaotichengService(zhengcaioaContext context, IMapper mapper)
+        {
+            _context = context;
+            _mapper = mapper;
+        }
+
+        public ResultEntity save(HrJixiaotichengDTO dto)
+        {
+            ResultEntity resultEntity = new ResultEntity();
+            try
+            {
+                var model = _mapper.Map<HrJixiaoticheng>(dto);
+                if (String.IsNullOrEmpty(model.Id))
+                {
+                    model.Id = Guid.NewGuid().ToString();
+
+
+                    _context.HrJixiaotichengs.Add(model);
+                }
+                else
+                {
+                    var updatepltRole = _context.HrJixiaotichengs.Find(model.Id);
+                    updatepltRole.PostId = model.PostId;
+                    updatepltRole.PiecerateId = model.PiecerateId;
+                    updatepltRole.Tichengstandard = model.Tichengstandard;
+                    updatepltRole.Renwustandard = model.Renwustandard;
+                    updatepltRole.Ticheng = model.Ticheng;
+                    updatepltRole.Renwu = model.Renwu;
+
+
+                    updatepltRole.Effecttime = model.Effecttime;
+
+                    updatepltRole.RecStatus = model.RecStatus;
+                    // updatepltRole.Creater = pltRole.Creater;
+                    //updatepltRole.Createtime = pltRole.Createtime;
+                    updatepltRole.Modifier = model.Modifier;
+                    updatepltRole.Modifytime = model.Modifytime;
+
+                }
+
+                _context.SaveChanges();
+                resultEntity.ReturnID = model.Id;
+                resultEntity.Result = true;
+            }
+            catch (Exception ex)
+            {
+                resultEntity.Result = false;
+                resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�";
+
+            }
+            return resultEntity;
+        }
+
+        public HrJixiaotichengDTO Get(string id)
+        {
+            var entity = _context.HrJixiaotichengs.Find(id);
+
+            if (entity.RecStatus != "A")
+            {
+                entity = new HrJixiaoticheng();
+            }
+            var HrJixiaotichengDTO = _mapper.Map<HrJixiaotichengDTO>(entity);
+            return HrJixiaotichengDTO;
+        }
+
+        public ResultDataEntity<HrJixiaotichengDTO> SearchByPaging(HrJixiaotichengDTOSearch searchEntity)
+        {
+            ResultDataEntity<HrJixiaotichengDTO> data = new ResultDataEntity<HrJixiaotichengDTO>();
+
+            var listCode = (from a in _context.SysCodeDtls
+                            join b in _context.SysCodes
+                            on a.CodeId equals b.Id
+                            where a.RecStatus == "A"
+                                          && b.RecStatus == "A"
+                            select new CodeDataEntity()
+                            {
+                                CodeId = b.Id,
+                                CodeTable = b.CodeTable,
+                                CodeField = b.CodeField,
+                                CodeSn = a.CodeSn,
+                                Comments = a.Comments,
+                                Contents = a.Contents,
+                                RecStatus = a.RecStatus,
+                                Sort = a.Sort
+                            }
+                     );
+
+            var query = (from a in _context.HrJixiaotichengs//.Where(x => x.RecStatus == "A")
+                         join b in listCode.Where(x => x.CodeTable == "fi_piecerate" && x.CodeField == "standard")
+                        on a.Tichengstandard equals b.CodeSn
+                         into bsssss
+                         from bbb in bsssss.DefaultIfEmpty()
+
+                         join c in listCode.Where(x => x.CodeTable == "hr_jixiaoticheng" && x.CodeField == "renwustandard")
+                       on a.Renwustandard equals c.CodeSn
+                        into csssss
+                         from ccc in csssss.DefaultIfEmpty()
+
+                         join f in _context.HrPositions
+                         on a.PostId equals f.Id
+                           into fsssss
+                         from fff in fsssss.DefaultIfEmpty()
+
+                         join g in _context.FiPiecerates
+                        on a.PiecerateId equals g.Id
+                          into gsssss
+                         from ggg in gsssss.DefaultIfEmpty()
+
+                         where a.RecStatus == "A"
+                          && (string.IsNullOrWhiteSpace(searchEntity.PostId) || a.PostId == searchEntity.PostId.Trim())
+                         select new HrJixiaotichengDTO
+                         {
+                             Id = a.Id,
+                             PostId = a.PostId,
+                             PostName = fff.PostName,
+                             PiecerateId = a.PiecerateId,
+                             PiecerateName = ggg.Project,
+                             Renwustandard = a.Renwustandard,
+                             RenwustandardName = ccc.Comments,
+                             Tichengstandard = a.Tichengstandard,
+                             TichengstandardName = bbb.Comments,
+                             Ticheng = a.Ticheng,
+                             Renwu = a.Renwu,
+
+
+                             TichengName = a.Ticheng.HasValue ? a.Ticheng.Value.ToString("F2") : "",
+                             RenwuName = a.Renwu.HasValue ? a.Renwu.Value.ToString("F2") : "",
+
+                             Effecttime = a.Effecttime,
+                             EffecttimeName = a.Effecttime.HasValue ? a.Effecttime.Value.ToString("yyyy-MM-dd") : "",
+
+
+
+
+                             RecStatus = a.RecStatus,
+                             Creater = a.Creater,
+                             Createtime = a.Createtime,
+                             Modifier = a.Modifier,
+                             Modifytime = a.Modifytime,
+
+                         }).OrderByDescending(x => x.Modifytime).ToList();
+
+
+
+
+
+
+
+            if (searchEntity.totalrows == 0)
+                searchEntity.totalrows = query.Count();
+            var rolelist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
+
+            data.LoadData(searchEntity, rolelist);
+            return data;
+        }
+
+        public ResultEntity ModifyStatus(string id, string userid)
+        {
+
+            ResultEntity result = new ResultEntity();
+            result.Result = true;
+
+            var model = _context.HrJixiaotichengs.Find(id);
+            if (model != null)
+            {
+                model.RecStatus = "D";
+                model.Modifier = userid;
+                model.Modifytime = DateTime.Now;
+                _context.SaveChanges();
+            }
+
+            return result;
+        }
+
+
+        /// <summary>
+        /// 鑾峰彇鎵�鏈夋湁鏁堣鑹�
+        /// </summary>
+        /// <returns></returns>
+        public List<HrJixiaotichengDTO> GetList()
+        {
+
+
+            var listPosition = _context.HrJixiaotichengs.Where(r => r.RecStatus == "A").ToList();
+
+            var list = _mapper.Map<List<HrJixiaotichengDTO>>(listPosition);
+            return list;
+        }
+    }
+}

--
Gitblit v1.9.1