检验代码生成器完成版

写维护页面重复逻辑写烦了,连页面的增、删、改、查、弹窗等代码都不行手写了,为此做成代码生成器成型版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
增加数据
在这里插入图片描述

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

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

在这里插入图片描述

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小乌鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值