python: generator IDAL and DAL using sql server 2019

其它数据库也是一样的思维方式

create IDAL

# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : 2024/11/18 21:10
# User      : geovindu
# Product   : PyCharm
# Project   : pyGenerator
# File      : SqlServerGenerator/createInterface.py
# explain   : 学习
import os
import re
import sys
import io
import datetime
from common.fileHelper import FileHelper
from common.strHelper import StrHelper
from bll.tableNameAndKey import TableNameAndKeyBll
from bll.tableForegin import TableForeginBll
from bll.tableModel import TableModelBll
 
class CreateInterface(object):
    """
 
    """
 
    def __init__(self):
        self.__modelpath = os.path.join(os.getcwd() + "/test/interface/")
        self.__file = FileHelper()
        self.__blltablekey = TableNameAndKeyBll()
        self.__database = "sql server 2019"
        self.__name = "CreateInterface"
        pass
 
    def __del__(self):
        """
 
        :return:
        """
        print(f"{self.__name} ERASE MEMORY")
    def addpackagefile(self):
        """
        生成包配置文件
        :return:
        """
        now = datetime.datetime.now()
        bll = TableNameAndKeyBll()
        sb = []
        sbt = f"""
# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : {now.strftime('%Y-%m-%d %H:%M:%S')}
# database  :{self.__database}
# User      : geovindu
# Product   : PyCharm
# Project   : IctGame
# File      : interface/__init__.py
# explain   : 学习
                    """
        sb.append(sbt)
        for li in bll.selectSql():
            sbp=f"""
from interface.{StrHelper.firstLower(li.TableName)} import I{li.TableName}
"""
            sb.append(sbp)
        if not os.path.exists(self.__modelpath):
            os.makedirs(self.__modelpath)
        filepath = self.__modelpath + '__init__.py'
        content = ''.join(sb)
        ok = self.__file.createModelFile(filepath, content)
 
    def add(self):
        """
        生成实体
        :return:
        """
        # fileHelper=FileHelper()
        now = datetime.datetime.now()
        bll = TableNameAndKeyBll()
        for li in bll.selectSql():
            sb = []
            sbt = f"""
# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : {now.strftime('%Y-%m-%d %H:%M:%S')}
# database  :{self.__database}
# User      : geovindu
# Product   : PyCharm
# Project   : IctGame
# File      : interface/{li.TableName}.py
# explain   : 学习
from __future__ import annotations
from abc import ABC, abstractmethod
import os
import sys
from model.{StrHelper.firstLower(li.TableName)} import {li.TableName}Info
 
class I{li.TableName}(ABC):
    \"""
    {li.TableDescription}                   
    \"""
"""
            sb.append(sbt)
            tbll = TableModelBll()
            sinhead = f"""
    @classmethod
    def __subclasshook__(cls, subclass):
        return (hasattr(subclass, 'load_data_source') and
                callable(subclass.load_data_source) and
                hasattr(subclass, 'extract_text') and
                callable(subclass.extract_text) or
                NotImplemented) 
                 
    @abstractmethod
    def selectSql(cls) -> list:
        \"""
 
        :return:
        \"""
        pass
 
    @abstractmethod
    def selectSqlCount(cls) -> list:
        \"""
        查询数据 总数
        :return:
        \"""
        pass
 
    @abstractmethod
    def selectSqlOrder(cls, order: str) -> list:
        \"""
 
        :param order:
        :return:
        \"""
        pass
 
    @abstractmethod
    def selectSort(cls,field:str,isOrder:bool)->list:
        \"""
 
        :param field
        :param order:  desc/asc
        :return:
        \"""
        pass
 
    @abstractmethod
    def selectIdSql(cls, {StrHelper.firstLower(li.FieldName)}: str):
        \"""
 
        :param {li.FieldName}:
        :return:
        \"""
        pass
 
    @abstractmethod
    def selectProc(cls):
        \"""
 
        :return:
        \"""
        pass
 
    @abstractmethod
    def selectIdProc(cls, {StrHelper.firstLower(li.FieldName)}):
        \"""
 
        :param {li.FieldName}:
        :return:
        \"""
        pass
 
    @abstractmethod
    def addSql(cls, info: {li.TableName}Info):
        \"""
 
        :param info:
        :return:
        \"""
        pass
 
    @abstractmethod
    def addProc(cls, info: {li.TableName}Info):
        \"""
 
        :param info:
        :return:
        \"""
        pass
 
    @abstractmethod
    def addOutProc(cls, info: {li.TableName}Info):
        \"""
 
        :param info:
        :return:
        \"""
        pass
 
    @abstractmethod
    def editSql(cls, info: {li.TableName}Info):
        \"""
 
        :param info:
        :return:
        \"""
        pass
 
    @abstractmethod
    def editProc(cls, info: {li.TableName}Info):
        \"""
 
        :param info:
        :return:
        \"""
        pass
 
    @abstractmethod
    def delSql(cls, {StrHelper.firstLower(li.FieldName)}):
        \"""
 
        :param {li.FieldName}:
        :return:
        \"""
        pass
 
    @abstractmethod
    def delProc(cls, {StrHelper.firstLower(li.FieldName)}):
        \"""
 
        :param {li.FieldName}:
        :return:
        \"""
        pass              
    """
            sb.append(sinhead)
 
 
 
 
            if not os.path.exists(self.__modelpath):
                os.makedirs(self.__modelpath)
            filepath = self.__modelpath + StrHelper.firstLower(li.TableName) + '.py'
            content = ''.join(sb)
            ok = self.__file.createModelFile(filepath, content)

create DAL 

# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : 2024/11/18 21:10
# User      : geovindu
# Product   : PyCharm
# Project   : pyGenerator
# File      : SqlServerGenerator/createDal.py
# explain   : 学习
import os
import re
import sys
import io
import datetime
from common.fileHelper import FileHelper
from common.strHelper import StrHelper
from bll.tableNameAndKey import TableNameAndKeyBll
from bll.tableForegin import TableForeginBll
from bll.tableModel import TableModelBll
 
class CreateDal(object):
    """
 
    """
 
    def __init__(self):
        self.__modelpath = os.path.join(os.getcwd() + "/test/dal/")
        self.__file = FileHelper()
        self.__blltablekey = TableNameAndKeyBll()
        self.__bllTableModel = TableModelBll()
        self.__database = "sql server 2019"
        self.__name = "CreateDal"
        pass
 
    def __del__(self):
        """
 
        :return:
        """
        print(f"{self.__name} ERASE MEMORY")
 
    def getColumn(self,tableName:str) -> str:
        """
         column=("SchoolId","SchoolName","SchoolTelNo")
        :return:
        """
        tables = self.__bllTableModel.selectSql(tableName)
        columns = []
        columnstr = '('
        if len(tables) > 0:
            for obj in tables:
                columns.append("\""+obj.FieldName+"\"")
            columnstr =columnstr + ','.join(columns)
        return columnstr+')'
 
 
    def getVales(self,tableName:str) -> str:
        """
        egs:
        vales=[info.SchoolId,info.SchoolName,info.SchoolTelNo]
        :return:
        """
        vales = []
        valesstr = '['
        tables = self.__bllTableModel.selectSql(tableName)
        if len(tables)>0:
            for obj in tables:
                vales.append('info.'+obj.FieldName)
            valesstr = valesstr+','.join(vales)
        return valesstr + ']'
 
 
    def getArgs(self,tableName:str) -> str:
        """
        egs:
        args = [info.SchoolId,info.SchoolName,info.SchoolTelNo] #修改的
        args ={{"schoolId":f"{{info.schoolId}}","SchoolName":f"{{info.SchoolName}}","SchoolTelNo":f"{{info.SchoolTelNo}}"}}
        :return:
        """
        args = []
        argsstr = '['
        tables = self.__bllTableModel.selectSql(tableName)
        if len(tables)>0:
            for obj in tables:
                args.append('info.'+obj.FieldName)
            argsstr =argsstr+ ','.join(args)
        return argsstr+']'
 
    def getArgs(self,tableName:str) -> str:
        """
        egs:
        args = [info.SchoolId,info.SchoolName,info.SchoolTelNo] #修改的
        :return:
        """
        args = []
        argsstr = '['
        tables = self.__bllTableModel.selectSql(tableName)
        if len(tables)>0:
            for obj in tables:
                args.append('info.'+obj.FieldName)
            argsstr = argsstr+','.join(args)
        return argsstr+']'
 
    def getArgsVariable(self,tableName:str) -> str:
        """
        egs:
        args ={"schoolId":f"{{info.schoolId}}","SchoolName":f"{{info.SchoolName}}","SchoolTelNo":f"{{info.SchoolTelNo}}"}}
        :return:
        """
        args = []
        argsstr = '{'
        tables = self.__bllTableModel.selectSql(tableName)
        if len(tables)>0:
            for obj in tables:
                args.append("\""+obj.FieldName+"\":f\"{info."+obj.FieldName+"}\"")
            argsstr =argsstr+ ','.join(args)
        return argsstr+'}'
 
    def getArgsOut(self,tableName:str, primekey:str) -> str:
        """
        egs:
        args = [info.SchoolName, info.SchoolTelNo,outid]   #添加返回值
        :return:
        """
        args = []
        argsstr = '['
        tables = self.__bllTableModel.selectSql(tableName)
        if len(tables)>0:
            for obj in tables:
                if str(obj.FieldName).lower() != primekey.lower():
                    args.append('info.'+obj.FieldName)
            argsstr = argsstr+','.join(args)
        return argsstr+',out'+primekey+']'
 
 
 
    def addpackagefile(self):
        """
        生成包配置文件
        :return:
        """
        now = datetime.datetime.now()
        bll = TableNameAndKeyBll()
        sb = []
        sbt = f"""
# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : {now.strftime('%Y-%m-%d %H:%M:%S')}
# database  :{self.__database}
# User      : geovindu
# Product   : PyCharm
# Project   : IctGame
# File      : dal/__init__.py
# explain   : 学习
                    """
        sb.append(sbt)
        for li in bll.selectSql():
            sbp=f"""
from dal.{StrHelper.firstLower(li.TableName)} import {li.TableName}Dal
"""
            sb.append(sbp)
        if not os.path.exists(self.__modelpath):
            os.makedirs(self.__modelpath)
        filepath = self.__modelpath + '__init__.py'
        content = ''.join(sb)
        ok = self.__file.createModelFile(filepath, content)
 
 
    def add(self):
        """
        生成实体
        :return:
        """
        # fileHelper=FileHelper()
        now = datetime.datetime.now()
        bll = TableNameAndKeyBll()
        for li in bll.selectSql():
            sb = []
            sbt = f"""
# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : {now.strftime('%Y-%m-%d %H:%M:%S')}
# database  :{self.__database}
# User      : geovindu
# Product   : PyCharm
# Project   : IctGame
# File      : dal/{li.TableName}.py
# explain   : 学习
from __future__ import annotations
from abc import ABC, abstractmethod
import os
import sys
from model.{StrHelper.firstLower(li.TableName)} import {li.TableName}Info
from DBUtility.MsSQLHelper import MsSqlHelper
from interface.{StrHelper.firstLower(li.TableName)} import I{li.TableName}
 
class {li.TableName}Dal(I{li.TableName}):
    \"""
    {li.TableDescription}                   
    \"""
"""
            sb.append(sbt)
            sinhead = f"""
    myms = MsSqlHelper()
    def __init__(self):
         \"""
         构造函数,方法
         :param strserver:
         :param struser:
         :param strpwd:
         :param strdatabase:
         \"""
         self._strserver = ""
         self._struser = ""
         self._strpwd = ""
         self._strdatabase =""
 
    def selectSql(cls)->list:
         \"""
         查询数据 self._strserver, self._struser, self._strpwd, self._strdatabase
         :return:
         \"""
         row=cls.myms.execute("select * from {li.TableName};")
         #cls.myms.close()
         return row
 
    def selectSqlCount(cls)->list:
         \"""
         查询数据 总数
         :return:
         \"""
 
         row=cls.myms.execute("select count(*) as total from {li.TableName};")
         #cls.myms.close()
         return row[0]
 
 
    def selectSqlOrder(cls,order:str)->list:
         \"""
         :param order:  SchoolId desc/asc
         :return:
         \"""
         students=[]
 
         strsql=f"select * from {li.TableName} order by {{order}};"
         row=cls.myms.execute(f"select * from {li.TableName} order by {{order}};")
         return row
 
    def selectSort(cls,field:str,isOrder:bool)->list:
         \"""
         :param field {li.FieldName}
         :param order:  desc/asc
         :return:
         \"""
         order='desc'
         if isOrder==True:
             order='desc'
         else:
             order='asc'
         strsql=f"select * from {li.TableName} order by {{field}} {{order}};"
         row=cls.myms.execute(f"select * from {li.TableName} order by {{field}} {{order}};")
         #cls.myms.close()
         return row
 
 
    def selectIdSql(cls,{li.FieldName}:str)->list:
         \"""
 
         :param {li.FieldName}: 主键ID
         :return:
         \"""
 
         row=cls.myms.execute(f"select * from {li.TableName} where SchoolId='{{SchoolId}}';")  #考虑数据类型
         #cls.myms.close()
         return row
 
    def selectProc(cls)->list:
         \"""
         存储过程
         :return:
         \"""
 
         args = ()
         row = cls.myms.executeCallProc("procSelect{li.TableName}All",args)
         return row
 
    def selectIdProc(cls,{li.FieldName}:str)->list:
         \"""
         存储过程
         :param {li.FieldName}: 主键ID
         :return:
         \"""
 
         args = ({li.FieldName},)
         row = cls.myms.executeCallProc('procSelect{li.TableName}', args)
         return row
 
    def addSql(cls,info:{li.TableName}Info)->int:
          \"""
          添加,要考虑添加返回ID值
          :param info:实体类
          :return:
          \"""
 
          column={self.getColumn(li.TableName)}
          vales={self.getVales(li.TableName)}
          return cls.myms.insertByColumnaAndValues("{li.TableName}",column,vales)
 
    def addProc(cls,info:{li.TableName}Info)->int:
          \"""
          添加,要考虑添加返回ID值
          :param info:实体类
          :return:
          \"""
 
          args={self.getArgs(li.TableName)}
          return cls.myms.insertCallProc("procInsert{li.TableName}",args)
 
    def addOutProc(cls,info:{li.TableName}Info) -> int:
          \"""
          添加,要考虑添加返回ID值
          :param info:实体类
          :return: 返回增加的ID
          \"""
          id = 0
          try:
 
              outid =('int',) #输出,元组类型
              print(info)
              args = {self.getArgsOut(li.TableName,li.FieldName)}
              print(args)
              result=cls.myms.insertOutCallProc("procInsert{li.TableName}Output", args)
              print(result)
              id = result
          except Exception as ex:
              print(ex)
          return id
 
    def editSql(cls,info:{li.TableName}Info)->int:
        \"""
 
        :param info:实体类
        :return:
        \"""
 
        args = {self.getArgsVariable(li.TableName)}
        where = f"{li.FieldName}={{info.{li.FieldName}}}" #
        #print(args,where)
        return cls.myms.updateByKeyValues("{li.TableName}",where,args)
 
    def editProc(cls, info: {li.TableName}Info)->int:
         \"""
 
         :param info: 实体类
         :return:
         \"""
 
         args = {self.getArgs(li.TableName)}
         return cls.myms.updateProc("procUpdate{li.TableName}",args)
 
 
    def delSql(cls,{li.FieldName}:str)->int:
       \"""
       sql语句删除
       :param {li.FieldName}: 主键ID
       :return:
       \"""
 
       where={{f"{li.FieldName}":{li.FieldName}}}
       return cls.myms.deleteByKeyValues("{li.TableName}",where)
 
    def delProc(cls, {li.FieldName}:str)->int:
        \"""
        删除 存储过程 删除多个ID,后面增加
        :param {li.FieldName}: 主键ID
        :return:
        \"""
        args ={li.FieldName}
        k=cls.myms.deleteProc("procDuDelete{li.TableName}", args)
        return k           
"""
            sb.append(sinhead)
            if not os.path.exists(self.__modelpath):
                os.makedirs(self.__modelpath)
            filepath = self.__modelpath + StrHelper.firstLower(li.TableName) + '.py'
            content = ''.join(sb)
            ok = self.__file.createModelFile(filepath, content)

生成的代码:

# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : 2024-11-19 21:12:32
# database  :sql server 2019
# User      : geovindu
# Product   : PyCharm
# Project   : IctGame
# File      : interface/School.py
# explain   : 学习
from __future__ import annotations
from abc import ABC, abstractmethod
import os
import sys
from model.school import SchoolInfo
 
class ISchool(ABC):
    """
    学校表                   
    """
 
    @classmethod
    def __subclasshook__(cls, subclass):
        return (hasattr(subclass, 'load_data_source') and
                callable(subclass.load_data_source) and
                hasattr(subclass, 'extract_text') and
                callable(subclass.extract_text) or
                NotImplemented) 
                 
    @abstractmethod
    def selectSql(cls) -> list:
        """
 
        :return:
        """
        pass
 
    @abstractmethod
    def selectSqlCount(cls) -> list:
        """
        查询数据 总数
        :return:
        """
        pass
 
    @abstractmethod
    def selectSqlOrder(cls, order: str) -> list:
        """
 
        :param order:
        :return:
        """
        pass
 
    @abstractmethod
    def selectSort(cls,field:str,isOrder:bool)->list:
        """
 
        :param field
        :param order:  desc/asc
        :return:
        """
        pass
 
    @abstractmethod
    def selectIdSql(cls, schoolId: str):
        """
 
        :param SchoolId:
        :return:
        """
        pass
 
    @abstractmethod
    def selectProc(cls):
        """
 
        :return:
        """
        pass
 
    @abstractmethod
    def selectIdProc(cls, schoolId):
        """
 
        :param SchoolId:
        :return:
        """
        pass
 
    @abstractmethod
    def addSql(cls, info: SchoolInfo):
        """
 
        :param info:
        :return:
        """
        pass
 
    @abstractmethod
    def addProc(cls, info: SchoolInfo):
        """
 
        :param info:
        :return:
        """
        pass
 
    @abstractmethod
    def addOutProc(cls, info: SchoolInfo):
        """
 
        :param info:
        :return:
        """
        pass
 
    @abstractmethod
    def editSql(cls, info: SchoolInfo):
        """
 
        :param info:
        :return:
        """
        pass
 
    @abstractmethod
    def editProc(cls, info: SchoolInfo):
        """
 
        :param info:
        :return:
        """
        pass
 
    @abstractmethod
    def delSql(cls, schoolId):
        """
 
        :param SchoolId:
        :return:
        """
        pass
 
    @abstractmethod
    def delProc(cls, schoolId):
        """
 
        :param SchoolId:
        :return:
        """
        pass              

# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : 2024-11-19 21:12:32
# database  :sql server 2019
# User      : geovindu
# Product   : PyCharm
# Project   : IctGame
# File      : dal/School.py
# explain   : 学习
from __future__ import annotations
from abc import ABC, abstractmethod
import os
import sys
from model.school import SchoolInfo
from DBUtility.MsSQLHelper import MsSqlHelper
from interface.school import ISchool
 
class SchoolDal(ISchool):
    """
    学校表                   
    """
 
    myms = MsSqlHelper()
    def __init__(self):
         """
         构造函数,方法
         :param strserver:
         :param struser:
         :param strpwd:
         :param strdatabase:
         """
         self._strserver = ""
         self._struser = ""
         self._strpwd = ""
         self._strdatabase =""
 
    def selectSql(cls)->list:
         """
         查询数据 self._strserver, self._struser, self._strpwd, self._strdatabase
         :return:
         """
         row=cls.myms.execute("select * from School;")
         #cls.myms.close()
         return row
 
    def selectSqlCount(cls)->list:
         """
         查询数据 总数
         :return:
         """
 
         row=cls.myms.execute("select count(*) as total from School;")
         #cls.myms.close()
         return row[0]
 
 
    def selectSqlOrder(cls,order:str)->list:
         """
         :param order:  SchoolId desc/asc
         :return:
         """
         students=[]
 
         strsql=f"select * from School order by {order};"
         row=cls.myms.execute(f"select * from School order by {order};")
         return row
 
    def selectSort(cls,field:str,isOrder:bool)->list:
         """
         :param field SchoolId
         :param order:  desc/asc
         :return:
         """
         order='desc'
         if isOrder==True:
             order='desc'
         else:
             order='asc'
         strsql=f"select * from School order by {field} {order};"
         row=cls.myms.execute(f"select * from School order by {field} {order};")
         #cls.myms.close()
         return row
 
 
    def selectIdSql(cls,SchoolId:str)->list:
         """
 
         :param SchoolId: 主键ID
         :return:
         """
 
         row=cls.myms.execute(f"select * from School where SchoolId='{SchoolId}';")  #考虑数据类型
         #cls.myms.close()
         return row
 
    def selectProc(cls)->list:
         """
         存储过程
         :return:
         """
 
         args = ()
         row = cls.myms.executeCallProc("procSelectSchoolAll",args)
         return row
 
    def selectIdProc(cls,SchoolId:str)->list:
         """
         存储过程
         :param SchoolId: 主键ID
         :return:
         """
 
         args = (SchoolId,)
         row = cls.myms.executeCallProc('procSelectSchool', args)
         return row
 
    def addSql(cls,info:SchoolInfo)->int:
          """
          添加,要考虑添加返回ID值
          :param info:实体类
          :return:
          """
 
          column=("SchoolId","SchoolName","SchoolTelNo")
          vales=[info.SchoolId,info.SchoolName,info.SchoolTelNo]
          return cls.myms.insertByColumnaAndValues("School",column,vales)
 
    def addProc(cls,info:SchoolInfo)->int:
          """
          添加,要考虑添加返回ID值
          :param info:实体类
          :return:
          """
 
          args=[info.SchoolId,info.SchoolName,info.SchoolTelNo]
          return cls.myms.insertCallProc("procInsertSchool",args)
 
    def addOutProc(cls,info:SchoolInfo) -> int:
          """
          添加,要考虑添加返回ID值
          :param info:实体类
          :return: 返回增加的ID
          """
          id = 0
          try:
 
              outid =('int',) #输出,元组类型
              print(info)
              args = [info.SchoolName,info.SchoolTelNo,outSchoolId]
              print(args)
              result=cls.myms.insertOutCallProc("procInsertSchoolOutput", args)
              print(result)
              id = result
          except Exception as ex:
              print(ex)
          return id
 
    def editSql(cls,info:SchoolInfo)->int:
        """
 
        :param info:实体类
        :return:
        """
 
        args = {"SchoolId":f"{info.SchoolId}","SchoolName":f"{info.SchoolName}","SchoolTelNo":f"{info.SchoolTelNo}"}
        where = f"SchoolId={info.SchoolId}" #
        #print(args,where)
        return cls.myms.updateByKeyValues("School",where,args)
 
    def editProc(cls, info: SchoolInfo)->int:
         """
 
         :param info: 实体类
         :return:
         """
 
         args = [info.SchoolId,info.SchoolName,info.SchoolTelNo]
         return cls.myms.updateProc("procUpdateSchool",args)
 
 
    def delSql(cls,SchoolId:str)->int:
       """
       sql语句删除
       :param SchoolId: 主键ID
       :return:
       """
 
       where={f"SchoolId":SchoolId}
       return cls.myms.deleteByKeyValues("School",where)
 
    def delProc(cls, SchoolId:str)->int:
        """
        删除 存储过程 删除多个ID,后面增加
        :param SchoolId: 主键ID
        :return:
        """
        args =SchoolId
        k=cls.myms.deleteProc("procDuDeleteSchool", args)
        return k           

拼就是一个粗放的项目

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/919449.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【澜舟科技-注册/登录安全分析报告】

前言 由于网站注册入口容易被机器执行自动化程序攻击,存在如下风险: 暴力破解密码,造成用户信息泄露,不符合国家等级保护的要求。短信盗刷带来的拒绝服务风险 ,造成用户无法登陆、注册,大量收到垃圾短信的…

基于Java Springboot出租车管理网站

一、作品包含 源码数据库设计文档万字PPT全套环境和工具资源部署教程 二、项目技术 前端技术:Html、Css、Js、Vue、Element-ui 数据库:MySQL 后端技术:Java、Spring Boot、MyBatis 三、运行环境 开发工具:IDEA/eclipse 数据…

鸿蒙原生应用开发元服务 元服务是什么?和App的关系?(保姆级步骤)

元服务是什么?和App的关系? 元服务是是一种HarmonyOS轻量应用形态,用户无需安装即可使用,具备随处可及、服务直达、自由流转的特征。 元服务是可以独立部署和运行的程序实体,独立于应用,不依赖应用可独立…

uniapp 自定义加载组件,全屏加载,局部加载 (微信小程序)

效果图 全屏加载 页面加载使用 局部加载 列表加载里面使用 使用gif html <template><view><view class"" v-if"typeFullScreen"><view class"loading" v-if"show"><view class""><i…

QQ 小程序已发布,但无法被搜索的解决方案

前言 我的 QQ 小程序在 2024 年 8 月就已经审核通过&#xff0c;上架后却一直无法被搜索到。打开后&#xff0c;再在 QQ 上下拉查看 “最近使用”&#xff0c;发现他出现一下又马上消失。 上线是按正常流程走的&#xff0c;开发、备案、审核&#xff0c;没有任何违规&#xf…

Java中日志采集框架-JUL、Slf4j、Log4j、Logstash

1. 日志采集 日志采集是指在软件系统、网络设备、服务器或其他IT基础设施中自动收集日志文件和事件信息的过程。这些日志通常包含了时间戳、事件类型、源和目标信息、错误代码、用户操作记录等关键数据。日志采集的目的是为了监控系统运行状态、分析系统性能、审计用户行为、故…

CSS遮罩:mask

CSS属性 mask 允许使用者通过遮罩或者裁切特定区域的图片的方式来隐藏一个元素的部分或者全部可见区域。 // 一般用位图图片做遮罩 mask: url(~/assets/images/mask.png); mask-size: 100% 100%;// 使用 SVG 图形中的形状来做遮罩 mask: url(~/assets/images/mask.svg#star);…

【python笔记01】python基础笔记汇总

文章目录 python概述计算机资源Why Pythonpython解释器解释器的种类python版本python解释器 开发工具PyCharmvscodecursor 程序的三种结构 python中的变量python中的输入输出python中的标准输入python中的格式化输出❗转义字符 运算符&#xff08;基本运算符不写&#xff09;短…

Postman之安装及汉化基本使用介绍

Postman之安装及汉化 1.安装及汉化postman2.基本使用介绍2.1.基本功能&#xff1a;2.2.编辑、查看、设置环境、全局、集合变量2.3.复制代码片段2.4.运行集合中的所有请求及引用外部文件进行参数化 1.安装及汉化postman 下载安装包 首先可以到官网下载安装包&#xff0c;需要注…

Excel如何把两列数据合并成一列,4种方法

Excel如何把两列数据合并成一列,4种方法 参考链接:https://baijiahao.baidu.com/s?id=1786337572531105925&wfr=spider&for=pc 在Excel中,有时候需要把两列或者多列数据合并到一列中,下面介绍4种常见方法,并且提示一些使用注意事项,总有一种方法符合你的要求:…

Android WMS概览

WMS&#xff08;WindowManagerService&#xff09;是 Android 系统的核心服务&#xff0c;负责管理应用和系统的窗口&#xff0c;包括窗口的创建、销毁、布局、层级管理、输入事件分发以及动画显示等。它通过协调 InputManager 和 SurfaceFlinger 实现触摸事件处理和窗口渲染&a…

Python | Leetcode Python题解之第564题寻找最近的回文数

题目&#xff1a; 题解&#xff1a; class Solution:def nearestPalindromic(self, n: str) -> str:m len(n)candidates [10 ** (m - 1) - 1, 10 ** m 1]selfPrefix int(n[:(m 1) // 2])for x in range(selfPrefix - 1, selfPrefix 2):y x if m % 2 0 else x // 10…

十六.SpringCloudAlibaba极简入门-整合Grpc代替OpenFeign

前言 他来了他来了&#xff0c;停了快2个月了终于又开始更新文章啦&#xff0c;这次带来的绝对是干货&#xff01;&#xff01;&#xff01;。由于公司项目进行重构的时候考虑到&#xff0c;OpenFeign做为服务通信组件在高并发情况下有一定的性能瓶颈&#xff0c;所以将其替换…

【机器学习】机器学习中用到的高等数学知识-7.信息论 (Information Theory)

熵 (Entropy)&#xff1a;用于评估信息的随机性&#xff0c;常用于决策树和聚类算法。交叉熵 (Cross-Entropy)&#xff1a;用于衡量两个概率分布之间的差异&#xff0c;在分类问题中常用。 信息论作为处理信息量和信息传输的数学理论&#xff0c;在机器学习中具有广泛的应用。…

高亮变色显示文本中的关键字

效果 第一步&#xff1a;按如下所示代码创建一个用来高亮显示文本的工具类&#xff1a; public class KeywordUtil {/*** 单个关键字高亮变色* param color 变化的色值* param text 文字* param keyword 文字中的关键字* return*/public static SpannableString highLigh…

【图像处理识别】数据集合集!

本文将为您介绍经典、热门的数据集&#xff0c;希望对您在选择适合的数据集时有所帮助。 1 CNN-ImageProc-Robotics 机器人 更新时间&#xff1a;2024-07-29 访问地址: GitHub 描述&#xff1a; 通过 CNN 和图像处理进行机器人对象识别项目侧重于集成最先进的深度学习技术和…

VTK知识学习(10)- 渲染引擎

1、前言 vtkProp; vtkAbstractMapper; vtkProperty; vtkCamera; vtkLight; vtkRenderer; vtkRenderWindow; vtkRenderWindowInteractor; vtkTransform; vtkLookupTable;………… 这些类都是与数据显示或渲染相关的。 用计算机图形学的专业词汇来说&#xff0c;就是它…

网络基础(3)https和加密

http其它的报头 直接看图片&#xff1a; 上图中的第一个和第二个类型之前已经使用过了也就不多做说明了&#xff0c;第三个报头类型使用的很少了。第四个报头类型主要就使用在一些灰度更新的应用上&#xff0c;确定用户使用的软件的版本不让其访问该版本不能访问的功能。下一个…

高阶C语言之五:(数据)文件

目录 文件名 文件类型 文件指针 文件的打开和关闭 文件打开模式 文件操作函数&#xff08;顺序&#xff09; 0、“流” 1、字符输出函数fputc 2、字符输入函数fgetc 3、字符串输出函数fputs 4、 字符串输入函数fgets 5、格式化输入函数fscanf 6、格式化输出函数fpr…

C#获取视频第一帧_腾讯云媒体处理获取视频第一帧

一、 使用步骤&#xff1a; 第一步、腾讯云开启万象 第二步、安装Tencent.QCloud.Cos.Sdk 包 第三步、修改 腾讯云配置 图片存储目录配置 第四步、执行获取图片并保存 二、封装代码 using System.Text; using System.Threading.Tasks;using COSXML.Model.CI; using COSXML.A…