GenSql.java 3 KB
package com.yoho.search;

import com.yoho.search.base.utils.ConvertUtils;

import java.util.*;

public class GenSql {

    public static void main(String[] args) {
        Map<Integer, String> sortBrands = new LinkedHashMap<Integer, String>();
        sortBrands.put(11, "60,144,197,208,230,232,257,261,341,342,343,361,396,482,560,630,654,710,1099,1175,1986,2362,2258,439");
        sortBrands.put(16, "4,60,208,228,230,232,235,341,342,349,361,482,506,512,654,710,963,1099,1175,1557,1986,2258,3022,3390,3432,3438");
        sortBrands.put(18, "27,37,62,138,144,208,230,232,450,471,479,482,506,519,536,550,644,692,710,720,1387,1752,2720,3146");
        sortBrands.put(20, "108,141,208,232,257,343,443,444,447,450,471,536,657,1175,1986,2258,2420,2720,3022");
        sortBrands.put(21, "27,62,138,141,144,208,230,232,341,361,469,471,479,482,506,512,536,550,677,700,710,1523,1557,2258,2420,3022,3146");

        sortBrands.put(26, "4,26,60,138,141,144,174,208,230,232,256,341,342,443,447,471,482,506,710,1099,1387,1557,1680,2224,2420,2600,3022,3476");
        sortBrands.put(27, "62,138,196,208,341,354,364,471,479,496,536,677,985,1387,2258,2420,3438");
        sortBrands.put(28, "60,144,145,208,230,257,342,361,396,444,450,560,710,1175,2224,2258");
        sortBrands.put(31, "141,144,230,342,349,536,752,890,1082,1387,1697,2166,2912,3146,3384");
        sortBrands.put(32, "141,342,524,710,882,1248,1387,1652,1697,1986,2166,2556,2912,3146,3384");

        sortBrands.put(44, "27,68,144,241,248,255,302,313,330,343,349,469,512,583,813,852,1632,2264,2836");
        sortBrands.put(45, "327,469,583,674,852,1283,1363,2422,3302");
        sortBrands.put(46, "144,210,239,302,327,349,583,852,963,1363,3206");
        sortBrands.put(59, "129,424,708,727,783,919,993,1016,1025,1434,1474,1475,1894,2082,2132");
        sortBrands.put(60, "141,144,210,361,512,795,2872,3390,3432");

        sortBrands.put(61, "129,208,210,641,877,1571,1575,1685,1870,3312");
        sortBrands.put(65, "117,129,162,426,717,732,953,1424,1540,1638,2800,2806,2816,2872,3392");
        sortBrands.put(226, "138,208,256,349,444,471,495,710,963,1523");
        sortBrands.put(1892, "4,60,108,208,591,631,692,700,752,763,1082,1248,1387,1524,1584,2292,2840,3146");
        sortBrands.put(1896, "62,138,141,341,471,710,1082,1387,1632");

        sortBrands.put(1900, "60,208,342,1512,1523,2258,3438");
        sortBrands.put(1904, "60,208,342,710,752,1387,1697,2166,2720");

        String sql = "INSERT INTO `cs_recall_config_sort_brand` (`id`, `sort_id`, `brand_id`, `update_time`) VALUES (%s, %s, %s, '2018-05-08 18:11:47');";
        int id = 1;
        for (Map.Entry<Integer, String> entry : sortBrands.entrySet()) {
            int sortId = entry.getKey();
            List<Integer> brandIds = ConvertUtils.stringToIntList(entry.getValue(), ",");
            Collections.sort(brandIds);
            for (Integer brandId : brandIds) {
                System.out.println(String.format(sql, id++, sortId,brandId ));
            }
        }

    }

}