duhongyu 5 lat temu
rodzic
commit
30ad3abdfd

+ 13 - 0
代码/System.IRepositories/IQC_IndexBaseReposytory.cs

@@ -0,0 +1,13 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.Model;
5
+using System.Text;
6
+
7
+namespace System.IRepositories
8
+{
9
+   
10
+    public interface IQC_IndexBaseReposytory : IRepository<T_QC_IndexBase>
11
+    {
12
+    }
13
+}

+ 13 - 0
代码/System.IRepositories/IQC_IndexCategoryReposytory.cs

@@ -0,0 +1,13 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.Model;
5
+using System.Text;
6
+
7
+namespace System.IRepositories
8
+{
9
+  
10
+    public interface IQC_IndexCategoryReposytory : IRepository<T_QC_IndexCategory>
11
+    {
12
+    }
13
+}

+ 143 - 0
代码/System.Model/T_QC_IndexBase.cs

@@ -0,0 +1,143 @@
1
+using System;
2
+namespace System.Model
3
+{
4
+    /// <summary>
5
+    /// T_QC_IndexBase:实体类(属性说明自动提取数据库字段的描述信息)
6
+    /// </summary>
7
+    [Serializable]
8
+    public partial class T_QC_IndexBase
9
+    {
10
+        public T_QC_IndexBase()
11
+        { }
12
+        #region Model
13
+        private int _f_indexid;
14
+        private int? _f_categoryid;
15
+        private int? _f_type;
16
+        private int? _f_score = 0;
17
+        private string _f_title;
18
+        private string _f_content;
19
+        private string _f_remark;
20
+        private DateTime? _f_createon;
21
+        private string _f_createby;
22
+        private DateTime? _f_modifyon;
23
+        private string _f_modifyby;
24
+        private int? _f_deleteflag;
25
+        private int? _f_sortmodel = 0;
26
+        private int? _f_sort;
27
+      
28
+      
29
+        /// <summary>
30
+        /// 
31
+        /// </summary>
32
+        public int F_IndexId
33
+        {
34
+            set { _f_indexid = value; }
35
+            get { return _f_indexid; }
36
+        }
37
+        /// <summary>
38
+        /// 指标分类Id
39
+        /// </summary>
40
+        public int? F_CategoryId
41
+        {
42
+            set { _f_categoryid = value; }
43
+            get { return _f_categoryid; }
44
+        }
45
+        /// <summary>
46
+        /// 题型
47
+        /// </summary>
48
+        public int? F_Type
49
+        {
50
+            set { _f_type = value; }
51
+            get { return _f_type; }
52
+        }
53
+        /// <summary>
54
+        /// 分值
55
+        /// </summary>
56
+        public int? F_Score
57
+        {
58
+            set { _f_score = value; }
59
+            get { return _f_score; }
60
+        }
61
+        /// <summary>
62
+        /// 指标标题
63
+        /// </summary>
64
+        public string F_Title
65
+        {
66
+            set { _f_title = value; }
67
+            get { return _f_title; }
68
+        }
69
+        /// <summary>
70
+        /// 指标内容
71
+        /// </summary>
72
+        public string F_Content
73
+        {
74
+            set { _f_content = value; }
75
+            get { return _f_content; }
76
+        }
77
+        /// <summary>
78
+        /// 备注
79
+        /// </summary>
80
+        public string F_Remark
81
+        {
82
+            set { _f_remark = value; }
83
+            get { return _f_remark; }
84
+        }
85
+        /// <summary>
86
+        /// 添加时间
87
+        /// </summary>
88
+        public DateTime? F_CreateOn
89
+        {
90
+            set { _f_createon = value; }
91
+            get { return _f_createon; }
92
+        }
93
+        /// <summary>
94
+        /// 创建人
95
+        /// </summary>
96
+        public string  F_CreateBy
97
+        {
98
+            set { _f_createby = value; }
99
+            get { return _f_createby; }
100
+        }
101
+        /// <summary>
102
+        /// 修改时间
103
+        /// </summary>
104
+        public DateTime? F_ModifyOn
105
+        {
106
+            set { _f_modifyon = value; }
107
+            get { return _f_modifyon; }
108
+        }
109
+        /// <summary>
110
+        /// 修改人Id
111
+        /// </summary>
112
+        public string  F_ModifyBy
113
+        {
114
+            set { _f_modifyby = value; }
115
+            get { return _f_modifyby; }
116
+        }
117
+        /// <summary>
118
+        /// 删除标志
119
+        /// </summary>
120
+        public int? F_DeleteFlag
121
+        {
122
+            set { _f_deleteflag = value; }
123
+            get { return _f_deleteflag; }
124
+        }
125
+        /// <summary>
126
+        /// 排序模式
127
+        /// </summary>
128
+        public int? F_SortModel
129
+        {
130
+            set { _f_sortmodel = value; }
131
+            get { return _f_sortmodel; }
132
+        }
133
+        /// <summary>
134
+        /// 
135
+        /// </summary>
136
+        public int? F_Sort
137
+        {
138
+            set { _f_sort = value; }
139
+            get { return _f_sort; }
140
+        }
141
+        #endregion Model
142
+    }
143
+}

+ 150 - 0
代码/System.Model/T_QC_IndexCategory.cs

@@ -0,0 +1,150 @@
1
+using System;
2
+namespace System.Model
3
+{
4
+    /// <summary>
5
+    /// T_QC_IndexCategory:实体类(属性说明自动提取数据库字段的描述信息)
6
+    /// </summary>
7
+    [Serializable]
8
+    public partial class T_QC_IndexCategory
9
+    {
10
+        public T_QC_IndexCategory()
11
+        { }
12
+        #region Model
13
+        private int _f_categoryid;
14
+        private string _f_categorynumber;
15
+        private string _f_categoryname;
16
+        private string _f_categoryename;
17
+        private int? _f_layer;
18
+        private int? _f_parentid;
19
+        private int? _f_categorytype;
20
+        private int? _f_candelete;
21
+        private int? _f_iscommon = 0;
22
+        private int? _f_sort = 0;
23
+        private string _f_expand1;
24
+        private string _f_expand2;
25
+        private DateTime? _f_createon;
26
+        private string _f_createby;
27
+        private int? _f_deleteflag = 0;
28
+        /// <summary>
29
+        /// 
30
+        /// </summary>
31
+        public int F_CategoryId
32
+        {
33
+            set { _f_categoryid = value; }
34
+            get { return _f_categoryid; }
35
+        }
36
+        /// <summary>
37
+        /// 
38
+        /// </summary>
39
+        public string F_CategoryNumber
40
+        {
41
+            set { _f_categorynumber = value; }
42
+            get { return _f_categorynumber; }
43
+        }
44
+        /// <summary>
45
+        /// 
46
+        /// </summary>
47
+        public string F_CategoryName
48
+        {
49
+            set { _f_categoryname = value; }
50
+            get { return _f_categoryname; }
51
+        }
52
+        /// <summary>
53
+        /// 
54
+        /// </summary>
55
+        public string F_CategoryEName
56
+        {
57
+            set { _f_categoryename = value; }
58
+            get { return _f_categoryename; }
59
+        }
60
+        /// <summary>
61
+        /// 
62
+        /// </summary>
63
+        public int? F_Layer
64
+        {
65
+            set { _f_layer = value; }
66
+            get { return _f_layer; }
67
+        }
68
+        /// <summary>
69
+        /// 
70
+        /// </summary>
71
+        public int? F_ParentId
72
+        {
73
+            set { _f_parentid = value; }
74
+            get { return _f_parentid; }
75
+        }
76
+        /// <summary>
77
+        /// 
78
+        /// </summary>
79
+        public int? F_CategoryType
80
+        {
81
+            set { _f_categorytype = value; }
82
+            get { return _f_categorytype; }
83
+        }
84
+        /// <summary>
85
+        /// 
86
+        /// </summary>
87
+        public int? F_CanDelete
88
+        {
89
+            set { _f_candelete = value; }
90
+            get { return _f_candelete; }
91
+        }
92
+        /// <summary>
93
+        /// 
94
+        /// </summary>
95
+        public int? F_IsCommon
96
+        {
97
+            set { _f_iscommon = value; }
98
+            get { return _f_iscommon; }
99
+        }
100
+        /// <summary>
101
+        /// 
102
+        /// </summary>
103
+        public int? F_Sort
104
+        {
105
+            set { _f_sort = value; }
106
+            get { return _f_sort; }
107
+        }
108
+        /// <summary>
109
+        /// 
110
+        /// </summary>
111
+        public string F_Expand1
112
+        {
113
+            set { _f_expand1 = value; }
114
+            get { return _f_expand1; }
115
+        }
116
+        /// <summary>
117
+        /// 
118
+        /// </summary>
119
+        public string F_Expand2
120
+        {
121
+            set { _f_expand2 = value; }
122
+            get { return _f_expand2; }
123
+        }
124
+        /// <summary>
125
+        /// 
126
+        /// </summary>
127
+        public DateTime? F_CreateOn
128
+        {
129
+            set { _f_createon = value; }
130
+            get { return _f_createon; }
131
+        }
132
+        /// <summary>
133
+        /// 
134
+        /// </summary>
135
+        public string F_CreateBy
136
+        {
137
+            set { _f_createby = value; }
138
+            get { return _f_createby; }
139
+        }
140
+        /// <summary>
141
+        /// 
142
+        /// </summary>
143
+        public int? F_DeleteFlag
144
+        {
145
+            set { _f_deleteflag = value; }
146
+            get { return _f_deleteflag; }
147
+        }
148
+        #endregion Model
149
+    }
150
+}

+ 14 - 0
代码/System.Repositories/QC_IndexBaseReposytory.cs

@@ -0,0 +1,14 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Text;
4
+using System.IRepositories;
5
+using System.Model;
6
+using System.Common;
7
+
8
+namespace System.Repositories
9
+{
10
+   
11
+    public class QC_IndexBaseReposytory : BaseRepository<T_QC_IndexBase>, IQC_IndexBaseReposytory
12
+    {
13
+    }
14
+}

+ 14 - 0
代码/System.Repositories/QC_IndexCategoryReposytory.cs

@@ -0,0 +1,14 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Text;
4
+using System.IRepositories;
5
+using System.Model;
6
+using System.Common;
7
+
8
+namespace System.Repositories
9
+{
10
+   
11
+    public class QC_IndexCategoryReposytory : BaseRepository<T_QC_IndexCategory>, IQC_IndexCategoryReposytory
12
+    {
13
+    }
14
+}

+ 53 - 0
代码/TVShoppingCallCenter_ZLJ/Controllers/IndexCategory/IndexBaseController.cs

@@ -0,0 +1,53 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.IRepositories;
5
+using System.Linq;
6
+using System.Model;
7
+using System.Security.Claims;
8
+using System.Threading.Tasks;
9
+using Microsoft.AspNetCore.Mvc;
10
+using SqlSugar;
11
+
12
+namespace TVShoppingCallCenter_ZLJ.Controllers.IndexCategory
13
+{
14
+    [Produces("application/json")]
15
+    [Route("api/[controller]")]
16
+    public class IndexBaseController : BaseController
17
+    {
18
+        private readonly IQC_IndexCategoryReposytory _qc_indexcategoryreposytory;
19
+        private readonly IQC_IndexBaseReposytory _qc_indexbasereposytory;
20
+        public IndexBaseController(IQC_IndexCategoryReposytory qc_indexcategoryreposytory, IQC_IndexBaseReposytory qc_indexbasereposytory)
21
+        {
22
+            _qc_indexcategoryreposytory = qc_indexcategoryreposytory;
23
+            _qc_indexbasereposytory = qc_indexbasereposytory;
24
+        }
25
+        /// <summary>
26
+        /// 添加指标
27
+        /// </summary>
28
+        /// <param name="input"></param>
29
+        /// <returns></returns>
30
+        [HttpPost("add")]
31
+        public async Task<IActionResult> AddAsync(T_QC_IndexBase input)
32
+        {
33
+                if (input.F_Sort > 100000)
34
+                {
35
+                    return Error("排序过大,请重新输入");
36
+                }
37
+            string user = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
38
+            input.F_CreateOn = DateTime.Now;
39
+            input.F_CreateBy = user;
40
+            input.F_DeleteFlag = 0;
41
+            var res = await _qc_indexbasereposytory.Add(input);
42
+            if (res > 0)
43
+            {
44
+                return Success("添加成功");
45
+            }
46
+            else
47
+            {
48
+                return Error("添加失败");
49
+            }
50
+        }
51
+     
52
+    }
53
+}

+ 139 - 0
代码/TVShoppingCallCenter_ZLJ/Controllers/IndexCategory/IndexCategoryController.cs

@@ -0,0 +1,139 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.IRepositories;
5
+using System.Linq;
6
+using System.Model;
7
+using System.Security.Claims;
8
+using System.Threading.Tasks;
9
+using Microsoft.AspNetCore.Mvc;
10
+using SqlSugar;
11
+
12
+namespace TVShoppingCallCenter_ZLJ.Controllers.IndexCategory
13
+{
14
+
15
+    [Produces("application/json")]
16
+    [Route("api/[controller]")]
17
+    public class IndexCategoryController : BaseController
18
+    {
19
+        private readonly IQC_IndexCategoryReposytory _qc_indexcategoryreposytory;
20
+        public IndexCategoryController(IQC_IndexCategoryReposytory qc_indexcategoryreposytory )
21
+        {
22
+            _qc_indexcategoryreposytory = qc_indexcategoryreposytory;
23
+        }
24
+        /// <summary>
25
+        /// 添加指标
26
+        /// </summary>
27
+        /// <param name="input"></param>
28
+        /// <returns></returns>
29
+        [HttpPost("add")]
30
+        public async Task<IActionResult> AddAsync(T_QC_IndexCategory  input)
31
+        {
32
+            if (string .IsNullOrEmpty (input.F_CategoryName))
33
+                return Error("请输入分类名称");
34
+            string user = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
35
+            input.F_CreateOn = DateTime.Now;
36
+            input.F_CreateBy = user;
37
+            input.F_DeleteFlag = 0;
38
+            var res = await _qc_indexcategoryreposytory.Add(input);
39
+            if (res > 0)
40
+            {
41
+                return Success("添加成功");
42
+            }
43
+            else
44
+            {
45
+                return Error("添加失败");
46
+            }
47
+        }
48
+        /// <summary>
49
+        /// 修改指标
50
+        /// </summary>
51
+        [HttpPost("update")]
52
+        public async Task<IActionResult> UpdateAsync(T_QC_IndexCategory input)
53
+        {
54
+            if (string.IsNullOrEmpty(input.F_CategoryName))
55
+                return Error("请输入分类名称");
56
+            string user = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
57
+            var model = await _qc_indexcategoryreposytory.GetSingle(x => x.F_CategoryId == input.F_CategoryId);
58
+            if (model == null)
59
+                return Error("操作失败");
60
+            input.F_DeleteFlag = 0;
61
+            input.F_CreateBy = model.F_CreateBy;
62
+            input.F_CreateOn = model.F_CreateOn;
63
+            var b = await _qc_indexcategoryreposytory.Update(input);
64
+            if (b)
65
+            {
66
+                return Success("修改成功");
67
+            }
68
+            return Error("修改失败");
69
+        }
70
+        /// <summary>
71
+        /// 删除指标
72
+        /// </summary>
73
+        /// <param name="ids"></param>
74
+        /// <returns></returns>
75
+        [HttpPost("delete")]
76
+        public async Task<IActionResult> Remove(int id =0)
77
+        {
78
+           
79
+            var model =  _qc_indexcategoryreposytory.GetSingle(x => x.F_CategoryId == id).Result ;
80
+            if (model == null)
81
+                return Error("该指标不存在");
82
+            model.F_DeleteFlag = (int)EnumUserCountState.Delete;
83
+            bool n = _qc_indexcategoryreposytory.Update(model).Result;
84
+            if (n )
85
+                return Success("删除成功");
86
+            else
87
+                return Error ("删除失败");
88
+        }
89
+        /// <summary>
90
+        /// 获取指标列表
91
+        /// </summary>
92
+        /// <param name="keyword"></param>
93
+        /// <param name="pageindex"></param>
94
+        /// <param name="pagesize"></param>
95
+        /// <returns></returns>
96
+        [HttpGet("getlist")]
97
+        public async Task<IActionResult> GetListMark(string name, int ParentId = -1, int smstype = -1, int isread = -1, int pageindex = 0, int pagesize = 0)
98
+        {
99
+            // string user = "8000";
100
+          
101
+            List<IConditionalModel> conModels = new List<IConditionalModel>();
102
+            #region 条件筛选
103
+            conModels.Add(new ConditionalModel() { FieldName = "F_DeleteFlag", ConditionalType = ConditionalType.Equal, FieldValue ="0"});
104
+            conModels.Add(new ConditionalModel() { FieldName = "F_CategoryName", ConditionalType = ConditionalType.Like , FieldValue = name });
105
+            if (ParentId>0)
106
+            {
107
+                conModels.Add(new ConditionalModel() { FieldName = "F_ParentId", ConditionalType = ConditionalType.Like, FieldValue = ParentId.ToString () });
108
+            }
109
+            
110
+
111
+            #endregion
112
+            int recordCount = 0;
113
+            if (pageindex > 0 && pagesize > 0)
114
+            {
115
+                var list = await _qc_indexcategoryreposytory.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount }, "  F_CreateOn  desc");
116
+                var obj = new
117
+                {
118
+                    state = "success",
119
+                    message = "成功",
120
+                    rows = list,
121
+                    total = list.Totals,
122
+                };
123
+                return Content(obj.ToJson());
124
+            }
125
+            else
126
+            {
127
+                var list = await _qc_indexcategoryreposytory.GetListALL(conModels, " F_CreateOn  desc");
128
+                var obj = new
129
+                {
130
+                    state = "success",
131
+                    message = "成功",
132
+                    rows = list,
133
+                    total = list.Count(),
134
+                };
135
+                return Content(obj.ToJson());
136
+            }
137
+        }
138
+    }
139
+}

+ 3 - 0
代码/TVShoppingCallCenter_ZLJ/Startup.cs

@@ -155,6 +155,9 @@ namespace TVShoppingCallCenter_ZLJ
155 155
             services.AddTransient<ISys_TodoManagementRepository, Sys_TodoManagementRepository>();
156 156
 
157 157
             services.AddTransient<ISMS_InternalMessagesReposytory, SMS_InternalMessagesReposytory>();
158
+
159
+            services.AddTransient<IQC_IndexBaseReposytory, QC_IndexBaseReposytory>();
160
+            services.AddTransient<IQC_IndexCategoryReposytory, QC_IndexCategoryReposytory>();
158 161
             #endregion
159 162
 
160 163