java版代码生成器

之前实现的JRT代码生成器是M版的,那么用户必须用M库才能有代码生成器的功能。为了提供给就是不用M库的用户使用,JRT再提供脚本版的java代码生成器,方便直接连关系库生成JRT的代码。

实现:

import JRT.Core.MultiPlatform.JRTContext;
import JRTBLLBase.BaseHttpHandlerNoSession;
import JRTBLLBase.Helper;

import java.io.File;
import java.nio.file.Paths;
import java.util.List;

/**
 * 基于当前连接的数据库生成全部表或者指定表的代码供开发使用,从而减少开发工作量
 * 所有数据库都可以基于此代码生成器生成JRT业务代码,不同库如果查表结构有差异,调整查询sql即可
 * JRT连的哪个数据库,执行逻辑就是针对的哪个数据库,由于关系库把表名称大小写丢失了,约定表说明用英文冒号分割第一位有东西就用那个名字当实体名称,
 * 否则就按小写的表名生成代码
 */
public class JRTGenerateCode extends BaseHttpHandlerNoSession {
    /**
     * 生成所有表的代码到D:\\JRTCode
     *
     * @return
     */
    public String GenerateAllTable() throws Exception {
        //查询所有表的sql,不同数据库的拷贝或者修改这个sql,只要输出名称符合约定即可
        String qryTableSql = "SELECT table_name \"TableName\"  FROM information_schema.tables where table_schema='dbo'";
        //查询所有表
        List<JRTGenerateCodeColDto> tableList = EntityManager().FindListBySqlAll(JRTGenerateCodeColDto.class, qryTableSql, null, -1, -1);
        //为每个表生成代码
        for (JRTGenerateCodeColDto one : tableList) {
            CollectTableInfoAndGenerate(one.TableName);
        }
        return "完成";
    }

    /**
     * 生成一个表的代码到D:\\JRTCode,Url请求通过Name传入不带模式的表名称
     *
     * @return
     */
    public String GenerateOneTable() throws Exception {
        String tableName = Helper.ValidParam(JRTContext.GetRequest(Request, "Name"), "");
        if (tableName.isEmpty()) {
            return "请传入表名属性Name";
        }
        CollectTableInfoAndGenerate(tableName);
        return "完成";
    }

    /**
     * 搜集表的信息并且执行编译
     *
     * @param tableName 表名称
     */
    private void CollectTableInfoAndGenerate(String tableName) throws Exception {
        List<JRTGenerateCodeColDto> colList = GetTableInfo(tableName);
        MakeCode(colList);
    }

    /**
     * 搜集表的信息
     *
     * @param tableName 表名称
     */
    private List<JRTGenerateCodeColDto> GetTableInfo(String tableName) throws Exception {
        //查询外键信息的sql,不同数据库的拷贝或者修改这个sql,只要输出名称符合约定即可
        String qryFkRefSql = "SELECT \n" +
                "    a.table_name AS \"TableName\",\n" +
                "    b.column_name AS \"ColName\",\n" +
                "    c.table_name AS \"RefTableName\",\n" +
                "    c.column_name AS \"RefColName\" \n" +
                "FROM\n" +
                " information_schema.table_constraints a\n" +
                "INNER JOIN information_schema.key_column_usage AS b ON a.constraint_name = b.constraint_name AND a.constraint_schema = b.constraint_schema AND a.table_name = b.table_name\n" +
                "INNER JOIN information_schema.constraint_column_usage AS c ON c.constraint_name = a.constraint_name AND a.constraint_schema = c.constraint_schema\n" +
                "WHERE a.constraint_type = 'FOREIGN KEY' AND a.table_name = '" + tableName + "' AND a.constraint_schema = 'dbo'";
        //查询表和列信息的sql,不同数据库的拷贝或者修改这个sql,只要输出名称符合约定即可。由于表明都是小写,约定实体名在表说明用:分割第一位,否则就用原生表名生成实体类
        String qryTableColSql = "select\n" +
                "\tc.relname \"TableName\",\n" +
                "\tcast (\n" +
                "\t\tobj_description (relfilenode, 'pg_class') as varchar\n" +
                "\t) \"TableRemark\",\n" +
                "\ta.attname \"ColName\",\n" +
                "\td.description \"ColRemark\",\n" +
                "\tconcat_ws (\n" +
                "\t\t'',\n" +
                "\t\tt.typname,\n" +
                "\t\tSUBSTRING (\n" +
                "\t\t\tformat_type (a.atttypid, a.atttypmod)\n" +
                "\t\t\tfrom\n" +
                "\t\t\t\t'\\(.*\\)'\n" +
                "\t\t)\n" +
                "\t) as \"ColType\",attnotnull \"NotNull\"\n" +
                "from\n" +
                "\tpg_class c,\n" +
                "\tpg_attribute a,\n" +
                "\tpg_type t,\n" +
                "\tpg_description d\n" +
                "where\n" +
                "\ta.attnum > 0\n" +
                "and a.attrelid = c.oid\n" +
                "and a.atttypid = t.oid\n" +
                "and d.objoid = a.attrelid\n" +
                "and d.objsubid = a.attnum\n" +
                "and c.relname in (\n" +
                "\tselect\n" +
                "\t\ttablename\n" +
                "\tfrom\n" +
                "\t\tpg_tables\n" +
                "\twhere\n" +
                "\t\tschemaname = 'dbo'\n" +
                "\tand position ('_2' in tablename) = 0\n" +
                ")\n" +
                "and c.relname='" + tableName + "'\n" +
                "order by\n" +
                "\tc.relname,\n" +
                "\ta.attnum\n";
        //得到参照信息
        List<JRTGenerateCodeFkRefDto> refList = EntityManager().FindListBySqlAll(JRTGenerateCodeFkRefDto.class, qryFkRefSql, null, -1, -1);
        //得到表的列信息
        List<JRTGenerateCodeColDto> colList = EntityManager().FindListBySqlAll(JRTGenerateCodeColDto.class, qryTableColSql, null, -1, -1);
        for (JRTGenerateCodeColDto one : colList) {
            if (one.ColRemark.isEmpty()) {
                one.ColRemark = one.ColName;
            }
            DealType(one);
            //把参照信息并入列信息
            if (refList != null && refList.size() > 0) {
                for (JRTGenerateCodeFkRefDto r : refList) {
                    if (one.ColName.equals(r.ColName)) {
                        one.RefTableName = r.RefTableName;
                        one.RefColName = r.RefColName;
                    }
                }
            }
        }
        return colList;
    }

    /**
     * 通过表的列信息生成代码
     *
     * @param colList 表的列信息
     */
    private void MakeCode(List<JRTGenerateCodeColDto> colList) throws Exception {
        //生成代码的根地址
        String basePath = "D:\\JRTCode";
        File base = new File(basePath);
        //没有就创建
        if (!base.exists()) {
            base.mkdir();
        }
        //生成实体代码
        MakeModelCode(colList, basePath);
        //生成业务代码
        MakeBllCode(colList, basePath);
        //生成界面代码
        MakeAspxCode(colList, basePath);
    }

    /**
     * 生成实体代码
     *
     * @param colList  表信息
     * @param basePath 根地址
     */
    private void MakeModelCode(List<JRTGenerateCodeColDto> colList, String basePath) throws Exception {
        System.out.println("生成实体代码");
        StringBuilder sb = new StringBuilder();
        String modelName = colList.get(0).ModelName;

        sb.append("package JRT.Model.Entity;" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("import JRT.Core.CustomAttributes.*;" + System.lineSeparator());
        sb.append("import JRT.Core.JsonAttributes.*;" + System.lineSeparator());
        sb.append("import com.fasterxml.jackson.databind.annotation.JsonDeserialize;" + System.lineSeparator());
        sb.append("import com.fasterxml.jackson.databind.annotation.JsonSerialize;" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("/**" + System.lineSeparator());
        sb.append("*[功能描述:本代码由LIS内部代码生成工具生成,请不要手动修改,如要修改,请写修改变更记录]" + System.lineSeparator());
        sb.append("*[创建者:JRT.Entity生成器]" + System.lineSeparator());
        sb.append("*/" + System.lineSeparator());
        String rowIDCol = "";
        for (JRTGenerateCodeColDto c : colList) {
            if (rowIDCol.isEmpty()) {
                rowIDCol = c.ColName;
                sb.append("@UniqueAttribute(ColNames = \"" + rowIDCol + "\")" + System.lineSeparator());
                sb.append("@TableAttribute(Name=\"dbo." + c.TableName + "\")" + System.lineSeparator());
                sb.append("public class " + modelName + System.lineSeparator());
                sb.append("{" + System.lineSeparator());
            }
            sb.append("	/**" + System.lineSeparator());
            sb.append("	* " + c.ColRemark + System.lineSeparator());
            sb.append("	*/" + System.lineSeparator());
            //非空特性
            if (c.NotNull == true) {
                sb.append("	@NotNullAttribute" + System.lineSeparator());
            }
            //主键特性
            if (c.ColName.equals(rowIDCol)) {
                sb.append("	@IdAttribute(Name = \"" + rowIDCol + "\")" + System.lineSeparator());
            }
            //日期
            if (c.ColName.length() > 4 && c.ColName.substring(c.ColName.length() - 4, c.ColName.length() - 1).equals("Date")) {
                sb.append("	@JsonSerialize(using = JRTDateSerializer.class)" + System.lineSeparator());
                sb.append("	@JsonDeserialize(using = JRTDateDeserializer.class)" + System.lineSeparator());
                sb.append("	@DateAttribute" + System.lineSeparator());
            }
            //时间
            if (c.ColName.length() > 4 && c.ColName.substring(c.ColName.length() - 4, c.ColName.length() - 1).equals("Time")) {
                sb.append("	@JsonSerialize(using = JRTTimeSerializer.class)" + System.lineSeparator());
                sb.append("	@JsonDeserialize(using = JRTTimeDeserializer.class)" + System.lineSeparator());
                sb.append("	@TimeAttribute" + System.lineSeparator());
            }
            //外键参照
            if (c.RefTableName != null && !c.RefTableName.isEmpty()) {
                String associaField = GetAssociaField(c.RefTableName);
                sb.append("	@FrekeyAttribute(Name = \"" + associaField.split("\\^")[0] + "\", RefColumnName = \"" + c.RefColName + "\", AssociaField = \"" + associaField.split("\\^")[1] + "\")" + System.lineSeparator());
            }
            //长度特性
            if (c.Len != null) {
                sb.append("	@LengthAttribute(MaxLen = " + c.Len + ")" + System.lineSeparator());
            }
            sb.append("	public " + c.JavaType + " " + c.ColName + ";" + System.lineSeparator());
            sb.append("" + System.lineSeparator());

        }
        sb.append("}" + System.lineSeparator());
        String saveName = Paths.get(basePath, modelName + ".java").toString();
        System.out.println("生成实体代码到:" + saveName);
        JRT.Core.Util.TxtUtil.WriteText2File(saveName, sb.toString());
    }

    /**
     * 得到拉取的字段
     *
     * @param tableName
     * @return
     * @throws Exception
     */
    private String GetAssociaField(String tableName) throws Exception {
        List<JRTGenerateCodeColDto> colList = GetTableInfo(tableName);
        String refTabelName = colList.get(0).ModelName;
        String ret = "";
        int curLev = 0;
        for (JRTGenerateCodeColDto c : colList) {
            if (ret.isEmpty()) {
                ret = c.ColName;
            }
            int lev = 0;
            if (c.ColName.equals("CName")) {
                lev = 999;
            } else if (c.ColName.equals("IName")) {
                lev = 99;
            } else if (c.ColName.equals("XName")) {
                lev = 99;
            }
            if (lev > curLev) {
                curLev = lev;
                ret = c.ColName;
            }
        }
        return refTabelName + "^" + ret;
    }

    /**
     * 生成后台代码
     *
     * @param colList  表信息
     * @param basePath 根地址
     */
    private void MakeBllCode(List<JRTGenerateCodeColDto> colList, String basePath) throws Exception {
        System.out.println("生成业务代码");
        StringBuilder sb = new StringBuilder();
        String modelName = colList.get(0).ModelName;

        sb.append("import JRTBLLBase.BaseHttpHandlerNoSession;" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("import JRTBLLBase.Helper;" + System.lineSeparator());
        sb.append("import JRT.Core.Dto.HashParam;" + System.lineSeparator());
        sb.append("import JRT.Core.Dto.ParamDto;" + System.lineSeparator());
        sb.append("import JRT.Core.Dto.OutParam;" + System.lineSeparator());
        sb.append("import JRT.Model.Entity.*;" + System.lineSeparator());
        sb.append("import JRT.Core.Util.Convert;" + System.lineSeparator());
        sb.append("import JRT.Core.MultiPlatform.JRTContext;" + System.lineSeparator());
        sb.append("import java.util.ArrayList;" + System.lineSeparator());
        sb.append("import java.util.List;" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("/**" + System.lineSeparator());
        sb.append("*由代码生成器生成的后台代码" + System.lineSeparator());
        sb.append("*/" + System.lineSeparator());
        sb.append("public class ash" + modelName + " extends BaseHttpHandlerNoSession {" + System.lineSeparator());
        //构造增加方法的代码
        sb.append("" + System.lineSeparator());
        sb.append("	/**" + System.lineSeparator());
        sb.append("	 * 保存数据,前台按表的属性名提交" + System.lineSeparator());
        sb.append("	 * @return 字符串" + System.lineSeparator());
        sb.append("	 */" + System.lineSeparator());
        sb.append("	public String Save" + modelName + "() throws Exception" + System.lineSeparator());
        sb.append("    {" + System.lineSeparator());
        sb.append("		" + modelName + " dto=new " + modelName + "();" + System.lineSeparator());
        String rowIDCol = "";
        for (JRTGenerateCodeColDto c : colList) {
            if (rowIDCol.isEmpty()) {
                rowIDCol = c.ColName;
            }
            sb.append("		//" + c.ColRemark + System.lineSeparator());
            sb.append("		dto." + c.ColName + "=Helper.ValidParam(JRTContext.GetRequest(Request, \"" + c.ColName + "\"), dto." + c.ColName + ");" + System.lineSeparator());
        }
        sb.append("		OutParam out=new OutParam();" + System.lineSeparator());
        sb.append("		int ret=0;" + System.lineSeparator());
        sb.append("		//更新" + System.lineSeparator());
        sb.append("		if(dto." + rowIDCol + ">0)" + System.lineSeparator());
        sb.append("		{" + System.lineSeparator());
        sb.append("			ret=EntityManager().Update(dto,null, out, null, null, null);" + System.lineSeparator());
        sb.append("		}" + System.lineSeparator());
        sb.append("		//插入数据" + System.lineSeparator());
        sb.append("		else" + System.lineSeparator());
        sb.append("		{" + System.lineSeparator());
        sb.append("			ret=EntityManager().Save(dto,out);" + System.lineSeparator());
        sb.append("		}" + System.lineSeparator());
        sb.append("		if(ret==1)" + System.lineSeparator());
        sb.append("		{" + System.lineSeparator());
        sb.append("			return Helper.Success();" + System.lineSeparator());
        sb.append("		}" + System.lineSeparator());
        sb.append("		else" + System.lineSeparator());
        sb.append("		{" + System.lineSeparator());
        sb.append("			return Helper.Error(out);" + System.lineSeparator());
        sb.append("		}" + System.lineSeparator());
        sb.append("    }" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());

        //构造删除方法
        sb.append("	/**" + System.lineSeparator());
        sb.append("	 * 删除数据,多个RowID以上尖号分割" + System.lineSeparator());
        sb.append("	 * @return 字符串" + System.lineSeparator());
        sb.append("	 */" + System.lineSeparator());
        sb.append("	public String Delete" + modelName + "() throws Exception" + System.lineSeparator());
        sb.append("    {" + System.lineSeparator());
        sb.append("		String RowIDS=Helper.ValidParam(JRTContext.GetRequest(Request, \"RowIDS\"), \"\");" + System.lineSeparator());

        sb.append("		if(RowIDS.isEmpty())" + System.lineSeparator());
        sb.append("		{" + System.lineSeparator());
        sb.append("			return Helper.Error(\"请传入要删除数据的RowID,多个以^分割!\");" + System.lineSeparator());
        sb.append("		}" + System.lineSeparator());
        sb.append("		//分割主键" + System.lineSeparator());
        sb.append("		String [] arr=RowIDS.split(\"^\");" + System.lineSeparator());

        sb.append("		//out参数" + System.lineSeparator());
        sb.append("		OutParam out=new OutParam();" + System.lineSeparator());
        sb.append("		//循环删除数据" + System.lineSeparator());
        sb.append("		for(int i=0;i<arr.length;i++)" + System.lineSeparator());
        sb.append("		{" + System.lineSeparator());
        sb.append("			int ret=EntityManager().RemoveById(" + modelName + ".class,Convert.ToInt32(arr[i]),out);" + System.lineSeparator());
        sb.append("			if(ret!=1)" + System.lineSeparator());
        sb.append("			{" + System.lineSeparator());
        sb.append("				return Helper.Error(out);" + System.lineSeparator());
        sb.append("			}" + System.lineSeparator());
        sb.append("		}" + System.lineSeparator());
        sb.append("		return Helper.Success();" + System.lineSeparator());
        sb.append("	}" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());

        //构造查询方法的代码
        sb.append("" + System.lineSeparator());
        sb.append("	/**" + System.lineSeparator());
        sb.append("	 * 查询数据,前台按表的属性名提交" + System.lineSeparator());
        sb.append("	 * @return 字符串" + System.lineSeparator());
        sb.append("	 */" + System.lineSeparator());
        sb.append("	public String Qry" + modelName + "() throws Exception" + System.lineSeparator());
        sb.append("    {" + System.lineSeparator());
        sb.append("		//预留的取前台参数代码" + System.lineSeparator());

        sb.append("		//参数" + System.lineSeparator());
        sb.append("		List<ParamDto> para=new ArrayList<>();" + System.lineSeparator());
        sb.append("		//sql连接符号" + System.lineSeparator());
        sb.append("		List<String> joiner=new ArrayList<>();" + System.lineSeparator());
        sb.append("		//sql比较符号" + System.lineSeparator());
        sb.append("		List<String> operators=new ArrayList<>();" + System.lineSeparator());
        sb.append("		//模糊查询" + System.lineSeparator());
        sb.append("		String Filter=Helper.ValidParam(JRTContext.GetRequest(Request, \"Filter\"), \"\");" + System.lineSeparator());
        sb.append("		//预留参数" + System.lineSeparator());
        for (JRTGenerateCodeColDto c : colList) {
            sb.append("		//" + c.ColRemark + System.lineSeparator());
            sb.append("		dto." + c.ColName + "=Helper.ValidParam(JRTContext.GetRequest(Request, \"" + c.ColName + "\"), dto." + c.ColName + ");" + System.lineSeparator());
        }
        sb.append("		//模糊查询" + System.lineSeparator());
        sb.append("		if(!Filter.isEmpty())" + System.lineSeparator());
        sb.append("		{" + System.lineSeparator());
        sb.append("			ParamDto p=null;" + System.lineSeparator());
        for (JRTGenerateCodeColDto c : colList) {
            if (!c.JavaType.equals("String")) {
                continue;
            }
            sb.append("			//" + c.ColRemark + System.lineSeparator());
            sb.append("			p=new ParamDto();" + System.lineSeparator());
            sb.append("			p.Key=\"" + c.ColName + "\";" + System.lineSeparator());
            sb.append("			p.Value=\"%\"+Filter+\"%\";" + System.lineSeparator());
            sb.append("			para.add(p);" + System.lineSeparator());
            sb.append("			joiner.add(\"or\");" + System.lineSeparator());
            sb.append("			operators.add(\"like\");" + System.lineSeparator());
        }
        sb.append("		}" + System.lineSeparator());

        sb.append("		//调用查询" + System.lineSeparator());
        sb.append("		String json=EntityManager().QueryAllWithFK(" + modelName + ".class,para,\"\",true,-1,-1,\"\",joiner,operators);" + System.lineSeparator());
        sb.append("		return json;" + System.lineSeparator());
        sb.append("	}" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());

        //收尾
        sb.append("}" + System.lineSeparator());
        String saveName = Paths.get(basePath, "ash" + modelName + ".java").toString();
        System.out.println("生成业务代码到:" + saveName);
        JRT.Core.Util.TxtUtil.WriteText2File(saveName, sb.toString());

    }

    /**
     * 生成界面代码
     *
     * @param colList  表信息
     * @param basePath 根地址
     */
    private void MakeAspxCode(List<JRTGenerateCodeColDto> colList, String basePath) throws Exception {
        System.out.println("生成界面代码");
        StringBuilder sb = new StringBuilder();
        String modelName = colList.get(0).ModelName;

        String rowIDCol = "";
        for (JRTGenerateCodeColDto c : colList) {
            if (rowIDCol.isEmpty()) {
                rowIDCol = c.ColName;
            }
        }
        sb.append("<!DOCTYPE html PUBLIC \"\"-//W3C//DTD XHTML 1.0 Transitional//EN\"\" \"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"\">" + System.lineSeparator());
        sb.append("<html xmlns=\"\"http://www.w3.org/1999/xhtml\"\">" + System.lineSeparator());
        sb.append("<head>" + System.lineSeparator());
        sb.append("    <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />" + System.lineSeparator());
        sb.append("    <title>" + modelName + "供拷贝代码使用</title>" + System.lineSeparator());
        sb.append("    <link rel=\"shortcut icon\" href=\"../../resource/common/images/favicon.ico\" />" + System.lineSeparator());
        sb.append("    <script src=\"../../resource/common/js/JRTBSBase.js\" type=\"text/javascript\"></script>" + System.lineSeparator());

        sb.append("    <script language=\"javascript\" type=\"text/javascript\">" + System.lineSeparator());
        sb.append("        SYSPageCommonInfo.Init();" + System.lineSeparator());
        sb.append("        var BasePath = '';" + System.lineSeparator());
        sb.append("        var ResourcePath = '';" + System.lineSeparator());
        sb.append("        var WebServicAddress = SYSPageCommonInfo.Data.WebServicAddress;" + System.lineSeparator());
        sb.append("        var UserDR = SYSPageCommonInfo.Data.Sesssion.UserDR;" + System.lineSeparator());
        sb.append("        var WorkGroupDR = SYSPageCommonInfo.Data.Sesssion.WorkGroupDR;" + System.lineSeparator());
        sb.append("        var sysTheme = SYSPageCommonInfo.Data.Sesssion.Theme;" + System.lineSeparator());
        sb.append("        var SessionStr = SYSPageCommonInfo.Data.SessionStr;" + System.lineSeparator());
        sb.append("    </script>" + System.lineSeparator());

        sb.append("    <script type=\"text/javascript\">" + System.lineSeparator());
        sb.append("        //全局变量" + System.lineSeparator());
        sb.append("        var me = {" + System.lineSeparator());
        sb.append("            actionUrl: '../ashx/ash" + modelName + ".ashx'" + System.lineSeparator());
        sb.append("        };" + System.lineSeparator());
        sb.append("");
        sb.append("        //jquery入口" + System.lineSeparator());
        sb.append("        $(function () {" + System.lineSeparator());
        sb.append("");
        sb.append("            //新增数据点击" + System.lineSeparator());
        sb.append("            $(\"#btnAdd" + modelName + "\").click(function () {" + System.lineSeparator());
        sb.append("                $(\"#txt" + modelName + "" + rowIDCol + "\").val(\"\"); " + System.lineSeparator());
        sb.append("				$('#winEdit" + modelName + "').window({" + System.lineSeparator());
        sb.append("                    title: TranslateDataMTHD('Add Data', '新增数据', '')," + System.lineSeparator());
        sb.append("                    modal: true" + System.lineSeparator());
        sb.append("                });" + System.lineSeparator());
        sb.append("            });" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("            //修改数据点击" + System.lineSeparator());
        sb.append("            $(\"#btnUpdate" + modelName + "\").click(function () {" + System.lineSeparator());
        sb.append("				Update" + modelName + "();" + System.lineSeparator());
        sb.append("            });" + System.lineSeparator());

        sb.append("" + System.lineSeparator());
        sb.append("			//修改数据" + System.lineSeparator());
        sb.append("			function Update" + modelName + "(row)" + System.lineSeparator());
        sb.append("			{" + System.lineSeparator());
        sb.append("                var selectRow = $('#dg" + modelName + "').datagrid(\"getSelected\");" + System.lineSeparator());
        sb.append("                if(row!=null)" + System.lineSeparator());
        sb.append("                {" + System.lineSeparator());
        sb.append("                	selectRow=row;" + System.lineSeparator());
        sb.append("                }" + System.lineSeparator());
        sb.append("                if (selectRow == null) {" + System.lineSeparator());
        sb.append("                    $.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to modify', '请选择要修改的数据!', ''), 'info');" + System.lineSeparator());
        sb.append("                    return;" + System.lineSeparator());
        sb.append("                }" + System.lineSeparator());
        sb.append("				$(\"#form" + modelName + "\").form('load', selectRow);" + System.lineSeparator());
        sb.append("				$('#winEdit" + modelName + "').window({" + System.lineSeparator());
        sb.append("                    title: TranslateDataMTHD('Update Data', '修改数据', '')," + System.lineSeparator());
        sb.append("                    modal: true" + System.lineSeparator());
        sb.append("                });" + System.lineSeparator());
        sb.append("			}" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());

        sb.append("            //删除数据点击" + System.lineSeparator());
        sb.append("            $(\"#btnDelete" + modelName + "\").click(function () {" + System.lineSeparator());
        sb.append("                var checkRow = $('#dg" + modelName + "').datagrid(\"getChecked\");" + System.lineSeparator());
        sb.append("                var selectRow = $('#dg" + modelName + "').datagrid(\"getSelected\");" + System.lineSeparator());
        sb.append("                if ((checkRow == null || checkRow.length == 0)&&selectRow==null) {" + System.lineSeparator());
        sb.append("                    $.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to delete', '请勾选要删除的数据!', ''), 'info');" + System.lineSeparator());
        sb.append("                    return;" + System.lineSeparator());
        sb.append("                }" + System.lineSeparator());
        sb.append("                if ((checkRow == null || checkRow.length == 0)) {" + System.lineSeparator());
        sb.append("                    checkRow=[selectRow];" + System.lineSeparator());
        sb.append("                }" + System.lineSeparator());
        sb.append("                var RowIDS = \"\";" + System.lineSeparator());
        sb.append("                for (var i = 0; i < checkRow.length; i++) {" + System.lineSeparator());
        sb.append("                    if (i == 0) {" + System.lineSeparator());
        sb.append("                        RowIDS = checkRow[i]." + rowIDCol + ";" + System.lineSeparator());
        sb.append("                    }" + System.lineSeparator());
        sb.append("                    else {" + System.lineSeparator());
        sb.append("                        RowIDS += \"^\" + checkRow[i]." + rowIDCol + ";" + System.lineSeparator());
        sb.append("                    }" + System.lineSeparator());
        sb.append("                }" + System.lineSeparator());

        sb.append("                $.messager.confirm(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Do you want to delete the selected data', '是否要删除选择的数据?', '') , function (r) {" + System.lineSeparator());
        sb.append("                    if (r) {" + System.lineSeparator());
        sb.append("                		//开启等待" + System.lineSeparator());
        sb.append("                		$.messager.progress({ text: TranslateDataMTHD(\"Deleting data\",\"正在删除数据\", \"\"), interval: 500 });" + System.lineSeparator());
        sb.append("                		setTimeout(function () {" + System.lineSeparator());
        sb.append("                    		$.messager.progress('close');" + System.lineSeparator());
        sb.append("                		}, 8000);" + System.lineSeparator());
        sb.append("                		//往后台提交数据" + System.lineSeparator());
        sb.append("                		$.ajax({" + System.lineSeparator());
        sb.append("                    		type: \"post\"," + System.lineSeparator());
        sb.append("                    		dataType: \"json\"," + System.lineSeparator());
        sb.append("                    		cache: false, //" + System.lineSeparator());
        sb.append("                    		async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir" + System.lineSeparator());
        sb.append("                    		url: me.actionUrl + '?Method=Delete" + modelName + "'," + System.lineSeparator());
        sb.append("                    		data: { RowIDS: RowIDS }," + System.lineSeparator());
        sb.append("                    		success: function (data, status) {" + System.lineSeparator());
        sb.append("                        		$.messager.progress('close');" + System.lineSeparator());
        sb.append("                        		if (!FilterBackData(data)) {" + System.lineSeparator());
        sb.append("                            		return;" + System.lineSeparator());
        sb.append("                        		}" + System.lineSeparator());
        sb.append("                        		if (!data.IsOk) {" + System.lineSeparator());
        sb.append("                            		$.messager.alert(TranslateDataMTHD(\"Error message\", \"错误提示\", \"\"), TranslateDataMTHD(\"failed to dalete data, error message:\", \"删除失败,错误信息:\", \"\") + data.Message);" + System.lineSeparator());
        sb.append("                        		}" + System.lineSeparator());
        sb.append("                        		else {" + System.lineSeparator());
        sb.append("                            		Qry" + modelName + "();" + System.lineSeparator());
        sb.append("                            		$.messager.show({" + System.lineSeparator());
        sb.append("                                		title: TranslateDataMTHD(\"Info\", \"提示\", \"\")," + System.lineSeparator());
        sb.append("                               		 	msg: TranslateDataMTHD(\"Successfully deleted!\", \"删除成功!\", \"\")," + System.lineSeparator());
        sb.append("                                		timeout: 500," + System.lineSeparator());
        sb.append("                                		showType: 'slide'" + System.lineSeparator());
        sb.append("                            		});" + System.lineSeparator());
        sb.append("                        		}" + System.lineSeparator());
        sb.append("                    		}" + System.lineSeparator());
        sb.append("                		});" + System.lineSeparator());
        sb.append("                    }" + System.lineSeparator());
        sb.append("                });" + System.lineSeparator());
        sb.append("            });" + System.lineSeparator());
        sb.append("");
        sb.append("");

        sb.append("            //保存数据" + System.lineSeparator());
        sb.append("            $(\"#btnSave" + modelName + "\").click(function () {" + System.lineSeparator());
        sb.append("                var saveData = jQuery.parseJSON($(\"#form" + modelName + "\").serializeObject());" + System.lineSeparator());
        sb.append("                //开启等待" + System.lineSeparator());
        sb.append("                $.messager.progress({ text: TranslateDataMTHD(\"Saving data\",\"正在保存数据\", \"\"), interval: 500 });" + System.lineSeparator());
        sb.append("                setTimeout(function () {" + System.lineSeparator());
        sb.append("                    $.messager.progress('close');" + System.lineSeparator());
        sb.append("                }, 8000);" + System.lineSeparator());
        sb.append("                //往后台提交数据" + System.lineSeparator());
        sb.append("                $.ajax({" + System.lineSeparator());
        sb.append("                    type: \"post\"," + System.lineSeparator());
        sb.append("                    dataType: \"json\"," + System.lineSeparator());
        sb.append("                    cache: false, //" + System.lineSeparator());
        sb.append("                    async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir" + System.lineSeparator());
        sb.append("                    url: me.actionUrl + '?Method=Save" + modelName + "'," + System.lineSeparator());
        sb.append("                    data: saveData," + System.lineSeparator());
        sb.append("                    success: function (data, status) {" + System.lineSeparator());
        sb.append("                        $.messager.progress('close');" + System.lineSeparator());
        sb.append("                        if (!FilterBackData(data)) {" + System.lineSeparator());
        sb.append("                            return;" + System.lineSeparator());
        sb.append("                        }" + System.lineSeparator());
        sb.append("                        if (!data.IsOk) {" + System.lineSeparator());
        sb.append("                            $.messager.alert(TranslateDataMTHD(\"Error message\", \"错误提示\", \"\"), TranslateDataMTHD(\"failed to dalete data, error message:\", \"删除失败,错误信息:\", \"\") + data.Message);" + System.lineSeparator());
        sb.append("                        }" + System.lineSeparator());
        sb.append("                        else {" + System.lineSeparator());
        sb.append("                            Qry" + modelName + "();" + System.lineSeparator());
        sb.append("                            $.messager.show({" + System.lineSeparator());
        sb.append("                                title: TranslateDataMTHD(\"Info\", \"提示\", \"\")," + System.lineSeparator());
        sb.append("                                msg: TranslateDataMTHD(\"Successfully saveed!\", \"保存成功!\", \"\")," + System.lineSeparator());
        sb.append("                                timeout: 500," + System.lineSeparator());
        sb.append("                                showType: 'slide'" + System.lineSeparator());
        sb.append("                            });" + System.lineSeparator());
        sb.append("                            $('#winEdit" + modelName + "').window(\"close\");" + System.lineSeparator());
        sb.append("                        }" + System.lineSeparator());
        sb.append("                    }" + System.lineSeparator());
        sb.append("                });" + System.lineSeparator());
        sb.append("            });" + System.lineSeparator());
        sb.append("");
        sb.append("");
        sb.append("            //关闭窗口" + System.lineSeparator());
        sb.append("            $(\"#btnClose" + modelName + "\").click(function () {" + System.lineSeparator());
        sb.append("				$('#winEdit" + modelName + "').window(\"close\");" + System.lineSeparator());
        sb.append("            });" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());

        sb.append("            //构造查询事件" + System.lineSeparator());
        sb.append("            $(\"#txtFilter" + modelName + "\").searchbox({" + System.lineSeparator());
        sb.append("                searcher: function (value, name) {" + System.lineSeparator());
        sb.append("                    Qry" + modelName + "();" + System.lineSeparator());
        sb.append("                }," + System.lineSeparator());
        sb.append("                prompt: TranslateDataMTHD('Enter query', '回车查询', '')" + System.lineSeparator());
        sb.append("            });" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());

        for (JRTGenerateCodeColDto c : colList) {
            //外键参照列
            if (c.RefTableName != null && !c.RefTableName.isEmpty()) {
                String aa = GetAssociaField(c.RefTableName);
                String refModelName = GetAssociaField(c.RefTableName).split("\\^")[0];
                String associaField = GetAssociaField(c.RefTableName).split("\\^")[1];
                sb.append("            //" + c.ColRemark + "下拉表格渲染" + System.lineSeparator());
                sb.append("            $('#txt" + modelName + c.ColName + "').combogrid({" + System.lineSeparator());
                sb.append("                panelWidth: 350," + System.lineSeparator());
                sb.append("                idField: '" + rowIDCol + "'," + System.lineSeparator());
                sb.append("                width: 205," + System.lineSeparator());
                sb.append("                textField: '" + associaField + "'," + System.lineSeparator());
                sb.append("                url: me.actionUrl + '?Method=CommonQueryView&data='+JSON.stringify({ ModelName: \"" + refModelName + "\", Pram: [], IsDisplayCount: false, Joiner: [], Operators: [] })," + System.lineSeparator());
                sb.append("                columns: [[" + System.lineSeparator());
                sb.append("                    { field: '" + rowIDCol + "', title: '主键', width: 60 }," + System.lineSeparator());
                sb.append("                    { field: '" + associaField + "', title: '名称', width: 260 }" + System.lineSeparator());
                sb.append("                ]]" + System.lineSeparator());
                sb.append("            });" + System.lineSeparator());
                sb.append("            $('#txt" + modelName + c.ColName + "').combogrid(\"showSelectWin\");" + System.lineSeparator());
                sb.append("" + System.lineSeparator());
            } else {

                if (c.JavaType.equals("Boolean") || c.JavaType.equals("boolean")) {
                    sb.append("            //" + c.ColRemark + "布尔渲染" + System.lineSeparator());
                    sb.append("            $('#txt" + modelName + c.ColName + "').combobox({" + System.lineSeparator());
                    sb.append("                valueField:'RowID'," + System.lineSeparator());
                    sb.append("                textField:'CName'," + System.lineSeparator());
                    sb.append("                width: 205," + System.lineSeparator());

                    sb.append("                data: [{\"RowID\":\"0\",\"CName\":TranslateDataMTHD('No', '否', '')},{\"RowID\":\"1\",\"CName\":TranslateDataMTHD('Yes', '是', '')}]" + System.lineSeparator());
                    sb.append("            });" + System.lineSeparator());
                    sb.append("" + System.lineSeparator());
                }
                if (c.ColName.length() > 4) {
                    String LastName = c.ColName.substring(c.ColName.length() - 4, c.ColName.length() - 1);
                    if (LastName.equals("Date")) {
                        sb.append("            //" + c.ColRemark + "日期渲染" + System.lineSeparator());
                        sb.append("            $('#txt" + modelName + c.ColName + "').datebox({" + System.lineSeparator());
                        sb.append("                required:false," + System.lineSeparator());
                        sb.append("                editable: true," + System.lineSeparator());
                        sb.append("                width: 205," + System.lineSeparator());
                        sb.append("                formatter: DateFormatter," + System.lineSeparator());
                        sb.append("                parser: DateParser" + System.lineSeparator());
                        sb.append("            });" + System.lineSeparator());
                        sb.append("            //设置默认日期" + System.lineSeparator());
                        sb.append("            $('#txt" + modelName + c.ColName + "').datebox(\"setValue\",GetCurentDate())" + System.lineSeparator());
                        sb.append("");
                    }
                    if (LastName.equals("Time")) {
                        sb.append("            //" + c.ColRemark + "时间渲染" + System.lineSeparator());
                        sb.append("            $('#txt" + modelName + c.ColName + "').timespinner({" + System.lineSeparator());
                        sb.append("                required:false," + System.lineSeparator());
                        sb.append("                editable: true," + System.lineSeparator());
                        sb.append("                width: 205," + System.lineSeparator());
                        sb.append("                showSeconds: true" + System.lineSeparator());
                        sb.append("            });" + System.lineSeparator());
                        sb.append("            //设置默认日期" + System.lineSeparator());
                        sb.append("            $('#txt" + modelName + c.ColName + "').timespinner(\"setValue\",GetCurentTime())" + System.lineSeparator());
                        sb.append("");
                    }
                }
            }
        }

        //构造表格代码
        sb.append("            //" + modelName + "表格" + System.lineSeparator());
        sb.append("            $('#dg" + modelName + "').datagrid({" + System.lineSeparator());
        sb.append("                remoteSort:false," + System.lineSeparator());
        sb.append("                singleSelect: true," + System.lineSeparator());
        sb.append("                toolbar: \"#dg" + modelName + "ToolBar\"," + System.lineSeparator());
        sb.append("                fit: true," + System.lineSeparator());
        sb.append("                onSelect: function (index, row) {" + System.lineSeparator());
        sb.append("                    //方便拷贝到子表查询用" + System.lineSeparator());
        sb.append("                	var select" + modelName + "=$('#dg" + modelName + "').datagrid(\"getSelected\");" + System.lineSeparator());
        sb.append("                }," + System.lineSeparator());
        sb.append("                onDblClickRow: function (index, row) {" + System.lineSeparator());
        sb.append("                    Update" + modelName + "(row);" + System.lineSeparator());
        sb.append("                }," + System.lineSeparator());
        sb.append("");
        sb.append("                columns: [[" + System.lineSeparator());
        sb.append("                    { field: 'ChkFlag', title: TranslateDataMTHD('Check', '选择', ''), width: 20, sortable: true, align: 'center', checkbox: true }," + System.lineSeparator());
        int index = 0;
        //构造表格列
        for (JRTGenerateCodeColDto c : colList) {
            String endChar = ",";
            if (c.RefTableName != null && !c.RefTableName.isEmpty()) {
                String colName = c.ColName;
                if (!c.RefColName.equals(rowIDCol)) {
                    colName = colName + "Name";
                }

            }
            index++;
            if (index == colList.size()) {
                endChar = "";
            }
            sb.append("                    { field: '" + c.ColName + "', title: TranslateDataMTHD('" + c.ColName + "', '" + c.ColRemark + "', '') , width: 150, sortable: true }" + endChar + System.lineSeparator());
        }
        sb.append("                ]]" + System.lineSeparator());
        sb.append("            });" + System.lineSeparator());
        sb.append("");
        sb.append("");
        //构造查询表格方法代码
        sb.append("            //查询" + modelName + System.lineSeparator());
        sb.append("            function Qry" + modelName + "() {" + System.lineSeparator());
        sb.append("                var Filter = $(\"#txtFilter" + modelName + "\").searchbox(\"getValue\");" + System.lineSeparator());
        sb.append("                //开启等待,默认注释,在单击事件调用的逻辑启用等待会冲掉双击事件,按需要开启" + System.lineSeparator());
        sb.append("                //$.messager.progress({ text: TranslateDataMTHD(\"Querying data\",\"正在查询数据\", \"\"), interval: 500 });" + System.lineSeparator());
        sb.append("                //setTimeout(function () {" + System.lineSeparator());
        sb.append("                    //$.messager.progress('close');" + System.lineSeparator());
        sb.append("                //}, 8000);" + System.lineSeparator());
        sb.append("                $.ajax({" + System.lineSeparator());
        sb.append("                    type: \"post\"," + System.lineSeparator());
        sb.append("                    dataType: \"json\"," + System.lineSeparator());
        sb.append("                    cache: false, //" + System.lineSeparator());
        sb.append("                    async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asir" + System.lineSeparator());
        sb.append("                    url: me.actionUrl + '?Method=Qry" + modelName + "'," + System.lineSeparator());
        sb.append("                    data: { Filter: Filter }," + System.lineSeparator());
        sb.append("                    success: function (data, status) {" + System.lineSeparator());
        sb.append("                        //结束等待" + System.lineSeparator());
        sb.append("                        //$.messager.progress('close');" + System.lineSeparator());
        sb.append("                        if (!FilterBackData(data)) {" + System.lineSeparator());
        sb.append("                           return;" + System.lineSeparator());
        sb.append("                        }" + System.lineSeparator());
        sb.append("                        $('#dg" + modelName + "').datagrid(\"loadData\", data);" + System.lineSeparator());
        sb.append("                    }" + System.lineSeparator());
        sb.append("                });" + System.lineSeparator());
        sb.append("            };" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("            //执行查询数据" + System.lineSeparator());
        sb.append("            Qry" + modelName + "();" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        sb.append("		});" + System.lineSeparator());
        sb.append("    </script>" + System.lineSeparator());
        sb.append("</head>" + System.lineSeparator());

        sb.append("<body>" + System.lineSeparator());
        sb.append("    <div class=\"easyui-layout\" fit=\"true\" style=\"border: none;\">" + System.lineSeparator());
        sb.append("        <div data-options=\"region:'center',title:''\" style=\"border: none;\">" + System.lineSeparator());
        sb.append("            <div id=\"dg" + modelName + "ToolBar\" style=\"padding: 3px 0px 3px 10px;\">" + System.lineSeparator());
        sb.append("                <a id=\"btnAdd" + modelName + "\" href=\"#\" class=\"easyui-linkbutton\" data-options=\"iconCls:'icon-add'\" plain=\"true\" listranslate=\"html~Add\">新增</a>" + System.lineSeparator());
        sb.append("                <a id=\"btnUpdate" + modelName + "\" href=\"#\" class=\"easyui-linkbutton\" data-options=\"iconCls:'icon-write-order'\" plain=\"true\" listranslate=\"html~Mod\">修改</a>" + System.lineSeparator());
        sb.append("                <a id=\"btnDelete" + modelName + "\" href=\"#\" class=\"easyui-linkbutton\" data-options=\"iconCls:'icon-cancel'\" plain=\"true\" listranslate=\"html~Del\">删除</a>" + System.lineSeparator());
        sb.append("                <input id=\"txtFilter" + modelName + "\" style=\"margin-left: 14px; width: 240px;\"></input>" + System.lineSeparator());
        sb.append("            </div>" + System.lineSeparator());
        sb.append("            <table id=\"dg" + modelName + "\" title=\"\" iconcls=\"icon-paper\" listranslate=\"title~" + modelName + "\"></table>" + System.lineSeparator());
        sb.append("        </div>" + System.lineSeparator());

        int allColNum = colList.size();
        int ColNum = 1;
        if (allColNum > 6) {
            ColNum = 2;
        }
        if (allColNum > 12) {
            ColNum = 3;
        }
        int winWidth = 370 * ColNum + 30;
        int windowHeight = allColNum * 37 / ColNum + 120;
        sb.append("        <div id=\"winEdit" + modelName + "\" style=\"padding: 10px 0px 0px 10px;width:" + winWidth + "px;height:" + windowHeight + "px;display: none;\">" + System.lineSeparator());
        sb.append("            <form id=\"form" + modelName + "\" name=\"edit_form\" method=\"post\">" + System.lineSeparator());
        sb.append("                <input type=\"hidden\" id=\"txt" + modelName + "RowID\" name=\"RowID\" value=\"0\" />" + System.lineSeparator());
        sb.append("                <table>" + System.lineSeparator());
        //构造弹窗编辑的HTML
        int outColNum = 0;
        for (JRTGenerateCodeColDto c : colList) {
            if (c.ColName.equals(rowIDCol)) {
                continue;
            }
            outColNum = outColNum + 1;
            if ((ColNum == 1) || (outColNum == 1) || ((outColNum % ColNum) == 1)) {
                sb.append("                    <tr>" + System.lineSeparator());
            }
            sb.append("                        <td class=\"lisar\" jrttranslate=\"html~" + c.ColName + "\">" + c.ColRemark + "</td>" + System.lineSeparator());
            if (c.RefTableName != null && !c.RefTableName.isEmpty()) {
                sb.append("                        <td class=\"lisal\"><input id=\"txt" + modelName + c.ColName + "\" type=\"text\" name=\"" + c.ColName + "\" style=\"width:200px;\"/></td>" + System.lineSeparator());
            } else {
                sb.append("                        <td class=\"lisal\"><input id=\"txt" + modelName + c.ColName + "\" type=\"text\" name=\"" + c.ColName + "\" style=\"width:200px;\" class=\"easyui-validatebox\"  maxlength=\"" + c.Len + "\"/></td>" + System.lineSeparator());
            }
            if ((ColNum == 1) || ((outColNum % ColNum) == 0) || (outColNum == allColNum)) {
                sb.append("                    </tr>" + System.lineSeparator());
            }
        }
        sb.append("                </table>" + System.lineSeparator());
        sb.append("                <div region=\"south\" border=\"fale\" style=\"text-align: center; padding: 5px 0 0;\">" + System.lineSeparator());
        sb.append("                    <a id=\"btnSave" + modelName + "\" href=\"#\" class=\"easyui-linkbutton\" plain=\"false\" listranslate=\"html~Save\">保存</a>" + System.lineSeparator());
        sb.append("                    <span class=\"sp6\"></span>" + System.lineSeparator());
        sb.append("                    <a id=\"btnClose" + modelName + "\" href=\"#\" class=\"easyui-linkbutton\" plain=\"false\" listranslate=\"html~Cancel\">取消</a>" + System.lineSeparator());
        sb.append("                </div>" + System.lineSeparator());
        sb.append("            </form>" + System.lineSeparator());
        sb.append("        </div>" + System.lineSeparator());
        sb.append("   </div>" + System.lineSeparator());
        sb.append("</body>" + System.lineSeparator());
        sb.append("</html>" + System.lineSeparator());
        sb.append("" + System.lineSeparator());
        String saveName = Paths.get(basePath, "frm" + modelName + ".aspx").toString();
        System.out.println("生成界面代码到:" + saveName);
        JRT.Core.Util.TxtUtil.WriteText2File(saveName, sb.toString());

    }

    /**
     * 处理类型,根据数据库类型得到对应实体的Jave类型,同时处理在表说明里面可能的实体名称
     *
     * @param col 一列信息
     */
    private void DealType(JRTGenerateCodeColDto col) {
        col.ModelName = col.TableName.replace("_", "");
        //没表说明就取表名称
        if (col.TableRemark == null) {
            col.TableRemark = col.ColName;
        }
        //表说明附带的实体名称提取
        if (col.TableRemark.contains(":")) {
            System.out.println("TableRemark:"+col.TableRemark);
            String [] arr=col.TableRemark.split(":");
            col.ModelName = arr[0];
            if(arr.length>1) {
                col.TableRemark = arr[1];
            }
            else
            {
                col.TableRemark = col.TableName;
            }
        }
        //int
        if (col.ColType.equals("int4")) {
            col.Len = 10;
            if (col.NotNull) {
                col.JavaType = "int";
            } else {
                col.JavaType = "Integer";
            }
        }
        //字符串
        else if (col.ColType.contains("varchar")) {
            String len = col.ColType.replace("varchar(", "");
            len = len.replace(")", "");
            col.Len = Integer.valueOf(len);

            if (col.NotNull) {
                if (col.Len == 1 && col.ColName.contains("Is")) {
                    col.JavaType = "boolean";
                } else {
                    col.JavaType = "String";
                }
            } else {
                if (col.Len == 1 && col.ColName.contains("Is")) {
                    col.JavaType = "Boolean";
                } else {
                    col.JavaType = "String";
                }
            }
        }
        //布尔
        else if (col.ColType.contains("boolean")) {
            if (col.NotNull) {
                col.JavaType = "boolean";
            } else {
                col.JavaType = "Boolean";
            }
        }
        //浮点数
        else if (col.ColType.equals("numeric")) {
            if (col.NotNull) {
                col.JavaType = "double";
            } else {
                col.JavaType = "Double";
            }
        }
        //其他
        else {
            col.JavaType = col.ColType;
        }

    }

    /**
     * 外键信息实体
     */
    public static class JRTGenerateCodeFkRefDto {
        /**
         * 表名
         */
        public String TableName;

        /**
         * 列名
         */
        public String ColName;

        /**
         * 参照表名
         */
        public String RefTableName;

        /**
         * 参照列名
         */
        public String RefColName;

    }

    /**
     * 表和列信息实体
     */
    public static class JRTGenerateCodeColDto {
        /**
         * 表名
         */
        public String TableName;

        /**
         * 表说明
         */
        public String TableRemark;

        /**
         * 列名
         */
        public String ColName;

        /**
         * 参列说明
         */
        public String ColRemark;

        /**
         * 列数据类型
         */
        public String ColType;

        /**
         * 不为空
         */
        public boolean NotNull;

        /**
         * 参照表名
         */
        public String RefTableName;

        /**
         * 参照列名
         */
        public String RefColName;

        /**
         * 长度
         */
        public Integer Len;

        /**
         * java类型
         */
        public String JavaType;

        /**
         * 实体名称
         */
        public String ModelName;


    }
}

测试
在这里插入图片描述

生成的代码ashJRTPrintImage

import JRTBLLBase.BaseHttpHandlerNoSession;

import JRTBLLBase.Helper;
import JRT.Core.Dto.HashParam;
import JRT.Core.Dto.ParamDto;
import JRT.Core.Dto.OutParam;
import JRT.Model.Entity.*;
import JRT.Core.Util.Convert;
import JRT.Core.MultiPlatform.JRTContext;
import java.util.ArrayList;
import java.util.List;

/**
*由代码生成器生成的后台代码
*/
public class ashJRTPrintImage extends BaseHttpHandlerNoSession {

	/**
	 * 保存数据,前台按表的属性名提交
	 * @return 字符串
	 */
	public String SaveJRTPrintImage() throws Exception
    {
		JRTPrintImage dto=new JRTPrintImage();
		//主键
		dto.RowID=Helper.ValidParam(JRTContext.GetRequest(Request, "RowID"), dto.RowID);
		//代码
		dto.Code=Helper.ValidParam(JRTContext.GetRequest(Request, "Code"), dto.Code);
		//名称
		dto.CName=Helper.ValidParam(JRTContext.GetRequest(Request, "CName"), dto.CName);
		//产品组唯一标识
		dto.ProductGroup=Helper.ValidParam(JRTContext.GetRequest(Request, "ProductGroup"), dto.ProductGroup);
		//产品组存的业务ID
		dto.ProductBllID=Helper.ValidParam(JRTContext.GetRequest(Request, "ProductBllID"), dto.ProductBllID);
		//开始日期
		dto.StartDate=Helper.ValidParam(JRTContext.GetRequest(Request, "StartDate"), dto.StartDate);
		//结束日期
		dto.EndDate=Helper.ValidParam(JRTContext.GetRequest(Request, "EndDate"), dto.EndDate);
		//图片Base64串
		dto.ImgBase64String=Helper.ValidParam(JRTContext.GetRequest(Request, "ImgBase64String"), dto.ImgBase64String);
		//图片类别
		dto.ImgType=Helper.ValidParam(JRTContext.GetRequest(Request, "ImgType"), dto.ImgType);
		OutParam out=new OutParam();
		int ret=0;
		//更新
		if(dto.RowID>0)
		{
			ret=EntityManager().Update(dto,null, out, null, null, null);
		}
		//插入数据
		else
		{
			ret=EntityManager().Save(dto,out);
		}
		if(ret==1)
		{
			return Helper.Success();
		}
		else
		{
			return Helper.Error(out);
		}
    }



	/**
	 * 删除数据,多个RowID以上尖号分割
	 * @return 字符串
	 */
	public String DeleteJRTPrintImage() throws Exception
    {
		String RowIDS=Helper.ValidParam(JRTContext.GetRequest(Request, "RowIDS"), "");
		if(RowIDS.isEmpty())
		{
			return Helper.Error("请传入要删除数据的RowID,多个以^分割!");
		}
		//分割主键
		String [] arr=RowIDS.split("^");
		//out参数
		OutParam out=new OutParam();
		//循环删除数据
		for(int i=0;i<arr.length;i++)
		{
			int ret=EntityManager().RemoveById(JRTPrintImage.class,Convert.ToInt32(arr[i]),out);
			if(ret!=1)
			{
				return Helper.Error(out);
			}
		}
		return Helper.Success();
	}



	/**
	 * 查询数据,前台按表的属性名提交
	 * @return 字符串
	 */
	public String QryJRTPrintImage() throws Exception
    {
		//预留的取前台参数代码
		//参数
		List<ParamDto> para=new ArrayList<>();
		//sql连接符号
		List<String> joiner=new ArrayList<>();
		//sql比较符号
		List<String> operators=new ArrayList<>();
		//模糊查询
		String Filter=Helper.ValidParam(JRTContext.GetRequest(Request, "Filter"), "");
		//预留参数
		//主键
		dto.RowID=Helper.ValidParam(JRTContext.GetRequest(Request, "RowID"), dto.RowID);
		//代码
		dto.Code=Helper.ValidParam(JRTContext.GetRequest(Request, "Code"), dto.Code);
		//名称
		dto.CName=Helper.ValidParam(JRTContext.GetRequest(Request, "CName"), dto.CName);
		//产品组唯一标识
		dto.ProductGroup=Helper.ValidParam(JRTContext.GetRequest(Request, "ProductGroup"), dto.ProductGroup);
		//产品组存的业务ID
		dto.ProductBllID=Helper.ValidParam(JRTContext.GetRequest(Request, "ProductBllID"), dto.ProductBllID);
		//开始日期
		dto.StartDate=Helper.ValidParam(JRTContext.GetRequest(Request, "StartDate"), dto.StartDate);
		//结束日期
		dto.EndDate=Helper.ValidParam(JRTContext.GetRequest(Request, "EndDate"), dto.EndDate);
		//图片Base64串
		dto.ImgBase64String=Helper.ValidParam(JRTContext.GetRequest(Request, "ImgBase64String"), dto.ImgBase64String);
		//图片类别
		dto.ImgType=Helper.ValidParam(JRTContext.GetRequest(Request, "ImgType"), dto.ImgType);
		//模糊查询
		if(!Filter.isEmpty())
		{
			ParamDto p=null;
			//代码
			p=new ParamDto();
			p.Key="Code";
			p.Value="%"+Filter+"%";
			para.add(p);
			joiner.add("or");
			operators.add("like");
			//名称
			p=new ParamDto();
			p.Key="CName";
			p.Value="%"+Filter+"%";
			para.add(p);
			joiner.add("or");
			operators.add("like");
			//产品组唯一标识
			p=new ParamDto();
			p.Key="ProductGroup";
			p.Value="%"+Filter+"%";
			para.add(p);
			joiner.add("or");
			operators.add("like");
			//产品组存的业务ID
			p=new ParamDto();
			p.Key="ProductBllID";
			p.Value="%"+Filter+"%";
			para.add(p);
			joiner.add("or");
			operators.add("like");
			//图片Base64串
			p=new ParamDto();
			p.Key="ImgBase64String";
			p.Value="%"+Filter+"%";
			para.add(p);
			joiner.add("or");
			operators.add("like");
			//图片类别
			p=new ParamDto();
			p.Key="ImgType";
			p.Value="%"+Filter+"%";
			para.add(p);
			joiner.add("or");
			operators.add("like");
		}
		//调用查询
		String json=EntityManager().QueryAllWithFK(JRTPrintImage.class,para,"",true,-1,-1,"",joiner,operators);
		return json;
	}


}

生成的代码frmJRTPrintImage.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>JRTPrintImage供拷贝代码使用</title>
    <link rel="shortcut icon" href="../../resource/common/images/favicon.ico" />
    <script src="../../resource/common/js/JRTBSBase.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        SYSPageCommonInfo.Init();
        var BasePath = '';
        var ResourcePath = '';
        var WebServicAddress = SYSPageCommonInfo.Data.WebServicAddress;
        var UserDR = SYSPageCommonInfo.Data.Sesssion.UserDR;
        var WorkGroupDR = SYSPageCommonInfo.Data.Sesssion.WorkGroupDR;
        var sysTheme = SYSPageCommonInfo.Data.Sesssion.Theme;
        var SessionStr = SYSPageCommonInfo.Data.SessionStr;
    </script>
    <script type="text/javascript">
        //全局变量
        var me = {
            actionUrl: '../ashx/ashJRTPrintImage.ashx'
        };
        //jquery入口
        $(function () {
            //新增数据点击
            $("#btnAddJRTPrintImage").click(function () {
                $("#txtJRTPrintImageRowID").val(""); 
				$('#winEditJRTPrintImage').window({
                    title: TranslateDataMTHD('Add Data', '新增数据', ''),
                    modal: true
                });
            });


            //修改数据点击
            $("#btnUpdateJRTPrintImage").click(function () {
				UpdateJRTPrintImage();
            });

			//修改数据
			function UpdateJRTPrintImage(row)
			{
                var selectRow = $('#dgJRTPrintImage').datagrid("getSelected");
                if(row!=null)
                {
                	selectRow=row;
                }
                if (selectRow == null) {
                    $.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to modify', '请选择要修改的数据!', ''), 'info');
                    return;
                }
				$("#formJRTPrintImage").form('load', selectRow);
				$('#winEditJRTPrintImage').window({
                    title: TranslateDataMTHD('Update Data', '修改数据', ''),
                    modal: true
                });
			}



            //删除数据点击
            $("#btnDeleteJRTPrintImage").click(function () {
                var checkRow = $('#dgJRTPrintImage').datagrid("getChecked");
                var selectRow = $('#dgJRTPrintImage').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=DeleteJRTPrintImage',
                    		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 {
                            		QryJRTPrintImage();
                            		$.messager.show({
                                		title: TranslateDataMTHD("Info", "提示", ""),
                               		 	msg: TranslateDataMTHD("Successfully deleted!", "删除成功!", ""),
                                		timeout: 500,
                                		showType: 'slide'
                            		});
                        		}
                    		}
                		});
                    }
                });
            });
            //保存数据
            $("#btnSaveJRTPrintImage").click(function () {
                var saveData = jQuery.parseJSON($("#formJRTPrintImage").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=SaveJRTPrintImage',
                    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 {
                            QryJRTPrintImage();
                            $.messager.show({
                                title: TranslateDataMTHD("Info", "提示", ""),
                                msg: TranslateDataMTHD("Successfully saveed!", "保存成功!", ""),
                                timeout: 500,
                                showType: 'slide'
                            });
                            $('#winEditJRTPrintImage').window("close");
                        }
                    }
                });
            });
            //关闭窗口
            $("#btnCloseJRTPrintImage").click(function () {
				$('#winEditJRTPrintImage').window("close");
            });


            //构造查询事件
            $("#txtFilterJRTPrintImage").searchbox({
                searcher: function (value, name) {
                    QryJRTPrintImage();
                },
                prompt: TranslateDataMTHD('Enter query', '回车查询', '')
            });



            //JRTPrintImage表格
            $('#dgJRTPrintImage').datagrid({
                remoteSort:false,
                singleSelect: true,
                toolbar: "#dgJRTPrintImageToolBar",
                fit: true,
                onSelect: function (index, row) {
                    //方便拷贝到子表查询用
                	var selectJRTPrintImage=$('#dgJRTPrintImage').datagrid("getSelected");
                },
                onDblClickRow: function (index, row) {
                    UpdateJRTPrintImage(row);
                },
                columns: [[
                    { field: 'ChkFlag', title: TranslateDataMTHD('Check', '选择', ''), width: 20, sortable: true, align: 'center', checkbox: true },
                    { field: 'RowID', title: TranslateDataMTHD('RowID', '主键', '') , width: 150, sortable: true },
                    { field: 'Code', title: TranslateDataMTHD('Code', '代码', '') , width: 150, sortable: true },
                    { field: 'CName', title: TranslateDataMTHD('CName', '名称', '') , width: 150, sortable: true },
                    { field: 'ProductGroup', title: TranslateDataMTHD('ProductGroup', '产品组唯一标识', '') , width: 150, sortable: true },
                    { field: 'ProductBllID', title: TranslateDataMTHD('ProductBllID', '产品组存的业务ID', '') , width: 150, sortable: true },
                    { field: 'StartDate', title: TranslateDataMTHD('StartDate', '开始日期', '') , width: 150, sortable: true },
                    { field: 'EndDate', title: TranslateDataMTHD('EndDate', '结束日期', '') , width: 150, sortable: true },
                    { field: 'ImgBase64String', title: TranslateDataMTHD('ImgBase64String', '图片Base64串', '') , width: 150, sortable: true },
                    { field: 'ImgType', title: TranslateDataMTHD('ImgType', '图片类别', '') , width: 150, sortable: true }
                ]]
            });
            //查询JRTPrintImage
            function QryJRTPrintImage() {
                var Filter = $("#txtFilterJRTPrintImage").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=QryJRTPrintImage',
                    data: { Filter: Filter },
                    success: function (data, status) {
                        //结束等待
                        //$.messager.progress('close');
                        if (!FilterBackData(data)) {
                           return;
                        }
                        $('#dgJRTPrintImage').datagrid("loadData", data);
                    }
                });
            };


            //执行查询数据
            QryJRTPrintImage();


		});
    </script>
</head>
<body>
    <div class="easyui-layout" fit="true" style="border: none;">
        <div data-options="region:'center',title:''" style="border: none;">
            <div id="dgJRTPrintImageToolBar" style="padding: 3px 0px 3px 10px;">
                <a id="btnAddJRTPrintImage" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" plain="true" listranslate="html~Add">新增</a>
                <a id="btnUpdateJRTPrintImage" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-write-order'" plain="true" listranslate="html~Mod">修改</a>
                <a id="btnDeleteJRTPrintImage" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" plain="true" listranslate="html~Del">删除</a>
                <input id="txtFilterJRTPrintImage" style="margin-left: 14px; width: 240px;"></input>
            </div>
            <table id="dgJRTPrintImage" title="" iconcls="icon-paper" listranslate="title~JRTPrintImage"></table>
        </div>
        <div id="winEditJRTPrintImage" style="padding: 10px 0px 0px 10px;width:770px;height:286px;display: none;">
            <form id="formJRTPrintImage" name="edit_form" method="post">
                <input type="hidden" id="txtJRTPrintImageRowID" name="RowID" value="0" />
                <table>
                    <tr>
                        <td class="lisar" jrttranslate="html~Code">代码</td>
                        <td class="lisal"><input id="txtJRTPrintImageCode" type="text" name="Code" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td>
                        <td class="lisar" jrttranslate="html~CName">名称</td>
                        <td class="lisal"><input id="txtJRTPrintImageCName" type="text" name="CName" style="width:200px;" class="easyui-validatebox"  maxlength="40"/></td>
                    </tr>
                    <tr>
                        <td class="lisar" jrttranslate="html~ProductGroup">产品组唯一标识</td>
                        <td class="lisal"><input id="txtJRTPrintImageProductGroup" type="text" name="ProductGroup" style="width:200px;" class="easyui-validatebox"  maxlength="30"/></td>
                        <td class="lisar" jrttranslate="html~ProductBllID">产品组存的业务ID</td>
                        <td class="lisal"><input id="txtJRTPrintImageProductBllID" type="text" name="ProductBllID" style="width:200px;" class="easyui-validatebox"  maxlength="30"/></td>
                    </tr>
                    <tr>
                        <td class="lisar" jrttranslate="html~StartDate">开始日期</td>
                        <td class="lisal"><input id="txtJRTPrintImageStartDate" type="text" name="StartDate" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                        <td class="lisar" jrttranslate="html~EndDate">结束日期</td>
                        <td class="lisal"><input id="txtJRTPrintImageEndDate" type="text" name="EndDate" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                    </tr>
                    <tr>
                        <td class="lisar" jrttranslate="html~ImgBase64String">图片Base64</td>
                        <td class="lisal"><input id="txtJRTPrintImageImgBase64String" type="text" name="ImgBase64String" style="width:200px;" class="easyui-validatebox"  maxlength="827670"/></td>
                        <td class="lisar" jrttranslate="html~ImgType">图片类别</td>
                        <td class="lisal"><input id="txtJRTPrintImageImgType" type="text" name="ImgType" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td>
                    </tr>
                </table>
                <div region="south" border="fale" style="text-align: center; padding: 5px 0 0;">
                    <a id="btnSaveJRTPrintImage" href="#" class="easyui-linkbutton" plain="false" listranslate="html~Save">保存</a>
                    <span class="sp6"></span>
                    <a id="btnCloseJRTPrintImage" href="#" class="easyui-linkbutton" plain="false" listranslate="html~Cancel">取消</a>
                </div>
            </form>
        </div>
   </div>
</body>
</html>


生成的代码JRTPrintImage.java

package JRT.Model.Entity;

import JRT.Core.CustomAttributes.*;
import JRT.Core.JsonAttributes.*;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
*[功能描述:本代码由LIS内部代码生成工具生成,请不要手动修改,如要修改,请写修改变更记录]
*[创建者:JRT.Entity生成器]
*/
@UniqueAttribute(ColNames = "RowID")
@TableAttribute(Name="dbo.jrt_printimage")
public class JRTPrintImage
{
	/**
	* 主键
	*/
	@NotNullAttribute
	@IdAttribute(Name = "RowID")
	@LengthAttribute(MaxLen = 10)
	public int RowID;

	/**
	* 代码
	*/
	@NotNullAttribute
	@LengthAttribute(MaxLen = 20)
	public String Code;

	/**
	* 名称
	*/
	@NotNullAttribute
	@LengthAttribute(MaxLen = 40)
	public String CName;

	/**
	* 产品组唯一标识
	*/
	@NotNullAttribute
	@LengthAttribute(MaxLen = 30)
	public String ProductGroup;

	/**
	* 产品组存的业务ID
	*/
	@NotNullAttribute
	@LengthAttribute(MaxLen = 30)
	public String ProductBllID;

	/**
	* 开始日期
	*/
	@NotNullAttribute
	@LengthAttribute(MaxLen = 10)
	public int StartDate;

	/**
	* 结束日期
	*/
	@NotNullAttribute
	@LengthAttribute(MaxLen = 10)
	public int EndDate;

	/**
	* 图片Base64串
	*/
	@NotNullAttribute
	@LengthAttribute(MaxLen = 827670)
	public String ImgBase64String;

	/**
	* 图片类别
	*/
	@NotNullAttribute
	@LengthAttribute(MaxLen = 10)
	public String ImgType;

}

工具脚本系列快齐了
在这里插入图片描述

M把表生成SQL脚本代码

Class Jbase.ImportTableToPostGresql Extends %RegisteredObject
{

/// 生成创建PostgreSql的SQL语句脚本
/// w ##class(Jbase.ImportTableToPostGresql).MakePGScript("D:\mktablesql.sql","")
ClassMethod MakePGScript(path, onlyInsert)
{
	s path=$g(path)
	s onlyInsert=$g(onlyInsert)
	s file=##class(%File).%New(path)
	//存在就追加
	i ##class(%File).Exists(path) d
	.d ##class(%File).Delete(path)
	.d file.Open("WSN:/SHARED:/IOTABLE=""UTF8""")
	//不存在就新建
	e  d
	.d file.Open("WSN:/SHARED:/IOTABLE=""UTF8""")
	
	//创建隐士转换
	//d ..WriteLineWithCode(file,"CREATE CAST (INTEGER AS VARCHAR) WITH INOUT AS IMPLICIT;")
	//d ..WriteLineWithCode(file,"CREATE CAST (VARCHAR AS INTEGER) WITH INOUT AS IMPLICIT;")
	//d ..WriteLineWithCode(file,"CREATE CAST (BIGINT AS VARCHAR) WITH INOUT AS IMPLICIT;")
	//d ..WriteLineWithCode(file,"CREATE CAST (VARCHAR AS BIGINT) WITH INOUT AS IMPLICIT;")
	//d ..WriteLineWithCode(file,"CREATE CAST (TEXT AS INTEGER) WITH INOUT AS IMPLICIT;")
	
	s rset1 = ##class(%ResultSet).%New()
	d rset1.Prepare("select TABLE_NAME,DESCRIPTION FROM information_schema.Tables where TABLE_SCHEMA='dbo'")
	s exeret1=rset1.Execute()
	s colCount1=rset1.GetColumnCount()
	s dealNum1=0
	s ViewNameMap=""
    While(rset1.Next())
    {
        s colField=rset1.GetColumnName(1)
        s ColValue=rset1.GetDataByName(colField)
        i $e(ColValue,1,2)="V_" d  continue
        .s ViewNameMap(ColValue)=""
        s colField2=rset1.GetColumnName(2)
        s ColValue2=rset1.GetDataByName(colField2)
        s ColValue2=$tr(ColValue2,$c(10))
        s ColValue2=$tr(ColValue2,$c(13))
        //i $e(ColValue,1,3)'="SYS" continue
        i onlyInsert'="1" d
        .//创建表的sql,先设置主键不自增
        .s oneCreateSql=..MakeOneCreateTableSql(ColValue)
        .d ..WriteLineWithCode(file,oneCreateSql_";")
        .s tableName="dbo."_ColValue

        
        .//添加表说明sql
        .s tableRemarkSql="comment on table "_tableName_" is '"_$tr(ColValue,"_","")_":"_ColValue2_"'"
        .d ..WriteLineWithCode(file,tableRemarkSql_";")
        .d ..WriteLineWithCode(file,"")
         
        .//添加列说明sql
        .s ColRemarkList=..MakeOneColRemarkSql(ColValue)
        .i $ll(ColRemarkList) d
        ..f ci=1:1:$ll(ColRemarkList) d
        ...d ..WriteLineWithCode(file,$lg(ColRemarkList,ci)_";") 
        .d ..WriteLineWithCode(file,"")
        .d ..WriteLineWithCode(file,"")
        
        //构造insert语句
        d ..MakeOneInsertSql(file,ColValue)
        
        //构造索引语句
        d ..MakeOneIndexSql(file,ColValue)
        d ..WriteLineWithCode(file,"")
        d ..WriteLineWithCode(file,"")
        d ..WriteLineWithCode(file,"")
    }
    
    //构造外键参照
    s rset2 = ##class(%ResultSet).%New()
	d rset2.Prepare("select TABLE_NAME,DESCRIPTION FROM information_schema.Tables where TABLE_SCHEMA='dbo'")
	s exeret2=rset2.Execute()
	s colCount2=rset2.GetColumnCount()
	s dealNum2=0
    While(rset2.Next())
    {
        s colField=rset2.GetColumnName(1)
        s ColValue=rset2.GetDataByName(colField)
        i $e(ColValue,1,2)="V_" continue
        s colField2=rset2.GetColumnName(2)
        s ColValue2=rset2.GetDataByName(colField2)
        //i $e(ColValue,1,3)'="SYS" continue
        //构造外键约束语句
        d ..MakeOneFKSql(file,ColValue)
    }
    //构造创建视图语句
    s ViewName="" f  s ViewName=$o(ViewNameMap(ViewName)) q:ViewName=""  d
    .s ClassName="dbo."_$tr(ViewName,"_")
    .s pathTmp=path_".xml"
    .s ret=$system.OBJ.Export(ClassName_".cls",pathTmp)
 	.s file1=##class(%File).%New(pathTmp)
 	.Do file1.Open("R:/SHARED")
 	.s AllStr=""
 	.f i=1:1:300 d
 	..s Str=file1.Read(32000,.sc)
    ..s AllStr=AllStr_Str_" "
    .d file1.Close()
 	.s ResponseXml= ##class(LIS.Util.COM.XML).FromXML(AllStr)
 	.s SqlTableName=ResponseXml.Class.SqlTableName
 	
 	.s Sql=ResponseXml.Class.ViewQuery
 	.s SqlTmp=$replace(Sql,"dbo.",$c(0))
 	.s SqlTmp=$replace(SqlTmp,"AS ",$c(1)_"""")
 	.s SqlTmp=$replace(SqlTmp,".",".""")
 	.s SqlTmp1=""
 	.s FlagNum=0
 	.f j=1:1:$l(SqlTmp) d
 	..s OneChar=$e(SqlTmp,j,j)
 	..i OneChar="""" s FlagNum=FlagNum+1
 	..i (OneChar=" ")||(OneChar=",") d
 	...i FlagNum>0 d
 	....s FlagNum=FlagNum-1
 	....s SqlTmp1=SqlTmp1_""""
 	..s SqlTmp1=SqlTmp1_OneChar
 	.i FlagNum>0 s SqlTmp1=SqlTmp1_""""
 	.s SqlTmp=$replace(SqlTmp1,$c(0),"dbo.")
 	.s SqlTmp=$replace(SqlTmp,$c(1),"AS ")
 	.s ViewSql="create view dbo."_SqlTableName_" as "_SqlTmp_";"
 	.d ..WriteLineWithCode(file,ViewSql)
    q "完成"
}

/// 生成一个表的创建表语句
/// w ##class(Jbase.ImportTableToPostGresql).MakeOneCreateTableSql("SYS_User")
ClassMethod MakeOneCreateTableSql(TableName)
{
	s TableName=$g(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()
	s retSql="create table dbo."_TableName
	s retSql=retSql_"("
	s retSql=retSql_"""RowID"" serial primary key"
	
    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)
        i colLen>10485760 s colLen=10485760
        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
        s NullStr=""
        i NULLABLE="NO" d
        .s NullStr=" not null"
        i colName="RowID" continue
        s type=colType
        s lenStr=""
        i colType="integer" d
        .s type="integer"
        .s colLen=10
        i colType="bigint" d
        .s type="integer"
        .s colLen=10
        i colType="smallint" d
        .s type="integer"
        .s colLen=10
        i colType="tinyint" d
        .s type="integer"
        .s colLen=10
        e  i colType="varchar" d
        .s type="varchar"
        .s lenStr="("_colLen_")"
        e  i colType="bit" d
        .s type="boolean"
        .s colLen=1
        e  i type="longvarbinary"
        .s type="varchar"
        .s colLen=10485760
        e  i colType="double" d
        .s type="numeric"
        .s colLen=10
        e  i colType="numeric" d
        .s type="numeric"
        .s colLen=10
        s retSql=retSql_","""_colName_""" "_type_lenStr_NullStr
    }
    s retSql=retSql_")"
    q retSql
}

/// 生成一个表的列说明
/// w ##class(Jbase.ImportTableToPostGresql).MakeOneColRemarkSql("SYS_User")
ClassMethod MakeOneColRemarkSql(TableName)
{
	s TableName=$g(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()
	s tableName="dbo."_TableName
	s retList=""
	
    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)
        i colLen>10485760 s colLen=10485760
        s colField3=rset.GetColumnName(4)
        s colDesc=rset.GetDataByName(colField3)
        s colField4=rset.GetColumnName(5)
        s NULLABLE=rset.GetDataByName(colField4)
        s colDesc=$tr(colDesc,$c(10))
        s colDesc=$tr(colDesc,$c(13))
        i '$l(colDesc) s colDesc=colName
        s sql="comment on column "_tableName_"."""_colName_""" is '"_colDesc_"'"
        s retList=retList_$lb(sql)
    }
    q retList
}

/// 构造一个表的insert语句
/// w ##class(Jbase.ImportTableToPostGresql).MakeOneInsertSql("","JRT_PrintTemplateEle")
ClassMethod MakeOneInsertSql(file, TableName)
{
	s TableName=$g(TableName)
	//替换下划线
    s tableName=$tr(TableName,"_")
    s MaxRowID=0
    i $d(@("^dbo."_tableName_"D")) d
    .s MaxRowID=""
    .&sql(SELECT count(*) INTO MaxRowID FROM dbo."_TableName_")
    //大于10000的不认为是基础数据
    //i ($e(tableName,1,3)'="SYS")&&(MaxRowID>10000) q ""
    //i ($e(tableName,1,3)'="SYS") q ""
    i MaxRowID>10000 q ""
    i ($e(tableName,$l(tableName)-2,$l(tableName))="Log") q ""
	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()
	s tableName="dbo."_TableName
	s retList=""
	s insertHead="insert into "_tableName_"("
	s index=0
	s typeStr=""
    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)
        i colLen>10485760 s colLen=10485760
        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
        i colName="RowID" continue
        s type=colType
        i colType="integer" d
        .s type="integer"
        i colType="bigint" d
        .s type="integer"
        i colType="smallint" d
        .s type="integer"
        i colType="tinyint" d
        .s type="integer"
        e  i colType="varchar" d
        .s type="varchar"
        .s lenStr="("_colLen_")"
        e  i colType="bit" d
        .s type="varchar"
        .s lenStr="("_colLen_")"
        e  i type="longvarbinary"
        .s type="varchar"
        e  i colType="double" d
        .s type="numeric"
        e  i colType="numeric" d
        .s type="numeric"
        s typeStr=typeStr_type_","
        s index=index+1
        i index>1 d
        .s insertHead=insertHead_","""_colName_""""
        e  d
        .s insertHead=insertHead_""""_colName_""""
    }
    s insertHead=insertHead_") values("
    
    s rset1 = ##class(%ResultSet).%New()
	d rset1.Prepare("select * FROM dbo."_TableName_" order by RowID asc")
	s exeret=rset1.Execute()
	s colCount=rset1.GetColumnCount()
	s rowNum=0
	s newRowID=0
    While(rset1.Next())
    {
	    s index=0
	    s valSql=""
	    s rowNum=rowNum+1
	    s rowID=0
	    f i=1:1:colCount d
        .s colField=rset1.GetColumnName(i)
        .s colVal=rset1.GetDataByName(colField)
        .s colVal=..DealNotSeeChar(colVal)
        .i i=1 s rowID=colVal q
        .s type=$p(typeStr,",",i-1)
        .s OutChar="'"
        .i (type="integer")||(type="numeric") d
        ..s OutChar=""
        ..i '$l(colVal) s colVal="null"
        .//帮助里面有特殊字符
        .i colField="FormHelp" s colVal=""
        .s index=index+1
        .i index>1 d
        ..s valSql=valSql_","_OutChar_colVal_OutChar
        .e  d
        ..s valSql=valSql_""_OutChar_colVal_OutChar
        i rowNum<rowID d
        .//比实际RowID少就删除让RowID增长
        .f j=1:1:(rowID-rowNum) d
        ..i $l(file) d
        ...d ..WriteLineWithCode(file,insertHead_valSql_");")
        ...s newRowID=newRowID+1
        ...//对齐RowID
        ...d ..WriteLineWithCode(file,"delete from dbo."_TableName_" where ""RowID""="_newRowID_"")
        i $l(file) d
        .d ..WriteLineWithCode(file,insertHead_valSql_");")
        .s newRowID=newRowID+1
        s rowNum=newRowID
    }
    i $l(file) d ..WriteLineWithCode(file,"")
    
    q ""
}

/// 构造生成索引语句
ClassMethod MakeOneIndexSql(file, TableName)
{
	s TableName=$g(TableName)
	//替换下划线
    s tableName=$tr(TableName,"_")
    
	s rset = ##class(%ResultSet).%New()
	d rset.Prepare("SELECT INDEX_NAME,COLUMN_NAME,NON_UNIQUE FROM information_schema.INDEXES WHERE TABLE_SCHEMA='dbo' and TABLE_NAME='"_TableName_"' order by ORDINAL_POSITION asc")
	s exeret=rset.Execute()
	s colCount=rset.GetColumnCount()
	s tableName="dbo."_TableName
	s MapObj=""
    While(rset.Next())
    {
	    s outStr=""
        s colField=rset.GetColumnName(1)
        s IndexName=rset.GetDataByName(colField)
        s colField1=rset.GetColumnName(2)
        s ColName=rset.GetDataByName(colField1)
        s colField2=rset.GetColumnName(3)
        s NoUnique=rset.GetDataByName(colField2)
        s IndexName=$tr(IndexName,".")
        i '$d(MapObj(NoUnique,IndexName)) d
        .s MapObj(NoUnique,IndexName)=$lb(ColName)
        e  d
        .s MapObj(NoUnique,IndexName)=MapObj(NoUnique,IndexName)_$lb(ColName)
        
    }
    s NoUnique="" f  s NoUnique=$o(MapObj(NoUnique)) q:NoUnique=""  d
    .s IndexName="" f  s IndexName=$o(MapObj(NoUnique,IndexName)) q:IndexName=""  d
    ..s NoUniqueStr=""
    ..i NoUnique="0" s NoUniqueStr="unique"
    ..s sql="create "_NoUniqueStr_" index "_TableName_"_"_IndexName_" on dbo."_TableName_" ("
    ..s ListCol=$g(MapObj(NoUnique,IndexName))
    ..f j=1:1:$ll(ListCol) d
    ...s ColName=$lg(ListCol,j)
    ...i j=1 s sql=sql_""""_ColName_""""
    ...e  s sql=sql_","""_ColName_"""" 
    ..s sql=sql_");"
    ..i $l(file) d ..WriteLineWithCode(file,sql)
    i $l(file) d ..WriteLineWithCode(file,"")
}

/// 构造生成索引语句
ClassMethod MakeOneFKSql(file, TableName)
{
	s TableName=$g(TableName)
	//替换下划线
    s tableName=$tr(TableName,"_")
    
	s rset = ##class(%ResultSet).%New()
	d rset.Prepare("SELECT constraint_name,column_name,referenced_table_name,referenced_column_name FROM information_schema.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA='dbo' and TABLE_NAME='"_TableName_"'")
	s exeret=rset.Execute()
	s colCount=rset.GetColumnCount()
	s tableName="dbo."_TableName
    While(rset.Next())
    {
	    s outStr=""
        s colField=rset.GetColumnName(1)
        s fkName=rset.GetDataByName(colField)
        s colField1=rset.GetColumnName(2)
        s ColName=rset.GetDataByName(colField1)
        s colField2=rset.GetColumnName(3)
        s refTableName=rset.GetDataByName(colField2)
        i '$l(refTableName) continue
        s colField3=rset.GetColumnName(4)
        s refColName=rset.GetDataByName(colField3)
        i '$l(refColName) continue
        s sql="alter table dbo."_TableName_" add constraint "_TableName_"_"_fkName_" foreign key ("""_ColName_""") references dbo."_refTableName_" ("""_refColName_""");"
        i $l(file) d ..WriteLineWithCode(file,sql)
    	
    }
    i $l(file) d ..WriteLineWithCode(file,"")
}

/// 带编码转换写字符
ClassMethod WriteLineWithCode(file, str)
{
	d file.WriteLine(str)
	//d file.WriteLine($zcvt(str,"O","UTF8"))
}

/// 去除不可见字符
ClassMethod DealNotSeeChar(Data As %String) As %String
{
	s Data=$g(Data)
	i $l(Data) d
	.f i=0:1:31  d
	..s Data=$tr(Data,$c(i))
	.s Data=$tr(Data,$c(127))
	q Data
}

}

在这里插入图片描述

在这里插入图片描述

越来越接近发布了,像一个精致的艺术品,越来越喜欢了

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

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

相关文章

代理IP有没有风险和安全问题?

在数字时代&#xff0c;随着互联网的日益普及&#xff0c;代理IP作为一种网络技术&#xff0c;其安全风险和潜在问题也逐渐成为人们关注的焦点。今天我们就来看看&#xff0c;代理IP到底有什么安全问题&#xff0c;我们又该如何避免这些问题呢&#xff1f; 这得从代理IP是什么来…

解读BEVFormer,新一代CV工作的基石

文章出处 BEVFormer这篇文章很有划时代的意义&#xff0c;改变了许多视觉领域工作的pipeline[2203.17270] BEVFormer: Learning Birds-Eye-View Representation from Multi-Camera Images via Spatiotemporal Transformers (arxiv.org)https://arxiv.org/abs/2203.17270 BEV …

fatal error:require():Failed opening required

今天部署网站遇到了个错误 fatal error:require():Failed opening required 这个错误经常遇到 大多是网站 是开启了 open_basedir 但今天这个错误很神奇 先说解决方法 1. 检测一下是不是真的 不存在这个文件 即使100%确定 也建议你再仔细看一下 这个文件存不存在 今天我遇…

高光谱图像加载、归一化和增强(jupyter book)

1.获取高光谱图像&#xff1a;我用的是indian_pines的数据集&#xff0c;感兴趣的兄弟可以自行去官方网下载&#xff0c;gt的那个是它的标签哦&#xff0c;别搞错了。 2.图像加载&#xff1a; &#xff08;1&#xff09;从本地路径加载 import scipy.io as sio# 文件路径 fil…

在 ASP.NET Core Web API 中使用操作筛选器统一处理通用操作

前言&#xff1a;什么是操作筛选器 操作筛选器是 ASP.NET Core Web API 中的一种过滤器&#xff0c;用于在执行控制器操作&#xff08;Action&#xff09;之前或之后执行一些代码&#xff0c;完成特定的功能&#xff0c;比如执行日志记录、身份验证、授权、异常处理等通用的处…

css设置不可点击

文章目录 一、前言二、MDN三、使用四、注意五、总结六、最后 一、前言 在网页开发中&#xff0c;经常会遇到一种情况&#xff0c;就是需要将某个元素的点击事件屏蔽&#xff0c;使其在用户点击时没有任何反应。这时候&#xff0c;我们可以通过CSS的pointer-events属性设置为no…

详解SpringCloud微服务技术栈:ElasticSearch搜索结果处理(排序、分页、高亮)

&#x1f468;‍&#x1f393;作者简介&#xff1a;一位大四、研0学生&#xff0c;正在努力准备大四暑假的实习 &#x1f30c;上期文章&#xff1a;详解SpringCloud微服务技术栈&#xff1a;DSL查询ES文档高级语法、相关性算分数学原理总结 &#x1f4da;订阅专栏&#xff1a;微…

【华为 ICT HCIA eNSP 习题汇总】——题目集9

1、缺省情况下&#xff0c;广播网络上 OSPF 协议 Hello 报文发送的周期和无效周期分别为&#xff08;&#xff09;。 A、10s&#xff0c;40s B、40s&#xff0c;10s C、30s&#xff0c;20s D、20s&#xff0c;30s 考点&#xff1a;①路由技术原理 ②OSPF 解析&#xff1a;&…

Android源码设计模式解析与实战第2版笔记(一)

第一章 走向灵活软件之路 — 面向对象的六大原则 优化代码的第一步 — 单一职责原则 单一职责原则的英文名称是Single Responsibility Principle&#xff0c;缩写是SRP。 SRP&#xff1a;就一个类而言&#xff0c;应该仅有一个引起它变化的原因。 一个类中应该是一组相关性很…

Elasticsearch:使用 Gemini、Langchain 和 Elasticsearch 进行问答

本教程演示如何使用 Gemini API创建 embeddings 并将其存储在 Elasticsearch 中。 我们将学习如何将 Gemini 连接到 Elasticsearch 中存储的私有数据&#xff0c;并使用 Langchian 构建问答功能。 准备 Elasticsearch 及 Kibana 如果你还没有安装好自己的 Elasticsearch 及 Ki…

小游戏选型(二):第三方社交小游戏厂家对比,即构/声网/融云/云信等

前言&#xff1a; 上一篇文章我们主要介绍社交游戏化趋势&#xff0c;并分析了直播平台面临的买量贵、变现难等问题&#xff0c;探讨了小游戏作为新的运营变现玩法的优势。同时还列举了各大直播平台TOP5的小游戏。今天我们继续介绍小游戏系列内容&#xff0c;本文是该系列的第…

力扣算法-Day20

541. 反转字符串II 给定一个字符串 s 和一个整数 k&#xff0c;从字符串开头算起&#xff0c;每计数至 2k 个字符&#xff0c;就反转这 2k 字符中的前 k 个字符。 如果剩余字符少于 k 个&#xff0c;则将剩余字符全部反转。如果剩余字符小于 2k 但大于或等于 k 个&#xff0c…

确定软件项目范围基准 5个重点

软件项目范围基准明确了项目的边界、目标和主要交付成果&#xff0c;有助于提高项目成本、进度和资源估算的准确性&#xff0c;便于实施项目控制&#xff0c;而且还可以帮助我们清楚分派责任&#xff0c;防止范围蔓延&#xff0c;从而提升项目的成功率。 如果没有明确确定范围基…

Java复习系列之阶段二:数据库

1. 基础语法 1.1 DQL&#xff08;数据查询语句&#xff09; 执行顺序&#xff1a; from、join 、on、where、group by、having、select、distinct、order by、limit 1.2 DML&#xff08;数据修改语言&#xff09; 对数据表的增删改 insert into update set delete form 1.…

数模.聚类模型

一、前言 二、K-means聚类算法 下面是针对量纲不同进行的操作 三、系统聚类 spass操作 spass操作 总结&#xff1a;最好使用系统聚类算法&#xff0c;在论文上写的的内容更加充实&#xff0c;图片也较多 四、DBSCAN算法 适用于这种比较有规律的。 这种算法使用很少。不建议使用…

喝酒筛子小游戏集合源码微信小程序喝酒骰子程序带流量主版本源码酒桌玩筛子源码

2023新版酒桌小游戏喝酒小程序源码-&#xff08;流量主版本&#xff09; 修改增加了广告位 根据文档直接替换&#xff0c;原版本没有广告位 直接上传源码到开发者端即可 通过后改广告代码&#xff0c;然后关闭广告展示提交&#xff0c;通过后打开即可 无广告引流 流量主版…

签到业务流程

1.技术选型 Redis主写入查询&#xff0c;Mysql辅助查询&#xff0c;传统签到多数都是直接采用mysql为存储DB,在大数据的情况下数据库的压力较大.查询速率也会随着数据量增大而增加.所以在需求定稿以后查阅了很多签到实现方式,发现用redis做签到会有很大的优势.本功能主要用到r…

git:使用git rebase合并多次commit为一个

git log&#xff1a;找到需要合并的最早 commit 的父级 git rebase -i 73a5cd8597除第一个 pick 外&#xff0c;将其它改成 s&#xff0c;改完后保存退出 保存完后弹出 commit message 合并提示&#xff0c;根据这次合并的目的&#xff0c;重写commit message&#xff0c;改完后…

计算机中丢失mfc100u.dll怎么解决,详细解析mfc100u.dll丢失的解决方法

遭遇“无法找到mfc100u.dll”的错误不必过分担忧&#xff0c;这是一个普遍现象。许多用户在启动某些软件或游戏的时候可能会碰到这样的情况。通常&#xff0c;这个错误信息表明你的计算机系统中缺失了一个关键的动态链接库(DLL)文件&#xff0c;它可能会妨碍应用程序的顺利启动…

Android读写文件,适配Q以上

Android Q升级了文件系统&#xff0c;访问文件不仅仅是说动态权限了&#xff0c;有各种限制。权限什么的就不赘述了&#xff0c;下面介绍一下在10以上的系统中访问文件。 首先是打开文件管理器 /*** 打开文件管理器 存储卡和外接U盘都可以访问*/public void openFileManager()…