Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yafangsuo_dataServer
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
node_server
yafangsuo_dataServer
Commits
0c7752d3
Project 'vue-project/liangXing/frontEnd' was moved to 'vue-project/ZhangJian/ZhangJianFrontEnd'. Please update any links and bookmarks that may still have the old path.
Commit
0c7752d3
authored
Sep 08, 2023
by
chenjinjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
302fb886
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
findData.ts
src/biz/mysql/findData.ts
+2
-1
mysqlTableConfig.ts
src/config/mysqlTableConfig.ts
+7
-5
sqlModelBind.ts
src/model/sqlModelBind.ts
+4
-1
No files found.
src/biz/mysql/findData.ts
View file @
0c7752d3
...
@@ -69,7 +69,7 @@ function analysisParamToWhere(param, column) {
...
@@ -69,7 +69,7 @@ function analysisParamToWhere(param, column) {
let
selectParam
:
any
=
{
where
};
let
selectParam
:
any
=
{
where
};
if
(
column
&&
column
.
length
)
selectParam
.
attributes
=
column
;
if
(
column
&&
column
.
length
)
selectParam
.
attributes
=
column
;
if
(
order
)
selectParam
.
order
=
order
;
if
(
order
&&
order
.
length
)
selectParam
.
order
=
order
;
if
(
limit
)
selectParam
.
limit
=
limit
;
if
(
limit
)
selectParam
.
limit
=
limit
;
return
selectParam
;
return
selectParam
;
}
}
...
@@ -159,6 +159,7 @@ export async function selectDataToTableAssociation(tableModel, includeConf, para
...
@@ -159,6 +159,7 @@ export async function selectDataToTableAssociation(tableModel, includeConf, para
}
}
/**
/**
* 多表联查
* 多表联查
* @param tableModel
* @param tableModel
...
...
src/config/mysqlTableConfig.ts
View file @
0c7752d3
...
@@ -29,8 +29,8 @@ export const TablesConfig = [
...
@@ -29,8 +29,8 @@ export const TablesConfig = [
},
},
loginId
:{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
false
},
//登录账号
loginId
:{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
false
},
//登录账号
pwd
:{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
false
},
//密码
pwd
:{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
false
},
//密码
token
:{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
fals
e
},
token
:{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
tru
e
},
tokenMs
:{
type
:
Sequelize
.
DATE
,
allowNull
:
fals
e
,
defaultValue
:
Sequelize
.
NOW
}
tokenMs
:{
type
:
Sequelize
.
DATE
,
allowNull
:
tru
e
,
defaultValue
:
Sequelize
.
NOW
}
},
},
association
:
[]
association
:
[]
},
},
...
@@ -106,7 +106,7 @@ export const TablesConfig = [
...
@@ -106,7 +106,7 @@ export const TablesConfig = [
theme
:
{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
false
},
//主题
theme
:
{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
false
},
//主题
themeType
:
{
type
:
Sequelize
.
INTEGER
,
allowNull
:
false
},
//主题类型
themeType
:
{
type
:
Sequelize
.
INTEGER
,
allowNull
:
false
},
//主题类型
dataMonth
:
{
type
:
Sequelize
.
DATE
,
allowNull
:
false
},
//数据月份
dataMonth
:
{
type
:
Sequelize
.
DATE
,
allowNull
:
false
},
//数据月份
bId
:
{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
false
,
defaultValue
:
'[]'
},
//支部表id 外键 [1,2] --多选
bId
:
{
type
:
Sequelize
.
INTEGER
,
allowNull
:
false
,
defaultValue
:
'[]'
},
//支部表id 外键
fileName
:
{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
true
,
defaultValue
:
'[]'
},
//文件名称 ["",""] --多选
fileName
:
{
type
:
Sequelize
.
STRING
(
100
),
allowNull
:
true
,
defaultValue
:
'[]'
},
//文件名称 ["",""] --多选
fileType
:
{
type
:
Sequelize
.
INTEGER
,
allowNull
:
true
},
//文件类型
fileType
:
{
type
:
Sequelize
.
INTEGER
,
allowNull
:
true
},
//文件类型
uploadTime
:
{
type
:
Sequelize
.
DATE
,
allowNull
:
true
,
defaultValue
:
Sequelize
.
NOW
},
//上传时间
uploadTime
:
{
type
:
Sequelize
.
DATE
,
allowNull
:
true
,
defaultValue
:
Sequelize
.
NOW
},
//上传时间
...
@@ -235,8 +235,10 @@ export const TablesConfig = [
...
@@ -235,8 +235,10 @@ export const TablesConfig = [
learningCompleted
:
{
type
:
Sequelize
.
INTEGER
,
allowNull
:
false
,
defaultValue
:
1
}
//是否已完成 1:正在进行、2:阅读完成
learningCompleted
:
{
type
:
Sequelize
.
INTEGER
,
allowNull
:
false
,
defaultValue
:
1
}
//是否已完成 1:正在进行、2:阅读完成
},
},
association
:
[
association
:
[
{
type
:
"hasOne"
,
check
:
"partyMember"
},
{
type
:
"belongsTo"
,
check
:
"partyMember"
,
foreignKey
:
"pmId"
,
targetKey
:
"pmId"
},
{
type
:
"hasOne"
,
check
:
"memberLearning"
}
{
type
:
"belongsTo"
,
check
:
"memberLearning"
,
foreignKey
:
"mlId"
,
targetKey
:
"mlId"
},
// {type: "hasOne", check: "partyMember"},
// {type: "hasOne", check: "memberLearning"}
]
]
},
},
{
{
...
...
src/model/sqlModelBind.ts
View file @
0c7752d3
...
@@ -35,7 +35,10 @@ export async function initMysqlModel() {
...
@@ -35,7 +35,10 @@ export async function initMysqlModel() {
}
else
if
(
type
==
"hasMany"
)
{
}
else
if
(
type
==
"hasMany"
)
{
mysqlModelMap
[
check
].
hasMany
(
mysqlModelMap
[
tableName
]);
mysqlModelMap
[
check
].
hasMany
(
mysqlModelMap
[
tableName
]);
}
}
mysqlModelMap
[
tableName
].
belongsTo
(
mysqlModelMap
[
check
]);
mysqlModelMap
[
tableName
].
belongsTo
(
mysqlModelMap
[
check
],
{
foreignKey
:
item
.
foreignKey
,
targetKey
:
item
.
targetKey
});
}
}
});
});
}
}
...
...
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