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
3b279d99
Commit
3b279d99
authored
Feb 10, 2023
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
54aa8b4b
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 @
3b279d99
import
{
mysqlDB
}
from
"./mysqlInit"
;
/**
* mysql数据表实体类
*/
export
class
mySqlTableClass
{
export
class
mySqlTableClass
{
file
;
file
;
//字段对象
/**表方法 */
tableName
;
//表名
tableName
;
//表名
sql
;
sql
;
//sql
moreTableSql
;
moreTableSql
;
//多表sql
constructor
(
tableName
:
string
,
sqlEnum
,
moreSqlEnum
)
{
constructor
(
tableName
:
string
,
file
?,
sqlEnum
?,
moreSqlEnum
?)
{
this
.
tableName
=
tableName
;
this
.
tableName
=
tableName
;
this
.
sql
=
sqlEnum
;
this
.
file
=
file
||
{};
this
.
moreTableSql
=
moreSqlEnum
;
this
.
sql
=
sqlEnum
||
{};
this
.
moreTableSql
=
moreSqlEnum
||
{};
}
}
/**
/**
...
@@ -18,7 +22,7 @@ export class mySqlTableClass {
...
@@ -18,7 +22,7 @@ export class mySqlTableClass {
* @param param 条件参数
* @param param 条件参数
* @param res 指定返回
* @param res 指定返回
*/
*/
find
(
param
,
res
?)
{
async
find
(
param
,
res
?)
{
let
sqlStr
=
'select '
;
let
sqlStr
=
'select '
;
if
(
!
res
)
sqlStr
+=
'* '
;
if
(
!
res
)
sqlStr
+=
'* '
;
else
{
else
{
...
@@ -45,9 +49,71 @@ export class mySqlTableClass {
...
@@ -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 @
3b279d99
import
{
mysqlDB
}
from
"../../db/mysql/mysqlInit"
;
/**
* 企业信息表
//指派表
* draftLock 草稿锁 当任务提交的时候,将此字段改为true
class
enterpriseClass
{
*/
name
:
string
//企业名称
taskId
:
string
//绑定的任务id
import
{
mySqlTableClass
}
from
"../../db/mysql/mysqlClass"
;
uscc
:
string
//统一信用代码
fuHuaQiUscc
:
string
//孵化器统一信用代码
/**表结构 */
industry
:
string
//领域 逗号隔开
const
TableConfig
=
{
logonTime
:
number
//注册时间
name
:
"string"
,
//企业名称
firstIncubationTime
:
number
//首次入孵时间
taskId
:
"string"
,
//绑定的任务id
timeOfImmigration
:
number
//迁入时间
uscc
:
"string"
,
//统一信用代码
isNaturalPersonHolding
:
boolean
//是否自然人控股企业
fuHuaQiUscc
:
"string"
,
//孵化器统一信用代码
oldLogonAdd
:
string
//迁入前注册地址
industry
:
"string"
,
//领域 逗号隔开
logonAdd
:
string
//注册地址
logonTime
:
"date"
,
//注册时间
operatingAdd
:
string
//经营地址
firstIncubationTime
:
"date"
,
//首次入孵时间
timeOfImmigration
:
"date"
,
//迁入时间
isNaturalPersonHolding
:
"boolean"
,
//是否自然人控股企业
oldLogonAdd
:
"string"
,
//迁入前注册地址
logonAdd
:
"string"
,
//注册地址
operatingAdd
:
"string"
,
//经营地址
leasedArea
:
"number"
,
//租赁面积(平方米)
draftLock
:
"boolean"
,
//草稿锁,true为提交之后,false为草稿 默认=false
createTime
:
"date"
//录入时间
// isPhysicalPresence:boolean//是否实地孵化 暂时弃用
// 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"
);
/**sql */
enum
SQLENUM
{
// /**
// * 通过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
MORETABLESQLENUM
{
// /**
}
// * 通过企业名称获取企业信息
// * @param selectParam 查询参数
// * @returns number 数据数量
// */
// export async function findEnterpriseInfoByName(name:string) {
// return await enterpriseModel.findOne({name});
// }
let
enterpriseModel
;
// /**
export
function
initModel
()
{
// * todo 注释后加
enterpriseModel
=
new
mySqlTableClass
(
"enterprise"
,
TableConfig
,
SQLENUM
,
MORETABLESQLENUM
);
// * @param selectParam 查询参数
}
// * @returns number 数据数量
// */
// export async function findEnterpriseListByFuHuaQiUsccName(fuHuaQiUscc:string) {
// return await enterpriseModel.find({fuHuaQiUscc});
// }
src/mysqlData/enterprise/financing.ts
View file @
3b279d99
import
{
mysqlDB
}
from
"../../db/mysql/mysqlInit"
;
/**
* 企业投资信息表
//指派表
* draftLock 草稿锁 当任务提交的时候,将此字段改为true
class
enterpriseClass
{
* 一个企业在一个月只能录入一个融资数据 2023-02-07 确定此需求
name
:
string
//企业名称
*/
taskId
:
string
//绑定的任务id
uscc
:
string
//统一信用代码
import
{
mySqlTableClass
}
from
"../../db/mysql/mysqlClass"
;
fuHuaQiUscc
:
string
//孵化器统一信用代码
industry
:
string
//领域 逗号隔开
/**表结构 */
logonTime
:
number
//注册时间
const
TableConfig
=
{
firstIncubationTime
:
number
//首次入孵时间
uscc
:
"string"
,
//融资企业统一信用代码 冗余字段
timeOfImmigration
:
number
//迁入时间
fuHuaQiUscc
:
"string"
,
//孵化器统一信用代码 冗余字段
isNaturalPersonHolding
:
boolean
//是否自然人控股企业
name
:
"string"
,
//企业名称
oldLogonAdd
:
string
//迁入前注册地址
taskId
:
"string"
,
//任务id
logonAdd
:
string
//注册地址
logonAdd
:
"string"
,
//注册地址
operatingAdd
:
string
//经营地址
operatingAdd
:
"string"
,
//经营地址
// isPhysicalPresence:boolean//是否实地孵化 暂时弃用
financingAmount
:
"number"
,
//融资金额(万元)
leasedArea
:
number
//租赁面积(平方米)
investmentInstitutionsName
:
"string"
,
//投资机构名称
draftLock
:
boolean
//草稿锁,true为提交之后,false为草稿 默认=false
timeToObtainInvestment
:
"date"
,
//获得投资时间
createTime
:
number
//录入时间
fuHuaQiInvestment
:
"boolean"
,
//孵化器是否投资
fuHuaQiInvestmentAmount
:
"number"
,
//孵化器投资金额(万元)
/**表方法 */
fuHuaQiInvestmentStyle
:
"number"
,
//孵化器投资方式
tableName
;
draftLock
:
"boolean"
,
//草稿锁,true为提交之后,false为草稿
sql
;
createTime
:
"date"
,
//录入时间
moreTableSql
;
industry
:
"string"
,
//领域
constructor
(
tableName
:
string
)
{
}
this
.
tableName
=
tableName
;
/**单表查询语句 */
enum
sqlEnum
{
获取任务
id
相关的企业列表
=
``
,
}
/**多表联查语句 */
enum
moreSqlEnum
{
}
/**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 @
3b279d99
/**
* 孵化器信息表
* 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 @
3b279d99
/**
* 孵化器月度填报表
* 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