Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zjxcxServer
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
zjxcxServer
Commits
2e158dd9
Commit
2e158dd9
authored
Feb 10, 2023
by
孙香冬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://123.207.147.179:8888/node_server/zjxcxServer
parents
426ea42a
790ef45b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
234 additions
and
204 deletions
+234
-204
mysqlClass.ts
src/db/mysql/mysqlClass.ts
+76
-9
enterprise.ts
src/mysqlData/enterprise/enterprise.ts
+34
-154
financing.ts
src/mysqlData/enterprise/financing.ts
+35
-41
fuhuaqi.ts
src/mysqlData/fuHuaQi/fuhuaqi.ts
+53
-0
monthTable.ts
src/mysqlData/fuHuaQi/monthTable.ts
+36
-0
No files found.
src/db/mysql/mysqlClass.ts
View file @
2e158dd9
import
{
mysqlDB
}
from
"./mysqlInit"
;
/**
* mysql数据表实体类
*/
export
class
mySqlTableClass
{
file
;
/**表方法 */
file
;
//字段对象
tableName
;
//表名
sql
;
moreTableSql
;
constructor
(
tableName
:
string
,
sqlEnum
,
moreSqlEnum
)
{
sql
;
//sql
moreTableSql
;
//多表sql
constructor
(
tableName
:
string
,
file
?,
sqlEnum
?,
moreSqlEnum
?)
{
this
.
tableName
=
tableName
;
this
.
sql
=
sqlEnum
;
this
.
moreTableSql
=
moreSqlEnum
;
this
.
file
=
file
||
{};
this
.
sql
=
sqlEnum
||
{};
this
.
moreTableSql
=
moreSqlEnum
||
{};
}
/**
...
...
@@ -18,7 +22,7 @@ export class mySqlTableClass {
* @param param 条件参数
* @param res 指定返回
*/
find
(
param
,
res
?)
{
async
find
(
param
,
res
?)
{
let
sqlStr
=
'select '
;
if
(
!
res
)
sqlStr
+=
'* '
;
else
{
...
...
@@ -45,9 +49,71 @@ export class mySqlTableClass {
}
}
return
await
mysqlDB
.
selectData
(
sqlStr
,
valueList
);
}
/**
* 查询单个
* @param param
* @param res
* @returns
*/
async
findOne
(
param
,
res
?)
{
let
sqlStr
=
'select '
;
if
(
!
res
)
sqlStr
+=
'* '
;
else
{
res
.
forEach
((
itemStr
,
index
)
=>
{
sqlStr
+=
itemStr
;
if
(
index
==
res
.
length
-
1
)
sqlStr
+=
' '
;
else
sqlStr
+=
', '
;
});
}
sqlStr
+=
`from
${
this
.
tableName
}
`
;
const
KeyLength
=
Object
.
keys
(
param
).
length
;
let
valueList
=
[];
if
(
KeyLength
>
0
)
{
sqlStr
+=
'where '
;
let
index
=
0
;
for
(
let
key
in
param
)
{
sqlStr
+=
`
${
key
}
= ?`
;
valueList
.
push
(
param
[
key
]);
if
(
index
<
KeyLength
-
1
)
sqlStr
+=
', '
;
else
sqlStr
+=
' '
;
index
+=
1
;
}
}
return
await
mysqlDB
.
findOne
(
sqlStr
,
valueList
);
}
/**
* 修改
* @param table
* @param param
* @param contition
* @returns
*/
async
update
(
param
:
object
,
contition
:
object
)
{
return
await
mysqlDB
.
updateData
(
this
.
tableName
,
param
,
contition
);
}
/**
* 删除
* @param paramater
* @returns
*/
async
delete
(
paramater
:
object
)
{
return
await
mysqlDB
.
deleteData
(
this
.
tableName
,
paramater
);
}
/**
* 创建
* @param param
* @returns
*/
async
install
(
param
:
object
)
{
return
await
mysqlDB
.
createData
(
this
.
tableName
,
param
);
}
}
\ No newline at end of file
src/mysqlData/enterprise/enterprise.ts
View file @
2e158dd9
import
{
mysqlDB
}
from
"../../db/mysql/mysqlInit"
;
//指派表
class
enterpriseClass
{
name
:
string
//企业名称
taskId
:
string
//绑定的任务id
uscc
:
string
//统一信用代码
fuHuaQiUscc
:
string
//孵化器统一信用代码
industry
:
string
//领域 逗号隔开
logonTime
:
number
//注册时间
firstIncubationTime
:
number
//首次入孵时间
timeOfImmigration
:
number
//迁入时间
isNaturalPersonHolding
:
boolean
//是否自然人控股企业
oldLogonAdd
:
string
//迁入前注册地址
logonAdd
:
string
//注册地址
operatingAdd
:
string
//经营地址
/**
* 企业信息表
* draftLock 草稿锁 当任务提交的时候,将此字段改为true
*/
import
{
mySqlTableClass
}
from
"../../db/mysql/mysqlClass"
;
/**表结构 */
const
TableConfig
=
{
name
:
"string"
,
//企业名称
taskId
:
"string"
,
//绑定的任务id
uscc
:
"string"
,
//统一信用代码
fuHuaQiUscc
:
"string"
,
//孵化器统一信用代码
industry
:
"string"
,
//领域 逗号隔开
logonTime
:
"date"
,
//注册时间
firstIncubationTime
:
"date"
,
//首次入孵时间
timeOfImmigration
:
"date"
,
//迁入时间
isNaturalPersonHolding
:
"boolean"
,
//是否自然人控股企业
oldLogonAdd
:
"string"
,
//迁入前注册地址
logonAdd
:
"string"
,
//注册地址
operatingAdd
:
"string"
,
//经营地址
leasedArea
:
"number"
,
//租赁面积(平方米)
draftLock
:
"boolean"
,
//草稿锁,true为提交之后,false为草稿 默认=false
createTime
:
"date"
//录入时间
// isPhysicalPresence:boolean//是否实地孵化 暂时弃用
leasedArea
:
number
//租赁面积(平方米)
draftLock
:
boolean
//草稿锁,true为提交之后,false为草稿 默认=false
createTime
:
number
//录入时间
/**表方法 */
tableName
;
sql
;
moreTableSql
;
constructor
(
tableName
:
string
)
{
this
.
tableName
=
tableName
;
/**单表查询语句 */
enum
sqlEnum
{
获取任务
id
相关的企业列表
=
``
,
}
/**多表联查语句 */
enum
moreSqlEnum
{
}
this
.
sql
=
sqlEnum
;
this
.
moreTableSql
=
moreSqlEnum
;
}
}
let
appointModel
=
new
enterpriseClass
(
"enterprise"
);
// /**
// * 通过taskId 获取此次任务添加的企业列表
// * @param taskId 任务id 格式遵循tool中getTaskId
// * @returns [{}]
// */
// export async function findEnterpriseListByTaskId(taskId:string) {
// mysqlDB.selectData();
// return await enterpriseModel.find({taskId});
// }
// /**
// * 将taskId的所有数据的draftLock字段为true
// * @param taskId 任务id 格式遵循tool中getTaskId
// */
// export async function updateEnterpriseDraftLock(taskId:string) {
// return await enterpriseModel.update({taskId}, {$set:{draftLock:true}}, {upsert:true});
// }
// /**
// * 通过企业统一信用代码获取企业信息
// * 支持.save方法保存对象修改
// * @param uscc 企业统一信用代码
// * @returns {}
// */
// export async function findEnterpriseByUscc(uscc:string) {
// return await enterpriseModel.selectOnceData({uscc});
// }
// /**
// * 创建新的企业数据
// * @param fuHuaQiUscc 企业所属孵化器的统一信用代码
// * @param taskId 任务id 格式遵循tool中getTaskId
// * @param param 添加的字段对象
// */
// export async function createEnterprise(fuHuaQiUscc:string, taskId:string, param) {
// let addInfo = Object.assign({fuHuaQiUscc, taskId, createTime:new Date().valueOf()}, param);
// await enterpriseModel.create(addInfo);
// }
// /**
// * 查找孵化器所拥有的企业数量
// * @param fuHuaQiUscc 孵化器统一信用代码
// * @returns
// */
// export async function findEnterpriseCountByFuHuaQiUscc(fuHuaQiUscc:string) {
// return await enterpriseModel.count({fuHuaQiUscc}).exec();
// }
// /**
// * 聚合查询 孵化器所拥有的企业数量
// * @returns {} key=孵化器统一信用 value=企业数量
// */
// export async function groupFindEnterprise() {
// let match = {draftLock:true};//前置条件
// let dataList = await enterpriseModel.aggregate([{$match:match},{$group:{_id:"$fuHuaQiUscc",count:{$sum:1}}}]).exec();
// let result = {};
// dataList.forEach(info => {
// let {_id, count} = info;
// result[_id] = count;
// });
// return result;
// }
// /**
// * 删除创建企业的草稿报表
// * @param uscc 企业统一信用代码
// */
// export async function deleteEnterprise(uscc:string) {
// return await enterpriseModel.deleteOne({uscc:uscc}).exec();
// }
// /**
// * 获取所有孵化器
// * @param selectParam 查询参数
// * @param skipCount 跳过数量
// * @returns [] 孵化器列表
// */
// export async function findEnterpriseList(selectParam, skipCount) {
// return await enterpriseModel.find(selectParam).skip(skipCount).limit(10);
// }
// /**
// * 获取所有孵化器
// * @param selectParam 查询参数
// * @returns number 数据数量
// */
// export async function findEnterpriseCount(selectParam) {
// return await enterpriseModel.find(selectParam).count();
// }
/**sql */
enum
SQLENUM
{
}
/**多表sql */
enum
MORETABLESQLENUM
{
// /**
// * 通过企业名称获取企业信息
// * @param selectParam 查询参数
// * @returns number 数据数量
// */
// export async function findEnterpriseInfoByName(name:string) {
// return await enterpriseModel.findOne({name});
// }
}
let
enterpriseModel
;
// /**
// * todo 注释后加
// * @param selectParam 查询参数
// * @returns number 数据数量
// */
// export async function findEnterpriseListByFuHuaQiUsccName(fuHuaQiUscc:string) {
// return await enterpriseModel.find({fuHuaQiUscc});
// }
export
function
initModel
()
{
enterpriseModel
=
new
mySqlTableClass
(
"enterprise"
,
TableConfig
,
SQLENUM
,
MORETABLESQLENUM
);
}
src/mysqlData/enterprise/financing.ts
View file @
2e158dd9
import
{
mysqlDB
}
from
"../../db/mysql/mysqlInit"
;
//指派表
class
enterpriseClass
{
name
:
string
//企业名称
taskId
:
string
//绑定的任务id
uscc
:
string
//统一信用代码
fuHuaQiUscc
:
string
//孵化器统一信用代码
industry
:
string
//领域 逗号隔开
logonTime
:
number
//注册时间
firstIncubationTime
:
number
//首次入孵时间
timeOfImmigration
:
number
//迁入时间
isNaturalPersonHolding
:
boolean
//是否自然人控股企业
oldLogonAdd
:
string
//迁入前注册地址
logonAdd
:
string
//注册地址
operatingAdd
:
string
//经营地址
// isPhysicalPresence:boolean//是否实地孵化 暂时弃用
leasedArea
:
number
//租赁面积(平方米)
draftLock
:
boolean
//草稿锁,true为提交之后,false为草稿 默认=false
createTime
:
number
//录入时间
/**表方法 */
tableName
;
sql
;
moreTableSql
;
constructor
(
tableName
:
string
)
{
this
.
tableName
=
tableName
;
/**单表查询语句 */
enum
sqlEnum
{
获取任务
id
相关的企业列表
=
``
,
}
/**多表联查语句 */
enum
moreSqlEnum
{
}
/**
* 企业投资信息表
* draftLock 草稿锁 当任务提交的时候,将此字段改为true
* 一个企业在一个月只能录入一个融资数据 2023-02-07 确定此需求
*/
import
{
mySqlTableClass
}
from
"../../db/mysql/mysqlClass"
;
/**表结构 */
const
TableConfig
=
{
uscc
:
"string"
,
//融资企业统一信用代码 冗余字段
fuHuaQiUscc
:
"string"
,
//孵化器统一信用代码 冗余字段
name
:
"string"
,
//企业名称
taskId
:
"string"
,
//任务id
logonAdd
:
"string"
,
//注册地址
operatingAdd
:
"string"
,
//经营地址
financingAmount
:
"number"
,
//融资金额(万元)
investmentInstitutionsName
:
"string"
,
//投资机构名称
timeToObtainInvestment
:
"date"
,
//获得投资时间
fuHuaQiInvestment
:
"boolean"
,
//孵化器是否投资
fuHuaQiInvestmentAmount
:
"number"
,
//孵化器投资金额(万元)
fuHuaQiInvestmentStyle
:
"number"
,
//孵化器投资方式
draftLock
:
"boolean"
,
//草稿锁,true为提交之后,false为草稿
createTime
:
"date"
,
//录入时间
industry
:
"string"
,
//领域
}
/**sql */
enum
SQLENUM
{
}
/**多表sql */
enum
MORETABLESQLENUM
{
this
.
sql
=
sqlEnum
;
this
.
moreTableSql
=
moreSqlEnum
;
}
}
let
financingModel
;
export
function
initModel
()
{
financingModel
=
new
mySqlTableClass
(
"financing"
,
TableConfig
,
SQLENUM
,
MORETABLESQLENUM
);
}
let
appointModel
=
new
enterpriseClass
(
"enterprise"
);
\ No newline at end of file
src/mysqlData/fuHuaQi/fuhuaqi.ts
View file @
2e158dd9
/**
* 孵化器信息表
* operationName不可修改 2023-02-06 确定此需求
* uscc不可修改 2023-02-06 确定此需求
* 首次登录要求改密码 不改密码不能继续操作 2023-02-07 确定此需求
* 管理后台列表页面一页展示10条 2023-02-08 确定此需求
* 孵化器账号不能被删除 只能被禁用 2023-02-08 确定此需求
*/
import
{
mySqlTableClass
}
from
"../../db/mysql/mysqlClass"
;
/**表结构 */
const
TableConfig
=
{
name
:
'string'
,
//名称
operationName
:
'string'
,
//运营机构名称 不可修改
uscc
:
'string'
,
//统一信用代码 也是登录账号 不可修改
virtualEnterpriseNum
:
'number'
,
//虚拟企业数量
logonTime
:
'number'
,
//注册时间
incubatedAcreage
:
'number'
,
//在孵面积(㎡)
acreageTotal
:
'number'
,
//孵化器总面积(㎡)
acreagePersonalUse
:
'number'
,
//孵化器自用面积(㎡)
lv
:
'number'
,
//孵化器级别
identificationTime
:
'number'
,
//认定时间
industry
:
'string'
,
//孵化领域
institutionalNature
:
'number'
,
//机构性质
liaison
:
'string'
,
//联系人
liaisonPhone
:
'string'
,
//联系电话
personInCharge
:
'string'
,
//负责人
personInChargePhone
:
'string'
,
//负责人联系电话
// hatchingGround:{type:[hatchingGroundSchema], default:[] },//经备案孵化场地
/**登录相关 */
pwd
:
'string'
,
//登录密码
token
:
'string'
,
tokenMs
:
'number'
,
firstLoginIsChangePwd
:
'boolean'
,
//首次登录是否修改密码
createTime
:
'number'
,
userState
:
'boolean'
//是否禁用
}
/**sql */
enum
SQLENUM
{
}
/**多表sql */
enum
MORETABLESQLENUM
{
}
let
financingModel
;
export
function
initModel
()
{
financingModel
=
new
mySqlTableClass
(
"fuhuaqi"
,
TableConfig
,
SQLENUM
,
MORETABLESQLENUM
);
}
src/mysqlData/fuHuaQi/monthTable.ts
View file @
2e158dd9
/**
* 孵化器月度填报表
* draftLock 草稿锁 当任务提交的时候,将此字段改为true
* occupancyRate 取%号前的数据 例如 填报数据为80% 库中数据为80
* name 为系统生成 此月填报上一月内容 即2月填报时 name中月份为1月 2023-02-06 确定此需求
*
*/
import
{
mySqlTableClass
}
from
"../../db/mysql/mysqlClass"
;
/**表结构 */
const
TableConfig
=
{
taskId
:{
type
:
String
,
index
:
true
},
//任务id
name
:
String
,
//任务名称
fuHuaQiUscc
:
String
,
//任务所属孵化器id
occupancyRate
:
Number
,
//出租率 单位为%
createTime
:
Number
,
//创建时间
/**不下发字段 */
draftLock
:{
type
:
Boolean
,
default
:
false
},
//草稿锁,true为提交之后,false为草稿
}
/**sql */
enum
SQLENUM
{
}
/**多表sql */
enum
MORETABLESQLENUM
{
}
let
financingModel
;
export
function
initModel
()
{
financingModel
=
new
mySqlTableClass
(
"monthTable"
,
TableConfig
,
SQLENUM
,
MORETABLESQLENUM
);
}
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