From b0c19dd2793b5ada90b303b7ec23a670cdbf48f6 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期五, 11 二月 2022 14:52:52 +0800 Subject: [PATCH] 根据删除的知识点查询 --- zhengcaioa/zhengcaioa/Model/UserPage.cs | 20 ++++++++-- zhengcaioa/Model/zcweb/zcwebContext.cs | 2 zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml | 3 + zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs | 1 zhengcaioa/Services/ExpertTestTopicService.cs | 11 ++--- zhengcaioa/DTO/ExpertTestTopicDTO.cs | 3 + zhengcaioa/Services/LiaotianService.cs | 21 ++++++++++ zhengcaioa/IServices/ILiaotianService.cs | 1 zhengcaioa/zhengcaioa/appsettings.json | 6 +- zhengcaioa/Model/zcUserInfoN_db/zcUserInfoN_dbContext.cs | 2 zhengcaioa/Model/zhengcaioaContext.cs | 2 11 files changed, 55 insertions(+), 17 deletions(-) diff --git a/zhengcaioa/DTO/ExpertTestTopicDTO.cs b/zhengcaioa/DTO/ExpertTestTopicDTO.cs index 1f960c3..463d592 100644 --- a/zhengcaioa/DTO/ExpertTestTopicDTO.cs +++ b/zhengcaioa/DTO/ExpertTestTopicDTO.cs @@ -73,7 +73,10 @@ public string TopicId { get; set; } public string Falv { get; set; } + + public string shanchuzhishitype { get; set; } + } } diff --git a/zhengcaioa/IServices/ILiaotianService.cs b/zhengcaioa/IServices/ILiaotianService.cs index 64e8b89..c174aa6 100644 --- a/zhengcaioa/IServices/ILiaotianService.cs +++ b/zhengcaioa/IServices/ILiaotianService.cs @@ -18,6 +18,7 @@ List<SysCodeDtl> GetSYScode(string code_table, string code_field); + List<SysCodeDtl> GetSYScodeshanchu(string code_table, string code_field); List<LiaotianDTO> SearchForPrint(LiaotianDTOSearch searchEntity); diff --git a/zhengcaioa/Model/zcUserInfoN_db/zcUserInfoN_dbContext.cs b/zhengcaioa/Model/zcUserInfoN_db/zcUserInfoN_dbContext.cs index 7f01ea7..15da6f5 100644 --- a/zhengcaioa/Model/zcUserInfoN_db/zcUserInfoN_dbContext.cs +++ b/zhengcaioa/Model/zcUserInfoN_db/zcUserInfoN_dbContext.cs @@ -26,7 +26,7 @@ if (!optionsBuilder.IsConfigured) { #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. - optionsBuilder.UseSqlServer("Data Source=.;Initial Catalog=zcUserInfoN_db;User ID=sa;Password=123456"); + optionsBuilder.UseSqlServer("Data Source=172.26.97.147;Initial Catalog=zcUserInfoN_db;User ID=sa;Password=Za20222812"); } } diff --git a/zhengcaioa/Model/zcweb/zcwebContext.cs b/zhengcaioa/Model/zcweb/zcwebContext.cs index 40074bb..43de4c2 100644 --- a/zhengcaioa/Model/zcweb/zcwebContext.cs +++ b/zhengcaioa/Model/zcweb/zcwebContext.cs @@ -25,7 +25,7 @@ if (!optionsBuilder.IsConfigured) { #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. - optionsBuilder.UseSqlServer("Data Source=.;Initial Catalog=zcweb;User ID=sa;Password=123456"); + optionsBuilder.UseSqlServer("Data Source=172.26.97.147;Initial Catalog=zcweb;User ID=sa;Password=Za20222812"); } } diff --git a/zhengcaioa/Model/zhengcaioaContext.cs b/zhengcaioa/Model/zhengcaioaContext.cs index a30d55d..4c8e020 100644 --- a/zhengcaioa/Model/zhengcaioaContext.cs +++ b/zhengcaioa/Model/zhengcaioaContext.cs @@ -143,7 +143,7 @@ if (!optionsBuilder.IsConfigured) { #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. - optionsBuilder.UseSqlServer("Data Source=.;Initial Catalog=zhengcaioa;User ID=sa;Password=123456"); + optionsBuilder.UseSqlServer("Data Source=172.26.97.147;Initial Catalog=zhengcaioa;User ID=sa;Password=Za20222812"); } } diff --git a/zhengcaioa/Services/ExpertTestTopicService.cs b/zhengcaioa/Services/ExpertTestTopicService.cs index 2b69280..847b3db 100644 --- a/zhengcaioa/Services/ExpertTestTopicService.cs +++ b/zhengcaioa/Services/ExpertTestTopicService.cs @@ -186,8 +186,7 @@ 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" + where b.RecStatus == "A" select new CodeDataEntity() { CodeId = b.Id, @@ -281,7 +280,7 @@ && (string.IsNullOrWhiteSpace(searchEntity.Falv) || lll.Falv == searchEntity.Falv.Trim()) - + && (string.IsNullOrWhiteSpace(searchEntity.shanchuzhishitype) || a.Zhishitype == searchEntity.shanchuzhishitype.Trim()) select new ExpertTestTopicDTO @@ -837,8 +836,8 @@ join f in listCode.Where(x => x.CodeTable == "expert_test_topic" && x.CodeField == "zhishitype") on a.Zhishitype equals f.CodeSn - into fsssss - from fff in fsssss.DefaultIfEmpty() + //into fsssss + // from fff in fsssss.DefaultIfEmpty() where a.RecStatus == "A" @@ -850,7 +849,7 @@ Topictype = a.Topictype, TopictypeName = eee.Comments, Zhishitype = a.Zhishitype, - ZhishitypeName = fff.Comments, + ZhishitypeName = f.Comments, Fenshu = a.Fenshu ?? 0, Fenzhi = a.Fenzhi??0, FenshuName = (a.Fenshu ?? 0).ToString("0.##"), diff --git a/zhengcaioa/Services/LiaotianService.cs b/zhengcaioa/Services/LiaotianService.cs index 6ddb2bb..ed98b8f 100644 --- a/zhengcaioa/Services/LiaotianService.cs +++ b/zhengcaioa/Services/LiaotianService.cs @@ -107,7 +107,28 @@ return sysCodeDtls; } + public List<SysCodeDtl> GetSYScodeshanchu(string code_table, string code_field) + { + + List<SysCodeDtl> sysCodeDtls = (from e in _context.SysCodes + join c in _context.SysCodeDtls + on e.Id equals c.CodeId + where e.RecStatus == "A" + && c.RecStatus == "D" + && e.CodeTable == code_table + && e.CodeField == code_field + select c).OrderBy(x => x.Sort).ToList(); + + + + + + + + return sysCodeDtls; + } + public ResultDataEntity<LiaotianDTO> SearchByPaging(LiaotianDTOSearch searchEntity) { ResultDataEntity<LiaotianDTO> data = new ResultDataEntity<LiaotianDTO>(); diff --git a/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs b/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs index 5845414..9962972 100644 --- a/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs @@ -95,6 +95,7 @@ ViewBag.shenpi_status = _liaotianService.GetSYScode("expert_test_topic", "shenpi_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); ViewBag.Falv = _liaotianService.GetSYScode("expert_test_topicjiexi", "falv").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.shanchuzhishitype = _liaotianService.GetSYScodeshanchu("expert_test_topic", "zhishitype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); var areaDTOs = _areaService.GetList().Where(x => x.ParentId == "0 ").ToList(); foreach (var areaDTO in areaDTOs) diff --git a/zhengcaioa/zhengcaioa/Model/UserPage.cs b/zhengcaioa/zhengcaioa/Model/UserPage.cs index 1b4c057..fdd0f51 100644 --- a/zhengcaioa/zhengcaioa/Model/UserPage.cs +++ b/zhengcaioa/zhengcaioa/Model/UserPage.cs @@ -26,11 +26,23 @@ public static List<PageEntity> GetUserPage(string userid, List<int> systemidlist, string page_method) { List<PageEntity> entityList = new List<PageEntity>(); + + var connectionString = ""; + try + { + var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.Development.json"); + connectionString = builder.Build().GetValue<string>("ConnectionStrings:" + "DefaultConnection"); + } + catch + { + var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json"); + connectionString = builder.Build().GetValue<string>("ConnectionStrings:" + "DefaultConnection"); - var builder = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("appsettings.json"); - var connectionString = builder.Build().GetValue<string>("ConnectionStrings:" + "DefaultConnection"); + } + + var dbContextOptionBuilder = new DbContextOptionsBuilder<zhengcaioaContext>(); using (var db = new zhengcaioaContext(dbContextOptionBuilder.UseSqlServer(connectionString).Options)) { diff --git a/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml b/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml index 0bf08a7..5dffcc0 100644 --- a/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml +++ b/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml @@ -12,6 +12,7 @@ var shenpi_status = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.shenpi_status))'; var Area = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.Area))'; var Falv = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.Falv))'; + var shanchuzhishitype = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.shanchuzhishitype))'; loseherght = 60; dataCol = [ { label: 'id', name: 'Id', labtype: 'txt', hidden: true }, @@ -56,7 +57,7 @@ { label: '璇曢', name: 'Topic', labtype: 'txt', hidden: false }, - + { label: '鍒犻櫎鐭ヨ瘑鐐�', name: 'shanchuzhishitype', labtype: 'combox', hidden: false, data: JSON.parse(shanchuzhishitype), cwidth: '5%', cccwidth: '15%' }, diff --git a/zhengcaioa/zhengcaioa/appsettings.json b/zhengcaioa/zhengcaioa/appsettings.json index a955d8f..b3b48bc 100644 --- a/zhengcaioa/zhengcaioa/appsettings.json +++ b/zhengcaioa/zhengcaioa/appsettings.json @@ -1,8 +1,8 @@ { "ConnectionStrings": { - "DefaultConnection": "server=localhost;database=zhengcaioa;uid=sa;pwd=123456;", - "zcwebConnection": "server=localhost;database=zcweb;uid=sa;pwd=123456;", - "zcUserInfoNConnection": "server=localhost;database=zcUserInfoN_db;uid=sa;pwd=123456;" + "DefaultConnection": "server=172.26.97.147;database=zhengcaioa;uid=sa;pwd=Za20222812;", + "zcwebConnection": "server=172.26.97.147;database=zcweb;uid=sa;pwd=Za20222812;", + "zcUserInfoNConnection": "server=172.26.97.147;database=zcUserInfoN_db;uid=sa;pwd=Za20222812;" }, "Logging": { "LogLevel": { -- Gitblit v1.9.1