柜体管理

duizhaopin
apan_youxiang@163.com 2 years ago
parent 58a2c4c9c0
commit 811afd4093

@ -3,11 +3,14 @@
'''
@Date:2022/07/29 09:03:39
'''
from pydoc import pager
from flask import Blueprint, jsonify, request
from Common.Utils import Utils, PageParam
from Common.auth import token_auth
from db_logic.client import BllClient
from db_logic.client_cell import BllClientCell
from db_logic.client_cell_user import BllClientCellUser
from db_logic.medicament_record import BllMedicamentRecord
from db_logic.medicament_template import BllMedicamentTemplate
from db_logic.meidcament_variety import BllMedicamentVariety
@ -134,11 +137,15 @@ def client_empty():
@client_router.route("/get_drawer_power", methods=["GET", "POST"])
def get_client_drawer_power():
drawer_id = request.values.get("drawer_id")
page = request.values.get("page", 1)
page_size = request.values.get("page_size", 10)
page_param = PageParam(int(page), int(page_size))
data_list = BllClientCell().get_drawer_power_user_list(drawer_id=drawer_id, page_param=page_param)
return jsonify(Utils.true_return(data={"data_list": Utils.msyql_table_model(data_list), "total_count": page_param.totalRecords}))
# 分配抽屉权限
@client_router.route("/set_drawer_power", methods=["GET", "POST"])
def set_client_drawer_power():
drawer_id = request.values.get("drawer_id")
# # 分配抽屉权限
# @client_router.route("/set_drawer_power", methods=["GET", "POST"])
# def set_client_drawer_power():
# drawer_id = request.values.get("drawer_id")

@ -0,0 +1,33 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Date:2022/08/09 17:38:47
'''
import sys
sys.path.append('.')
from db_logic.db_base import Repository
from models.client_models import EntityClientCell
from Common.Utils import Utils
class BllClientCell(Repository):
def __init__(self, entityType=EntityClientCell):
super().__init__(entityType)
# 展示抽屉权限用户
def get_drawer_power_user_list(self, drawer_id, page_param):
sql_all = f"""
select a.real_name, a.user_id,
CASE WHEN b.id is not null THEN 1 ELSE 0 END drawer_type
from rms_user as a LEFT JOIN (
select * from rms_client_cell_user where client_cell_id='{drawer_id}'
) as b on a.user_id=b.user_id
"""
try:
count_number = len(self.execute(sql_all).fetchall())
except Exception:
count_number = 0
page_param.totalRecords = count_number
page_sql = Utils.sql_paging_assemble(sql_all, page_param)
return self.execute(page_sql).fetchall()

@ -0,0 +1,17 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Date:2022/08/09 17:41:46
'''
import sys
sys.path.append('.')
from db_logic.db_base import Repository
from models.client_models import EntityClientCellUser
#用户操作业务逻辑类
class BllClientCellUser(Repository):
def __init__(self, entityType=EntityClientCellUser):
super().__init__(entityType)

@ -100,14 +100,28 @@ class EntityClientVersion(Base):
is_add = Column(Integer, comment="", default=1)
class EntityClientVersion(Base):
class EntityClientCell(Base):
__tablename__ = "rms_client_cell"
__table_args__ = (
{
"comment": "终端版本实体"
"comment": "终端抽屉"
}
)
id = Column(String(50), primary_key=True, comment="ID", default=get_uuid)
cell_code = Column(String(50), comment="抽屉码")
client_id = Column(Integer, comment="终端id")
cell_speci = Column(String(50), comment="单元格")
if __name__ == '__main__':
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from config.SystemConfig import SystemConfig
from sqlalchemy.pool import NullPool
engine = create_engine(SystemConfig.getConfig(
'dbconntion'), poolclass=NullPool)
DBSession = sessionmaker(bind=engine, expire_on_commit=False)
# 创建session对象
session = DBSession()
Base.metadata.create_all(engine)

Loading…
Cancel
Save