生成插入语句的java程序应用于商品日期表(版本3)
发布日期:2021-06-29 16:58:53 浏览次数:2 分类:技术文章

本文共 2396 字,大约阅读时间需要 7 分钟。

import java.text.DecimalFormat;//生成插入语句的java程序应用于商品日期表(版本3)public class demo2 {    public static void main(String[] args) {        shengInsert("4");        shengInsert("5");        shengInsert("6");        shengInsert("7");        shengInsert("8");        shengInsert("9");        shengInsert("10");        shengInsert("11");    }        static   void  shengInsert(String m){        //把商品的productid抽出单写,减少修改,加快insert的生成效率        String month = m;        //五月        for (int i=1;i<=31;i++){            double a=Math.random()*1000;            DecimalFormat df = new DecimalFormat( "0.00" );            String str=df.format( a );            System.out.println("INSERT INTO `productdate` VALUES ('20210500"+month+i+"', '"+month+"', '2021-05-"+i+"', "+str+", 1);");        }        //六月        for (int i=1;i<=30;i++){            double a=Math.random()*1000;            DecimalFormat df = new DecimalFormat( "0.00" );            String str=df.format( a );            System.out.println("INSERT INTO `productdate` VALUES ('20210600"+month+i+"', '"+month+"', '2021-06-"+i+"', "+str+", 1);");        }        //七月        for (int i=1;i<=31;i++){            double a=Math.random()*1000;            DecimalFormat df = new DecimalFormat( "0.00" );            String str=df.format( a );            System.out.println("INSERT INTO `productdate` VALUES ('20210700"+month+i+"', '"+month+"', '2021-07-"+i+"', "+str+", 1);");        }        //八月        for (int i=1;i<=31;i++){            double a=Math.random()*1000;            DecimalFormat df = new DecimalFormat( "0.00" );            String str=df.format( a );            System.out.println("INSERT INTO `productdate` VALUES ('20210800"+month+i+"', '"+month+"', '2021-08-"+i+"', "+str+", 1);");        }        //九月        for (int i=1;i<=30;i++){            double a=Math.random()*1000;            DecimalFormat df = new DecimalFormat( "0.00" );            String str=df.format( a );            System.out.println("INSERT INTO `productdate` VALUES ('20210900"+month+i+"', '"+month+"', '2021-09-"+i+"', "+str+", 1);");        }        //十月        for (int i=1;i<=31;i++){            double a=Math.random()*1000;            DecimalFormat df = new DecimalFormat( "0.00" );            String str=df.format( a );            System.out.println("INSERT INTO `productdate` VALUES ('20211000"+month+i+"', '"+month+"', '2021-10-"+i+"', "+str+", 1);");        }    }}

 

转载地址:https://superman.blog.csdn.net/article/details/117389129 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:boost::math::hypot用法的测试程序
下一篇:boost::math::interpolators::cardinal_quadratic_b_spline用法的测试程序

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月13日 05时14分06秒