检验代码生成器完成版

写维护页面重复逻辑写烦了,连页面的增、删、改、查、弹窗等代码都不行手写了,为此做成代码生成器成型版1.0.干到10点。。。

代码:

Class Demo.CodeGener Extends %RegisteredObject
{/// 生成操作表相关的代码,包括M、C#调用代码、界面增删改查代码、实体代码
/// 编码格式改WriteLineWithCode
/// TableName:表名
/// PathAdd:生成路径,默认D
/// MPath:M前缀,默认LIS.WS.BLL
/// AshxDir:ashx文件要放的路径,默认lis
/// w ##class(Demo.CodeGener).MakeOperTableCode("SYS_TableEnum")
/// w ##class(Demo.CodeGener).MakeOperTableCode("RP_VisitNumber")
ClassMethod MakeOperTableCode(TableName, PathAdd, MPath, AshxDir)
{s TableName=$g(TableName)s PathAdd=$g(PathAdd)s MPath=$g(MPath)s AshxDir=$g(AshxDir)//构造增删改查Mw ..MakeTableCUIDQCode(TableName, PathAdd, MPath, AshxDir),!//构造C#调用代码w ..MakeTableCSharpCallCode(TableName, PathAdd, MPath, AshxDir),!//构造aspx页面代码w ..MakeAspxCode(TableName, PathAdd, MPath, AshxDir),!//构造实体代码w ..MakeModelCode(TableName, PathAdd),!q "完成"
}/// 构造表的增删改查M类代码,以简化常规表M代码和C#调用代码工作量
/// 编码格式改WriteLineWithCode
/// w ##class(Demo.CodeGener).MakeTableCUIDQCode("SYS_TableEnum")
/// w ##class(Demo.CodeGener).MakeTableCUIDQCode("RP_VisitNumber")
ClassMethod MakeTableCUIDQCode(TableName, PathAdd, MPath, AshxDir)
{s TableName=$g(TableName)s PathAdd=$g(PathAdd)s MPath=$g(MPath)s AshxDir=$g(AshxDir)i '$l(MPath) s MPath="LIS.WS.BLL"i '$l(AshxDir) s AshxDir="lis"s ClassName=$tr(TableName,"_")s rset = ##class(%ResultSet).%New()d rset.Prepare("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,DESCRIPTION,IS_NULLABLE FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='dbo'  and TABLE_NAME='"_TableName_"'")s exeret=rset.Execute()s colCount=rset.GetColumnCount()Set repid=$I(^CacheTemp)k ^TMP($zn,repid,$j)s IsLinux=1s logpath=""i ##class(%SYSTEM.Version).GetOS()="Windows" s IsLinux=0//默认路径i '$l(logpath) d.i IsLinux=0 d..s logpath="D:\".e  d..s logpath="/"s logName=logpath_PathAdd_MPath_".DHC"_$tr(TableName,"_")_".cls"//方法名,查询名s TableInnerName=$tr(TableName,"_")//不存在目录就创建i '##class(%File).DirectoryExists(logpath_PathAdd) d.d ##class(%File).CreateNewDir(logpath_PathAdd,"")s file=##class(%File).%New(logName)//存在就追加i ##class(%File).Exists(logName) d.d ##class(%File).Delete(logName).d file.Open("WSN:/SHARED:/IOTABLE=""UTF8""")//不存在就新建e  d.d file.Open("WSN:/SHARED:/IOTABLE=""UTF8""")//写类头部d ..WriteLineWithCode(file,"///"_TableName_"操作类,由工具生成,返回空串保存成功,否则就是返回失败原因")d ..WriteLineWithCode(file,"Class "_MPath_".DHC"_$tr(TableName,"_")_" Extends %RegisteredObject")d ..WriteLineWithCode(file,"{")d ..WriteLineWithCode(file,"///"_$zd($h,8))d ..WriteLineWithCode(file,"///保存数据,多列以$CSP$分割")d ..WriteLineWithCode(file,"///w ##Class("_MPath_".DHC"_TableInnerName_").Save"_TableInnerName_"MTHD("""")")d ..WriteLineWithCode(file,"///"_TableInnerName)d ..WriteLineWithCode(file,"ClassMethod Save"_TableInnerName_"MTHD(SaveStr As %String(MAXLEN=99999999), P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String")d ..WriteLineWithCode(file,"{")d ..WriteLineWithCode(file,"	s SaveStr=$g(SaveStr)")d ..WriteLineWithCode(file,"	s Sessions=$g(Sessions)")d ..WriteLineWithCode(file,"	s UserDR=$p(Sessions,""^"",1)")d ..WriteLineWithCode(file,"	s WorkGroupDR=$p(Sessions,""^"",2)")d ..WriteLineWithCode(file,"	s HospitalDR=$p(Sessions,""^"",5)")d ..WriteLineWithCode(file,"	s sp=""$CSP$""")d ..WriteLineWithCode(file,"	//得到主键,为空就插入数据,否则就更新数据")d ..WriteLineWithCode(file,"	s RowID=$p(SaveStr,sp,1)")d ..WriteLineWithCode(file,"	s SaveObj=""""")d ..WriteLineWithCode(file,"	i '$l(RowID) d")d ..WriteLineWithCode(file,"	.s SaveObj=##Class(dbo."_TableInnerName_").%New()")d ..WriteLineWithCode(file,"	e  d")d ..WriteLineWithCode(file,"	.s SaveObj=##Class(dbo."_TableInnerName_").%OpenId(RowID)")s Index=0s RowSpec="RowID"While(rset.Next()){s outStr=""s colField=rset.GetColumnName(1)s colName=rset.GetDataByName(colField)s colField1=rset.GetColumnName(2)s colType=rset.GetDataByName(colField1)s colField2=rset.GetColumnName(3)s colLen=rset.GetDataByName(colField2)s colField3=rset.GetColumnName(4)s colDesc=rset.GetDataByName(colField3)s Index=Index+1i colName="RowID" continues RowSpec=RowSpec_","_colNamed ..WriteLineWithCode(file,"	s SaveObj."_colName_"=$p(SaveStr,sp,"_Index_")")}d ..WriteLineWithCode(file,"	s sc=SaveObj.%Save()")d ..WriteLineWithCode(file,"	i ('$SYSTEM.Status.IsOK(sc)) d")d ..WriteLineWithCode(file,"	.THROW ##class(%Exception.SystemException).%New(""事务委托"",""D"",,""-1^保存"_TableInnerName_"失败:""_$SYSTEM.Status.GetErrorText(sc))")d ..WriteLineWithCode(file,"	q """"")d ..WriteLineWithCode(file,"}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")//构造删除数据代码d ..WriteLineWithCode(file,"///"_$zd($h,8))d ..WriteLineWithCode(file,"///删除数据,多个RowID以上尖号分割,返回空成功,非空为失败原因")d ..WriteLineWithCode(file,"///w ##Class("_MPath_".DHC"_TableInnerName_").Delete"_TableInnerName_"MTHD(1030,"""","""","""","""","""","""","""","""","""","""","""","""","""","""")")d ..WriteLineWithCode(file,"///"_TableInnerName)d ..WriteLineWithCode(file,"ClassMethod Delete"_TableInnerName_"MTHD(RowIDS As %String(MAXLEN=99999999), P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String")d ..WriteLineWithCode(file,"{")d ..WriteLineWithCode(file,"	s RowIDS=$g(RowIDS)")d ..WriteLineWithCode(file,"	s Sessions=$g(Sessions)")d ..WriteLineWithCode(file,"	//托管事务删除数据")d ..WriteLineWithCode(file,"	q ##Class(LIS.WS.DHCLISServiceBase).DeclarativeTrans(""LIS.WS.BLL.DHC"_TableInnerName_""",""Delete"_TableInnerName_"Do"",RowIDS, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions)")d ..WriteLineWithCode(file,"}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"///"_$zd($h,8))d ..WriteLineWithCode(file,"///删除数据,多个RowID以上尖号分割")d ..WriteLineWithCode(file,"///w ##Class("_MPath_".DHC"_TableInnerName_").Delete"_TableInnerName_"Do(1030)")d ..WriteLineWithCode(file,"///"_TableInnerName)d ..WriteLineWithCode(file,"ClassMethod Delete"_TableInnerName_"Do(RowIDS As %String(MAXLEN=99999999), P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String")d ..WriteLineWithCode(file,"{")d ..WriteLineWithCode(file,"	s RowIDS=$g(RowIDS)")d ..WriteLineWithCode(file,"	s Sessions=$g(Sessions)")d ..WriteLineWithCode(file,"	s Sessions=$g(Sessions)")d ..WriteLineWithCode(file,"	s UserDR=$p(Sessions,""^"",1)")d ..WriteLineWithCode(file,"	s WorkGroupDR=$p(Sessions,""^"",2)")d ..WriteLineWithCode(file,"	s HospitalDR=$p(Sessions,""^"",5)")d ..WriteLineWithCode(file,"	f i=1:1:$l(RowIDS,""^"") d")d ..WriteLineWithCode(file,"	.s RowID=$p(RowIDS,""^"",i)")d ..WriteLineWithCode(file,"	.s sc=##Class(dbo."_TableInnerName_").%DeleteId(RowID)")d ..WriteLineWithCode(file,"	.i ('$SYSTEM.Status.IsOK(sc)) d")d ..WriteLineWithCode(file,"	..THROW ##class(%Exception.SystemException).%New(""事务委托"",""D"",,""-1^删除"_TableInnerName_"失败:""_$SYSTEM.Status.GetErrorText(sc))")d ..WriteLineWithCode(file,"	q """"")d ..WriteLineWithCode(file,"}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")//构造查询代码d ..WriteLineWithCode(file,"///"_$zd($h,8))d ..WriteLineWithCode(file,"///查询数据,查询条件自己改")d ..WriteLineWithCode(file,"///"_TableInnerName)d ..WriteLineWithCode(file,"Query Qry"_TableInnerName_"(Filter, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, PageSize, PageIndex, Sessions, Output RowCount As %String) As %Query")d ..WriteLineWithCode(file,"{")d ..WriteLineWithCode(file,"}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"/// 构造输出列")d ..WriteLineWithCode(file,"ClassMethod Qry"_TableInnerName_"GetInfo(ByRef colinfo As %List, ByRef parminfo As %List, ByRef idinfo As %List, ByRef qHandle As %Binary, extoption As %Integer = 0, extinfo As %List) As %Status")d ..WriteLineWithCode(file,"{")d ..WriteLineWithCode(file,"	Set RowSpec=$LIST(qHandle,4)")d ..WriteLineWithCode(file,"	f i=1:1:$l(RowSpec,"","") d")d ..WriteLineWithCode(file,"	.s OneCol=$p(RowSpec,"","",i)")d ..WriteLineWithCode(file,"	.s OneColType=$p(OneCol,"":"",2)")d ..WriteLineWithCode(file,"	.s OneCol=$p(OneCol,"":"",1)")d ..WriteLineWithCode(file,"	.i i=1 s colinfo=$lb($lb(OneCol,OneColType))")d ..WriteLineWithCode(file,"	.e  s colinfo=colinfo_$lb($lb(OneCol,OneColType))")d ..WriteLineWithCode(file,"	s parminfo = """"")d ..WriteLineWithCode(file,"	s idinfo = """"")d ..WriteLineWithCode(file,"	q $$$OK")d ..WriteLineWithCode(file,"}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"/// 在Execute控制RowSpec输出列")d ..WriteLineWithCode(file,"/// Query的执行方法")d ..WriteLineWithCode(file,"/// d ##class(%ResultSet).RunQuery("""_""_MPath_".DHC"_TableInnerName_""",""Qry"_TableInnerName_""","""","""","""","""","""","""","""","""","""","""","""","""","""","""","""","""")")d ..WriteLineWithCode(file,"ClassMethod Qry"_TableInnerName_"Execute(ByRef qHandle As %Binary, Filter, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, PageSize, PageIndex, Sessions, Output RowCount As %String) As %Status")d ..WriteLineWithCode(file,"{")d ..WriteLineWithCode(file,"	s Filter=$g(Filter)")d ..WriteLineWithCode(file,"	s IsPer=0")d ..WriteLineWithCode(file,"	//指定输出列,和RowSpec保存一致,冒号指定类型")d ..WriteLineWithCode(file,"	s RowSpec="""_RowSpec_"""")d ..WriteLineWithCode(file,"	//得到repid和初始化ind")d ..WriteLineWithCode(file,"	Set ColFields = """_RowSpec_"""")d ..WriteLineWithCode(file," 	Set repid=$I(^CacheTemp)")d ..WriteLineWithCode(file,"	If $Get(ind)="""" Set ind=1")d ..WriteLineWithCode(file,"	//输出数据逻辑,这段逻辑可以动态改RowSpec控制输出列")d ..WriteLineWithCode(file,"	s RowID="""" f  s RowID=$o(^dbo."_TableInnerName_"I(""PK"_$zcvt(TableInnerName,"U")_""",RowID)) q:RowID=""""  d")d ..WriteLineWithCode(file,"	.d OutPutRow")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"	//第4个参数不可少")d ..WriteLineWithCode(file," 	Set qHandle=$lb(0,repid,0,RowSpec)")d ..WriteLineWithCode(file,"	Quit $$$OK")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"OutPutRow")d ..WriteLineWithCode(file,"	s OneRowData=$g(^dbo."_TableInnerName_"D(RowID))")f i=2:1:$l(RowSpec,",") d.s OneName=$p(RowSpec,",",i).d ..WriteLineWithCode(file,"	s "_OneName_"=$lg(OneRowData,"_i_")").d ..WriteLineWithCode(file,"	i $l(Filter),"_OneName_"[Filter s IsPer=1")d ..WriteLineWithCode(file,"	i $l(Filter),(IsPer=0) q")d ..WriteLineWithCode(file,"	s Data = $lb("_RowSpec_")")d ..WriteLineWithCode(file,"	Set ^CacheTemp(repid,ind)=##Class(LIS.Util.Common).TransListNull(Data,ColFields)")d ..WriteLineWithCode(file,"	Set ind=ind+1")d ..WriteLineWithCode(file,"	q")d ..WriteLineWithCode(file,"}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"ClassMethod Qry"_TableInnerName_"Close(ByRef qHandle As %Binary) As %Status [ PlaceAfter = Qry"_TableInnerName_"Execute ]")d ..WriteLineWithCode(file,"{")d ..WriteLineWithCode(file,"	Set repid=$LIST(qHandle,2)")d ..WriteLineWithCode(file," 	Kill ^CacheTemp(repid)")d ..WriteLineWithCode(file,"	Quit $$$OK")d ..WriteLineWithCode(file,"}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"ClassMethod Qry"_TableInnerName_"Fetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = Qry"_TableInnerName_"Execute ]")d ..WriteLineWithCode(file,"{")d ..WriteLineWithCode(file," 	Set AtEnd=$LIST(qHandle,1)")d ..WriteLineWithCode(file," 	Set repid=$LIST(qHandle,2)")d ..WriteLineWithCode(file," 	Set ind=$LIST(qHandle,3)")d ..WriteLineWithCode(file," 	Set ind=$o(^CacheTemp(repid,ind))")d ..WriteLineWithCode(file," 	If ind="""" {	")d ..WriteLineWithCode(file," 		Set AtEnd=1")d ..WriteLineWithCode(file," 		Set Row=""""")d ..WriteLineWithCode(file," 	}")d ..WriteLineWithCode(file," 	Else      {	")d ..WriteLineWithCode(file," 		Set Row=^CacheTemp(repid,ind)")d ..WriteLineWithCode(file," 	}")d ..WriteLineWithCode(file," 	// Save QHandle")d ..WriteLineWithCode(file," 	s qHandle=$lb(AtEnd,repid,ind)")d ..WriteLineWithCode(file,"	Quit $$$OK")d ..WriteLineWithCode(file,"}")d ..WriteLineWithCode(file,"}")d file.Close()q "代码生成在:"_logName
}/// 构造表的增删改查的界面代码,以简化常规表界面代码工作量
/// 编码格式改WriteLineWithCode
/// w ##class(Demo.CodeGener).MakeAspxCode("SYS_TableEnum")
/// w ##class(Demo.CodeGener).MakeAspxCode("RP_VisitNumber")
ClassMethod MakeAspxCode(TableName, PathAdd, MPath, AshxDir)
{s TableName=$g(TableName)s PathAdd=$g(PathAdd)s MPath=$g(MPath)s AshxDir=$g(AshxDir)i '$l(MPath) s MPath="LIS.WS.BLL"i '$l(AshxDir) s AshxDir="lis"s ClassName=$tr(TableName,"_")s ClassName=$tr(TableName,"_")s rset = ##class(%ResultSet).%New()d rset.Prepare("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,DESCRIPTION,IS_NULLABLE FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='dbo'  and TABLE_NAME='"_TableName_"'")s exeret=rset.Execute()s colCount=rset.GetColumnCount()Set repid=$I(^CacheTemp)k ^TMP($zn,repid,$j)s IsLinux=1s logpath=""i ##class(%SYSTEM.Version).GetOS()="Windows" s IsLinux=0//默认路径i '$l(logpath) d.i IsLinux=0 d..s logpath="D:\".e  d..s logpath="/"s logName=logpath_PathAdd_"frm"_$tr(TableName,"_")_".aspx"//方法名,查询名s TableInnerName=$tr(TableName,"_")//不存在目录就创建i '##class(%File).DirectoryExists(logpath_PathAdd) d.d ##class(%File).CreateNewDir(logpath_PathAdd,"")s file=##class(%File).%New(logName)//存在就追加i ##class(%File).Exists(logName) d.d ##class(%File).Delete(logName).d file.Open("WSN:/SHARED:/IOTABLE=""UTF8""")//不存在就新建e  d.d file.Open("WSN:/SHARED:/IOTABLE=""UTF8""")s RowSpec="RowID"s RowLen="10"s RowRemark="主键"While(rset.Next()){s outStr=""s colField=rset.GetColumnName(1)s colName=rset.GetDataByName(colField)s colField1=rset.GetColumnName(2)s colType=rset.GetDataByName(colField1)s colField2=rset.GetColumnName(3)s colLen=rset.GetDataByName(colField2)s colField3=rset.GetColumnName(4)s colDesc=rset.GetDataByName(colField3)s colField4=rset.GetColumnName(5)s NULLABLE=rset.GetDataByName(colField4)i colName="RowID" continues RowSpec=RowSpec_","_colNames type=colTypei colType="integer" d.s type="int".s colLen=10.i NULLABLE="YES" d..s type=type_"?"i colType="bigint" d.s type="int".s colLen=10.i NULLABLE="YES" d..s type=type_"?"i colType="smallint" d.s type="int".s colLen=10.i NULLABLE="YES" d..s type=type_"?"i colType="tinyint" d.s type="int".s colLen=10.i NULLABLE="YES" d..s type=type_"?"e  i colType="varchar" d.s type="string"e  i colType="bit" d.s type="bool".s colLen=1.i NULLABLE="YES" d..s type=type_"?"e  i colType="double" d.s type="double".s colLen=10.i NULLABLE="YES" d..s type=type_"?"e  i colType="numeric" d.s type="double".s colLen=10.i NULLABLE="YES" d..s type=type_"?"s RowLen=RowLen_","_colLens colDesc=$tr(colDesc," ")s RowRemark=RowRemark_","_colDesc}//写类头部d ..WriteLineWithCode(file,"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">")d ..WriteLineWithCode(file,"<html xmlns=""http://www.w3.org/1999/xhtml"">")d ..WriteLineWithCode(file,"<head>")d ..WriteLineWithCode(file,"    <meta http-equiv=""Content-Type"" content=""text/html;charset=utf-8"" />")d ..WriteLineWithCode(file,"    <title>供拷贝代码使用</title>")d ..WriteLineWithCode(file,"    <link rel=""shortcut icon"" href=""../../resource/common/images/favicon.ico"" />")d ..WriteLineWithCode(file,"    <script src=""../../resource/common/js/lis-commonHISUI.js"" type=""text/javascript""></script>")d ..WriteLineWithCode(file,"    <script language=""javascript"" type=""text/javascript"">")d ..WriteLineWithCode(file,"        LISSYSPageCommonInfo.Init();")d ..WriteLineWithCode(file,"        var BasePath = '';")d ..WriteLineWithCode(file,"        var ResourcePath = '';")d ..WriteLineWithCode(file,"        var WebServicAddress = LISSYSPageCommonInfo.Data.WebServicAddress;")d ..WriteLineWithCode(file,"        var UserDR = LISSYSPageCommonInfo.Data.Sesssion.UserDR;")d ..WriteLineWithCode(file,"        var WorkGroupDR = LISSYSPageCommonInfo.Data.Sesssion.WorkGroupDR;")d ..WriteLineWithCode(file,"        var sysTheme = LISSYSPageCommonInfo.Data.Sesssion.Theme;")d ..WriteLineWithCode(file,"        var SessionStr = LISSYSPageCommonInfo.Data.SessionStr;")d ..WriteLineWithCode(file,"    </script>")d ..WriteLineWithCode(file,"    <script type=""text/javascript"">")d ..WriteLineWithCode(file,"        //全局变量")d ..WriteLineWithCode(file,"        var me = {")d ..WriteLineWithCode(file,"            actionUrl: '../ashx/ash"_TableInnerName_".ashx'")d ..WriteLineWithCode(file,"        };")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"        //jquery入口")d ..WriteLineWithCode(file,"        $(function () {")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"            //新增数据点击")d ..WriteLineWithCode(file,"            $(""#btnAdd"_TableInnerName_""").click(function () {")d ..WriteLineWithCode(file,"                $(""#txt"_TableInnerName_"RowID"").val(""""); ")d ..WriteLineWithCode(file,"				$('#winEdit"_TableInnerName_"').window({")d ..WriteLineWithCode(file,"                    title: TranslateDataMTHD('Add Data', '新增数据', ''),")d ..WriteLineWithCode(file,"                    modal: true")d ..WriteLineWithCode(file,"                });")d ..WriteLineWithCode(file,"            });")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"            //修改数据点击")d ..WriteLineWithCode(file,"            $(""#btnUpdate"_TableInnerName_""").click(function () {")d ..WriteLineWithCode(file,"				Update"_TableInnerName_"();")d ..WriteLineWithCode(file,"            });")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"			//修改数据")d ..WriteLineWithCode(file,"			function Update"_TableInnerName_"(row)")d ..WriteLineWithCode(file,"			{")d ..WriteLineWithCode(file,"                var selectRow = $('#dg"_TableInnerName_"').datagrid(""getSelected"");")d ..WriteLineWithCode(file,"                if(row!=null)")d ..WriteLineWithCode(file,"                {")d ..WriteLineWithCode(file,"                	selectRow=row;")d ..WriteLineWithCode(file,"                }")d ..WriteLineWithCode(file,"                if (selectRow == null) {")d ..WriteLineWithCode(file,"                    $.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to modify', '请选择要修改的数据!', ''), 'info');")d ..WriteLineWithCode(file,"                    return;")d ..WriteLineWithCode(file,"                }")d ..WriteLineWithCode(file,"				$(""#form"_TableInnerName_""").form('load', selectRow);")d ..WriteLineWithCode(file,"				$('#winEdit"_TableInnerName_"').window({")d ..WriteLineWithCode(file,"                    title: TranslateDataMTHD('Update Data', '修改数据', ''),")d ..WriteLineWithCode(file,"                    modal: true")d ..WriteLineWithCode(file,"                });")d ..WriteLineWithCode(file,"			}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"            //删除数据点击")d ..WriteLineWithCode(file,"            $(""#btnDelete"_TableInnerName_""").click(function () {")d ..WriteLineWithCode(file,"                var checkRow = $('#dg"_TableInnerName_"').datagrid(""getChecked"");")d ..WriteLineWithCode(file,"                var selectRow = $('#dg"_TableInnerName_"').datagrid(""getSelected"");")d ..WriteLineWithCode(file,"                if ((checkRow == null || checkRow.length == 0)&&selectRow==null) {")d ..WriteLineWithCode(file,"                    $.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to delete', '请勾选要删除的数据!', ''), 'info');")d ..WriteLineWithCode(file,"                    return;")d ..WriteLineWithCode(file,"                }")d ..WriteLineWithCode(file,"                if ((checkRow == null || checkRow.length == 0)) {")d ..WriteLineWithCode(file,"                    checkRow=[selectRow];")d ..WriteLineWithCode(file,"                }")d ..WriteLineWithCode(file,"                var RowIDS = """";")d ..WriteLineWithCode(file,"                for (var i = 0; i < checkRow.length; i++) {")d ..WriteLineWithCode(file,"                    if (i == 0) {")d ..WriteLineWithCode(file,"                        RowIDS = checkRow[i].RowID;")d ..WriteLineWithCode(file,"                    }")d ..WriteLineWithCode(file,"                    else {")d ..WriteLineWithCode(file,"                        RowIDS += ""^"" + checkRow[i].RowID;")d ..WriteLineWithCode(file,"                    }")d ..WriteLineWithCode(file,"                }")d ..WriteLineWithCode(file,"                $.messager.confirm(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Do you want to delete the selected data', '是否要删除选择的数据?', '') , function (r) {")d ..WriteLineWithCode(file,"                    if (r) {")d ..WriteLineWithCode(file,"                		//开启等待")d ..WriteLineWithCode(file,"                		$.messager.progress({ text: TranslateDataMTHD(""Deleting data"",""正在删除数据"", """"), interval: 500 });")d ..WriteLineWithCode(file,"                		setTimeout(function () {")d ..WriteLineWithCode(file,"                    		$.messager.progress('close');")d ..WriteLineWithCode(file,"                		}, 8000);")d ..WriteLineWithCode(file,"                		//往后台提交数据")d ..WriteLineWithCode(file,"                		$.ajax({")d ..WriteLineWithCode(file,"                    		type: ""post"",")d ..WriteLineWithCode(file,"                    		dataType: ""json"",")d ..WriteLineWithCode(file,"                    		cache: false, //")d ..WriteLineWithCode(file,"                    		async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir")d ..WriteLineWithCode(file,"                    		url: me.actionUrl + '?Method=Delete"_TableInnerName_"',")d ..WriteLineWithCode(file,"                    		data: { RowIDS: RowIDS },")d ..WriteLineWithCode(file,"                    		success: function (data, status) {")d ..WriteLineWithCode(file,"                        		$.messager.progress('close');")d ..WriteLineWithCode(file,"                        		if (!FilterBackData(data)) {")d ..WriteLineWithCode(file,"                            		return;")d ..WriteLineWithCode(file,"                        		}")d ..WriteLineWithCode(file,"                        		if (!data.IsOk) {")d ..WriteLineWithCode(file,"                            		$.messager.alert(TranslateDataMTHD(""Error message"", ""错误提示"", """"), TranslateDataMTHD(""failed to dalete data, error message:"", ""删除失败,错误信息:"", """") + data.Message);")d ..WriteLineWithCode(file,"                        		}")d ..WriteLineWithCode(file,"                        		else {")d ..WriteLineWithCode(file,"                            		Qry"_TableInnerName_"();")d ..WriteLineWithCode(file,"                            		$.messager.show({")d ..WriteLineWithCode(file,"                                		title: TranslateDataMTHD(""Info"", ""提示"", """"),")d ..WriteLineWithCode(file,"                               		 	msg: TranslateDataMTHD(""Successfully deleted!"", ""删除成功!"", """"),")d ..WriteLineWithCode(file,"                                		timeout: 500,")d ..WriteLineWithCode(file,"                                		showType: 'slide'")d ..WriteLineWithCode(file,"                            		});")d ..WriteLineWithCode(file,"                        		}")d ..WriteLineWithCode(file,"                    		}")d ..WriteLineWithCode(file,"                		});")d ..WriteLineWithCode(file,"                    }")d ..WriteLineWithCode(file,"                });")d ..WriteLineWithCode(file,"            });")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"            //保存数据")d ..WriteLineWithCode(file,"            $(""#btnSave"_TableInnerName_""").click(function () {")d ..WriteLineWithCode(file,"                var saveData = jQuery.parseJSON($(""#form"_TableInnerName_""").serializeObject());")d ..WriteLineWithCode(file,"                //开启等待")d ..WriteLineWithCode(file,"                $.messager.progress({ text: TranslateDataMTHD(""Saving data"",""正在保存数据"", """"), interval: 500 });")d ..WriteLineWithCode(file,"                setTimeout(function () {")d ..WriteLineWithCode(file,"                    $.messager.progress('close');")d ..WriteLineWithCode(file,"                }, 8000);")d ..WriteLineWithCode(file,"                //往后台提交数据")d ..WriteLineWithCode(file,"                $.ajax({")d ..WriteLineWithCode(file,"                    type: ""post"",")d ..WriteLineWithCode(file,"                    dataType: ""json"",")d ..WriteLineWithCode(file,"                    cache: false, //")d ..WriteLineWithCode(file,"                    async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir")d ..WriteLineWithCode(file,"                    url: me.actionUrl + '?Method=Save"_TableInnerName_"',")d ..WriteLineWithCode(file,"                    data: saveData,")d ..WriteLineWithCode(file,"                    success: function (data, status) {")d ..WriteLineWithCode(file,"                        $.messager.progress('close');")d ..WriteLineWithCode(file,"                        if (!FilterBackData(data)) {")d ..WriteLineWithCode(file,"                            return;")d ..WriteLineWithCode(file,"                        }")d ..WriteLineWithCode(file,"                        if (!data.IsOk) {")d ..WriteLineWithCode(file,"                            $.messager.alert(TranslateDataMTHD(""Error message"", ""错误提示"", """"), TranslateDataMTHD(""failed to dalete data, error message:"", ""删除失败,错误信息:"", """") + data.Message);")d ..WriteLineWithCode(file,"                        }")d ..WriteLineWithCode(file,"                        else {")d ..WriteLineWithCode(file,"                            Qry"_TableInnerName_"();")d ..WriteLineWithCode(file,"                            $.messager.show({")d ..WriteLineWithCode(file,"                                title: TranslateDataMTHD(""Info"", ""提示"", """"),")d ..WriteLineWithCode(file,"                                msg: TranslateDataMTHD(""Successfully saveed!"", ""保存成功!"", """"),")d ..WriteLineWithCode(file,"                                timeout: 500,")d ..WriteLineWithCode(file,"                                showType: 'slide'")d ..WriteLineWithCode(file,"                            });")d ..WriteLineWithCode(file,"                            $('#winEdit"_TableInnerName_"').window(""close"");")d ..WriteLineWithCode(file,"                        }")d ..WriteLineWithCode(file,"                    }")d ..WriteLineWithCode(file,"                });")d ..WriteLineWithCode(file,"            });")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"            //关闭窗口")d ..WriteLineWithCode(file,"            $(""#btnClose"_TableInnerName_""").click(function () {")d ..WriteLineWithCode(file,"				$('#winEdit"_TableInnerName_"').window(""close"");")d ..WriteLineWithCode(file,"            });")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"            //构造查询事件")d ..WriteLineWithCode(file,"            $(""#txtFilter"_TableInnerName_""").searchbox({")d ..WriteLineWithCode(file,"                searcher: function (value, name) {")d ..WriteLineWithCode(file,"                    Qry"_TableInnerName_"();")d ..WriteLineWithCode(file,"                },")d ..WriteLineWithCode(file,"                prompt: TranslateDataMTHD('Enter query', '回车查询', '')")d ..WriteLineWithCode(file,"            });")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")f i=1:1:$l(RowSpec,",") d.s colName=$p(RowSpec,",",i).s colLen=$p(RowLen,",",i).s remark=$p(RowRemark,",",i).//外键参照信息.s refInfo=..GetForeignKeyInfo(colName,TableName).//有外键.i $l(refInfo) d..d ..WriteLineWithCode(file,"            //"_remark_"下拉表格渲染")..d ..WriteLineWithCode(file,"            $('#txt"_TableInnerName_colName_"').combogrid({")..d ..WriteLineWithCode(file,"                panelWidth: 350,")..d ..WriteLineWithCode(file,"                idField: 'RowID',")..d ..WriteLineWithCode(file,"                textField: '"_$p(refInfo,"^",3)_"',")..d ..WriteLineWithCode(file,"                url: me.actionUrl + '?Method=CommonQueryView&data='+JSON.stringify({ ModelName: """_$p(refInfo,"^",1)_""", Pram: [], IsDisplayCount: false, Joiner: [], Operators: [] }),")..d ..WriteLineWithCode(file,"                columns: [[")..d ..WriteLineWithCode(file,"                    { field: 'RowID', title: '主键', width: 60 },")..d ..WriteLineWithCode(file,"                    { field: '"_$p(refInfo,"^",3)_"', title: '名称', width: 260 }")..d ..WriteLineWithCode(file,"                ]]")..d ..WriteLineWithCode(file,"            });").//没外键.e  i $l(colName)>4 d..s LastName=$e(colName,$l(colName)-3,$l(colName))..i LastName="Date" d...d ..WriteLineWithCode(file,"            //"_remark_"日期渲染")...d ..WriteLineWithCode(file,"            $('#txt"_TableInnerName_colName_"').datebox({")...d ..WriteLineWithCode(file,"                required:false,")...d ..WriteLineWithCode(file,"                editable: true,")...d ..WriteLineWithCode(file,"                formatter: DateFormatter,")...d ..WriteLineWithCode(file,"                parser: DateParser")...d ..WriteLineWithCode(file,"            });")...d ..WriteLineWithCode(file,"            //设置默认日期")...d ..WriteLineWithCode(file,"            $('#txt"_TableInnerName_colName_"').datebox(""setValue"",GetCurentDate())")..i LastName="Time" d...d ..WriteLineWithCode(file,"            //"_remark_"时间渲染")...d ..WriteLineWithCode(file,"            $('#txt"_TableInnerName_colName_"').timespinner({")...d ..WriteLineWithCode(file,"                required:false,")...d ..WriteLineWithCode(file,"                editable: true,")...d ..WriteLineWithCode(file,"                showSeconds: true")...d ..WriteLineWithCode(file,"            });")...d ..WriteLineWithCode(file,"            //设置默认日期")...d ..WriteLineWithCode(file,"            $('#txt"_TableInnerName_colName_"').timespinner(""setValue"",GetCurentTime())")//构造表格代码d ..WriteLineWithCode(file,"            //"_TableInnerName_"表格")d ..WriteLineWithCode(file,"            $('#dg"_TableInnerName_"').datagrid({")d ..WriteLineWithCode(file,"                singleSelect: true,")d ..WriteLineWithCode(file,"                toolbar: ""#dg"_TableInnerName_"ToolBar"",")d ..WriteLineWithCode(file,"                fit: true,")d ..WriteLineWithCode(file,"                onDblClickRow: function (index, row) {")d ..WriteLineWithCode(file,"                    Update"_TableInnerName_"(row);")d ..WriteLineWithCode(file,"                },")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"                columns: [[")d ..WriteLineWithCode(file,"                    { field: 'ChkFlag', title: TranslateDataMTHD('Check', '选择', ''), width: 20, sortable: true, align: 'center', checkbox: true },")f i=1:1:$l(RowSpec,",") d.s colName=$p(RowSpec,",",i).s colLen=$p(RowLen,",",i).s remark=$p(RowRemark,",",i).s endChar=",".i i=$l(RowSpec,",") s endChar="".d ..WriteLineWithCode(file,"                    { field: '"_colName_"', title: TranslateDataMTHD('"_colName_"', '"_remark_"', '') , width: 150 }"_endChar)d ..WriteLineWithCode(file,"                ]]")d ..WriteLineWithCode(file,"            });")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")//构造查询表格方法代码d ..WriteLineWithCode(file,"            //查询"_TableInnerName)d ..WriteLineWithCode(file,"            function Qry"_TableInnerName_"() {")d ..WriteLineWithCode(file,"                var Filter = $(""#txtFilter"_TableInnerName_""").searchbox(""getValue"");")d ..WriteLineWithCode(file,"                //开启等待")d ..WriteLineWithCode(file,"                $.messager.progress({ text: TranslateDataMTHD(""Querying data"",""正在查询数据"", """"), interval: 500 });")d ..WriteLineWithCode(file,"                setTimeout(function () {")d ..WriteLineWithCode(file,"                    $.messager.progress('close');")d ..WriteLineWithCode(file,"                }, 8000);")d ..WriteLineWithCode(file,"                $.ajax({")d ..WriteLineWithCode(file,"                    type: ""post"",")d ..WriteLineWithCode(file,"                    dataType: ""json"",")d ..WriteLineWithCode(file,"                    cache: false, //")d ..WriteLineWithCode(file,"                    async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir")d ..WriteLineWithCode(file,"                    url: me.actionUrl + '?Method=Qry"_TableInnerName_"',")d ..WriteLineWithCode(file,"                    data: { Filter: Filter },")d ..WriteLineWithCode(file,"                    success: function (data, status) {")d ..WriteLineWithCode(file,"                        //结束等待")d ..WriteLineWithCode(file,"                        $.messager.progress('close');")d ..WriteLineWithCode(file,"                        $('#dg"_TableInnerName_"').datagrid(""loadData"", data);")d ..WriteLineWithCode(file,"                    }")d ..WriteLineWithCode(file,"                });")d ..WriteLineWithCode(file,"            };")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"            //执行查询数据")d ..WriteLineWithCode(file,"            Qry"_TableInnerName_"();")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")s windowHeight=$l(RowSpec,",")*48d ..WriteLineWithCode(file,"		});")d ..WriteLineWithCode(file,"    </script>")d ..WriteLineWithCode(file,"</head>")d ..WriteLineWithCode(file,"<body>")d ..WriteLineWithCode(file,"    <div class=""hisui-layout"" fit=""true"" style=""border: none;"">")d ..WriteLineWithCode(file,"        <div data-options=""region:'center',title:''"" style=""border: none;"">")d ..WriteLineWithCode(file,"            <div id=""dg"_TableInnerName_"ToolBar"" style=""padding: 3px 0px 3px 10px;"">")d ..WriteLineWithCode(file,"                <a id=""btnAdd"_TableInnerName_""" href=""#"" class=""hisui-linkbutton"" data-options=""iconCls:'icon-add'"" plain=""true"" listranslate=""html~Add"">新增</a>")d ..WriteLineWithCode(file,"                <a id=""btnUpdate"_TableInnerName_""" href=""#"" class=""hisui-linkbutton"" data-options=""iconCls:'icon-write-order'"" plain=""true"" listranslate=""html~Mod"">修改</a>")d ..WriteLineWithCode(file,"                <a id=""btnDelete"_TableInnerName_""" href=""#"" class=""hisui-linkbutton"" data-options=""iconCls:'icon-cancel'"" plain=""true"" listranslate=""html~Del"">删除</a>")d ..WriteLineWithCode(file,"                <input id=""txtFilter"_TableInnerName_""" style=""margin-left: 14px; width: 240px;""></input>")d ..WriteLineWithCode(file,"            </div>")d ..WriteLineWithCode(file,"            <table id=""dg"_TableInnerName_""" title="""" iconcls=""icon-paper"" listranslate=""title~"_TableInnerName_"""></table>")d ..WriteLineWithCode(file,"        </div>")d ..WriteLineWithCode(file,"        <div id=""winEdit"_TableInnerName_""" style=""padding: 10px 0px 0px 10px;width:"_360_"px;height:"_windowHeight_"px;"">")d ..WriteLineWithCode(file,"            <form id=""form"_TableInnerName_""" name=""edit_form"" method=""post"">")d ..WriteLineWithCode(file,"                <input type=""hidden"" id=""txt"_TableInnerName_"RowID"" name=""RowID"" value=""0"" />")d ..WriteLineWithCode(file,"                <table>")f i=1:1:$l(RowSpec,",") d.s colName=$p(RowSpec,",",i).i colName="RowID" q.s colLen=$p(RowLen,",",i).s remark=$p(RowRemark,",",i).d ..WriteLineWithCode(file,"                    <tr>").d ..WriteLineWithCode(file,"                        <td class=""lisar"" listranslate=""html~"_colName_""">"_remark_"</td>").//外键参照信息.s refInfo=..GetForeignKeyInfo(colName,TableName).//有外键.i $l(refInfo) d..d ..WriteLineWithCode(file,"                        <td class=""lisal""><input id=""txt"_TableInnerName_colName_""" type=""text"" name="""_colName_""" style=""width:200px;""/></td>").//没外键.e  d..d ..WriteLineWithCode(file,"                        <td class=""lisal""><input id=""txt"_TableInnerName_colName_""" type=""text"" name="""_colName_""" style=""width:200px;"" class=""hisui-validatebox""  maxlength="""_colLen_"""/></td>").d ..WriteLineWithCode(file,"                    </tr>")d ..WriteLineWithCode(file,"                </table>")d ..WriteLineWithCode(file,"                <div region=""south"" border=""fale"" style=""text-align: center; padding: 5px 0 0;"">")d ..WriteLineWithCode(file,"                    <a id=""btnSave"_TableInnerName_""" href=""#"" class=""hisui-linkbutton"" plain=""false"" listranslate=""html~Save"">保存</a>")d ..WriteLineWithCode(file,"                    <span class=""sp6""></span>")d ..WriteLineWithCode(file,"                    <a id=""btnClose"_TableInnerName_""" href=""#"" class=""hisui-linkbutton"" plain=""false"" listranslate=""html~Cancel"">取消</a>")d ..WriteLineWithCode(file,"                </div>")d ..WriteLineWithCode(file,"            </form>")d ..WriteLineWithCode(file,"        </div>")d ..WriteLineWithCode(file,"</body>")d ..WriteLineWithCode(file,"</html>")d ..WriteLineWithCode(file,"")q "代码生成在:"_logName
}/// 构造表的增删改查M类的C#调用代码,以简化常规表M代码和C#调用代码工作量
/// 编码格式改WriteLineWithCode
/// w ##class(Demo.CodeGener).MakeTableCSharpCallCode("SYS_TableEnum")
/// w ##class(Demo.CodeGener).MakeTableCSharpCallCode("RP_VisitNumber")
ClassMethod MakeTableCSharpCallCode(TableName, PathAdd, MPath, AshxDir)
{s TableName=$g(TableName)s PathAdd=$g(PathAdd)s MPath=$g(MPath)s AshxDir=$g(AshxDir)i '$l(MPath) s MPath="LIS.WS.BLL"i '$l(AshxDir) s AshxDir="lis"s ClassName=$tr(TableName,"_")s ClassName=$tr(TableName,"_")s rset = ##class(%ResultSet).%New()d rset.Prepare("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,DESCRIPTION,IS_NULLABLE FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='dbo'  and TABLE_NAME='"_TableName_"'")s exeret=rset.Execute()s colCount=rset.GetColumnCount()Set repid=$I(^CacheTemp)k ^TMP($zn,repid,$j)s IsLinux=1s logpath=""i ##class(%SYSTEM.Version).GetOS()="Windows" s IsLinux=0//默认路径i '$l(logpath) d.i IsLinux=0 d..s logpath="D:\".e  d..s logpath="/"s logName=logpath_PathAdd_"ash"_$tr(TableName,"_")_".cs"//方法名,查询名s TableInnerName=$tr(TableName,"_")//不存在目录就创建i '##class(%File).DirectoryExists(logpath_PathAdd) d.d ##class(%File).CreateNewDir(logpath_PathAdd,"")s file=##class(%File).%New(logName)//存在就追加i ##class(%File).Exists(logName) d.d ##class(%File).Delete(logName).d file.Open("WSN:/SHARED:/IOTABLE=""UTF8""")//不存在就新建e  d.d file.Open("WSN:/SHARED:/IOTABLE=""UTF8""")//写类头部d ..WriteLineWithCode(file,"using System;")d ..WriteLineWithCode(file,"using System.Web;")d ..WriteLineWithCode(file,"using System.Reflection;")d ..WriteLineWithCode(file,"using System.Text;")d ..WriteLineWithCode(file,"using System.Data;")d ..WriteLineWithCode(file,"using System.Collections;")d ..WriteLineWithCode(file,"using System.Collections.Generic;")d ..WriteLineWithCode(file,"using LIS.Model.Entity;")d ..WriteLineWithCode(file,"using LIS.Model.Bussiness;")d ..WriteLineWithCode(file,"using Microsoft.AspNetCore.Http;")d ..WriteLineWithCode(file,"using iMedicalLIS;")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"///<summary  NoteObject=""Class"">")d ..WriteLineWithCode(file,"/// [功能描述:"_TableInnerName_"调用类] <para/>")d ..WriteLineWithCode(file,"/// [创建者:自动生成] <para/>")d ..WriteLineWithCode(file,"/// [创建时间:"_$zd($h,8)_"] <para/>")d ..WriteLineWithCode(file,"///<说明>")d ..WriteLineWithCode(file,"///  [说明:自定义操作自己改]<para/>")d ..WriteLineWithCode(file,"///</说明>")d ..WriteLineWithCode(file,"///<修改记录>")d ..WriteLineWithCode(file,"///    [修改时间:本次修改时间]<para/>")d ..WriteLineWithCode(file,"///</summary> ")d ..WriteLineWithCode(file,"namespace UI."_AshxDir_".ashx")d ..WriteLineWithCode(file,"{")//构造保存方法d ..WriteLineWithCode(file,"    public class ash"_TableInnerName_" : BaseHttpHandler")d ..WriteLineWithCode(file,"    {")d ..WriteLineWithCode(file,"        /// <summary>")d ..WriteLineWithCode(file,"        /// 保存数据,多列以$CSP$分割")d ..WriteLineWithCode(file,"        /// </summary>")d ..WriteLineWithCode(file,"        /// <returns></returns>")d ..WriteLineWithCode(file,"        public string Save"_TableInnerName_"()")d ..WriteLineWithCode(file,"        {")d ..WriteLineWithCode(file,"            //调用的后台类")d ..WriteLineWithCode(file,"            string className = """_MPath_".DHC"_TableInnerName_""";")d ..WriteLineWithCode(file,"            //调用的后台方法")d ..WriteLineWithCode(file,"            string funcName = ""Save"_TableInnerName_"MTHD"";")d ..WriteLineWithCode(file,"            string SaveStr="""";")d ..WriteLineWithCode(file,"            string sp=""$CSP$"";")s Index=0s RowSpec="RowID"d ..WriteLineWithCode(file,"            string RowID=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, ""RowID""), """");")While(rset.Next()){s outStr=""s colField=rset.GetColumnName(1)s colName=rset.GetDataByName(colField)s colField1=rset.GetColumnName(2)s colType=rset.GetDataByName(colField1)s colField2=rset.GetColumnName(3)s colLen=rset.GetDataByName(colField2)s colField3=rset.GetColumnName(4)s colDesc=rset.GetDataByName(colField3)s Index=Index+1i colName="RowID" continues RowSpec=RowSpec_","_colNamed ..WriteLineWithCode(file,"            string "_colName_"=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, """_colName_"""), """");")}s SaveCodeStr=$REPLACE(RowSpec,",","+sp+")d ..WriteLineWithCode(file,"            SaveStr="_SaveCodeStr_";")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"            Parameters param = new Parameters();")d ..WriteLineWithCode(file,"            param.P0=SaveStr;")d ..WriteLineWithCode(file,"            string logInfo = this.UserLogin.UserDR + ""^"" + this.UserLogin.WorkGroupDR + ""^"" + this.UserLogin.LocationDR + ""^"" + this.UserLogin.WorkGroupDR + ""^"" + this.UserLogin.HospitalDR;")d ..WriteLineWithCode(file,"            int rowCount;")d ..WriteLineWithCode(file,"            string ObjStr = LIS.DAL.DataAccess.WebManager.GetDataJSON(className, funcName, param, logInfo, false, out rowCount, out this.Err);")d ..WriteLineWithCode(file,"            if(ObjStr=="""")")d ..WriteLineWithCode(file,"            {")d ..WriteLineWithCode(file,"            	return Helper.Success();")d ..WriteLineWithCode(file,"            }")d ..WriteLineWithCode(file,"            else")d ..WriteLineWithCode(file,"            {")d ..WriteLineWithCode(file,"            	return Helper.Error(ObjStr);")d ..WriteLineWithCode(file,"            }")d ..WriteLineWithCode(file,"    	}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")    //构造删除方法d ..WriteLineWithCode(file,"        /// <summary>")d ..WriteLineWithCode(file,"        /// 删除数据,多个RowID以上尖号分割")d ..WriteLineWithCode(file,"        /// </summary>")d ..WriteLineWithCode(file,"        /// <returns></returns>")d ..WriteLineWithCode(file,"        public string Delete"_TableInnerName_"()")d ..WriteLineWithCode(file,"        {")d ..WriteLineWithCode(file,"            //调用的后台类")d ..WriteLineWithCode(file,"            string className = """_MPath_".DHC"_TableInnerName_""";")d ..WriteLineWithCode(file,"            //调用的后台方法")d ..WriteLineWithCode(file,"            string funcName = ""Delete"_TableInnerName_"MTHD"";")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"            Parameters param = new Parameters();")d ..WriteLineWithCode(file,"            param.P0=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, ""RowIDS""), """");")d ..WriteLineWithCode(file,"            string logInfo = this.UserLogin.UserDR + ""^"" + this.UserLogin.WorkGroupDR + ""^"" + this.UserLogin.LocationDR + ""^"" + this.UserLogin.WorkGroupDR + ""^"" + this.UserLogin.HospitalDR;")d ..WriteLineWithCode(file,"            int rowCount;")d ..WriteLineWithCode(file,"            string ObjStr = LIS.DAL.DataAccess.WebManager.GetDataJSON(className, funcName, param, logInfo, false, out rowCount, out this.Err);")d ..WriteLineWithCode(file,"            if(ObjStr=="""")")d ..WriteLineWithCode(file,"            {")d ..WriteLineWithCode(file,"            	return Helper.Success();")d ..WriteLineWithCode(file,"            }")d ..WriteLineWithCode(file,"            else")d ..WriteLineWithCode(file,"            {")d ..WriteLineWithCode(file,"            	return Helper.Error(ObjStr);")d ..WriteLineWithCode(file,"            }")d ..WriteLineWithCode(file,"    	}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")  //构造查询代码d ..WriteLineWithCode(file,"        /// <summary>")d ..WriteLineWithCode(file,"        /// 查询数据")d ..WriteLineWithCode(file,"        /// </summary>")d ..WriteLineWithCode(file,"        /// <returns></returns>")d ..WriteLineWithCode(file,"        public string Qry"_TableInnerName_"()")d ..WriteLineWithCode(file,"        {")d ..WriteLineWithCode(file,"            //调用的后台类")d ..WriteLineWithCode(file,"            string className = """_MPath_".DHC"_TableInnerName_""";")d ..WriteLineWithCode(file,"            //调用的后台方法")d ..WriteLineWithCode(file,"            string funcName = ""Qry"_TableInnerName_""";")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"        	//预留的取前台参数代码")s Index=0d ..WriteLineWithCode(file,"            string RowID=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, ""RowID""), """");")f i=1:1:$l(RowSpec,",") d.s colName=$p(RowSpec,",",i).i colName="RowID" q.d ..WriteLineWithCode(file,"            string "_colName_"=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, """_colName_"""), """");")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"            Parameters param = new Parameters();")d ..WriteLineWithCode(file,"            param.P0= Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, ""Filter""), """");")d ..WriteLineWithCode(file,"            string logInfo = this.UserLogin.UserDR + ""^"" + this.UserLogin.WorkGroupDR + ""^"" + this.UserLogin.LocationDR + ""^"" + this.UserLogin.WorkGroupDR + ""^"" + this.UserLogin.HospitalDR;")d ..WriteLineWithCode(file,"            int rowCount;")d ..WriteLineWithCode(file,"            string ObjStr = LIS.DAL.DataAccess.WebManager.GetDataJSON(className, funcName, param, logInfo, false, out rowCount, out this.Err);")d ..WriteLineWithCode(file,"            return ObjStr;")d ..WriteLineWithCode(file,"    	}")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"")  //收尾d ..WriteLineWithCode(file,"    }")d ..WriteLineWithCode(file,"}")d file.Close()q "代码生成在:"_logName
}/// 生成表实体代码
/// 编码格式改WriteLineWithCode
/// w ##class(Demo.CodeGener).MakeModelCode("SYS_TableEnum")
ClassMethod MakeModelCode(TableName, PathAdd)
{s TableName=$g(TableName)s PathAdd=$g(PathAdd)s ClassName=$tr(TableName,"_")s rset = ##class(%ResultSet).%New()d rset.Prepare("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,DESCRIPTION,IS_NULLABLE FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='dbo'  and TABLE_NAME='"_TableName_"'")s exeret=rset.Execute()s colCount=rset.GetColumnCount()Set repid=$I(^CacheTemp)k ^TMP($zn,repid,$j)s IsLinux=1s logpath=""i ##class(%SYSTEM.Version).GetOS()="Windows" s IsLinux=0//默认路径i '$l(logpath) d.i IsLinux=0 d..s logpath="D:\".e  d..s logpath="/"s logName=logpath_PathAdd_$tr(TableName,"_")_".cs"//不存在目录就创建i '##class(%File).DirectoryExists(logpath_PathAdd) d.d ##class(%File).CreateNewDir(logpath_PathAdd,"")s file=##class(%File).%New(logName)//存在就追加i ##class(%File).Exists(logName) d.d ##class(%File).Delete(logName).d file.Open("WSN:/SHARED:/IOTABLE=""UTF8""")//不存在就新建e  d.d file.Open("WSN:/SHARED:/IOTABLE=""UTF8""")//写日志d ..WriteLineWithCode(file,"using System;")d ..WriteLineWithCode(file,"using System.Data;")d ..WriteLineWithCode(file,"using LIS.DAL.ORM.CustomAttributes;")d ..WriteLineWithCode(file,"")d ..WriteLineWithCode(file,"namespace LIS.Model.Entity")d ..WriteLineWithCode(file,"{")d ..WriteLineWithCode(file,"    ///<summary  NoteObject=""Class"">")d ..WriteLineWithCode(file,"    /// [功能描述:本代码由LIS内部代码生成工具生成,请不要手动修改,如要修改,请写修改变更记录] <para/>")d ..WriteLineWithCode(file,"    /// [创建者:LIS.Entity生成器] <para/>")d ..WriteLineWithCode(file,"    /// [创建时间:"_$zd($h,8)_"] <para/>")d ..WriteLineWithCode(file,"    ///<说明>")d ..WriteLineWithCode(file,"    ///  [说明:本代码由LIS内部代码生成工具生成,请不要手动修改]<para/>")d ..WriteLineWithCode(file,"    ///</说明>")d ..WriteLineWithCode(file,"    ///<修改记录>")d ..WriteLineWithCode(file,"    ///    [修改时间:本次修改时间]<para/>")d ..WriteLineWithCode(file,"    ///    [修改内容:本次修改内容]<para/>")d ..WriteLineWithCode(file,"    ///</修改记录>")d ..WriteLineWithCode(file,"    ///</summary>")d ..WriteLineWithCode(file,"    [Unique(ColNames = ""RowID"")]")d ..WriteLineWithCode(file,"    [Serializable]")d ..WriteLineWithCode(file,"    [Table(Name = ""dbo."_TableName_""")]")d ..WriteLineWithCode(file,"    public class "_ClassName_" : LIS.Core.Dto.BaseDto")d ..WriteLineWithCode(file,"    {")While(rset.Next()){s outStr=""s colField=rset.GetColumnName(1)s colName=rset.GetDataByName(colField)s colField1=rset.GetColumnName(2)s colType=rset.GetDataByName(colField1)s colField2=rset.GetColumnName(3)s colLen=rset.GetDataByName(colField2)s colField3=rset.GetColumnName(4)s colDesc=rset.GetDataByName(colField3)s colField4=rset.GetColumnName(5)s NULLABLE=rset.GetDataByName(colField4)i '$l(colDesc) s colDesc=colNamed ..WriteLineWithCode(file,"        /// <summary>")d ..WriteLineWithCode(file,"        /// "_##Class(LIS.Util.Common).DealNotSeeChar(colDesc))d ..WriteLineWithCode(file,"        /// </summary>")i NULLABLE="NO" d.d ..WriteLineWithCode(file,"        [NotNull]")i colName="RowID" d.d ..WriteLineWithCode(file,"        [Id(Name = ""RowID"", Strategy = GenerationType.INDENTITY)]")s type=colTypei colType="integer" d.s type="int".s colLen=10.i NULLABLE="YES" d..s type=type_"?"i colType="bigint" d.s type="int".s colLen=10.i NULLABLE="YES" d..s type=type_"?"i colType="smallint" d.s type="int".s colLen=10.i NULLABLE="YES" d..s type=type_"?"i colType="tinyint" d.s type="int".s colLen=10.i NULLABLE="YES" d..s type=type_"?"e  i colType="varchar" d.s type="string"e  i colType="bit" d.s type="bool".s colLen=1.i NULLABLE="YES" d..s type=type_"?"e  i colType="double" d.s type="double".s colLen=10.i NULLABLE="YES" d..s type=type_"?"e  i colType="numeric" d.s type="double".s colLen=10.i NULLABLE="YES" d..s type=type_"?"//外键参照信息s refInfo=..GetForeignKeyInfo(colName,TableName)i $l(refInfo) d.d ..WriteLineWithCode(file,"        [Frekey(Name = """_$tr($p(refInfo,"^",1),"_")_""", RefColumnName = """_$p(refInfo,"^",2)_""", AssociaField = """_$p(refInfo,"^",3)_""")]")i $l(colLen) d.d ..WriteLineWithCode(file,"        [Length(MaxLen = "_colLen_")]")d ..WriteLineWithCode(file,"        public "_type_" "_colName)d ..WriteLineWithCode(file,"        {")d ..WriteLineWithCode(file,"            get;")d ..WriteLineWithCode(file,"            set;")d ..WriteLineWithCode(file,"        }")d ..WriteLineWithCode(file,"")zw colNamezw colTypezw colLen}d ..WriteLineWithCode(file,"    }")d ..WriteLineWithCode(file,"}")d file.Close()q "代码生成在:"_logName
}/// 带编码转换写字符
ClassMethod WriteLineWithCode(file, str)
{d file.WriteLine(str)//d file.WriteLine($zcvt(str,"O","UTF8"))
}/// 得到外键参照关系
ClassMethod GetForeignKeyInfo(ColName, TableName)
{s TableName=$g(TableName)s ColName=$g(ColName)s rset = ##class(%ResultSet).%New()d rset.Prepare("select REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME,* FROM information_schema.KEY_COLUMN_USAGE where REFERENCED_TABLE_SCHEMA='dbo' and TABLE_NAME='"_TableName_"' and COLUMN_NAME='"_ColName_"'")s exeret=rset.Execute()s colCount=rset.GetColumnCount()s ret=""While(rset.Next()){s outStr=""s colField=rset.GetColumnName(1)s refTableName=rset.GetDataByName(colField)s colField1=rset.GetColumnName(2)s refColName=rset.GetDataByName(colField1)s ret=refTableName_"^"_refColName_"^"_..GetForeignKeyAssociaField(refTableName)}q ret
}/// 得到外键参照要拉取的字段
ClassMethod GetForeignKeyAssociaField(TableName)
{s TableName=$g(TableName)s rset = ##class(%ResultSet).%New()d rset.Prepare("select COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='dbo'  and TABLE_NAME='"_TableName_"'")s exeret=rset.Execute()s colCount=rset.GetColumnCount()s ret="RowID"s curLev=0While(rset.Next()){s outStr=""s colField=rset.GetColumnName(1)s colName=rset.GetDataByName(colField)s lev=0i colName="CName" s lev=999i colName="IName" s lev=99i colName="XName" s lev=9i lev>curLev d.s ret=colName.s curLev=lev}q ret
}}

执行生成
在这里插入图片描述

生成的cls代码示例

///SYS_TableEnum操作类,由工具生成,返回空串保存成功,否则就是返回失败原因
Class LIS.WS.BLL.DHCSYSTableEnum Extends %RegisteredObject
{
///20230808
///保存数据,多列以$CSP$分割
///w ##Class(LIS.WS.BLL.DHCSYSTableEnum).SaveSYSTableEnumMTHD("")
///SYSTableEnum
ClassMethod SaveSYSTableEnumMTHD(SaveStr As %String(MAXLEN=99999999), P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String
{s SaveStr=$g(SaveStr)s Sessions=$g(Sessions)s UserDR=$p(Sessions,"^",1)s WorkGroupDR=$p(Sessions,"^",2)s HospitalDR=$p(Sessions,"^",5)s sp="$CSP$"//得到主键,为空就插入数据,否则就更新数据s RowID=$p(SaveStr,sp,1)s SaveObj=""i '$l(RowID) d.s SaveObj=##Class(dbo.SYSTableEnum).%New()e  d.s SaveObj=##Class(dbo.SYSTableEnum).%OpenId(RowID)s SaveObj.TableCode=$p(SaveStr,sp,2)s SaveObj.FieldCode=$p(SaveStr,sp,3)s SaveObj.DataCode=$p(SaveStr,sp,4)s SaveObj.DataValue=$p(SaveStr,sp,5)s SaveObj.DataName=$p(SaveStr,sp,6)s SaveObj.Sequence=$p(SaveStr,sp,7)s SaveObj.Active=$p(SaveStr,sp,8)s sc=SaveObj.%Save()i ('$SYSTEM.Status.IsOK(sc)) d.THROW ##class(%Exception.SystemException).%New("事务委托","D",,"-1^保存SYSTableEnum失败:"_$SYSTEM.Status.GetErrorText(sc))q ""
}///20230808
///删除数据,多个RowID以上尖号分割,返回空成功,非空为失败原因
///w ##Class(LIS.WS.BLL.DHCSYSTableEnum).DeleteSYSTableEnumMTHD(1030,"","","","","","","","","","","","","","")
///SYSTableEnum
ClassMethod DeleteSYSTableEnumMTHD(RowIDS As %String(MAXLEN=99999999), P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String
{s RowIDS=$g(RowIDS)s Sessions=$g(Sessions)//托管事务删除数据q ##Class(LIS.WS.DHCLISServiceBase).DeclarativeTrans("LIS.WS.BLL.DHCSYSTableEnum","DeleteSYSTableEnumDo",RowIDS, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions)
}///20230808
///删除数据,多个RowID以上尖号分割
///w ##Class(LIS.WS.BLL.DHCSYSTableEnum).DeleteSYSTableEnumDo(1030)
///SYSTableEnum
ClassMethod DeleteSYSTableEnumDo(RowIDS As %String(MAXLEN=99999999), P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Sessions, Output RowCount As %String) As %String
{s RowIDS=$g(RowIDS)s Sessions=$g(Sessions)s Sessions=$g(Sessions)s UserDR=$p(Sessions,"^",1)s WorkGroupDR=$p(Sessions,"^",2)s HospitalDR=$p(Sessions,"^",5)f i=1:1:$l(RowIDS,"^") d.s RowID=$p(RowIDS,"^",i).s sc=##Class(dbo.SYSTableEnum).%DeleteId(RowID).i ('$SYSTEM.Status.IsOK(sc)) d..THROW ##class(%Exception.SystemException).%New("事务委托","D",,"-1^删除SYSTableEnum失败:"_$SYSTEM.Status.GetErrorText(sc))q ""
}///20230808
///查询数据,查询条件自己改
///SYSTableEnum
Query QrySYSTableEnum(Filter, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, PageSize, PageIndex, Sessions, Output RowCount As %String) As %Query
{
}/// 构造输出列
ClassMethod QrySYSTableEnumGetInfo(ByRef colinfo As %List, ByRef parminfo As %List, ByRef idinfo As %List, ByRef qHandle As %Binary, extoption As %Integer = 0, extinfo As %List) As %Status
{Set RowSpec=$LIST(qHandle,4)f i=1:1:$l(RowSpec,",") d.s OneCol=$p(RowSpec,",",i).s OneColType=$p(OneCol,":",2).s OneCol=$p(OneCol,":",1).i i=1 s colinfo=$lb($lb(OneCol,OneColType)).e  s colinfo=colinfo_$lb($lb(OneCol,OneColType))s parminfo = ""s idinfo = ""q $$$OK
}/// 在Execute控制RowSpec输出列
/// Query的执行方法
/// d ##class(%ResultSet).RunQuery("LIS.WS.BLL.DHCSYSTableEnum","QrySYSTableEnum","","","","","","","","","","","","","","","","")
ClassMethod QrySYSTableEnumExecute(ByRef qHandle As %Binary, Filter, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, PageSize, PageIndex, Sessions, Output RowCount As %String) As %Status
{s Filter=$g(Filter)s IsPer=0//指定输出列,和RowSpec保存一致,冒号指定类型s RowSpec="RowID,TableCode,FieldCode,DataCode,DataValue,DataName,Sequence,Active"//得到repid和初始化indSet ColFields = "RowID,TableCode,FieldCode,DataCode,DataValue,DataName,Sequence,Active"Set repid=$I(^CacheTemp)If $Get(ind)="" Set ind=1//输出数据逻辑,这段逻辑可以动态改RowSpec控制输出列s RowID="" f  s RowID=$o(^dbo.SYSTableEnumI("PKSYSTABLEENUM",RowID)) q:RowID=""  d.d OutPutRow//第4个参数不可少Set qHandle=$lb(0,repid,0,RowSpec)Quit $$$OKOutPutRows OneRowData=$g(^dbo.SYSTableEnumD(RowID))s TableCode=$lg(OneRowData,2)i $l(Filter),TableCode[Filter s IsPer=1s FieldCode=$lg(OneRowData,3)i $l(Filter),FieldCode[Filter s IsPer=1s DataCode=$lg(OneRowData,4)i $l(Filter),DataCode[Filter s IsPer=1s DataValue=$lg(OneRowData,5)i $l(Filter),DataValue[Filter s IsPer=1s DataName=$lg(OneRowData,6)i $l(Filter),DataName[Filter s IsPer=1s Sequence=$lg(OneRowData,7)i $l(Filter),Sequence[Filter s IsPer=1s Active=$lg(OneRowData,8)i $l(Filter),Active[Filter s IsPer=1i $l(Filter),(IsPer=0) qs Data = $lb(RowID,TableCode,FieldCode,DataCode,DataValue,DataName,Sequence,Active)Set ^CacheTemp(repid,ind)=##Class(LIS.Util.Common).TransListNull(Data,ColFields)Set ind=ind+1q
}ClassMethod QrySYSTableEnumClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = QrySYSTableEnumExecute ]
{Set repid=$LIST(qHandle,2)Kill ^CacheTemp(repid)Quit $$$OK
}ClassMethod QrySYSTableEnumFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = QrySYSTableEnumExecute ]
{Set AtEnd=$LIST(qHandle,1)Set repid=$LIST(qHandle,2)Set ind=$LIST(qHandle,3)Set ind=$o(^CacheTemp(repid,ind))If ind="" {	Set AtEnd=1Set Row=""}Else      {	Set Row=^CacheTemp(repid,ind)}// Save QHandles qHandle=$lb(AtEnd,repid,ind)Quit $$$OK
}
}

生成的C#调用代码示例

using System;
using System.Web;
using System.Reflection;
using System.Text;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using LIS.Model.Entity;
using LIS.Model.Bussiness;
using Microsoft.AspNetCore.Http;
using iMedicalLIS;///<summary  NoteObject="Class">
/// [功能描述:SYSTableEnum调用类] <para/>
/// [创建者:自动生成] <para/>
/// [创建时间:20230808] <para/>
///<说明>
///  [说明:自定义操作自己改]<para/>
///</说明>
///<修改记录>
///    [修改时间:本次修改时间]<para/>
///</summary> 
namespace UI.lis.ashx
{public class ashSYSTableEnum : BaseHttpHandler{/// <summary>/// 保存数据,多列以$CSP$分割/// </summary>/// <returns></returns>public string SaveSYSTableEnum(){//调用的后台类string className = "LIS.WS.BLL.DHCSYSTableEnum";//调用的后台方法string funcName = "SaveSYSTableEnumMTHD";string SaveStr="";string sp="$CSP$";string RowID=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "RowID"), "");string TableCode=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "TableCode"), "");string FieldCode=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "FieldCode"), "");string DataCode=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "DataCode"), "");string DataValue=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "DataValue"), "");string DataName=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "DataName"), "");string Sequence=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "Sequence"), "");string Active=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "Active"), "");SaveStr=RowID+sp+TableCode+sp+FieldCode+sp+DataCode+sp+DataValue+sp+DataName+sp+Sequence+sp+Active;Parameters param = new Parameters();param.P0=SaveStr;string logInfo = this.UserLogin.UserDR + "^" + this.UserLogin.WorkGroupDR + "^" + this.UserLogin.LocationDR + "^" + this.UserLogin.WorkGroupDR + "^" + this.UserLogin.HospitalDR;int rowCount;string ObjStr = LIS.DAL.DataAccess.WebManager.GetDataJSON(className, funcName, param, logInfo, false, out rowCount, out this.Err);if(ObjStr==""){return Helper.Success();}else{return Helper.Error(ObjStr);}}/// <summary>/// 删除数据,多个RowID以上尖号分割/// </summary>/// <returns></returns>public string DeleteSYSTableEnum(){//调用的后台类string className = "LIS.WS.BLL.DHCSYSTableEnum";//调用的后台方法string funcName = "DeleteSYSTableEnumMTHD";Parameters param = new Parameters();param.P0=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "RowIDS"), "");string logInfo = this.UserLogin.UserDR + "^" + this.UserLogin.WorkGroupDR + "^" + this.UserLogin.LocationDR + "^" + this.UserLogin.WorkGroupDR + "^" + this.UserLogin.HospitalDR;int rowCount;string ObjStr = LIS.DAL.DataAccess.WebManager.GetDataJSON(className, funcName, param, logInfo, false, out rowCount, out this.Err);if(ObjStr==""){return Helper.Success();}else{return Helper.Error(ObjStr);}}/// <summary>/// 查询数据/// </summary>/// <returns></returns>public string QrySYSTableEnum(){//调用的后台类string className = "LIS.WS.BLL.DHCSYSTableEnum";//调用的后台方法string funcName = "QrySYSTableEnum";//预留的取前台参数代码string RowID=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "RowID"), "");string TableCode=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "TableCode"), "");string FieldCode=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "FieldCode"), "");string DataCode=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "DataCode"), "");string DataValue=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "DataValue"), "");string DataName=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "DataName"), "");string Sequence=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "Sequence"), "");string Active=Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "Active"), "");Parameters param = new Parameters();param.P0= Helper.ValidParam(LIS.Core.MultiPlatform.LISContext.GetRequest(Request, "Filter"), "");string logInfo = this.UserLogin.UserDR + "^" + this.UserLogin.WorkGroupDR + "^" + this.UserLogin.LocationDR + "^" + this.UserLogin.WorkGroupDR + "^" + this.UserLogin.HospitalDR;int rowCount;string ObjStr = LIS.DAL.DataAccess.WebManager.GetDataJSON(className, funcName, param, logInfo, false, out rowCount, out this.Err);return ObjStr;}}
}

生成的aspx页面代码示例

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>供拷贝代码使用</title><link rel="shortcut icon" href="../../resource/common/images/favicon.ico" /><script src="../../resource/common/js/lis-commonHISUI.js" type="text/javascript"></script><script language="javascript" type="text/javascript">LISSYSPageCommonInfo.Init();var BasePath = '';var ResourcePath = '';var WebServicAddress = LISSYSPageCommonInfo.Data.WebServicAddress;var UserDR = LISSYSPageCommonInfo.Data.Sesssion.UserDR;var WorkGroupDR = LISSYSPageCommonInfo.Data.Sesssion.WorkGroupDR;var sysTheme = LISSYSPageCommonInfo.Data.Sesssion.Theme;var SessionStr = LISSYSPageCommonInfo.Data.SessionStr;</script><script type="text/javascript">//全局变量var me = {actionUrl: '../ashx/ashSYSTableEnum.ashx'};//jquery入口$(function () {//新增数据点击$("#btnAddSYSTableEnum").click(function () {$("#txtSYSTableEnumRowID").val(""); $('#winEditSYSTableEnum').window({title: TranslateDataMTHD('Add Data', '新增数据', ''),modal: true});});//修改数据点击$("#btnUpdateSYSTableEnum").click(function () {UpdateSYSTableEnum();});//修改数据function UpdateSYSTableEnum(row){var selectRow = $('#dgSYSTableEnum').datagrid("getSelected");if(row!=null){selectRow=row;}if (selectRow == null) {$.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to modify', '请选择要修改的数据!', ''), 'info');return;}$("#formSYSTableEnum").form('load', selectRow);$('#winEditSYSTableEnum').window({title: TranslateDataMTHD('Update Data', '修改数据', ''),modal: true});}//删除数据点击$("#btnDeleteSYSTableEnum").click(function () {var checkRow = $('#dgSYSTableEnum').datagrid("getChecked");var selectRow = $('#dgSYSTableEnum').datagrid("getSelected");if ((checkRow == null || checkRow.length == 0)&&selectRow==null) {$.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to delete', '请勾选要删除的数据!', ''), 'info');return;}if ((checkRow == null || checkRow.length == 0)) {checkRow=[selectRow];}var RowIDS = "";for (var i = 0; i < checkRow.length; i++) {if (i == 0) {RowIDS = checkRow[i].RowID;}else {RowIDS += "^" + checkRow[i].RowID;}}$.messager.confirm(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Do you want to delete the selected data', '是否要删除选择的数据?', '') , function (r) {if (r) {//开启等待$.messager.progress({ text: TranslateDataMTHD("Deleting data","正在删除数据", ""), interval: 500 });setTimeout(function () {$.messager.progress('close');}, 8000);//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=DeleteSYSTableEnum',data: { RowIDS: RowIDS },success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}if (!data.IsOk) {$.messager.alert(TranslateDataMTHD("Error message", "错误提示", ""), TranslateDataMTHD("failed to dalete data, error message:", "删除失败,错误信息:", "") + data.Message);}else {QrySYSTableEnum();$.messager.show({title: TranslateDataMTHD("Info", "提示", ""),msg: TranslateDataMTHD("Successfully deleted!", "删除成功!", ""),timeout: 500,showType: 'slide'});}}});}});});//保存数据$("#btnSaveSYSTableEnum").click(function () {var saveData = jQuery.parseJSON($("#formSYSTableEnum").serializeObject());//开启等待$.messager.progress({ text: TranslateDataMTHD("Saving data","正在保存数据", ""), interval: 500 });setTimeout(function () {$.messager.progress('close');}, 8000);//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=SaveSYSTableEnum',data: saveData,success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}if (!data.IsOk) {$.messager.alert(TranslateDataMTHD("Error message", "错误提示", ""), TranslateDataMTHD("failed to dalete data, error message:", "删除失败,错误信息:", "") + data.Message);}else {QrySYSTableEnum();$.messager.show({title: TranslateDataMTHD("Info", "提示", ""),msg: TranslateDataMTHD("Successfully saveed!", "保存成功!", ""),timeout: 500,showType: 'slide'});$('#winEditSYSTableEnum').window("close");}}});});//关闭窗口$("#btnCloseSYSTableEnum").click(function () {$('#winEditSYSTableEnum').window("close");});//构造查询事件$("#txtFilterSYSTableEnum").searchbox({searcher: function (value, name) {QrySYSTableEnum();},prompt: TranslateDataMTHD('Enter query', '回车查询', '')});//SYSTableEnum表格$('#dgSYSTableEnum').datagrid({singleSelect: true,toolbar: "#dgSYSTableEnumToolBar",fit: true,onDblClickRow: function (index, row) {UpdateSYSTableEnum(row);},columns: [[{ field: 'ChkFlag', title: TranslateDataMTHD('Check', '选择', ''), width: 20, sortable: true, align: 'center', checkbox: true },{ field: 'RowID', title: TranslateDataMTHD('RowID', '主键', '') , width: 150 },{ field: 'TableCode', title: TranslateDataMTHD('TableCode', '表名', '') , width: 150 },{ field: 'FieldCode', title: TranslateDataMTHD('FieldCode', '字段名', '') , width: 150 },{ field: 'DataCode', title: TranslateDataMTHD('DataCode', '数据代码', '') , width: 150 },{ field: 'DataValue', title: TranslateDataMTHD('DataValue', '数据值', '') , width: 150 },{ field: 'DataName', title: TranslateDataMTHD('DataName', '数据名称', '') , width: 150 },{ field: 'Sequence', title: TranslateDataMTHD('Sequence', '序号', '') , width: 150 },{ field: 'Active', title: TranslateDataMTHD('Active', '激活{1:true', '') , width: 150 }]]});//查询SYSTableEnumfunction QrySYSTableEnum() {var Filter = $("#txtFilterSYSTableEnum").searchbox("getValue");//开启等待$.messager.progress({ text: TranslateDataMTHD("Querying data","正在查询数据", ""), interval: 500 });setTimeout(function () {$.messager.progress('close');}, 8000);$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=QrySYSTableEnum',data: { Filter: Filter },success: function (data, status) {//结束等待$.messager.progress('close');$('#dgSYSTableEnum').datagrid("loadData", data);}});};//执行查询数据QrySYSTableEnum();});</script>
</head>
<body><div class="hisui-layout" fit="true" style="border: none;"><div data-options="region:'center',title:''" style="border: none;"><div id="dgSYSTableEnumToolBar" style="padding: 3px 0px 3px 10px;"><a id="btnAddSYSTableEnum" href="#" class="hisui-linkbutton" data-options="iconCls:'icon-add'" plain="true" listranslate="html~Add">新增</a><a id="btnUpdateSYSTableEnum" href="#" class="hisui-linkbutton" data-options="iconCls:'icon-write-order'" plain="true" listranslate="html~Mod">修改</a><a id="btnDeleteSYSTableEnum" href="#" class="hisui-linkbutton" data-options="iconCls:'icon-cancel'" plain="true" listranslate="html~Del">删除</a><input id="txtFilterSYSTableEnum" style="margin-left: 14px; width: 240px;"></input></div><table id="dgSYSTableEnum" title="" iconcls="icon-paper" listranslate="title~SYSTableEnum"></table></div><div id="winEditSYSTableEnum" style="padding: 10px 0px 0px 10px;width:360px;height:384px;"><form id="formSYSTableEnum" name="edit_form" method="post"><input type="hidden" id="txtSYSTableEnumRowID" name="RowID" value="0" /><table><tr><td class="lisar" listranslate="html~TableCode">表名</td><td class="lisal"><input id="txtSYSTableEnumTableCode" type="text" name="TableCode" style="width:200px;" class="hisui-validatebox"  maxlength="40"/></td></tr><tr><td class="lisar" listranslate="html~FieldCode">字段名</td><td class="lisal"><input id="txtSYSTableEnumFieldCode" type="text" name="FieldCode" style="width:200px;" class="hisui-validatebox"  maxlength="40"/></td></tr><tr><td class="lisar" listranslate="html~DataCode">数据代码</td><td class="lisal"><input id="txtSYSTableEnumDataCode" type="text" name="DataCode" style="width:200px;" class="hisui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" listranslate="html~DataValue">数据值</td><td class="lisal"><input id="txtSYSTableEnumDataValue" type="text" name="DataValue" style="width:200px;" class="hisui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" listranslate="html~DataName">数据名称</td><td class="lisal"><input id="txtSYSTableEnumDataName" type="text" name="DataName" style="width:200px;" class="hisui-validatebox"  maxlength="40"/></td></tr><tr><td class="lisar" listranslate="html~Sequence">序号</td><td class="lisal"><input id="txtSYSTableEnumSequence" type="text" name="Sequence" style="width:200px;" class="hisui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" listranslate="html~Active">激活{1:true</td><td class="lisal"><input id="txtSYSTableEnumActive" type="text" name="Active" style="width:200px;" class="hisui-validatebox"  maxlength="1"/></td></tr></table><div region="south" border="fale" style="text-align: center; padding: 5px 0 0;"><a id="btnSaveSYSTableEnum" href="#" class="hisui-linkbutton" plain="false" listranslate="html~Save">保存</a><span class="sp6"></span><a id="btnCloseSYSTableEnum" href="#" class="hisui-linkbutton" plain="false" listranslate="html~Cancel">取消</a></div></form></div>
</body>
</html>

生成的实体示例

using System;
using System.Data;
using LIS.DAL.ORM.CustomAttributes;namespace LIS.Model.Entity
{///<summary  NoteObject="Class">/// [功能描述:本代码由LIS内部代码生成工具生成,请不要手动修改,如要修改,请写修改变更记录] <para/>/// [创建者:LIS.Entity生成器] <para/>/// [创建时间:20230808] <para/>///<说明>///  [说明:本代码由LIS内部代码生成工具生成,请不要手动修改]<para/>///</说明>///<修改记录>///    [修改时间:本次修改时间]<para/>///    [修改内容:本次修改内容]<para/>///</修改记录>///</summary>[Unique(ColNames = "RowID")][Serializable][Table(Name = "dbo.SYS_TableEnum")]public class SYSTableEnum : LIS.Core.Dto.BaseDto{/// <summary>/// 主键  /// </summary>[NotNull][Id(Name = "RowID", Strategy = GenerationType.INDENTITY)][Length(MaxLen = 10)]public int RowID{get;set;}/// <summary>/// 表名  /// </summary>[NotNull][Length(MaxLen = 40)]public string TableCode{get;set;}/// <summary>/// 字段名  /// </summary>[NotNull][Length(MaxLen = 40)]public string FieldCode{get;set;}/// <summary>/// 数据代码  /// </summary>[Length(MaxLen = 10)]public string DataCode{get;set;}/// <summary>/// 数据值/// </summary>[Length(MaxLen = 10)]public string DataValue{get;set;}/// <summary>/// 数据名称/// </summary>[Length(MaxLen = 40)]public string DataName{get;set;}/// <summary>/// 序号  /// </summary>[Length(MaxLen = 10)]public int? Sequence{get;set;}/// <summary>/// 激活  {1:true,0:false}/// </summary>[Length(MaxLen = 1)]public bool? Active{get;set;}}
}

直接代码投放到检验目录测试ok
增加数据
在这里插入图片描述

双击修改数据
在这里插入图片描述

查询数据
在这里插入图片描述
删除数据
在这里插入图片描述

在这里插入图片描述

大功告成,以后对基础维护表生成代码,直接拷贝要的代码再组装成父子表维护界面就可以很快了。单表维护用通用码表就能满足,特殊定义的单表维护生成代码再细化,多表维护生成代码拷贝组装页面。 哈哈哈

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

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【go-zero】docker镜像直接部署go-zero的API与RPC服务 如何实现注册发现?docker network 实现 go-zero 注册发现

一、场景&问题 使用docker直接部署go-zero微服务会发现API无法找到RPC服务 1、API无法发现RPC服务 用docker直接部署 我们会发现API无法注册发现RPC服务 原因是我们缺少了docker的network网桥 2、系统内查看 RPC服务运行正常API服务启动,通过docker logs 查看日志还是未…

迭代器模式(C++)

定义 提供一种方法顺序访问一个聚合对象中的各个元素&#xff0c;而又不暴露(稳定)该对象的内部表示。 应用场景 在软件构建过程中&#xff0c;集合对象内部结构常常变化各异。但对于这些集合对象&#xff0c;我们希望在不暴露其内部结构的同时&#xff0c;可以让外部客户代…

BpBinder与PPBinder调用过程——Android开发Binder IPC通信技术

在Android系统中&#xff0c;进程间通信&#xff08;IPC&#xff09;是一个非常重要的话题。Android系统通过Binder IPC机制实现进程间通信&#xff0c;而Binder IPC通信技术则是Android系统中最为重要的进程间通信技术之一。本文将介绍Binder IPC通信技术的原理&#xff0c;并…

JMeter处理接口签名之BeanShell实现MD5加密

项目A需要给项目B提供一个接口&#xff0c;这个接口加密了&#xff0c;现在需要测试这个接口&#xff0c;需要怎么编写脚本呢&#xff1f;实现接口签名的方式有两种&#xff1a;BeanShell实现MD5加密和函数助手实现MD5加密&#xff0c;之前已经分享过了函数助手实现MD5加密&…

[Linux]计算机软硬体系结构

[Linux]计算机软硬体系结构 文章目录 [Linux]计算机软硬体系结构冯诺依曼体系结构冯诺依曼体系结构的组成冯诺依曼体系结构中各部件的功能对存储器(内存)的理解对数据流的理解 了解操作系统操作系统的概念管理的概念管理的本质管理的精髓“先描述&#xff0c;再组织”计算机软硬…

SpringCloud之微服务API网关Gateway介绍

文章目录 1 微服务API网关Gateway1.1 网关1.1.1 简介1.1.2 相比于Zuul 1.2 Spring Cloud Gateway介绍1.3 Gateway特性1.4 Gateway工作流程1.5 Gateway核心概念1.5.1 路由1.5.1.1 定义1.4.1.2 动态路由 1.4.2 断言1.4.2.1 默认断言1.4.2.2 自定义Predicate 1.4.3 过滤器1.4.3.1 …

Llama 2 云端部署与API调用【AWS SageMaker】

Meta 刚刚发布了 Llama 2 大模型。如果你和我们一样&#xff0c;你一定会迫不及待地想要亲自动手并用它来构建。 推荐&#xff1a;用 NSDT设计器 快速搭建可编程3D场景。 使用任何类型的 LLM 进行构建的第一步是将其托管在某处并通过 API 使用它。 然后你的开发人员可以轻松地将…

决策树和随机森林对比

1.用accuracy来对比 # -*-coding:utf-8-*-""" accuracy来对比决策树和随机森林 """ from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.datasets import load_wine#(178, 13…

【Spring】使用注解存储Bean对象

目录 一、配置扫描路径&#xff08;使用注解的方式存对象的前提&#xff09; 二、使用类注解存储Bean对象 1、使用五大类注解存储Bean对象 2、为什么要这么多的类注解&#xff1f; 2.1、五大类注解之间的关系 3、获取Bean对象时的默认命名规则 三、使用方法注解来存储…

2023年新手如何学剪辑视频 想学视频剪辑如何入门

随着短视频、vlog等媒体形式的兴起&#xff0c;视频剪辑已经成为了热门技能。甚至有人说&#xff0c;不会修图可以&#xff0c;但不能不会剪视频。实际上&#xff0c;随着各种智能软件的发展&#xff0c;视频剪辑已经变得越来越简单。接下来&#xff0c;一起来看看新手如何学剪…

以指标驱动,保险、零售、制造企业开启精益敏捷运营的新范式

近日&#xff0c;以“释放数智生产力”为主题的 Kyligence 用户大会在上海前滩香格里拉大酒店成功举行。大会包含上午的主论坛和下午的 4 场平行论坛&#xff0c;并举办了闭门会议、Open Day 等活动。来自金融、零售、制造、医药等行业的客户及合作伙伴带来了超过 23 场主题演讲…

VAE、 EM、KL散度

文章目录 VAEVAE额外的损失函数 EMKL散度 VAE 左图相当于变量x&#xff0c;右图相当于z 假如在AE中&#xff0c;一张满月的图片作为输入&#xff0c;模型得到的输出是一张满月的图片&#xff1b;一张弦月的图片作为输入&#xff0c;模型得到的是一张弦月的图片。当从满月的code…

瞅一眼nginx

目录 &#x1f9ac;什么是nginx? &#x1f9ac;nginx配置官方yum源&#xff1a; &#x1f9ac;nginx优点 &#x1f9ac;nginx 缺点 &#x1f9ac;查看nginx默认模块 &#x1f40c;nginx新版本的配置文件&#xff1a; &#x1f40c;nginx目录索引 &#x1f40c;nginx状态…

网络编程(JavaEE初阶系列10)

目录 前言&#xff1a; 1.网络编程的基础 1.1为什么需要网络编程 1.2什么是网络编程 1.3网络编程中的基本概念 1.3.1发送端和接收端 1.3.2请求和响应 1.3.3客户端和服务端 2.Socket套接字 2.1概念 2.2分类 3.UDP数据报套接字编程 3.1DataGramSocket API 3.2Datagr…

【游戏客户端】制作你玩我猜Like玩法

【游戏客户端】制作你玩我猜Like玩法 大家好&#xff0c;我是Lampard猿奋~~ “你画我猜”相信大家都不陌生&#xff0c;当初这款小游戏可谓茶余饭后必玩之选&#xff0c;风头一时无二。今天要和大家分享如何实现一个你玩我猜Like的玩法。 我们可以简单的把需求拆成两个个部分&…

python实现对图油画、卡通、梦幻、草图、水彩效果

本篇博客将介绍如何使用wxPython模块和OpenCV库来实现对图像进行灰度化、二值化、伽马校正、色彩空间转换和图像反转这5种效果的合并程序。程序可以通过wxPython提供的GUI界面来选择图片路径和效果类型&#xff0c;程序会将处理后的图像保存到指定路径并打开。 步骤一&#xf…

2021年12月 Python(一级)真题解析#中国电子学会#全国青少年软件编程等级考试

一、单选题(共25题,每题2分,共50分) 第1题 昨天的温度是5摄氏度,今天降温7摄氏度,今天的温度是多少摄氏度? A:12 B:7 C:2 D:-2 正确的答案是 D:-2。 解析: 根据题目描述,昨天的温度是 5 摄氏度,今天降温了 7 摄氏度。降温意味着温度变低,所以今天的温度…

k8s之Pod控制器

目录 一、Pod控制器及其功用二、pod控制器的多种类型2.1 pod容器中的有状态和无状态的区别 三、Deployment 控制器四、SatefulSet 控制器4.1 StatefulSet由以下几个部分组成4.2 为什么要有headless&#xff1f;4.3 为什么要有volumeClaimTemplate&#xff1f;4.4 滚动更新4.5 扩…

解决MAC M1处理器运行Android protoc时出现的错误

Protobuf是Google开发的一种新的结构化数据存储格式&#xff0c;一般用于结构化数据的序列化&#xff0c;也就是我们常说的数据序列化。这个序列化协议非常轻量级和高效&#xff0c;并且是跨平台的。目前&#xff0c;它支持多种主流语言&#xff0c;比传统的XML、JSON等方法更具…

性能优化必知必会

系统性能调优 分为四个层次 基础设施网络编解码分布式系统性能整体提升 一&#xff1a;基础设施优化 从提升单机进程的性能入手&#xff0c;包括高效的使用主机的CPU、内存、磁盘等硬件&#xff0c;通过提高并发编程提升吞吐量&#xff0c;根据业务特性选择合适的算法 01 …