zoukankan      html  css  js  c++  java
  • 循环生成sql文件。

    package com;
    
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.PrintWriter;
    
    public class getSql {
        public static void main(String[] args){
            //创建一个文件对象
            File datafile = new File("D:\shopSql.sql");
            try{
                datafile.createNewFile();
            //下面开始向文件中写入数据
            FileWriter fw=new FileWriter(datafile);
            PrintWriter out=null;
            out=new PrintWriter(fw);
            for(int i=1;i<100000;i++){
                String partyId = "w"+i;
                String userLoginId = "user"+i;
                String iStr = String.valueOf(i);
                String ShopTelStr = "789-1111111";
                String EnterPriseId = "E"+i;
                ShopTelStr = ShopTelStr.substring(0,ShopTelStr.length()-iStr.length())+iStr;
                String partySql = "insert into Party(PARTY_ID,PARTY_TYPE_ID,STATUS_ID,CREATED_DATE,CREATED_BY_USER_LOGIN,LAST_MODIFIED_DATE,LAST_MODIFIED_BY_USER_LOGIN,LAST_UPDATED_STAMP,LAST_UPDATED_TX_STAMP,CREATED_STAMP,CREATED_TX_STAMP) "+
                                "values('"+partyId+"','PARTY_GROUP','PARTY_ENABLED','2015-09-17 17:40:56','admin','2015-09-17 17:40:56','admin','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56');";
                String userLoginSql = "insert into User_Login(USER_LOGIN_ID,CURRENT_PASSWORD,ENABLED,LAST_UPDATED_STAMP,LAST_UPDATED_TX_STAMP,CREATED_STAMP,CREATED_TX_STAMP,PARTY_ID)"+
                        "values('"+userLoginId+"','$XnAW6aavnoCchMe67vifBZatqCU','Y','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56','"+partyId+"');";
                String partyGroupSql = "insert into party_group(PARTY_ID,GROUP_NAME,COMMENTS,SHOP_ADDRESS,LINK_MAN,LAST_UPDATED_STAMP,LAST_UPDATED_TX_STAMP,CREATED_STAMP,CREATED_TX_STAMP,TAG3,TAG2,LICENSED_DINING_IMAGE_URL,TAG1,MERCHANT_TYPE_ID,SHOP_TEL_NUMBER,RENTAL_FROM_DATE,RENTAL_THRU_DATE,BUSINESS_LICENSE_IMAGE_URL,COMPANY_LOGO_IMAGE_URL,COMPANY_IMAGE_URL,LATITUDE,LONGITUDE,UPDATED_TIME,CREATED_TIME,ENTERPRISE_ID)"+
                        "values('"+partyId+"','商户名称WW"+i+"','备注"+i+"','地址"+i+"','联系人"+i+"','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56','标签三"+i+"','标签二"+i+"','/images/upload/partyImage/1.jpg','标签1"+i+"','FOOT','"+ShopTelStr+"','2015-09-17 00:00:00','2015-09-24 00:00:00','/images/upload/partyImage/2.jpg','/images/upload/partyImage/3.jpg','/images/upload/partyImage/4.jpg','"+i+"','"+i+"','2015-09-17 17:43:38','2015-09-17 17:40:56','"+EnterPriseId+"');";
                String enterPriseSql = "insert into enterprise_info (ENTERPRISE_ID,ENTERPRISE_NAME,ORG_CODE,ENTERPRISE_ADDRESS,REGISTER_ADDRESS,TAX_REGION,SCALE,INDUSTRY,OFFICER,OFFICER_TITLE,OFFICER_PHONE,OFFICER_MOBILE,OFFICER_EMAIL,CONTACT_ADDRESS,DESCRIPTION,LICENSE_COPY,TAX_CERTIFICATE_COPY,COMMITEMENT_COPY,ORG_CODE_CERTIFICATE_COPY,STATUS,ENTERPRISE_CATEGORY,LAST_UPDATED_STAMP,LAST_UPDATED_TX_STAMP,CREATED_STAMP,CREATED_TX_STAMP,LEGAL_PERSON,REGISTER_CAPITAL)"+
                        "values('"+EnterPriseId+"','法人"+i+"','代码"+i+"','经营地址"+i+"','注册地址"+i+"','税管地"+i+"','"+i+"','INDUSTRY_BIOMEDICAL','1','1','111-11111111','13123123123','123123@qq.com','1231231231','123123','/images/upload/enterprise/1.jpg','/images/upload/enterprise/2.jpg','/images/upload/enterprise/3.jpg','/images/upload/enterprise/4.jpg','','ENTERPRISE_CATEGORY_SHOP','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56','1','1');";
                String partyRoleSql1 = "insert into party_role (PARTY_ID,ROLE_TYPE_ID,LAST_UPDATED_STAMP,LAST_UPDATED_TX_STAMP,CREATED_STAMP,CREATED_TX_STAMP) values('"+partyId+"','SUPPLIER','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56');";
                String partyRoleSql2 = "insert into party_role (PARTY_ID,ROLE_TYPE_ID,LAST_UPDATED_STAMP,LAST_UPDATED_TX_STAMP,CREATED_STAMP,CREATED_TX_STAMP) values('"+partyId+"','_NA_','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56','2015-09-17 17:40:56');";
                out.println(partySql);
                out.println(userLoginSql);
                out.println(partyGroupSql);
                out.println(enterPriseSql);
                out.println(partyRoleSql1);
                out.println(partyRoleSql2);
                out.println("");
            }
            out.close();
            fw.close();
            }catch(IOException e){
                System.out.println(e.getMessage());
            }
        }
            
        
    }
  • 相关阅读:
    WebGL着色器32位浮点数精度损失问题
    Web地图呈现原理
    虚拟DOM详解
    webgl开发第一道坎——矩阵与坐标变换
    作为前端应当了解的Web缓存知识
    浅谈模板引擎
    WebGL中深度碰撞方法总结
    不加班的项目从排期开始
    从0到1带人做项目
    webgl自学笔记——深度监测与混合
  • 原文地址:https://www.cnblogs.com/wangqc/p/getSql.html
Copyright © 2011-2022 走看看