All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mybatis.generator.api.plus.MybatisUtilHtmlImageBack Maven / Gradle / Ivy

package org.mybatis.generator.api.plus;

import org.mybatis.generator.api.IntrospectedTable;

import java.io.*;

/**
 * @author wangfupeng
 */
public class MybatisUtilHtmlImageBack {

    public static void writeCommonImage(String htmlPath, String fileName, String content) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "/content/page-common/image");
            folder.mkdirs();
            file = new File(htmlPath + "/content/page-common/image/" + fileName);
            //如果文件不存在,则创建文件,如果已存在,则覆盖
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            bufferedWriter.write(content);
            System.out.println("write to file success : " + file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            MybatisUtilCommon.closeBufferWriterAndFileOutputStream(fileOutputStream, bufferedWriter);
        }
    }

    public static void writeAllImage(IntrospectedTable introspectedTable, String htmlPath, String modelUrl) {
        writeCommonImage(htmlPath, "blank.svg", "");
        writeCommonImage(htmlPath, "person.svg", "");
        writeCommonImage(htmlPath, "lock.svg", "");
        writeCommonImage(htmlPath, "expand.svg", "");
        writeCommonImage(htmlPath, "new.svg", "");
        writeCommonImage(htmlPath, "config.svg", "");
        writeCommonImage(htmlPath, "hide.svg", "");
        writeCommonImage(htmlPath, "search.svg", "");
        writeCommonImage(htmlPath, "yes.svg", "");
        writeCommonImage(htmlPath, "no.svg", "");
        writeCommonImage(htmlPath, "edit.svg", "");
        writeCommonImage(htmlPath, "delete.svg", "");
        writeCommonImage(htmlPath, "table.svg", "");
        writeCommonImage(htmlPath, "chat.svg", "");
        writeCommonImage(htmlPath, "reply.svg", "");
        writeCommonImage(htmlPath, "talk-girl.svg", "");
        writeCommonImage(htmlPath, "person-active.svg", "");
        writeCommonImage(htmlPath, "wrench.svg", "");
        writeCommonImage(htmlPath, "clear.svg", "");
        writeCommonImage(htmlPath, "hand.svg", "");
        writeCommonImage(htmlPath, "home.svg", "");
        writeCommonImage(htmlPath, "rmb.svg", "");
        writeCommonImage(htmlPath, "charge.svg", "");
        writeCommonImage(htmlPath, "withdraw.svg", "");
        writeCommonImage(htmlPath, "warning.svg", "");
        writeCommonImage(htmlPath, "invoice.svg", "");
        writeCommonImage(htmlPath, "upload.svg", "");
        writeCommonImage(htmlPath, "blank.svg", "");
        writeCommonImage(htmlPath, "blank.svg", "");
        writeCommonImage(htmlPath, "blank.svg", "");
        writeCommonImage(htmlPath, "blank.svg", "");
        writeCommonImage(htmlPath, "blank.svg", "");
        writeCommonImage(htmlPath, "blank.svg", "");


    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy