@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@localhost:gdms" uuid="356b1cbb-8e8d-401f-bdfc-b3e917bc8301">
|
||||
<driver-ref>mariadb</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mariadb://localhost:3306/gdms</jdbc-url>
|
||||
<driver-properties>
|
||||
<property name="autoReconnect" value="true" />
|
||||
<property name="zeroDateTimeBehavior" value="convertToNull" />
|
||||
<property name="tinyInt1isBit" value="false" />
|
||||
<property name="characterEncoding" value="utf8" />
|
||||
<property name="characterSetResults" value="utf8" />
|
||||
<property name="yearIsDateType" value="false" />
|
||||
</driver-properties>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
@ -1,6 +1,8 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="zhai_">
|
||||
<words>
|
||||
<w>gdms</w>
|
||||
<w>mariadb</w>
|
||||
<w>synchronizable</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Context>
|
||||
<Resource type="javax.sql.DataSource"
|
||||
name="jdbc/gdms"
|
||||
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
|
||||
driverClassName="com.mysql.jdbc.Driver"
|
||||
url="jdbc:mariadb://localhost:3306/gdms"
|
||||
username="gdms"
|
||||
password="GDMS"/>
|
||||
</Context>
|
@ -0,0 +1,4 @@
|
||||
0 windows home 1809
|
||||
1 java jdk10 默认路径
|
||||
2 tomcat8.5 默认路径
|
||||
3
|
@ -0,0 +1 @@
|
||||
CREATE DATABASE `GDMS`;
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
Before Width: | Height: | Size: 286 KiB After Width: | Height: | Size: 286 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 382 KiB After Width: | Height: | Size: 382 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
@ -1,4 +0,0 @@
|
||||
package core.process;
|
||||
|
||||
public class APSet {
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package core.process;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CompoundProcess extends Process {
|
||||
private List<Process> processes;
|
||||
public CompoundProcess(String info) {
|
||||
super(info);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package core.process;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Condition {
|
||||
private List<Process> processes;
|
||||
public Process get(int index){
|
||||
return processes.get(index);
|
||||
}
|
||||
public Condition(List<Process> processes){
|
||||
this.processes=processes;
|
||||
}
|
||||
public Condition(){
|
||||
processes = new ArrayList<>();
|
||||
}
|
||||
public void add(Process process){
|
||||
this.processes.add(process);
|
||||
}
|
||||
public void add(List<Process> processes){
|
||||
this.processes.addAll(processes);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package core.process;
|
||||
|
||||
public class LastProcess extends Process{
|
||||
|
||||
public LastProcess(String info) {
|
||||
super(info);
|
||||
}
|
||||
}
|
@ -1,10 +1,25 @@
|
||||
package core.process;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ProcessManagement {
|
||||
private CompoundProcess processes;
|
||||
private List<AtomProcess> processes;
|
||||
private Map<String,List<Process>> lastProcesses;
|
||||
public void setProcessesByJson(File file){
|
||||
//todo
|
||||
}
|
||||
public Process getAtomProcess(int index){
|
||||
return processes.get(index);
|
||||
}
|
||||
public Condition getCondition(String userType, List<Integer> index){
|
||||
Condition condition = new Condition(lastProcesses.get(userType));
|
||||
for(int i:index){
|
||||
condition.add(getAtomProcess(i));
|
||||
}
|
||||
return condition;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package dao;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.tomcat.jdbc.pool.DataSource;
|
||||
import org.apache.tomcat.jdbc.pool.PoolProperties;
|
||||
|
||||
|
||||
public class DBManagement {
|
||||
|
||||
static final String driverClassName="org.mariadb.jdbc.Driver";
|
||||
static final String url="jdbc:mariadb://localhost:3306/gdms";
|
||||
static final String username="gdms";
|
||||
static final String password="GDMS";
|
||||
|
||||
public static DataSource dataSource = new DataSource();
|
||||
|
||||
public void init(){
|
||||
PoolProperties poolProperties = new PoolProperties();
|
||||
poolProperties.setUrl(url);
|
||||
poolProperties.setDriverClassName(driverClassName);
|
||||
poolProperties.setUsername(username);
|
||||
poolProperties.setPassword(password);
|
||||
dataSource.setPoolProperties(poolProperties);
|
||||
}
|
||||
public static Connection getConnection(){
|
||||
try {
|
||||
Class.forName(driverClassName);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
return DriverManager.getConnection(url,username,password);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
package dao;
|
||||
|
||||
public interface Utils {
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,49 @@
|
||||
package gdms;
|
||||
import core.user.Student;
|
||||
import core.user.User;
|
||||
import dao.DBManagement;
|
||||
import org.apache.tomcat.jdbc.pool.DataSource;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class test {
|
||||
public static void main(String argc[]){
|
||||
String sTest = "-a add -s set -d delete";
|
||||
Map<String,Object> test = core.operation.utils.util.string2MapOptions(sTest);
|
||||
System.out.println(test);
|
||||
public test(){
|
||||
Connection con = null;
|
||||
try{
|
||||
con = DBManagement.getConnection();
|
||||
Statement stmt = con.createStatement(); //创建Statement对象
|
||||
System.out.print("成功连接到数据库!");
|
||||
String sql = "select * from test";
|
||||
ResultSet rs = stmt.executeQuery(sql);
|
||||
rs.next();
|
||||
System.out.println(rs.getString("name"));
|
||||
rs.close();
|
||||
stmt.close();
|
||||
con.close();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if(con!=null) {
|
||||
try {
|
||||
con.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static void main(String argc[]) throws NamingException, SQLException {
|
||||
new test();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package init;
|
||||
|
||||
import dao.DBManagement;
|
||||
import gdms.test;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
@WebServlet(name = "Init")
|
||||
public class Init extends HttpServlet {
|
||||
public void init(){
|
||||
new DBManagement().init();
|
||||
new test();
|
||||
}
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
|
||||
}
|
||||
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
|
||||
}
|
||||
}
|