Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
DataCenter_Core2.1_20190520
Commits
d26f1849
Commit
d26f1849
authored
Nov 01, 2021
by
wish_lf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加功能:流水自动检测
parent
505f4020
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
213 additions
and
12 deletions
+213
-12
dc_component_dictionary.cs
Bailun.DC.Models/Component/Entity/dc_component_dictionary.cs
+66
-0
dc_component_query.cs
Bailun.DC.Models/Component/Entity/dc_component_query.cs
+5
-0
ComponentEnum.cs
Bailun.DC.Models/Component/Enum/ComponentEnum.cs
+0
-0
DictionaryEnum.cs
Bailun.DC.Models/Component/Enum/DictionaryEnum.cs
+15
-10
QueryEnum.cs
Bailun.DC.Models/Component/Enum/QueryEnum.cs
+19
-0
DictionaryService.cs
Bailun.DC.Services/Component/DictionaryService.cs
+48
-0
DictionaryController.cs
...C.Web/Areas/Component/Controllers/DictionaryController.cs
+57
-0
form-control.js
Bailun.DC.Web/wwwroot/js/component/form-control.js
+3
-2
No files found.
Bailun.DC.Models/Component/Entity/dc_component_dictionary.cs
0 → 100644
View file @
d26f1849
using
Bailun.DC.Models.Component.Enum
;
using
System
;
namespace
Bailun.DC.Models.Component.Entity
{
/// <summary>
/// 字典组件
/// </summary>
public
class
dc_component_dictionary
{
/// <summary>
/// ID
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
/// 名称
/// </summary>
public
string
name
{
get
;
set
;
}
/// <summary>
/// 编码
/// </summary>
public
string
code
{
get
;
set
;
}
/// <summary>
/// 分类:1:数据源
/// </summary>
public
DictionaryCategoryEnum
?
category
{
get
;
set
;
}
/// <summary>
/// 类型:1:SQL
/// </summary>
public
DictionaryTypeEnum
?
type
{
get
;
set
;
}
/// <summary>
/// 方法:get;post;
/// </summary>
public
string
method
{
get
;
set
;
}
/// <summary>
/// 值
/// </summary>
public
string
value
{
get
;
set
;
}
/// <summary>
/// 数据库:1: 数据中心, 2: 交易流水
/// </summary>
public
DBEnum
?
data_db
{
get
;
set
;
}
/// <summary>
/// 是否删除: 1:是; 0:否
/// </summary>
public
bool
is_delete
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
gmt_create
{
get
;
set
;
}
/// <summary>
/// 更新时间
/// </summary>
public
DateTime
gmt_modified
{
get
;
set
;
}
}
}
Bailun.DC.Models/Component/Entity/dc_component_query.cs
View file @
d26f1849
...
...
@@ -14,6 +14,11 @@ namespace Bailun.DC.Models.Component.Entity
public
int
id
{
get
;
set
;
}
/// <summary>
/// 名称
/// </summary>
public
string
name
{
get
;
set
;
}
/// <summary>
/// 通用查询代码
/// </summary>
public
string
code
{
get
;
set
;
}
...
...
Bailun.DC.Models/Component/Enum/
DB
Enum.cs
→
Bailun.DC.Models/Component/Enum/
Component
Enum.cs
View file @
d26f1849
File moved
Bailun.DC.Models/Component/Enum/
ColumnType
Enum.cs
→
Bailun.DC.Models/Component/Enum/
Dictionary
Enum.cs
View file @
d26f1849
...
...
@@ -3,21 +3,26 @@
namespace
Bailun.DC.Models.Component.Enum
{
/// <summary>
///
列名类型:1:API,2:SQL,3:本地配置
///
字典分类:1: 数据源
/// </summary>
public
enum
ColumnType
Enum
public
enum
DictionaryCategory
Enum
{
[
Description
(
"API"
)]
Api
=
1
,
/// <summary>
///
SQL
///
数据源
/// </summary>
[
Description
(
"SQL"
)]
Sql
=
2
,
[
Description
(
"数据源"
)]
DataSource
=
1
}
/// <summary>
/// 字典类型:1: SQL
/// </summary>
public
enum
DictionaryTypeEnum
{
/// <summary>
///
本地配置
///
SQL
/// </summary>
[
Description
(
"
配置
"
)]
Config
=
3
[
Description
(
"
SQL
"
)]
SQL
=
1
}
}
Bailun.DC.Models/Component/Enum/
DataType
Enum.cs
→
Bailun.DC.Models/Component/Enum/
Query
Enum.cs
View file @
d26f1849
...
...
@@ -3,6 +3,25 @@
namespace
Bailun.DC.Models.Component.Enum
{
/// <summary>
/// 列名类型:1:API,2:SQL,3:本地配置
/// </summary>
public
enum
ColumnTypeEnum
{
[
Description
(
"API"
)]
Api
=
1
,
/// <summary>
/// SQL
/// </summary>
[
Description
(
"SQL"
)]
Sql
=
2
,
/// <summary>
/// 本地配置
/// </summary>
[
Description
(
"配置"
)]
Config
=
3
}
/// <summary>
/// 列名类型:1:Api,2:Sql,3:数据库表或视图,4:动态SQL,5:储存过程
/// </summary>
public
enum
DataTypeEnum
...
...
Bailun.DC.Services/Component/DictionaryService.cs
0 → 100644
View file @
d26f1849
using
Bailun.DC.Models.Component.Entity
;
using
Bailun.DC.Models.Component.Enum
;
using
Dapper
;
using
System.Collections.Generic
;
using
System.Linq
;
namespace
Bailun.DC.Services.Component
{
/// <summary>
/// 字典组件
/// </summary>
public
class
DictionaryService
:
BaseService
{
/// <summary>
/// 获取字典组件
/// </summary>
/// <param name="sqlparam">参数</param>
/// <returns></returns>
public
IEnumerable
<
dynamic
>
GetList
(
DynamicParameters
sqlparam
=
null
)
{
IEnumerable
<
dynamic
>
list
=
default
(
IEnumerable
<
dynamic
>);
dc_component_dictionary
entity
=
default
(
dc_component_dictionary
);
if
(
sqlparam
!=
null
&&
sqlparam
.
ParameterNames
.
Contains
(
"code"
))
{
using
(
var
db
=
DB
)
{
entity
=
db
.
QueryFirstOrDefault
<
dc_component_dictionary
>(
"select * from dc_component_dictionary where is_delete = 0 and code = @code"
,
sqlparam
);
}
if
(
entity
!=
null
)
{
switch
(
entity
.
type
)
{
case
DictionaryTypeEnum
.
SQL
:
//查询
using
(
var
db
=
(
entity
.
data_db
==
DBEnum
.
DataWareHouse
?
DW_DB
:
DB
))
{
list
=
db
.
Query
(
entity
.
value
,
sqlparam
);
}
break
;
}
}
}
return
list
;
}
}
}
Bailun.DC.Web/Areas/Component/Controllers/DictionaryController.cs
0 → 100644
View file @
d26f1849
using
Bailun.DC.Models.Component.DTO
;
using
Bailun.DC.Services.Component
;
using
Dapper
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Text
;
using
System.Linq
;
namespace
Bailun.DC.Web.Areas.Component.Controllers
{
[
Area
(
"Component"
)]
public
class
DictionaryController
:
Base
.
BaseController
{
public
JsonResult
GetList
()
{
ResultDTO
result
=
new
ResultDTO
();
try
{
DynamicParameters
sqlparam
=
new
DynamicParameters
();
switch
(
Request
.
Method
)
{
case
"GET"
:
Request
.
Query
.
Keys
.
ForEach
(
l
=>
sqlparam
.
Add
(
l
,
Request
.
Query
[
l
]));
break
;
case
"POST"
:
if
(
Request
.
ContentType
.
Contains
(
"multipart/form-data"
))
{
Request
.
Form
.
Keys
.
ForEach
(
l
=>
sqlparam
.
Add
(
l
,
Request
.
Form
[
l
]));
}
else
if
(
Request
.
ContentType
.
Contains
(
"application/json"
))
{
using
(
Stream
stream
=
Request
.
Body
)
{
byte
[]
buffer
=
new
byte
[
Request
.
ContentLength
.
Value
];
stream
.
Read
(
buffer
,
0
,
buffer
.
Length
);
string
content
=
Encoding
.
UTF8
.
GetString
(
buffer
);
IDictionary
<
string
,
object
>
dic
=
JsonConvert
.
DeserializeObject
<
IDictionary
<
string
,
object
>>(
content
);
dic
.
ForEach
(
l
=>
sqlparam
.
Add
(
l
.
Key
,
dic
[
l
.
Key
]));
}
}
break
;
}
result
.
Data
=
new
DictionaryService
().
GetList
(
sqlparam
);
result
.
Result
=
true
;
}
catch
(
Exception
ex
)
{
result
.
Message
=
ex
.
Message
;
}
return
Json
(
result
);
}
}
}
Bailun.DC.Web/wwwroot/js/component/form-control.js
View file @
d26f1849
...
...
@@ -98,8 +98,9 @@
emulateJSON
:
method
==
"post"
}).
then
(
function
(
response
)
{
var
result
=
response
.
data
;
if
(
response
.
status
==
200
&&
result
&&
result
.
length
)
{
var
listOptionValue
=
response
.
data
.
list
||
(
Array
.
isArray
(
response
.
data
)
&&
response
.
data
)
if
(
response
.
status
==
200
&&
result
&&
(
result
.
length
||
(
result
.
data
&&
result
.
data
.
length
)))
{
debugger
var
listOptionValue
=
Array
.
isArray
(
result
)
?
result
:
(
Array
.
isArray
(
result
.
data
)
?
result
.
data
:
result
.
data
.
list
);
if
(
listOptionValue
&&
listOptionValue
.
length
&&
(
listOptionValue
[
0
].
constructor
===
String
||
listOptionValue
[
0
].
constructor
===
Number
))
{
listOptionValue
=
listOptionValue
.
map
(
function
(
item
,
index
)
{
return
{
value
:
item
,
display
:
item
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment