Exemplo n.º 1
0
        public static JavaClass CreateBoClass(DDLTable table, JavaBeanConfig javaBeanConfig, bool createVo)
        {
            JavaClass javaClass = new JavaClass(javaBeanConfig.PackageName, table, javaBeanConfig);



            table.Columns.ForEach(c =>
            {
                if (false == c.Validate())
                {
                    return;
                }
                FieldBase filedBase;
                javaClass.Fields.Add(filedBase = FieldBase.Create(c));
                filedBase.FiledTypeStr         = GetFildTypeStr(filedBase);
            });

            javaClass.Desc = table.Desc;

            javaClass.ClassName = table.ClassName.Length == 0 ? CodeUtil.GetClassName(javaBeanConfig, table.TableName) : table.ClassName;

            if (createVo)
            {
                javaClass.JavaVoClass = JavaClass.CreateVo(javaBeanConfig.VOPackageName, javaClass);
            }
            return(javaClass);
        }
Exemplo n.º 2
0
        internal static FieldBase Create(DDLColumn c)
        {
            FieldBase fieldBase = new FieldBase();

            fieldBase.Name               = CodeUtil.GetFieldName(c);
            fieldBase.Desc               = c.Desc;
            fieldBase.Remark             = c.Remark;
            fieldBase.DDLColumn          = c;
            fieldBase.FieldType          = DDLUtil.AnalysisFieldType(c);
            fieldBase.JDBCType           = DBUtil.AnalysisJDBCType(fieldBase.FieldType);
            fieldBase.IsKeyField         = c.IsKeyColumn();
            fieldBase.IsPrimaryKeyColumn = c.IsPrimaryKeyColumn();
            fieldBase.IsUniqueKeyColumn  = c.IsUniqueKeyColumn();
            fieldBase.IsParentKey        = c.IsParentKey;
            return(fieldBase);
        }