From d4a6d65f5e449c3e5464aa18ae97bf8953987217 Mon Sep 17 00:00:00 2001
From: LR-20210131IOQH\Administrator <jackcold@163.com>
Date: 星期二, 10 八月 2021 15:44:14 +0800
Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/zhengcaioa
---
zhengcaioa/Services/LZhuanjiahuidumService.cs | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 169 insertions(+), 0 deletions(-)
diff --git a/zhengcaioa/Services/LZhuanjiahuidumService.cs b/zhengcaioa/Services/LZhuanjiahuidumService.cs
new file mode 100644
index 0000000..3171e70
--- /dev/null
+++ b/zhengcaioa/Services/LZhuanjiahuidumService.cs
@@ -0,0 +1,169 @@
+锘縰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 LZhuanjiahuidumService : ILZhuanjiahuidumService
+ {
+ private readonly zhengcaioaContext _context;
+ private readonly IMapper _mapper;
+ public LZhuanjiahuidumService(zhengcaioaContext context, IMapper mapper)
+ {
+ _context = context;
+ _mapper = mapper;
+ }
+
+ public ResultEntity save(LZhuanjiahuidumDTO dto)
+ {
+ ResultEntity resultEntity = new ResultEntity();
+ try
+ {
+ var model = _mapper.Map<LZhuanjiahuidum>(dto);
+ if (String.IsNullOrEmpty(model.Id))
+ {
+ model.Id = Guid.NewGuid().ToString();
+
+
+ _context.LZhuanjiahuida.Add(model);
+ }
+ else
+ {
+ var updatepltRole = _context.LZhuanjiahuida.Find(model.Id);
+ updatepltRole.Userid = model.Userid;
+ updatepltRole.Username = model.Username;
+ updatepltRole.Anwser = model.Anwser;
+ updatepltRole.Question = model.Question;
+ updatepltRole.HuidaStatus = model.HuidaStatus;
+
+ 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 LZhuanjiahuidumDTO Get(string id)
+ {
+ var entity = _context.LZhuanjiahuida.Find(id);
+
+ if (entity.RecStatus != "A")
+ {
+ entity = new LZhuanjiahuidum();
+ }
+ var LZhuanjiahuidumDTO = _mapper.Map<LZhuanjiahuidumDTO>(entity);
+ return LZhuanjiahuidumDTO;
+ }
+
+ public ResultDataEntity<LZhuanjiahuidumDTO> SearchByPaging(LZhuanjiahuidumDTOSearch searchEntity)
+ {
+ ResultDataEntity<LZhuanjiahuidumDTO> data = new ResultDataEntity<LZhuanjiahuidumDTO>();
+
+
+
+ var query = (from a in _context.LZhuanjiahuida//.Where(x => x.RecStatus == "A")
+
+
+
+ where a.RecStatus == "A"
+ && (string.IsNullOrWhiteSpace(searchEntity.Username) || a.Username.Contains(searchEntity.Username.Trim()))
+ && (string.IsNullOrWhiteSpace(searchEntity.Question) || a.Question.Contains(searchEntity.Question.Trim()))
+ && (string.IsNullOrWhiteSpace(searchEntity.Userid) || a.Userid == searchEntity.Userid.Trim())
+ && (string.IsNullOrWhiteSpace(searchEntity.HuidaStatus) || a.HuidaStatus == searchEntity.HuidaStatus.Trim())
+ select new LZhuanjiahuidumDTO
+ {
+ Id = a.Id,
+ Userid = a.Userid,
+ Username = a.Username,
+ Anwser = a.Anwser,
+ Question = a.Question,
+ HuidaStatus = a.HuidaStatus,
+
+
+
+
+ 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.LZhuanjiahuida.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<LZhuanjiahuidumDTO> GetList(string Userid = "", string question = "")
+ {
+
+
+ var listPosition = _context.LZhuanjiahuida.Where(r => r.RecStatus == "A").ToList();
+ if (!string.IsNullOrEmpty(Userid))
+ {
+ listPosition = listPosition.Where(x=>x.Userid== Userid).ToList();
+ }
+ if (!string.IsNullOrEmpty(question))
+ {
+ listPosition = listPosition.Where(x => x.Question == question).ToList();
+ }
+
+ var list = _mapper.Map<List<LZhuanjiahuidumDTO>>(listPosition);
+ return list;
+ }
+ }
+}
--
Gitblit v1.9.1