Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mancheng
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mancheng
Commits
6eb8047c
Commit
6eb8047c
authored
Feb 03, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230202
parent
d7658369
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
17 deletions
+35
-17
apps/models.py
+20
-16
apps/view_choose/view.py
+1
-1
apps/view_map/view.py
+14
-0
No files found.
apps/models.py
View file @
6eb8047c
...
@@ -27,11 +27,28 @@ class IndustryDistribute(db.Model):
...
@@ -27,11 +27,28 @@ class IndustryDistribute(db.Model):
investment_volume
=
db
.
Column
(
db
.
Float
,
comment
=
'投资额(亿元)'
)
investment_volume
=
db
.
Column
(
db
.
Float
,
comment
=
'投资额(亿元)'
)
# 新版产业链数据
class
IndustryChain
(
db
.
Model
):
__tablename_
=
"industry_chain"
__table_args__
=
({
'comment'
:
'新版产业链数据数据表'
})
# 添加表注释
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
,
autoincrement
=
True
,
comment
=
'主键id'
)
industry_name
=
db
.
Column
(
db
.
String
(
20
),
comment
=
'行业名称'
)
icon_url
=
db
.
Column
(
db
.
String
(
255
),
comment
=
'未选中时行业图标'
)
icon_url1
=
db
.
Column
(
db
.
String
(
255
),
comment
=
'选中时行业图标'
)
status
=
db
.
Column
(
db
.
Integer
,
doc
=
'启用状态1启用,2禁用'
,
comment
=
'启用状态1启用,2禁用'
)
# 启用状态1启用,2禁用
industry_type
=
db
.
Column
(
db
.
Integer
,
comment
=
'行业类型(0是产业集群,1是上游行业,2是中游行业,3是下游行业)'
)
relate_id
=
db
.
Column
(
db
.
Integer
,
comment
=
'关系id(关联与哪个产业环节'
)
# enterprise_id = db.Column(db.Integer, db.ForeignKey("enterprise.id"), comment='外键id,全国企业id')
enterprise
=
db
.
relationship
(
'Enterprise'
,
backref
=
db
.
backref
(
'enterprise'
))
# 全国企业
# 全国企业
class
Enterprise
(
db
.
Model
):
class
Enterprise
(
db
.
Model
):
__tablename__
=
"enterprise"
__tablename__
=
"enterprise"
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
,
autoincrement
=
True
,
doc
=
'企业主键id'
,
comment
=
'企业主键id主键id'
)
# 企业
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
,
autoincrement
=
True
,
doc
=
'企业主键id'
,
comment
=
'企业主键id主键id'
)
# 企业
industry_chain_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'industry_chain.id'
))
company_name
=
db
.
Column
(
db
.
String
(
255
),
index
=
True
,
doc
=
'企业名'
,
comment
=
'企业名'
)
# 企业名
company_name
=
db
.
Column
(
db
.
String
(
255
),
index
=
True
,
doc
=
'企业名'
,
comment
=
'企业名'
)
# 企业名
status
=
db
.
Column
(
db
.
String
(
32
),
doc
=
'经营状态'
,
comment
=
'经营状态'
)
# 经营状态
status
=
db
.
Column
(
db
.
String
(
32
),
doc
=
'经营状态'
,
comment
=
'经营状态'
)
# 经营状态
legal
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'发定代表人'
,
comment
=
'发定代表人'
)
# 发定代表人
legal
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'发定代表人'
,
comment
=
'发定代表人'
)
# 发定代表人
...
@@ -114,9 +131,9 @@ class Enterprise(db.Model):
...
@@ -114,9 +131,9 @@ class Enterprise(db.Model):
f_name
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'父行业类名'
,
comment
=
'父行业类名'
)
# 父行业类名
f_name
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'父行业类名'
,
comment
=
'父行业类名'
)
# 父行业类名
f_type
=
db
.
Column
(
db
.
Integer
,
index
=
True
,
doc
=
'父行业类id'
,
comment
=
'父行业类id'
)
# 父行业类id
f_type
=
db
.
Column
(
db
.
Integer
,
index
=
True
,
doc
=
'父行业类id'
,
comment
=
'父行业类id'
)
# 父行业类id
sxonhun
=
db
.
Column
(
db
.
String
(
32
))
# 是否山西100强
sxonhun
=
db
.
Column
(
db
.
String
(
32
)
,
comment
=
'是否山西100强'
)
# 是否山西100强
scale
=
db
.
Column
(
db
.
String
(
32
))
# 规模以上企业
scale
=
db
.
Column
(
db
.
String
(
32
)
,
comment
=
'规模以上企业'
)
# 规模以上企业
serve
=
db
.
Column
(
db
.
String
(
32
))
# 限额以上服务业
serve
=
db
.
Column
(
db
.
String
(
32
)
,
comment
=
'限额以上服务业'
)
# 限额以上服务业
__table_args__
=
({
'comment'
:
'全国企业表'
})
# 添加表注释
__table_args__
=
({
'comment'
:
'全国企业表'
})
# 添加表注释
...
@@ -1730,17 +1747,4 @@ class OperationLog(db.Model):
...
@@ -1730,17 +1747,4 @@ class OperationLog(db.Model):
time
=
db
.
Column
(
db
.
DateTime
,
default
=
''
,
comment
=
'转为已读状态的时间(用于消息提醒)'
)
time
=
db
.
Column
(
db
.
DateTime
,
default
=
''
,
comment
=
'转为已读状态的时间(用于消息提醒)'
)
# 新版产业链数据
class
IndustryChain
(
db
.
Model
):
__tablename_
=
"industry_chain"
__table_args__
=
({
'comment'
:
'新版产业链数据数据表'
})
# 添加表注释
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
,
autoincrement
=
True
,
comment
=
'主键id'
)
industry_name
=
db
.
Column
(
db
.
String
(
20
),
comment
=
'行业名称'
)
icon_url
=
db
.
Column
(
db
.
String
(
255
),
comment
=
'未选中时行业图标'
)
icon_url1
=
db
.
Column
(
db
.
String
(
255
),
comment
=
'选中时行业图标'
)
status
=
db
.
Column
(
db
.
Integer
,
doc
=
'启用状态1启用,2禁用'
,
comment
=
'启用状态1启用,2禁用'
)
# 启用状态1启用,2禁用
industry_type
=
db
.
Column
(
db
.
Integer
,
comment
=
'行业类型(0是产业集群,1是上游行业,2是中游行业,3是下游行业)'
)
relate_id
=
db
.
Column
(
db
.
Integer
,
comment
=
'关系id(关联与哪个产业环节'
)
apps/view_choose/view.py
View file @
6eb8047c
...
@@ -104,7 +104,7 @@ def advice():
...
@@ -104,7 +104,7 @@ def advice():
if
not
indu
:
if
not
indu
:
return
jsonify
(
code
=
RET
.
DATAERR
,
msg
=
"参数错误"
)
return
jsonify
(
code
=
RET
.
DATAERR
,
msg
=
"参数错误"
)
# 获取产业名称
# 获取产业名称
industry_name
=
indu
.
o
name
industry_name
=
indu
.
industry_
name
# 根据产业名称查询园区
# 根据产业名称查询园区
zone
=
Induzone
.
query
.
filter
(
or_
(
Induzone
.
navigat
.
like
(
"
%
{}
%
"
.
format
(
industry_name
)),
zone
=
Induzone
.
query
.
filter
(
or_
(
Induzone
.
navigat
.
like
(
"
%
{}
%
"
.
format
(
industry_name
)),
Induzone
.
navigator
.
like
(
"
%
{}
%
"
.
format
(
industry_name
))))
Induzone
.
navigator
.
like
(
"
%
{}
%
"
.
format
(
industry_name
))))
...
...
apps/view_map/view.py
View file @
6eb8047c
...
@@ -389,3 +389,17 @@ def attract_enterprise():
...
@@ -389,3 +389,17 @@ def attract_enterprise():
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据库查询错误"
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据库查询错误"
)
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
@api_map.route
(
'/GetChain'
,
methods
=
[
'GET'
])
def
get_chain
():
# 在IndustryChain中查找到某个产业链,比如:‘中成药’
indu_obj
=
IndustryChain
.
query
.
filter_by
(
industry_name
=
'中成药'
)
.
first
()
industry_name
=
indu_obj
.
industry_name
enterprise_list
=
Enterprise
.
query
.
filter
(
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
industry_name
)))
.
all
()
for
enterprise_obj
in
enterprise_list
:
indu_obj
.
enterprise
.
append
(
enterprise_obj
)
continue
enterprise_list1
=
indu_obj
.
enterprise
print
(
enterprise_list1
)
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