智慧保安后台管理项目备份
tangzy
2021-08-20 a65e232e93762ad414ef6a9d144c967993f14c3a
1.用户
5 files modified
162 ■■■■ changed files
src/main/java/org/springblade/common/utils/MysqlCenlint.java 58 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/utils/OutJson.java 56 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/controller/InformationController.java 40 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/entity/User.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/utils/MysqlCenlint.java
@@ -39,6 +39,64 @@
    }
    /**
     * 连接mysql数据库 修改
     * @param sql
     */
    public static void update(String sql) {
        try {
            int ColumnCount;
            //int RowCount;
            String driver = "com.mysql.jdbc.Driver";
            String url = "jdbc:mysql://223.82.109.183:2083/zhba"; //换成要连接的数据库信息
            String user = "root";
            String password = "zhba0728";
            Class.forName ( driver );
            Connection conn = (Connection) DriverManager.getConnection ( url, user, password );
            if (!conn.isClosed ()) {
                System.out.println ( "数据库连接成功:" );
                String sqls = sql; //sql
                PreparedStatement ps = conn.prepareStatement ( sqls );
                ps.executeUpdate();
                ps.close ();
                conn.close ();
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace ();
        } catch (SQLException e) {
            e.printStackTrace ();
        }
    }
    /**
     * 连接mysql数据库 删除
     * @param sql
     */
    public static void delete(String sql) {
        try {
            int ColumnCount;
            //int RowCount;
            String driver = "com.mysql.jdbc.Driver";
            String url = "jdbc:mysql://223.82.109.183:2083/zhba"; //换成要连接的数据库信息
            String user = "root";
            String password = "zhba0728";
            Class.forName ( driver );
            Connection conn = (Connection) DriverManager.getConnection ( url, user, password );
            if (!conn.isClosed ()) {
                System.out.println ( "数据库连接成功:" );
                String sqls = sql; //sql
                PreparedStatement ps = conn.prepareStatement ( sqls );
                ps.executeUpdate();
                ps.close ();
                conn.close ();
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace ();
        } catch (SQLException e) {
            e.printStackTrace ();
        }
    }
    /**
     * 删除本地文件
     */
    public  static  void delete(){
src/main/java/org/springblade/common/utils/OutJson.java
@@ -1,9 +1,6 @@
package org.springblade.common.utils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.io.*;
public class OutJson {
    /**
@@ -138,4 +135,55 @@
        }
        return result.toString();
    }
    /**
     * 删除文件
     * @param str
     * @return
     */
    public static String stringReplace(String str) {
        //去掉" "号
        String strs= str.replace("\"", "");
        return strs ;
    }
    /**
     * 读取json文件并解析
     * @return
     */
    public static String TestJson(){
        File file = new File("D:\\anbao\\sql.json");
        StringBuilder localStrBulider = new StringBuilder();
        if(file.isFile() && file.exists()) {
            try {
                InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "utf-8");
                BufferedReader bufferReader = new BufferedReader(inputStreamReader);
                String lineStr = null;
                try {
                    while((lineStr = bufferReader.readLine()) != null) {
                        localStrBulider.append(lineStr);
                    }
                    bufferReader.close();
                    inputStreamReader.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    System.out.println("file read error!");
                    e.printStackTrace();
                }
            } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                System.out.println("file catch unsupported encoding!");
                e.printStackTrace();
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                System.out.println("file not found!");
                e.printStackTrace();
            }
        }else {
            System.out.println("file is not a file or file is not existing!");
        }
        return  localStrBulider.toString();
    }
}
src/main/java/org/springblade/modules/information/controller/InformationController.java
@@ -955,44 +955,4 @@
//        MysqlCenlint.inster(sql);
//        MysqlCenlint.delete();
//    }
    public static String stringReplace(String str) {
        //去掉" "号
        String strs= str.replace("\"", "");
        return strs ;
    }
    public static String TestJson(){
        File file = new File("D:\\anbao\\sql.json");
        StringBuilder localStrBulider = new StringBuilder();
        if(file.isFile() && file.exists()) {
            try {
                InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "utf-8");
                BufferedReader bufferReader = new BufferedReader(inputStreamReader);
                String lineStr = null;
                try {
                    while((lineStr = bufferReader.readLine()) != null) {
                        localStrBulider.append(lineStr);
                    }
                    bufferReader.close();
                    inputStreamReader.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    System.out.println("file read error!");
                    e.printStackTrace();
                }
            } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                System.out.println("file catch unsupported encoding!");
                e.printStackTrace();
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                System.out.println("file not found!");
                e.printStackTrace();
            }
        }else {
            System.out.println("file is not a file or file is not existing!");
        }
        return  localStrBulider.toString();
    }
}
src/main/java/org/springblade/modules/system/entity/User.java
@@ -168,7 +168,14 @@
     */
    @TableField("my_picture")
    private String myPicture;
    /**
     * 是否缴社保
     */
    private String soil;
    /**
     * 健康状态  0:健康 1:良好 2:一般 3:较差
     */
    private String healthstatus;
}
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -44,6 +44,7 @@
        <result column="dispatch" property="dispatch"/>
        <result column="my_picture" property="myPicture"/>
        <result column="soil" property="soil"/>
        <result column="healthstatus" property="healthstatus"/>
    </resultMap>