guyanqing hace 1 año
padre
commit
0ebb904f25

+ 13 - 0
gn_oa_vip27/.idea/compiler.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <annotationProcessing>
+      <profile name="Maven default annotation processors profile" enabled="true">
+        <sourceOutputDir name="target/generated-sources/annotations" />
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
+        <outputRelativeToContentRoot value="true" />
+        <module name="gn_oa_vip27" />
+      </profile>
+    </annotationProcessing>
+  </component>
+</project>

+ 7 - 0
gn_oa_vip27/.idea/encodings.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
+  </component>
+</project>

+ 20 - 0
gn_oa_vip27/.idea/jarRepositories.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RemoteRepositoriesConfiguration">
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Central Repository" />
+      <option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="jboss.community" />
+      <option name="name" value="JBoss Community repository" />
+      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
+    </remote-repository>
+  </component>
+</project>

+ 17 - 0
gn_oa_vip27/.idea/misc.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="FrameworkDetectionExcludesConfiguration">
+    <file type="web" url="file://$PROJECT_DIR$" />
+  </component>
+  <component name="MavenProjectsManager">
+    <option name="originalFiles">
+      <list>
+        <option value="$PROJECT_DIR$/pom.xml" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/out" />
+  </component>
+</project>

+ 6 - 0
gn_oa_vip27/.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
+  </component>
+</project>

+ 95 - 0
gn_oa_vip27/.idea/workspace.xml

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AutoImportSettings">
+    <option name="autoReloadType" value="SELECTIVE" />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" id="fdadf229-95a2-4903-b472-eec1ea62a98e" name="Changes" comment="">
+      <change afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/jarRepositories.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/dao/BaseDao.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/dao/RoleDao.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/dao/impl/RoleDaoImpl.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/dto/Page.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/entity/Role.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/service/RoleService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/service/impl/RoleServiceImpl.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/utils/JdbcUtil.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/resources/db.properties" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/webapp/index.jsp" afterDir="false" />
+    </list>
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="FileTemplateManagerImpl">
+    <option name="RECENT_TEMPLATES">
+      <list>
+        <option value="Interface" />
+        <option value="Class" />
+      </list>
+    </option>
+  </component>
+  <component name="Git.Settings">
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
+  </component>
+  <component name="MarkdownSettingsMigration">
+    <option name="stateVersion" value="1" />
+  </component>
+  <component name="ProjectId" id="2YCzjmZhflILlI1E6uK1SCG4R9I" />
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true">
+    <ConfirmationsSetting value="2" id="Add" />
+  </component>
+  <component name="ProjectViewState">
+    <option name="showLibraryContents" value="true" />
+  </component>
+  <component name="PropertiesComponent"><![CDATA[{
+  "keyToString": {
+    "RunOnceActivity.OpenProjectViewOnStart": "true",
+    "RunOnceActivity.ShowReadmeOnStart": "true",
+    "SHARE_PROJECT_CONFIGURATION_FILES": "true",
+    "WebServerToolWindowFactoryState": "false",
+    "last_opened_file_path": "D:/Program Files/IntelliJ IDEA 2019.3.3/VIPJAVA/gn_oa_vip27/src/main/resources",
+    "node.js.detected.package.eslint": "true",
+    "node.js.detected.package.tslint": "true",
+    "node.js.selected.package.eslint": "(autodetect)",
+    "node.js.selected.package.tslint": "(autodetect)",
+    "project.structure.last.edited": "Modules",
+    "project.structure.proportion": "0.0",
+    "project.structure.side.proportion": "0.0",
+    "settings.editor.selected.configurable": "editor.preferences.fonts.default",
+    "vue.rearranger.settings.migration": "true"
+  }
+}]]></component>
+  <component name="RecentsManager">
+    <key name="CopyFile.RECENT_KEYS">
+      <recent name="D:\Program Files\IntelliJ IDEA 2019.3.3\VIPJAVA\gn_oa_vip27\src\main\resources" />
+    </key>
+  </component>
+  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="fdadf229-95a2-4903-b472-eec1ea62a98e" name="Changes" comment="" />
+      <created>1700044489277</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1700044489277</updated>
+      <workItem from="1700044490943" duration="5807000" />
+    </task>
+    <servers />
+  </component>
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="version" value="3" />
+  </component>
+  <component name="XSLT-Support.FileAssociations.UIState">
+    <expand />
+    <select />
+  </component>
+</project>

+ 242 - 0
gn_oa_vip27/pom.xml

@@ -0,0 +1,242 @@
+<?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.sf</groupId>
+  <artifactId>gn_oa_vip27</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>war</packaging>
+
+  <name>gn_oa_vip27 Maven Webapp</name>
+  <!-- FIXME change it to the project's website -->
+  <url>http://www.example.com</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.source>1.8</maven.compiler.source>
+    <maven.compiler.target>1.8</maven.compiler.target>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+
+    <!--   asm   字节码操作库 -->
+    <dependency>
+      <groupId>org.ow2.asm</groupId>
+      <artifactId>asm</artifactId>
+      <version>4.2</version>
+    </dependency>
+
+    <!--  cglib - 3.1  -->
+    <dependency>
+      <groupId>cglib</groupId>
+      <artifactId>cglib</artifactId>
+      <version>3.1</version>
+    </dependency>
+
+    <!-- commons-codec -->
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.1</version>
+    </dependency>
+
+    <!-- commons-collections4 -->
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
+      <version>4.4</version>
+    </dependency>
+
+    <!--  commons-fileupload -->
+    <dependency>
+      <groupId>commons-fileupload</groupId>
+      <artifactId>commons-fileupload</artifactId>
+      <version>1.4</version>
+    </dependency>
+
+    <!-- commons-io -->
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.6</version>
+    </dependency>
+
+    <!-- curvesapi -->
+    <dependency>
+      <groupId>com.github.virtuald</groupId>
+      <artifactId>curvesapi</artifactId>
+      <version>1.04</version>
+    </dependency>
+
+    <!-- druid -->
+    <dependency>
+      <groupId>com.alibaba</groupId>
+      <artifactId>druid</artifactId>
+      <version>1.1.10</version>
+    </dependency>
+
+    <!-- easyexcel -->
+    <dependency>
+      <groupId>com.alibaba</groupId>
+      <artifactId>easyexcel</artifactId>
+      <version>2.2.3</version>
+    </dependency>
+
+    <!-- ehcache -->
+    <dependency>
+      <groupId>org.ehcache</groupId>
+      <artifactId>ehcache</artifactId>
+      <version>3.4.0</version>
+    </dependency>
+
+    <!-- fastjson -->
+    <dependency>
+      <groupId>com.alibaba</groupId>
+      <artifactId>fastjson</artifactId>
+      <version>1.2.53</version>
+    </dependency>
+
+    <!-- javaee-api -->
+    <dependency>
+      <groupId>javax</groupId>
+      <artifactId>javaee-api</artifactId>
+      <version>7.0</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <!--jstl标签库-->
+    <!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/javax.servlet.jsp.jstl-api -->
+    <dependency>
+      <groupId>javax.servlet.jsp.jstl</groupId>
+      <artifactId>javax.servlet.jsp.jstl-api</artifactId>
+      <version>1.2.1</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl-api -->
+    <dependency>
+      <groupId>javax.servlet.jsp.jstl</groupId>
+      <artifactId>jstl-api</artifactId>
+      <version>1.2</version>
+    </dependency>
+
+    <!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>jstl</artifactId>
+      <version>1.2</version>
+    </dependency>
+
+
+    <!--    standard   - jstl标签库的依赖包-->
+    <!-- https://mvnrepository.com/artifact/org.apache.taglibs/taglibs-standard-impl -->
+    <dependency>
+      <groupId>org.apache.taglibs</groupId>
+      <artifactId>taglibs-standard-impl</artifactId>
+      <version>1.2.5</version>
+      <scope>runtime</scope>
+    </dependency>
+
+    <!-- mysql-connector-java -->
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+      <version>5.1.47</version>
+    </dependency>
+
+    <!-- poi -->
+    <dependency>
+      <groupId>org.apache.poi</groupId>
+      <artifactId>poi</artifactId>
+      <version>3.17</version>
+    </dependency>
+
+    <!--  poi-ooxml -->
+    <dependency>
+      <groupId>org.apache.poi</groupId>
+      <artifactId>poi-ooxml</artifactId>
+      <version>3.17</version>
+    </dependency>
+
+    <!-- poi-ooxml-schemas -->
+    <dependency>
+      <groupId>org.apache.poi</groupId>
+      <artifactId>poi-ooxml-schemas</artifactId>
+      <version>3.17</version>
+    </dependency>
+
+    <!-- slf4j-api -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.26</version>
+    </dependency>
+
+    <!-- standard -->
+    <dependency>
+      <groupId>taglibs</groupId>
+      <artifactId>standard</artifactId>
+      <version>1.1.2</version>
+    </dependency>
+
+
+    <!-- stax-api -->
+    <dependency>
+      <groupId>javax.xml.stream</groupId>
+      <artifactId>stax-api</artifactId>
+      <version>1.0</version>
+    </dependency>
+
+    <!-- xmlbeans -->
+    <dependency>
+      <groupId>org.apache.xmlbeans</groupId>
+      <artifactId>xmlbeans</artifactId>
+      <version>2.6.0</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <finalName>gn_oa_vip27</finalName>
+    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
+      <plugins>
+        <plugin>
+          <artifactId>maven-clean-plugin</artifactId>
+          <version>3.1.0</version>
+        </plugin>
+        <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
+        <plugin>
+          <artifactId>maven-resources-plugin</artifactId>
+          <version>3.0.2</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.8.0</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.22.1</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-war-plugin</artifactId>
+          <version>3.2.2</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-install-plugin</artifactId>
+          <version>2.5.2</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-deploy-plugin</artifactId>
+          <version>2.8.2</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

+ 143 - 0
gn_oa_vip27/src/main/java/com/sf/dao/BaseDao.java

@@ -0,0 +1,143 @@
+package com.sf.dao;
+import java.lang.reflect.Field;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+
+public class BaseDao<T> {
+
+
+    /**
+     * 通用增删改
+     * @throws SQLException
+     */
+    public void update(Connection connection,String sql,Object...args) throws SQLException {
+        //获取PreparedStatement并且预编译sql语句
+        PreparedStatement ps = connection.prepareStatement(sql);
+        //给SQL语句中的占位符赋值
+        if(args!=null &&args.length>0) {
+            for (int i = 0; i < args.length; i++) {
+                ps.setObject(i+1, args[i]);
+            }
+        }
+        //执行
+        ps.executeUpdate();
+    }
+
+
+    /**
+     * 查询列表
+     * @throws SQLException
+     * @throws IllegalAccessException
+     * @throws InstantiationException
+     * @throws SecurityException
+     * @throws NoSuchFieldException
+     */
+    public List<T> getList(Connection connection,Class<T> clazz,String sql,Object...args) throws SQLException, InstantiationException, IllegalAccessException, NoSuchFieldException, SecurityException{
+        List<T> list = new ArrayList<>();
+        //获取PreparedStatement并且预编译sql语句
+        PreparedStatement ps = connection.prepareStatement(sql);
+        //给SQL语句中的占位符赋值
+        if(args!=null &&args.length>0) {
+            for (int i = 0; i < args.length; i++) {
+                ps.setObject(i+1, args[i]);
+            }
+        }
+        //执行
+        ResultSet rs = ps.executeQuery();
+        //获取数据库表的元数据信息
+        ResultSetMetaData rsmd = rs.getMetaData();
+        //获取表的列的总数
+        int columnCount = rsmd.getColumnCount();
+
+        //从结果集中获取每一个数据
+        while(rs.next()) {
+            //创建T对象
+            T t = clazz.newInstance();
+            //获取列名,jdbc提供了使用列的下标获取列名的方式
+            for (int i = 0; i < columnCount; i++) {
+                String columnLabel = rsmd.getColumnLabel(i+1);
+                //通过列名获取列值
+                Object columnValue = rs.getObject(columnLabel);
+
+                //获取T对象中属性的对象
+                Field field = clazz.getDeclaredField(columnLabel);//获取当前类中的属性列表
+                //开启权限
+                field.setAccessible(true);
+                //给当前属性赋值
+                field.set(t, columnValue);
+            }
+            list.add(t);
+        }
+        return list;
+    }
+
+    /**
+     * 查询单个对象
+     * @throws SQLException
+     * @throws IllegalAccessException
+     * @throws IllegalArgumentException
+     * @throws SecurityException
+     * @throws NoSuchFieldException
+     * @throws InstantiationException
+     */
+    public T get(Connection connection,Class<T> clazz,String sql,Object...args) throws SQLException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, InstantiationException {
+        T t = null;
+
+        //获取PreparedStatement并且预编译sql语句
+        PreparedStatement ps = connection.prepareStatement(sql);
+        //给SQL语句中的占位符赋值
+        if(args!=null &&args.length>0) {
+            for (int i = 0; i < args.length; i++) {
+                ps.setObject(i+1, args[i]);
+            }
+        }
+        //执行
+        ResultSet rs = ps.executeQuery();
+        //获取数据库表的元数据信息
+        ResultSetMetaData rsmd = rs.getMetaData();
+        //获取表的列的总数
+        int columnCount = rsmd.getColumnCount();
+
+        //从结果集中获取每一个数据
+        if(rs.next()) {
+            //创建T对象
+            t = clazz.newInstance();
+            //获取列名,jdbc提供了使用列的下标获取列名的方式
+            for (int i = 0; i < columnCount; i++) {
+                String columnLabel = rsmd.getColumnLabel(i+1);
+                //通过列名获取列值
+                Object columnValue = rs.getObject(columnLabel);
+
+                //获取T对象中属性的对象
+                Field field = clazz.getDeclaredField(columnLabel);//获取当前类中的属性列表
+                //开启权限
+                field.setAccessible(true);
+                //给当前属性赋值
+                field.set(t, columnValue);
+            }
+        }
+        return t;
+    }
+
+
+    /**
+     * 获取数据库表的总记录数
+     * @throws SQLException
+     * SELECT COUNT(*) FROM employee;
+     */
+    public int getCount(Connection connection,String sql) throws SQLException {
+        Statement statement = connection.createStatement();
+        ResultSet rs = statement.executeQuery(sql);
+        if(rs.next()) {
+            int count = rs.getInt("count");
+            return count;
+        }
+        return 0;
+    }
+}

+ 64 - 0
gn_oa_vip27/src/main/java/com/sf/dao/RoleDao.java

@@ -0,0 +1,64 @@
+package com.sf.dao;
+
+import com.sf.entity.Role;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.List;
+
+/**
+ * 操作数据库的接口 roledao
+ */
+public interface RoleDao {
+    /**
+     * 添加角色
+     * @param connection
+     * @param sql
+     * @param ags
+     */
+    void addRole(Connection connection,String sql ,Object...ags) throws SQLException;
+
+    /**
+     * 更新修改角色
+     * @param connection
+     * @param sql
+     * @param ags
+     */
+    void updateRole(Connection connection,String sql ,Object...ags) throws SQLException;
+
+    /**
+     * 根据角色Id进行删除
+     * @param connection
+     * @param sql
+     * @param ags
+     */
+    void deleteRoleByRoleId(Connection connection,String sql ,Object...ags) throws SQLException;
+
+    /**
+     * 查询role列表
+     * @param connection
+     * @param clazz
+     * @param sql
+     * @param args
+     * @return
+     */
+    List<Role> getRoleList(Connection connection,Class<Role> clazz,String sql ,Object...args) throws SQLException, NoSuchFieldException, InstantiationException, IllegalAccessException;
+
+    /**
+     * 查询单个角色信息  根据角色ID进行查询
+     * @param connection
+     * @param clazz
+     * @param sql
+     * @param args
+     * @return
+     */
+    Role getRoleByRoleId(Connection connection,Class<Role> clazz,String sql ,Object...args) throws SQLException, NoSuchFieldException, IllegalAccessException, InstantiationException;
+
+    /**
+     * 查询role数据的总记录数  为后面分页做准备
+     * @param connection
+     * @param sql
+     * @return
+     */
+    int getRoleCount(Connection connection,String sql) throws SQLException;
+}

+ 96 - 0
gn_oa_vip27/src/main/java/com/sf/dao/impl/RoleDaoImpl.java

@@ -0,0 +1,96 @@
+package com.sf.dao.impl;
+
+import com.sf.dao.BaseDao;
+import com.sf.dao.RoleDao;
+import com.sf.entity.Role;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.List;
+
+/**
+ * RoleDao的实现类
+ */
+public class RoleDaoImpl extends BaseDao<Role> implements RoleDao {
+    /**
+     * 添加角色
+     * @param connection
+     * @param sql
+     * @param ags
+     * @throws SQLException
+     */
+    @Override
+    public void addRole(Connection connection, String sql, Object... ags) throws SQLException {
+        update(connection,sql,ags);
+    }
+
+    /**
+     * 更新角色
+     * @param connection
+     * @param sql
+     * @param ags
+     * @throws SQLException
+     */
+    @Override
+    public void updateRole(Connection connection, String sql, Object... ags) throws SQLException {
+        update(connection,sql,ags);
+    }
+
+    /**
+     * 删除角色  根据id进行删除
+     * @param connection
+     * @param sql
+     * @param ags
+     * @throws SQLException
+     */
+    @Override
+    public void deleteRoleByRoleId(Connection connection, String sql, Object... ags) throws SQLException {
+        update(connection,sql,ags);
+    }
+
+    /**
+     * 查询role列表
+     * @param connection
+     * @param clazz
+     * @param sql
+     * @param args
+     * @return
+     * @throws SQLException
+     * @throws NoSuchFieldException
+     * @throws InstantiationException
+     * @throws IllegalAccessException
+     */
+    @Override
+    public List<Role> getRoleList(Connection connection, Class<Role> clazz, String sql, Object... args) throws SQLException, NoSuchFieldException, InstantiationException, IllegalAccessException {
+        return getList(connection,clazz,sql,args);
+    }
+
+    /**
+     * 根据角色id查询角色详情
+     * @param connection
+     * @param clazz
+     * @param sql
+     * @param args
+     * @return
+     * @throws SQLException
+     * @throws NoSuchFieldException
+     * @throws IllegalAccessException
+     * @throws InstantiationException
+     */
+    @Override
+    public Role getRoleByRoleId(Connection connection, Class<Role> clazz, String sql, Object... args) throws SQLException, NoSuchFieldException, IllegalAccessException, InstantiationException {
+        return get(connection,clazz,sql,args);
+    }
+
+    /**
+     * 查询role的总记录数
+     * @param connection
+     * @param sql
+     * @return
+     * @throws SQLException
+     */
+    @Override
+    public int getRoleCount(Connection connection, String sql) throws SQLException {
+        return getCount(connection,sql);
+    }
+}

+ 58 - 0
gn_oa_vip27/src/main/java/com/sf/dto/Page.java

@@ -0,0 +1,58 @@
+package com.sf.dto;
+
+import org.apache.commons.collections4.iterators.PeekingIterator;
+
+/**
+ * 封装数据的page类
+ */
+public class Page {
+//    当前页
+    private Integer pageNo;
+//    总记录数
+    private Integer pageCount;
+
+//    当前页数据
+    private Object obj;
+
+    public Page() {
+    }
+
+    public Page(Integer pageNo, Integer pageCount, Object obj) {
+        this.pageNo = pageNo;
+        this.pageCount = pageCount;
+        this.obj = obj;
+    }
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+
+    public Integer getPageCount() {
+        return pageCount;
+    }
+
+    public void setPageCount(Integer pageCount) {
+        this.pageCount = pageCount;
+    }
+
+    public Object getObj() {
+        return obj;
+    }
+
+    public void setObj(Object obj) {
+        this.obj = obj;
+    }
+
+    @Override
+    public String toString() {
+        return "Page{" +
+                "pageNo=" + pageNo +
+                ", pageCount=" + pageCount +
+                ", obj=" + obj +
+                '}';
+    }
+}

+ 55 - 0
gn_oa_vip27/src/main/java/com/sf/entity/Role.java

@@ -0,0 +1,55 @@
+package com.sf.entity;
+
+/**
+ * 映射数据库表的实体类  -- role  角色表
+ */
+public class Role {
+//    角色id
+    private Integer roleId;
+//    角色的名称
+    private String roleName;
+//    角色的状态   有效/无效
+    private String status;
+
+    public Role() {
+    }
+
+    public Role(Integer roleId, String roleName, String status) {
+        this.roleId = roleId;
+        this.roleName = roleName;
+        this.status = status;
+    }
+
+    public Integer getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(Integer roleId) {
+        this.roleId = roleId;
+    }
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    @Override
+    public String toString() {
+        return "Role{" +
+                "roleId=" + roleId +
+                ", roleName='" + roleName + '\'' +
+                ", status='" + status + '\'' +
+                '}';
+    }
+}

+ 50 - 0
gn_oa_vip27/src/main/java/com/sf/service/RoleService.java

@@ -0,0 +1,50 @@
+package com.sf.service;
+
+import com.sf.dto.Page;
+import com.sf.entity.Role;
+
+import java.util.List;
+
+/**
+ * 角色表的业务逻辑层
+ */
+public interface RoleService {
+    /**
+     * 角色的添加
+     * @param role
+     */
+    void addRole(Role role);
+
+    /**
+     * 角色的更新修改
+     * @param role
+     */
+    void updateRole(Role role);
+
+    /**
+     * 删除角色 根据用户的id进行删除
+     * @param roleId
+     */
+    void deleteRoleByRoleId(Integer roleId);
+
+    /**
+     * 根据角色的id查询角色详情
+     * @param roleId
+     * @return
+     */
+    Role getRoleByRoleId(Integer roleId);
+
+    /**
+     * 查询角色的列表
+     * @return
+     */
+    List<Role> getRoleList();
+
+    /**
+     * 获取分页数据
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    Page getRolePage(Integer pageNo, Integer pageSize);
+}

+ 45 - 0
gn_oa_vip27/src/main/java/com/sf/service/impl/RoleServiceImpl.java

@@ -0,0 +1,45 @@
+package com.sf.service.impl;
+
+import com.sf.dao.RoleDao;
+import com.sf.dao.impl.RoleDaoImpl;
+import com.sf.dto.Page;
+import com.sf.entity.Role;
+import com.sf.service.RoleService;
+
+import java.util.List;
+
+/**
+ * roleServiceD的实现类
+ */
+public class RoleServiceImpl implements RoleService {
+//    service需要调用dao层,所有先生命roleDao
+    private RoleDao roleDao = new RoleDaoImpl();
+    @Override
+    public void addRole(Role role) {
+    }
+
+    @Override
+    public void updateRole(Role role) {
+
+    }
+
+    @Override
+    public void deleteRoleByRoleId(Integer roleId) {
+
+    }
+
+    @Override
+    public Role getRoleByRoleId(Integer roleId) {
+        return null;
+    }
+
+    @Override
+    public List<Role> getRoleList() {
+        return null;
+    }
+
+    @Override
+    public Page getRolePage(Integer pageNo, Integer pageSize) {
+        return null;
+    }
+}

+ 75 - 0
gn_oa_vip27/src/main/java/com/sf/utils/JdbcUtil.java

@@ -0,0 +1,75 @@
+package com.sf.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import com.alibaba.druid.pool.DruidDataSource;
+
+/**
+ * 数据库连接的管理工具类
+ */
+public class JdbcUtil {
+
+    private static ThreadLocal<Connection> pool = new ThreadLocal<Connection>();
+    private static DruidDataSource ds = null;
+
+    static {
+        //外部资源文件加载
+        InputStream in = JdbcUtil.class.getClassLoader().getResourceAsStream("db.properties");
+        Properties p = new Properties();
+        try {
+            p.load(in);
+            //创建数据库连接池,关键和管理数据库连接
+            ds = new DruidDataSource();
+            ds.setUrl(p.getProperty("url"));
+            ds.setUsername(p.getProperty("username"));
+            ds.setPassword(p.getProperty("password"));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }finally {
+            try {
+                in.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * 获取数据库连接
+     * @throws SQLException
+     */
+    public static Connection getConnection() throws SQLException {
+        Connection connection = pool.get();
+        if(connection==null) {
+            //从连接池中获取连接
+            connection = ds.getConnection();
+            //加入到ThreadLocal
+            pool.set(connection);
+        }
+        return connection;
+    }
+
+
+    /**
+     * 关闭数据库连接
+     * @throws SQLException
+     */
+    public static void close() throws SQLException {
+        Connection connection = pool.get();
+        if(connection!=null) {
+            connection.close();
+            //将此关闭的连接从ThreadLocal中移除
+            pool.remove();
+        }
+    }
+
+//    public static void main(String[] args) throws SQLException {
+//        Connection connection = getConnection();
+//        System.out.println(connection);
+//        close();
+//    }
+}

+ 3 - 0
gn_oa_vip27/src/main/resources/db.properties

@@ -0,0 +1,3 @@
+url=jdbc:mysql://127.0.0.1:3306/gn_oa?characterEncoding=utf-8
+username=root
+password=root

+ 11 - 0
gn_oa_vip27/src/main/webapp/WEB-INF/web.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd "
+         version="2.5">
+
+  <display-name>Archetype Created Web Application</display-name>
+
+</web-app>
+
+

+ 5 - 0
gn_oa_vip27/src/main/webapp/index.jsp

@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>