server: port: 8000 spring: datasource: name: BaBa url: jdbc:mysql://****:3300/BaBa username: root password: root # 使用druid数据源 type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.jdbc.Driver filters: stat maxActive: 20 initialSize: 1 maxWait: 60000 minIdle: 1 timeBetweenEvictionRunsMillis: 60000 minEvictableIdleTimeMillis: 300000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false testOnReturn: false poolPreparedStatements: true maxOpenPreparedStatements: 20 mybatis: mapper-locations: classpath:mapping/*.xml type-aliases-package: com.baba.model #pagehelper pagehelper: helperDialect: mysql reasonable: true supportMethodsArguments: true params: count=countSql
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.baba</groupId> <artifactId>baba</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>baba</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <!--<version>2.0.0.BUILD-SNAPSHOT</version>--> <version>1.5.9.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.7</java.version> </properties> <dependencies> <dependency> <groupId>
package net.moonstart.web.utils; import java.io.IOException; import java.io.OutputStream; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import jxl.Workbook; import jxl.format.Alignment; import jxl.format.CellFormat; import jxl.write.Label; import jxl.write.WritableCellFormat; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import jxl.write.WriteException; import net.moonstart.web.model.Ms_alert; import net.moonstart.web.model.device.Ms_device; import net.moonstart.web.model.workshop.Ms_workshop; public class ExcelUtils { static DecimalFormat decimalFormat = new DecimalFormat("###0.00");//格式化设置 public static WritableWorkbook createTemplate(OutputStream output, int type, List<Ms_workshop> listw, List<Ms_device> listd, List<Ms_alert> lista) throws IOException, WriteException { WritableWorkbook writableWorkbook = Workbook.createWorkbook(output); WritableSheet wsheet = null; SimpleDateFo
import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Map; public class ProcessBuilderTest { public static void restart() throws IOException { // Runtime 例子 Process p; // test.bat中的命令是ipconfig/all String cmd = "c:\\test\\test.bat"; try { // 执行命令 p = Runtime.getRuntime().exec(cmd); // 取得命令结果的输出流 InputStream fis = p.getInputStream(); // 用一个读输出流类去读 InputStreamReader isr = new InputStreamReader(fis); // 用缓冲器读行 BufferedReader br = new BufferedReader(isr); String line = null; // 直到读完为止 while ((line = br.readLine()) != null) { System.out.println(line); } } catch (IOException e) { e.printStackTrace();
class PBDemo { public static void main(String args[]) { try { ProcessBuilder proc = new ProcessBuilder("notepad.exe", "testfile"); proc.start(); } catch (Exception e) { System.out.println("Error executing notepad."); } } }