检验代码生成器完成版

news2025/7/10 17:45:19

写维护页面重复逻辑写烦了,连页面的增、删、改、查、弹窗等代码都不行手写了,为此做成代码生成器成型版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)
	//构造增删改查M
	w ..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=1
	s 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=0
	s 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+1
        i colName="RowID" continue
        s RowSpec=RowSpec_","_colName
        d ..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=1
	s 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" continue
        s RowSpec=RowSpec_","_colName
        s type=colType
        i 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_","_colLen
        s 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,",")*48
	d ..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=1
	s 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=0
	s 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+1
        i colName="RowID" continue
        s RowSpec=RowSpec_","_colName
        d ..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=0
	d ..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=1
	s 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=colName
        d ..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=colType
        i 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 colName
        zw colType
        zw 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=0
	While(rset.Next())
    {
	    s outStr=""
        s colField=rset.GetColumnName(1)
        s colName=rset.GetDataByName(colField)
        s lev=0
        i colName="CName" s lev=999
        i colName="IName" s lev=99
        i colName="XName" s lev=9
        i 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和初始化ind
	Set 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 $$$OK


OutPutRow
	s OneRowData=$g(^dbo.SYSTableEnumD(RowID))
	s TableCode=$lg(OneRowData,2)
	i $l(Filter),TableCode[Filter s IsPer=1
	s FieldCode=$lg(OneRowData,3)
	i $l(Filter),FieldCode[Filter s IsPer=1
	s DataCode=$lg(OneRowData,4)
	i $l(Filter),DataCode[Filter s IsPer=1
	s DataValue=$lg(OneRowData,5)
	i $l(Filter),DataValue[Filter s IsPer=1
	s DataName=$lg(OneRowData,6)
	i $l(Filter),DataName[Filter s IsPer=1
	s Sequence=$lg(OneRowData,7)
	i $l(Filter),Sequence[Filter s IsPer=1
	s Active=$lg(OneRowData,8)
	i $l(Filter),Active[Filter s IsPer=1
	i $l(Filter),(IsPer=0) q
	s Data = $lb(RowID,TableCode,FieldCode,DataCode,DataValue,DataName,Sequence,Active)
	Set ^CacheTemp(repid,ind)=##Class(LIS.Util.Common).TransListNull(Data,ColFields)
	Set ind=ind+1
	q
}


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=1
 		Set Row=""
 	}
 	Else      {	
 		Set Row=^CacheTemp(repid,ind)
 	}
 	// Save QHandle
 	s 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时强制等待;-asir
                    		url: 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时强制等待;-asir
                    url: 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 }
                ]]
            });


            //查询SYSTableEnum
            function 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时强制等待;-asir
                    url: 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.coloradmin.cn/o/849962.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

有效管理IT问题的5个原则

问题管理就是发现未知的、隐藏的问题&#xff0c;这是根本原因&#xff0c; 这是您 IT 帮助台无穷无尽的工单来源。当您实施有效的 问题管理&#xff0c;您的 IT 团队可以超越消防模式&#xff0c;专注于战略 IT 目标。以下是可以帮助您实现一流问题管理的五个原则&#xff1a;…

远程运维大批量IT设备?向日葵批量部署、分组授权与安全功能解析

数字化转型的不断推进&#xff0c;给予了企业全方位的赋能&#xff0c;但任何发展都伴随着成本与代价&#xff0c;比如在数字化转型过程中企业内部办公与外部业务所需的不断增加的IT设备数量&#xff0c;就为日常的运维工作提出了更大的挑战。 针对企业面对海量IT设备时的运维…

多态总结

什么是多态&#xff1f; 所谓多态&#xff0c;就是同一个操作&#xff0c;作用在了不同的对象上&#xff0c;就会有不同的解释&#xff0c;进而产生不同的执行结果。使用时&#xff0c;是采用父类指针指向子类对象的方法。其中&#xff0c;重载和重写是常见的实现多态的手段。…

【MySQL】基础知识(一)

MySQL基础知识&#xff08;一&#xff09; 文章目录 MySQL基础知识&#xff08;一&#xff09;00 MySQL安装01 数据库介绍1.1 什么是数据库1.2数据库分类 02 SQL分类03 数据库操作3.1显示数据库3.2创建数据库3.3选中数据库3.4删除数据库 04 常用数据类型4.1数值类型4.2字符串类…

LeetCode 0024. 两两交换链表中的节点:粗暴易懂的方法(几个临时变量)

【LetMeFly】24.两两交换链表中的节点&#xff1a;粗暴易懂的方法&#xff08;几个临时变量&#xff09; 力扣题目链接&#xff1a;https://leetcode.cn/problems/swap-nodes-in-pairs/ 给你一个链表&#xff0c;两两交换其中相邻的节点&#xff0c;并返回交换后链表的头节点…

安路FPGA的赋值报错——移位处理,加括号

authordaisy.skye的博客_CSDN博客-嵌入式,Qt,Linux领域博主 在使用移位符号用来当作除以号使用时&#xff0c;发现如下问题 其中 cnt_8K 为偶数和奇数时输出的数据不一样 reg [10:0] cnt_8K; reg [10:0] ram1_addra; always(posedge clk_16M) begin if(ram_out_flag )begin if(…

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

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

重磅来袭!Android UI设计规范助你打造精美Android应用!

重磅来袭&#xff01;Android UI设计规范助你打造精美Android应用&#xff01; 为了规范Android UI设计&#xff0c;Google官方推出UI设计指南助你打造精美的Android应用。 使用 Android 主题和组件创建应用设计。利用 Android 独特的设计模式和产品打造精美、易用的现代应用…

nginx之location匹配的规则和优先级,以及rewrite

主要内容&#xff1a;一、location匹配的规则和优先级&#xff08;重点&#xff0c;面试会问&#xff0c;工作用得到&#xff09; 二、nginx常用的问题&#xff08;要求掌握&#xff09; 三、rewrite&#xff1a;重定向功能&#xff08;有掌握&#xff0c;有理解&#xff09;…

DNS:使用 bind9 配置主从权威DNS服务器

写在前面 分享一些 使用 bind9 配置主从权威名称服务器的笔记理解不足小伙伴帮忙指正 对每个人而言&#xff0c;真正的职责只有一个&#xff1a;找到自我。然后在心中坚守其一生&#xff0c;全心全意&#xff0c;永不停息。所有其它的路都是不完整的&#xff0c;是人的逃避方式…

设计模式行为型——策略模式

在现实生活中常常遇到达成某种目的&#xff0c;有多种实现策略可供选择的情况。例如&#xff0c;出行上班可以乘坐公交车、乘坐地铁、骑自行车或自己开私家车等&#xff0c;填饱肚子可以吃火锅、吃烤肉、吃烤串、吃东北家常菜等方法。 在软件开发中也常常遇到类似的情况&#x…

人物启示-张一鸣与陆奇

在科技行业中&#xff0c;张一鸣与陆奇可谓是两位颇具影响力的人物。张一鸣和陆奇分别是字节跳动&#xff08;TikTok 的母公司&#xff09;的创始人和百度前总裁。张一鸣作为字节跳动的创始人&#xff0c;成功打造了今日头条、抖音等知名产品&#xff0c;而陆奇则曾任微软副总裁…

计算机组成与设计01:计算机的抽象与技术

目录 1 概述 1.1 计算机体系结构体中的8个伟大思想 1.2 计算机层次结构 1.2.1 概述 1.2.2 指令集体系结构 1.3 实例&#xff1a;从程序到电子信号 1.3.1 从高级语言到汇编语言 1.3.2 从汇编语言到机器语言 1.3.3 生成可执行文件并执行 1.3.4 计算机基本执行结构 1.3…

【vue3】基础知识点-computed和watch

学习vue3&#xff0c;都会从基础知识点学起。了解setup函数&#xff0c;ref&#xff0c;recative&#xff0c;watch、computed、pinia等如何使用 今天说vue3组合式api&#xff0c;computed和watch 在vue3中&#xff0c;computed和watch仍然是非常有用的特性&#xff0c;帮助处…

【C语言】实现linux下基于C语言的一个简单的UDP客/服端通信

一、实例代码 对于基础好的朋友可以直接拿代码看 客户端代码&#xff1a; #include <stdio.h> #include <sys/socket.h>//socket() #include <netinet/in.h>//struct sockaddr_in #include <string.h>//memset() #include <arpa/inet.h>//ine…

数字化转型中的抉择:定制化软件还是引入PDM系统?

企业在数字化转型过程中可以考虑是使用定制化软件、基于成熟模块改造&#xff0c;或引入PDM&#xff08;产品数据管理&#xff09;系统&#xff0c;这时需要仔细权衡各种因素&#xff0c;以确保选择最适合其需求的路径。这些选择各自有其优势和适用场景&#xff0c;下面将分别对…

Linux项目部署

目录 一JAVAWeb环境的部署【安装JDK&#xff0c;MySQL数据库&#xff0c;Tomcat】 二.手工部署SpringBoot项目&#xff08;写的最好的&#xff09; 1.在IDEA中开发SpringBoot项目并打成jar包--点击右侧的Maven执行package命令 2.将jar包上传到Linux服务器 3.执行以下命令&a…

探究Spring事务:了解失效场景及应对策略

在现代软件开发中&#xff0c;数据的一致性和完整性是至关重要的。为了保证这些特性&#xff0c;Spring框架提供了强大的事务管理机制&#xff0c;让开发者能够更加自信地处理数据库操作。然而&#xff0c;事务并非银弹&#xff0c;存在一些失效的情景&#xff0c;本文将带您深…

C++ Visual Studio工程目录相对路径设置

文章目录 相对路径相对路径是相对vs工程的哪个目录而言书写格式 参考 相对路径 要设对相对路径&#xff0c;需要搞清楚下面两个问题&#xff1a; 相对路径是相对vs工程的哪个目录而言相对路径的书写格式 相对路径是相对vs工程的哪个目录而言 注意&#xff1a; 并非以解决方案…

LeetCode150道面试经典题-买卖股票的最佳时机(简单)

1、题目 给定一个数组 prices &#xff0c;它的第 i 个元素 prices[i] 表示一支给定股票第 i 天的价格。 你只能选择 某一天 买入这只股票&#xff0c;并选择在 未来的某一个不同的日子 卖出该股票。设计一个算法来计算你所能获取的最大利润。 返回你可以从这笔交易中获取的…