├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── README.md ├── db └── graduationdesign.sql ├── find ├── lib └── beautyeye_lnf.jar ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── mikey │ │ └── design │ │ ├── GraduationDesignApplication.java │ │ ├── controller │ │ └── StudentController.java │ │ ├── entity │ │ ├── Admin.java │ │ ├── AdminExample.java │ │ ├── Design.java │ │ ├── DesignExample.java │ │ ├── Student.java │ │ ├── StudentExample.java │ │ ├── Teacher.java │ │ ├── TeacherExample.java │ │ ├── TitleOfStudent.java │ │ ├── TitleOfStudentExample.java │ │ ├── Wish.java │ │ └── WishExample.java │ │ ├── listerner │ │ ├── admin │ │ │ └── AdminListener.java │ │ ├── common │ │ │ ├── LoginListener.java │ │ │ └── LoginOut.java │ │ ├── student │ │ │ └── StudentListener.java │ │ └── teacher │ │ │ ├── AdmitStudentButtonListener.java │ │ │ └── TeacherLisetener.java │ │ ├── mapper │ │ ├── AdminMapper.java │ │ ├── AdminMapper.xml │ │ ├── DesignMapper.java │ │ ├── DesignMapper.xml │ │ ├── StudentMapper.java │ │ ├── StudentMapper.xml │ │ ├── TeacherMapper.java │ │ ├── TeacherMapper.xml │ │ ├── TitleOfStudentMapper.java │ │ ├── TitleOfStudentMapper.xml │ │ ├── WishMapper.java │ │ └── WishMapper.xml │ │ ├── service │ │ ├── AdminService.java │ │ ├── DesignService.java │ │ ├── StudentService.java │ │ ├── TeacherService.java │ │ ├── TitleOfStudentService.java │ │ ├── WishService.java │ │ └── impl │ │ │ ├── AdminServiceImpl.java │ │ │ ├── DesignServiceImpl.java │ │ │ ├── StudentServiceImpl.java │ │ │ ├── TeacherServiceImpl.java │ │ │ ├── TitleOfStudentServiceImpl.java │ │ │ └── WishServiceImpl.java │ │ ├── utils │ │ ├── GBM.java │ │ ├── SpringUtil.java │ │ └── ThreadLocalUtil.java │ │ └── views │ │ ├── Test │ │ ├── Frame1.java │ │ ├── MyButtonEditor.java │ │ ├── MyButtonRenderer.java │ │ ├── Test.java │ │ ├── Test2.java │ │ ├── TestListAndMap.java │ │ ├── TestPhone.java │ │ ├── TestTable.java │ │ ├── change.java │ │ ├── table.java │ │ └── test1.java │ │ ├── admin │ │ ├── AddStudentJpanel.java │ │ ├── AddTeacherJpanel.java │ │ ├── AdminMainView.java │ │ ├── LookStudentJpanel.java │ │ ├── LookTeacherJpanel.java │ │ ├── StudentWishStateJpanel.java │ │ └── WishDateCountJpanel.java │ │ ├── common │ │ ├── UpPwdPanel.java │ │ ├── UpdatePanel.java │ │ └── WelcomeJpanel.java │ │ ├── login │ │ ├── Login.java │ │ └── LoginSystem.java │ │ ├── renderer │ │ ├── AdmitStudentButtonRenderer.java │ │ └── MyTableCellRenderer.java │ │ ├── student │ │ ├── AlrealdFillWispPanel.java │ │ ├── StudentMainView.java │ │ ├── TeacherJpanel.java │ │ ├── TitleJpanel.java │ │ └── WispPanel.java │ │ └── teacher │ │ ├── AddTitlePanel.java │ │ ├── AdmitStudentTable.java │ │ ├── AdmitStudentsJpanel.java │ │ ├── AlrealyAdmitJpanel.java │ │ ├── SelfDesignJpanel.java │ │ └── TeacherMainView.java └── resources │ ├── application.yml │ ├── banner.txt │ ├── doc │ └── design.docx │ ├── gbm │ └── nbg.xml │ └── images │ ├── TIM图片20201229184207.png │ ├── TIM图片20201229184239.png │ ├── TIM图片20201229184248.png │ ├── TIM图片20201229184256.png │ ├── TIM图片20201229184303.png │ └── TIM图片20201229184311.png └── test └── java └── com └── mikey └── design └── GraduationDesignApplicationTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeygithub/GraduationDesign/609a09caed0ef8b2cce696f58b2af298761f8947/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GraduationDesign 2 | 3 | 基于Java Swing的课程设计/毕业设计选题系统 4 | 5 | ## 功能描述 6 | 7 | >提供学生和教师进行课程设计或者毕业设计选题平台,教师角色通过登入平台发布选题信息和录取相关学生,学生用户进行选题提交教师审核,管理员负责基础数据维护。 8 | 9 | ## 页面截图 10 | 11 | ![avatar](/src/main/resources/images/TIM图片20201229184311.png) 12 | 13 | ![avatar](/src/main/resources/images/TIM图片20201229184303.png) 14 | 15 | ![avatar](/src/main/resources/images/TIM图片20201229184256.png) 16 | 17 | ![avatar](/src/main/resources/images/TIM图片20201229184248.png) 18 | 19 | ![avatar](/src/main/resources/images/TIM图片20201229184239.png) 20 | 21 | ![avatar](/src/main/resources/images/TIM图片20201229184207.png) 22 | 23 | ## 使用技术 24 | 25 | - [SpringBoot]() 26 | - [Java Swing]() 27 | - [Beautyeye](https://github.com/JackJiang2011/beautyeye) 28 | 29 | ## 部署方法 30 | 31 | 1.通过maven安装依赖 32 | 2.导入db文件夹下的数据库文件 33 | 3.运行主类即可 -------------------------------------------------------------------------------- /find: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeygithub/GraduationDesign/609a09caed0ef8b2cce696f58b2af298761f8947/find -------------------------------------------------------------------------------- /lib/beautyeye_lnf.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeygithub/GraduationDesign/609a09caed0ef8b2cce696f58b2af298761f8947/lib/beautyeye_lnf.jar -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.mikey 7 | graduation-design-system 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | graduationdesignsystem 12 | Demo project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 2.1.0.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | org.mybatis.spring.boot 30 | mybatis-spring-boot-starter 31 | 1.3.2 32 | 33 | 34 | 35 | mysql 36 | mysql-connector-java 37 | 5.1.47 38 | 39 | 40 | org.projectlombok 41 | lombok 42 | true 43 | 44 | 45 | org.springframework.boot 46 | spring-boot-starter-test 47 | test 48 | 49 | 50 | 51 | com.alibaba 52 | druid 53 | 1.1.8 54 | 55 | 56 | 57 | com.github.pagehelper 58 | pagehelper-spring-boot-starter 59 | 1.2.3 60 | 61 | 62 | 63 | org.mybatis.generator 64 | mybatis-generator-core 65 | 1.3.7 66 | 67 | 68 | org.junit.jupiter 69 | junit-jupiter-api 70 | RELEASE 71 | compile 72 | 73 | 74 | 75 | 76 | com.beautyeye 77 | beautyeye 78 | 1.0 79 | system 80 | ${project.basedir}/lib/beautyeye_lnf.jar 81 | 82 | 83 | 84 | 85 | 86 | org.springframework.boot 87 | spring-boot-maven-plugin 88 | 89 | 90 | 91 | 92 | src/main/java 93 | 94 | **/*.xml 95 | 96 | 97 | 98 | lib 99 | 100 | **/*.jar 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/GraduationDesignApplication.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design; 2 | 3 | import com.mikey.design.views.login.Login; 4 | import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper; 5 | import org.mybatis.spring.annotation.MapperScan; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | 9 | import javax.swing.*; 10 | 11 | @MapperScan(basePackages={"com.mikey.design.mapper"}) 12 | @SpringBootApplication 13 | public class GraduationDesignApplication { 14 | 15 | 16 | public static void main(String[] args) { 17 | 18 | SpringApplication.run(GraduationDesignApplication.class, args); 19 | 20 | showLoginView(); 21 | } 22 | public static void showLoginView(){ 23 | System.setProperty("java.awt.headless", "false"); 24 | try 25 | { 26 | // BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.osLookAndFeelDecorated; 27 | // BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.translucencySmallShadow; 28 | // BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.translucencyAppleLike; 29 | 30 | BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.generalNoTranslucencyShadow; 31 | //加载美化包 32 | BeautyEyeLNFHelper.translucencyAtFrameInactive = false; 33 | org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper.launchBeautyEyeLNF(); 34 | //关闭设置功能 35 | UIManager.put("RootPane.setupButtonVisible", false); 36 | //设置此开关量为false即表示关闭之,BeautyEye LNF中默认是true 37 | } 38 | catch(Exception e) 39 | { 40 | e.printStackTrace(); 41 | } 42 | new Login(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/controller/StudentController.java: -------------------------------------------------------------------------------- 1 | //package com.mikey.design.controller; 2 | // 3 | //import com.mikey.design.views.login.Login; 4 | //import org.springframework.beans.factory.annotation.Autowired; 5 | //import org.springframework.stereotype.Component; 6 | // 7 | ///** 8 | // * @author Mikey 9 | // * @Title: 10 | // * @Description: 11 | // * @Email:1625017540@qq.com 12 | // * @date 2018/12/4 7:38 13 | // * @Version 1.0 14 | // */ 15 | //@Component 16 | //public class StudentController { 17 | // @Autowired 18 | // private Login login; 19 | // public static void showLoginView(){ 20 | //// login.shows(); 21 | // } 22 | //} 23 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/entity/Admin.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.entity; 2 | 3 | public class Admin { 4 | private Integer adminId; 5 | 6 | private String adminName; 7 | 8 | private Integer adminSex; 9 | 10 | private String adminPassword; 11 | 12 | private String adminPhone; 13 | 14 | public Integer getAdminId() { 15 | return adminId; 16 | } 17 | 18 | public void setAdminId(Integer adminId) { 19 | this.adminId = adminId; 20 | } 21 | 22 | public String getAdminName() { 23 | return adminName; 24 | } 25 | 26 | public void setAdminName(String adminName) { 27 | this.adminName = adminName == null ? null : adminName.trim(); 28 | } 29 | 30 | public Integer getAdminSex() { 31 | return adminSex; 32 | } 33 | 34 | public void setAdminSex(Integer adminSex) { 35 | this.adminSex = adminSex; 36 | } 37 | 38 | public String getAdminPassword() { 39 | return adminPassword; 40 | } 41 | 42 | public void setAdminPassword(String adminPassword) { 43 | this.adminPassword = adminPassword == null ? null : adminPassword.trim(); 44 | } 45 | 46 | public String getAdminPhone() { 47 | return adminPhone; 48 | } 49 | 50 | public void setAdminPhone(String adminPhone) { 51 | this.adminPhone = adminPhone == null ? null : adminPhone.trim(); 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/entity/Design.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.entity; 2 | 3 | public class Design { 4 | private Integer designId; 5 | 6 | private Integer designOfTeacher; 7 | 8 | private String designTitle; 9 | 10 | private Integer designNum; 11 | 12 | private Integer designFillNum; 13 | 14 | private String designRequire; 15 | 16 | public Integer getDesignId() { 17 | return designId; 18 | } 19 | 20 | public void setDesignId(Integer designId) { 21 | this.designId = designId; 22 | } 23 | 24 | public Integer getDesignOfTeacher() { 25 | return designOfTeacher; 26 | } 27 | 28 | public void setDesignOfTeacher(Integer designOfTeacher) { 29 | this.designOfTeacher = designOfTeacher; 30 | } 31 | 32 | public String getDesignTitle() { 33 | return designTitle; 34 | } 35 | 36 | public void setDesignTitle(String designTitle) { 37 | this.designTitle = designTitle == null ? null : designTitle.trim(); 38 | } 39 | 40 | public Integer getDesignNum() { 41 | return designNum; 42 | } 43 | 44 | public void setDesignNum(Integer designNum) { 45 | this.designNum = designNum; 46 | } 47 | 48 | public Integer getDesignFillNum() { 49 | return designFillNum; 50 | } 51 | 52 | public void setDesignFillNum(Integer designFillNum) { 53 | this.designFillNum = designFillNum; 54 | } 55 | 56 | public String getDesignRequire() { 57 | return designRequire; 58 | } 59 | 60 | public void setDesignRequire(String designRequire) { 61 | this.designRequire = designRequire == null ? null : designRequire.trim(); 62 | } 63 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/entity/Student.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.entity; 2 | 3 | public class Student { 4 | private Integer studentId; 5 | 6 | private String studentName; 7 | 8 | private Integer studentSex; 9 | 10 | private String studentPassword; 11 | 12 | private String studentPhone; 13 | 14 | public Integer getStudentId() { 15 | return studentId; 16 | } 17 | 18 | public void setStudentId(Integer studentId) { 19 | this.studentId = studentId; 20 | } 21 | 22 | public String getStudentName() { 23 | return studentName; 24 | } 25 | 26 | public void setStudentName(String studentName) { 27 | this.studentName = studentName == null ? null : studentName.trim(); 28 | } 29 | 30 | public Integer getStudentSex() { 31 | return studentSex; 32 | } 33 | 34 | public void setStudentSex(Integer studentSex) { 35 | this.studentSex = studentSex; 36 | } 37 | 38 | public String getStudentPassword() { 39 | return studentPassword; 40 | } 41 | 42 | public void setStudentPassword(String studentPassword) { 43 | this.studentPassword = studentPassword == null ? null : studentPassword.trim(); 44 | } 45 | 46 | public String getStudentPhone() { 47 | return studentPhone; 48 | } 49 | 50 | public void setStudentPhone(String studentPhone) { 51 | this.studentPhone = studentPhone == null ? null : studentPhone.trim(); 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/entity/Teacher.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.entity; 2 | 3 | public class Teacher { 4 | private Integer teacherId; 5 | 6 | private String teacherName; 7 | 8 | private Integer teacherSex; 9 | 10 | private String teacherInfo; 11 | 12 | private String teacherPassword; 13 | 14 | private String teacherPhone; 15 | 16 | public Integer getTeacherId() { 17 | return teacherId; 18 | } 19 | 20 | public void setTeacherId(Integer teacherId) { 21 | this.teacherId = teacherId; 22 | } 23 | 24 | public String getTeacherName() { 25 | return teacherName; 26 | } 27 | 28 | public void setTeacherName(String teacherName) { 29 | this.teacherName = teacherName == null ? null : teacherName.trim(); 30 | } 31 | 32 | public Integer getTeacherSex() { 33 | return teacherSex; 34 | } 35 | 36 | public void setTeacherSex(Integer teacherSex) { 37 | this.teacherSex = teacherSex; 38 | } 39 | 40 | public String getTeacherInfo() { 41 | return teacherInfo; 42 | } 43 | 44 | public void setTeacherInfo(String teacherInfo) { 45 | this.teacherInfo = teacherInfo == null ? null : teacherInfo.trim(); 46 | } 47 | 48 | public String getTeacherPassword() { 49 | return teacherPassword; 50 | } 51 | 52 | public void setTeacherPassword(String teacherPassword) { 53 | this.teacherPassword = teacherPassword == null ? null : teacherPassword.trim(); 54 | } 55 | 56 | public String getTeacherPhone() { 57 | return teacherPhone; 58 | } 59 | 60 | public void setTeacherPhone(String teacherPhone) { 61 | this.teacherPhone = teacherPhone == null ? null : teacherPhone.trim(); 62 | } 63 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/entity/TitleOfStudent.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.entity; 2 | 3 | public class TitleOfStudent { 4 | private Integer desOfStuId; 5 | 6 | private Integer desOfStu; 7 | 8 | private Integer desOfTitle; 9 | 10 | private Integer desState; 11 | 12 | private Integer desWishOrder; 13 | 14 | public Integer getDesOfStuId() { 15 | return desOfStuId; 16 | } 17 | 18 | public void setDesOfStuId(Integer desOfStuId) { 19 | this.desOfStuId = desOfStuId; 20 | } 21 | 22 | public Integer getDesOfStu() { 23 | return desOfStu; 24 | } 25 | 26 | public void setDesOfStu(Integer desOfStu) { 27 | this.desOfStu = desOfStu; 28 | } 29 | 30 | public Integer getDesOfTitle() { 31 | return desOfTitle; 32 | } 33 | 34 | public void setDesOfTitle(Integer desOfTitle) { 35 | this.desOfTitle = desOfTitle; 36 | } 37 | 38 | public Integer getDesState() { 39 | return desState; 40 | } 41 | 42 | public void setDesState(Integer desState) { 43 | this.desState = desState; 44 | } 45 | 46 | public Integer getDesWishOrder() { 47 | return desWishOrder; 48 | } 49 | 50 | public void setDesWishOrder(Integer desWishOrder) { 51 | this.desWishOrder = desWishOrder; 52 | } 53 | private Student student; 54 | 55 | private Design design; 56 | 57 | public Student getStudent() { 58 | return student; 59 | } 60 | 61 | public void setStudent(Student student) { 62 | this.student = student; 63 | } 64 | 65 | public Design getDesign() { 66 | return design; 67 | } 68 | 69 | public void setDesign(Design design) { 70 | this.design = design; 71 | } 72 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/entity/Wish.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.entity; 2 | 3 | public class Wish { 4 | private Integer wishId; 5 | 6 | private String wishFist; 7 | 8 | private String wishSecond; 9 | 10 | public Integer getWishId() { 11 | return wishId; 12 | } 13 | 14 | public void setWishId(Integer wishId) { 15 | this.wishId = wishId; 16 | } 17 | 18 | public String getWishFist() { 19 | return wishFist; 20 | } 21 | 22 | public void setWishFist(String wishFist) { 23 | this.wishFist = wishFist == null ? null : wishFist.trim(); 24 | } 25 | 26 | public String getWishSecond() { 27 | return wishSecond; 28 | } 29 | 30 | public void setWishSecond(String wishSecond) { 31 | this.wishSecond = wishSecond == null ? null : wishSecond.trim(); 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/listerner/admin/AdminListener.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.listerner.admin; 2 | 3 | /** 4 | * @author Mikey 5 | * @Title: 6 | * @Description: 7 | * @Email:1625017540@qq.com 8 | * @date 2018/12/3 20:22 9 | * @Version 1.0 10 | */ 11 | public class AdminListener { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/listerner/common/LoginListener.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.listerner.common; 2 | 3 | import com.mikey.design.entity.Admin; 4 | import com.mikey.design.entity.Student; 5 | import com.mikey.design.entity.Teacher; 6 | import com.mikey.design.service.AdminService; 7 | import com.mikey.design.service.StudentService; 8 | import com.mikey.design.service.TeacherService; 9 | import com.mikey.design.utils.SpringUtil; 10 | import com.mikey.design.utils.ThreadLocalUtil; 11 | import com.mikey.design.views.admin.AdminMainView; 12 | import com.mikey.design.views.student.StudentMainView; 13 | import com.mikey.design.views.teacher.TeacherMainView; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.Component; 16 | 17 | import javax.swing.*; 18 | import java.awt.*; 19 | import java.awt.event.ActionEvent; 20 | import java.util.regex.Pattern; 21 | 22 | /** 23 | * @author Mikey 24 | * @Title: 25 | * @Description: 26 | * @Email:1625017540@qq.com 27 | * @date 2018/12/3 9:36 28 | * @Version 1.0 29 | */ 30 | @Component 31 | public class LoginListener extends AbstractAction { 32 | 33 | @Autowired 34 | private StudentService studentService; 35 | @Autowired 36 | private TeacherService teacherService; 37 | @Autowired 38 | private AdminService adminService; 39 | 40 | private final static String ADMIN="admin"; 41 | 42 | private final static String STU="student"; 43 | 44 | private final static String TEA="teacher"; 45 | 46 | private final static String IS_NUM="^\\d+$"; 47 | 48 | private JFrame login; 49 | 50 | private JTextField usernameField; 51 | 52 | private JPasswordField passwordField; 53 | 54 | private String username; 55 | 56 | private String password; 57 | 58 | private String role; 59 | 60 | private CheckboxGroup group;//选择 61 | 62 | private String baseUserName;//数据库查询出来的用户名 63 | 64 | private String basePassWord;//数据库查询出来的密码 65 | 66 | @Override 67 | public void actionPerformed(ActionEvent e) { 68 | 69 | /** 70 | * 无法通过自动注入,只能通过工具类获取 71 | */ 72 | studentService = (StudentService) SpringUtil.getBean("studentServiceImpl"); 73 | teacherService = (TeacherService) SpringUtil.getBean("teacherServiceImpl"); 74 | adminService = (AdminService) SpringUtil.getBean("adminServiceImpl"); 75 | 76 | 77 | this.username=usernameField.getText().trim();//获取用户名 78 | this.password=new String(passwordField.getPassword()).trim();//获取密码 79 | this.role=group.getSelectedCheckbox().getLabel();//获取角色 80 | 81 | if(Pattern.matches(IS_NUM,username)==false){ 82 | JOptionPane.showMessageDialog(login, "学号或者工号错误"); 83 | return; 84 | } 85 | 86 | if(username.length()==0||password.length()==0||username.equals("请输入学号或者工号")){ 87 | JOptionPane.showMessageDialog(login, "用户名密码不能为空"); 88 | return; 89 | } 90 | 91 | switch (role){ 92 | case ADMIN://管理员登入 93 | Admin admin=adminService.getAdmin(Integer.parseInt(username)); 94 | if (admin==null){ 95 | JOptionPane.showMessageDialog(login, "用户不存在"); 96 | return; 97 | } 98 | this.baseUserName=admin.getAdminId().toString(); 99 | this.basePassWord=admin.getAdminPassword(); 100 | //身份认证 101 | if(username.equals(baseUserName)&&password.equals(basePassWord)){//判断用户名和密码 102 | System.out.println("管理员登入成功------------》》》》"); 103 | //登录成功 104 | ThreadLocalUtil.set(admin);//保存用户信息 105 | login.setVisible(false); 106 | new AdminMainView(login);//进入管理员页面 107 | } 108 | else{ 109 | JOptionPane.showMessageDialog(login, "用户名或密码错误"); 110 | } 111 | break; 112 | case STU://学生登入 113 | 114 | Student student= this.studentService.getStudent(Integer.parseInt(username)); 115 | 116 | if (student==null){ 117 | JOptionPane.showMessageDialog(login, "用户不存在"); 118 | return; 119 | } 120 | 121 | this.baseUserName=student.getStudentId().toString(); 122 | this.basePassWord=student.getStudentPassword(); 123 | //身份认证 124 | if(username.equals(baseUserName)&&password.equals(basePassWord)){//判断用户名和密码 125 | //登录成功 126 | ThreadLocalUtil.set(student);//保存用户信息 127 | login.setVisible(false); 128 | new StudentMainView(login);//进入学生页面 129 | } 130 | else{ 131 | JOptionPane.showMessageDialog(login, "用户名或密码错误"); 132 | } 133 | break; 134 | case TEA://教师登入 135 | Teacher teacher=teacherService.getTeacher(Integer.parseInt(username)); 136 | 137 | if (teacher==null){ 138 | JOptionPane.showMessageDialog(login, "用户不存在"); 139 | return; 140 | } 141 | this.baseUserName=teacher.getTeacherId().toString(); 142 | this.basePassWord=teacher.getTeacherPassword(); 143 | //身份认证 144 | if(username.equals(baseUserName)&&password.equals(basePassWord)){//判断用户名和密码 145 | //登录成功 146 | ThreadLocalUtil.set(teacher);//保存登入用户信息 147 | login.setVisible(false); 148 | new TeacherMainView(login);//进入教师页面 149 | } 150 | else{ 151 | JOptionPane.showMessageDialog(login, "用户名或密码错误"); 152 | } 153 | break; 154 | } 155 | } 156 | 157 | public LoginListener() { 158 | } 159 | 160 | public LoginListener(JTextField username, JPasswordField passwordField, CheckboxGroup group,JFrame login) { 161 | this.usernameField = username; 162 | this.passwordField = passwordField; 163 | this.group=group; 164 | this.login=login; 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/listerner/common/LoginOut.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.listerner.common; 2 | 3 | import com.mikey.design.utils.ThreadLocalUtil; 4 | 5 | import javax.swing.*; 6 | import java.awt.event.ActionEvent; 7 | 8 | /** 9 | * @author Mikey 10 | * @Title: logout 11 | * @Description: 退出登入监听器 12 | * @Email:1625017540@qq.com 13 | * @date 2018/12/4 10:16 14 | * @Version 1.0 15 | */ 16 | public class LoginOut extends AbstractAction { 17 | 18 | private JFrame loginjFrame;//登入面板 19 | private JFrame mainjFrame;//主页面面板 20 | 21 | @Override 22 | public void actionPerformed(ActionEvent e) { 23 | int result = JOptionPane.showConfirmDialog(mainjFrame, "确认退出登入?", "系统提示", JOptionPane.YES_NO_CANCEL_OPTION); 24 | /** 25 | * 提交保存 26 | */ 27 | if (result == JOptionPane.YES_OPTION) { 28 | mainjFrame.setVisible(false);//关闭登入面板 29 | ThreadLocalUtil.remove();//移除登入的用户 30 | System.out.println("用户退出登入成功================》》》》》》"); 31 | loginjFrame.setVisible(true);//开启登入面板 32 | } 33 | } 34 | 35 | public LoginOut(JFrame loginjFrame, JFrame mainjFrame) { 36 | this.loginjFrame = loginjFrame; 37 | this.mainjFrame = mainjFrame; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/listerner/student/StudentListener.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.listerner.student; 2 | 3 | import javax.swing.*; 4 | import java.awt.event.ActionEvent; 5 | 6 | /** 7 | * @author Mikey 8 | * @Title: 监听器 9 | * @Description: 监听学生端 10 | * @Email:1625017540@qq.com 11 | * @date 2018/12/3 20:21 12 | * @Version 1.0 13 | */ 14 | public class StudentListener extends AbstractAction { 15 | @Override 16 | public void actionPerformed(ActionEvent e) { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/listerner/teacher/AdmitStudentButtonListener.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.listerner.teacher; 2 | 3 | import com.mikey.design.entity.TitleOfStudent; 4 | import com.mikey.design.service.TitleOfStudentService; 5 | import com.mikey.design.utils.SpringUtil; 6 | import com.mikey.design.views.teacher.AdmitStudentsJpanel; 7 | import org.jb2011.lnf.beautyeye.ch3_button.BEButtonUI; 8 | 9 | import javax.swing.*; 10 | import javax.swing.table.TableCellEditor; 11 | import java.awt.*; 12 | import java.awt.event.ActionEvent; 13 | import java.awt.event.ActionListener; 14 | import java.util.List; 15 | /** 16 | * @author Mikey 17 | * @Title: 监听录取按钮 18 | * @Description: 监听教师在报名列表录取报名学生 19 | * @Email:1625017540@qq.com 20 | * @date 2018/12/4 21:27 21 | * @Version 1.0 22 | */ 23 | public class AdmitStudentButtonListener extends AbstractCellEditor implements TableCellEditor { 24 | 25 | private TitleOfStudentService titleOfStudentService; 26 | 27 | //当前教师的毕设题目列表 28 | private static List titleOfStudentList; 29 | 30 | public static void setTitleOfStudentList(List titleOfStudentList) { 31 | AdmitStudentButtonListener.titleOfStudentList = titleOfStudentList; 32 | } 33 | 34 | private JPanel buttonJpanel; 35 | 36 | private JButton admitButton; 37 | 38 | public AdmitStudentButtonListener(JTable table,AdmitStudentsJpanel admitStudentsJpanel) { 39 | 40 | //获取当前登入用户信息 41 | 42 | titleOfStudentService = (TitleOfStudentService) SpringUtil.getBean("titleOfStudentServiceImpl"); 43 | 44 | buttonJpanel=new JPanel(); 45 | buttonJpanel.setLayout(new BorderLayout()); 46 | admitButton=new JButton("录取"); 47 | admitButton.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.green)); 48 | buttonJpanel.add(admitButton,BorderLayout.CENTER); 49 | 50 | 51 | admitButton.addActionListener(new ActionListener() { 52 | @Override 53 | public void actionPerformed(ActionEvent e) { 54 | System.out.println("Message=当前页数量"+titleOfStudentList.size()); 55 | 56 | int selectedRow = table.getSelectedRow(); 57 | 58 | System.out.println("选中的行--------------------》》》》》》》》》》》》"+selectedRow); 59 | 60 | if (selectedRow>titleOfStudentList.size()){ 61 | JOptionPane.showMessageDialog(admitStudentsJpanel, "该行无数据"); 62 | return; 63 | } 64 | 65 | int result = JOptionPane.showConfirmDialog(admitStudentsJpanel, "您确定要录取这位学生吗?", "确认录取", JOptionPane.YES_NO_OPTION); 66 | 67 | if(result == JOptionPane.YES_OPTION){ 68 | //进行录取操作、调用service执行sql语句 69 | TitleOfStudent titleOfStudent = titleOfStudentList.get(selectedRow); 70 | // 71 | System.out.println("将要录取的学生姓名="+titleOfStudent.getStudent().getStudentName()); 72 | //录取 73 | titleOfStudentService.admitStudentWish(titleOfStudent); 74 | 75 | titleOfStudentList.remove(selectedRow);//移除 76 | 77 | JOptionPane.showMessageDialog(admitStudentsJpanel, "录取学生成功"); 78 | 79 | admitStudentsJpanel.refreshData();//刷新数据 80 | 81 | System.out.println("录取学生成功===================》》》》》》》》》"); 82 | } 83 | fireEditingStopped();//终止编辑 84 | } 85 | }); 86 | } 87 | /** 88 | * 为编辑器设置初始值 89 | * @param table 90 | * @param value 91 | * @param isSelected 92 | * @param row 93 | * @param column 94 | * @return 95 | */ 96 | @Override 97 | public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { 98 | return buttonJpanel; 99 | } 100 | 101 | /** 102 | *设置编辑器返回值 103 | * @return 104 | */ 105 | @Override 106 | public Object getCellEditorValue() { 107 | return null; 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/listerner/teacher/TeacherLisetener.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.listerner.teacher; 2 | 3 | /** 4 | * @author Mikey 5 | * @Title: 6 | * @Description: 7 | * @Email:1625017540@qq.com 8 | * @date 2018/12/3 20:22 9 | * @Version 1.0 10 | */ 11 | public class TeacherLisetener { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/mapper/AdminMapper.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.mapper; 2 | 3 | import com.mikey.design.entity.Admin; 4 | import com.mikey.design.entity.AdminExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | public interface AdminMapper { 9 | long countByExample(AdminExample example); 10 | 11 | int deleteByExample(AdminExample example); 12 | 13 | int deleteByPrimaryKey(Integer adminId); 14 | 15 | int insert(Admin record); 16 | 17 | int insertSelective(Admin record); 18 | 19 | List selectByExample(AdminExample example); 20 | 21 | Admin selectByPrimaryKey(Integer adminId); 22 | 23 | int updateByExampleSelective(@Param("record") Admin record, @Param("example") AdminExample example); 24 | 25 | int updateByExample(@Param("record") Admin record, @Param("example") AdminExample example); 26 | 27 | int updateByPrimaryKeySelective(Admin record); 28 | 29 | int updateByPrimaryKey(Admin record); 30 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/mapper/DesignMapper.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.mapper; 2 | 3 | import com.mikey.design.entity.Design; 4 | import com.mikey.design.entity.DesignExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | public interface DesignMapper { 9 | long countByExample(DesignExample example); 10 | 11 | int deleteByExample(DesignExample example); 12 | 13 | int deleteByPrimaryKey(Integer designId); 14 | 15 | int insert(Design record); 16 | 17 | int insertSelective(Design record); 18 | 19 | List selectByExample(DesignExample example); 20 | 21 | Design selectByPrimaryKey(Integer designId); 22 | 23 | int updateByExampleSelective(@Param("record") Design record, @Param("example") DesignExample example); 24 | 25 | int updateByExample(@Param("record") Design record, @Param("example") DesignExample example); 26 | 27 | int updateByPrimaryKeySelective(Design record); 28 | 29 | int updateByPrimaryKey(Design record); 30 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/mapper/StudentMapper.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.mapper; 2 | 3 | import com.mikey.design.entity.Student; 4 | import com.mikey.design.entity.StudentExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Component; 8 | 9 | public interface StudentMapper { 10 | long countByExample(StudentExample example); 11 | 12 | int deleteByExample(StudentExample example); 13 | 14 | int deleteByPrimaryKey(Integer studentId); 15 | 16 | int insert(Student record); 17 | 18 | int insertSelective(Student record); 19 | 20 | List selectByExample(StudentExample example); 21 | 22 | Student selectByPrimaryKey(Integer studentId); 23 | 24 | int updateByExampleSelective(@Param("record") Student record, @Param("example") StudentExample example); 25 | 26 | int updateByExample(@Param("record") Student record, @Param("example") StudentExample example); 27 | 28 | int updateByPrimaryKeySelective(Student record); 29 | 30 | int updateByPrimaryKey(Student record); 31 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/mapper/TeacherMapper.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.mapper; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mikey.design.entity.Student; 5 | import com.mikey.design.entity.Teacher; 6 | import com.mikey.design.entity.TeacherExample; 7 | import java.util.List; 8 | 9 | import com.mikey.design.entity.TitleOfStudent; 10 | import org.apache.ibatis.annotations.Param; 11 | import org.springframework.stereotype.Component; 12 | 13 | public interface TeacherMapper { 14 | long countByExample(TeacherExample example); 15 | 16 | int deleteByExample(TeacherExample example); 17 | 18 | int deleteByPrimaryKey(Integer teacherId); 19 | 20 | int insert(Teacher record); 21 | 22 | int insertSelective(Teacher record); 23 | 24 | List selectByExample(TeacherExample example); 25 | 26 | Teacher selectByPrimaryKey(Integer teacherId); 27 | 28 | int updateByExampleSelective(@Param("record") Teacher record, @Param("example") TeacherExample example); 29 | 30 | int updateByExample(@Param("record") Teacher record, @Param("example") TeacherExample example); 31 | 32 | int updateByPrimaryKeySelective(Teacher record); 33 | 34 | int updateByPrimaryKey(Teacher record); 35 | //获取填报当前登入教师的所有学生志愿信息 36 | List getWillAdmitStudentMes(Integer teacherId); 37 | //获取当前教师已经录取的学生信息 38 | List getAllAlreayAdmitStudent(Integer teacherId); 39 | //获取学生填报志愿状态 40 | List getAllStudentWishStateForAdmin(); 41 | //统计已经填报志愿的人数个数 42 | long getAlreadyFillWishStudentNum(); 43 | //统计未填报志愿人数个数 44 | long getNotFillWishStudentNum(); 45 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/mapper/TitleOfStudentMapper.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.mapper; 2 | 3 | import com.mikey.design.entity.TitleOfStudent; 4 | import com.mikey.design.entity.TitleOfStudentExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | public interface TitleOfStudentMapper { 9 | long countByExample(TitleOfStudentExample example); 10 | 11 | int deleteByExample(TitleOfStudentExample example); 12 | 13 | int deleteByPrimaryKey(Integer desOfStuId); 14 | 15 | int insert(TitleOfStudent record); 16 | 17 | int insertSelective(TitleOfStudent record); 18 | 19 | List selectByExample(TitleOfStudentExample example); 20 | 21 | TitleOfStudent selectByPrimaryKey(Integer desOfStuId); 22 | 23 | int updateByExampleSelective(@Param("record") TitleOfStudent record, @Param("example") TitleOfStudentExample example); 24 | 25 | int updateByExample(@Param("record") TitleOfStudent record, @Param("example") TitleOfStudentExample example); 26 | 27 | int updateByPrimaryKeySelective(TitleOfStudent record); 28 | 29 | int updateByPrimaryKey(TitleOfStudent record); 30 | 31 | //回档第二志愿 32 | void backSecondWish(Integer studentId); 33 | //回档第一志愿 34 | void backFirstWish(Integer studentId); 35 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/mapper/WishMapper.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.mapper; 2 | 3 | import com.mikey.design.entity.Wish; 4 | import com.mikey.design.entity.WishExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | public interface WishMapper { 9 | long countByExample(WishExample example); 10 | 11 | int deleteByExample(WishExample example); 12 | 13 | int deleteByPrimaryKey(Integer wishId); 14 | 15 | int insert(Wish record); 16 | 17 | int insertSelective(Wish record); 18 | 19 | List selectByExample(WishExample example); 20 | 21 | Wish selectByPrimaryKey(Integer wishId); 22 | 23 | int updateByExampleSelective(@Param("record") Wish record, @Param("example") WishExample example); 24 | 25 | int updateByExample(@Param("record") Wish record, @Param("example") WishExample example); 26 | 27 | int updateByPrimaryKeySelective(Wish record); 28 | 29 | int updateByPrimaryKey(Wish record); 30 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/mapper/WishMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | and ${criterion.condition} 18 | 19 | 20 | and ${criterion.condition} #{criterion.value} 21 | 22 | 23 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 24 | 25 | 26 | and ${criterion.condition} 27 | 28 | #{listItem} 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | and ${criterion.condition} 47 | 48 | 49 | and ${criterion.condition} #{criterion.value} 50 | 51 | 52 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 53 | 54 | 55 | and ${criterion.condition} 56 | 57 | #{listItem} 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | wish_id, wish_fist, wish_second 69 | 70 | 84 | 90 | 91 | delete from des_wish 92 | where wish_id = #{wishId,jdbcType=INTEGER} 93 | 94 | 95 | delete from des_wish 96 | 97 | 98 | 99 | 100 | 101 | insert into des_wish (wish_id, wish_fist, wish_second 102 | ) 103 | values (#{wishId,jdbcType=INTEGER}, #{wishFist,jdbcType=VARCHAR}, #{wishSecond,jdbcType=VARCHAR} 104 | ) 105 | 106 | 107 | insert into des_wish 108 | 109 | 110 | wish_id, 111 | 112 | 113 | wish_fist, 114 | 115 | 116 | wish_second, 117 | 118 | 119 | 120 | 121 | #{wishId,jdbcType=INTEGER}, 122 | 123 | 124 | #{wishFist,jdbcType=VARCHAR}, 125 | 126 | 127 | #{wishSecond,jdbcType=VARCHAR}, 128 | 129 | 130 | 131 | 137 | 138 | update des_wish 139 | 140 | 141 | wish_id = #{record.wishId,jdbcType=INTEGER}, 142 | 143 | 144 | wish_fist = #{record.wishFist,jdbcType=VARCHAR}, 145 | 146 | 147 | wish_second = #{record.wishSecond,jdbcType=VARCHAR}, 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | update des_wish 156 | set wish_id = #{record.wishId,jdbcType=INTEGER}, 157 | wish_fist = #{record.wishFist,jdbcType=VARCHAR}, 158 | wish_second = #{record.wishSecond,jdbcType=VARCHAR} 159 | 160 | 161 | 162 | 163 | 164 | update des_wish 165 | 166 | 167 | wish_fist = #{wishFist,jdbcType=VARCHAR}, 168 | 169 | 170 | wish_second = #{wishSecond,jdbcType=VARCHAR}, 171 | 172 | 173 | where wish_id = #{wishId,jdbcType=INTEGER} 174 | 175 | 176 | update des_wish 177 | set wish_fist = #{wishFist,jdbcType=VARCHAR}, 178 | wish_second = #{wishSecond,jdbcType=VARCHAR} 179 | where wish_id = #{wishId,jdbcType=INTEGER} 180 | 181 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/AdminService.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service; 2 | 3 | import com.mikey.design.entity.Admin; 4 | 5 | /** 6 | * @author Mikey 7 | * @Title: 管理员 8 | * @Description: 统计志愿填报,总学生人数,已经填报人数,未填报人数,教师人数,毕业设计题目总数 9 | * @Email:1625017540@qq.com 10 | * @date 2018/11/28 18:44 11 | * @Version 1.0 12 | */ 13 | public interface AdminService { 14 | /** 15 | * 统计教师人数 16 | * @return 17 | */ 18 | public long getTeacherNum(); 19 | 20 | /** 21 | * 统计学生人数 22 | * @return 23 | */ 24 | public long getStudentNum(); 25 | 26 | /** 27 | * 统计所有毕设题目总数 28 | * @return 29 | */ 30 | public long allTitleNum() ; 31 | /** 32 | * 查看信息、登入 33 | * @param AdminId 34 | * @return 35 | */ 36 | public Admin getAdmin(int AdminId); 37 | 38 | /** 39 | * 更新数据 40 | * @param admin 41 | */ 42 | public void updataAdmin(Admin admin); 43 | 44 | /** 45 | * 统计已经填报志愿的学生个数 46 | * @return 47 | */ 48 | long getAlreadyFillWishStudentNum(); 49 | 50 | /** 51 | * 统计未填报志愿的学生个数 52 | * @return 53 | */ 54 | long getNotFillWishStudentNum(); 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/DesignService.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mikey.design.entity.Design; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author Mikey 10 | * @Title: 11 | * @Description: 12 | * @Email:1625017540@qq.com 13 | * @date 2018/11/28 18:45 14 | * @Version 1.0 15 | */ 16 | public interface DesignService { 17 | public void addDesign(Design design); 18 | public void updateDesign(Design design); 19 | public void deleteDesign(int designId); 20 | public List getAllDesign(); 21 | PageInfo getDesignByPage(int currentPage, int pageSize); 22 | PageInfo getSelfDesignByPage(int teacherId,int currentPage, int pageSize);//教师获取自己的毕设题目列表 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/StudentService.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mikey.design.entity.Student; 5 | 6 | /** 7 | * @author Mikey 8 | * @Title: 9 | * @Description: 10 | * @Email:1625017540@qq.com 11 | * @date 2018/11/28 18:10 12 | * @Version 1.0 13 | */ 14 | public interface StudentService { 15 | public void addStudent(Student student); 16 | public void updateStudent(Student student); 17 | public void deleteStudent(int studentId); 18 | public int getStudentNum(); 19 | public Student getStudent(int studentId); 20 | 21 | PageInfo getAllTeacherByPage(int currentPage, int pageSize); 22 | 23 | /** 24 | * 通过手机号回显学号 25 | * @param studentPhone 26 | * @return 27 | */ 28 | Student getStudentByPhone(String studentPhone); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/TeacherService.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mikey.design.entity.Teacher; 5 | import com.mikey.design.entity.TitleOfStudent; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author Mikey 11 | * @Title: 12 | * @Description: 13 | * @Email:1625017540@qq.com 14 | * @date 2018/11/28 18:45 15 | * @Version 1.0 16 | */ 17 | public interface TeacherService { 18 | public int getTeacherNum();//获取教师人数 19 | public void addTeacher(Teacher teacher);//添加教师 20 | public void updateTeacherNum(Teacher teacher); 21 | public void deleteTeacherNum(int teacherId); 22 | public Teacher getTeacher(int teacherId); 23 | List getAllTeacher(); 24 | PageInfo getAllTeacherByPage(int currentPage, int pageSize);//分页获取所有教师 25 | PageInfo getWillAdmitStudentMes(Integer teacherId, int currentPage, int pageSize);//通过教师id获取全部志愿信息分页 26 | //获取当前教师已经录取的学生信息 27 | PageInfo getAllAlreayAdmitStudent(Integer teacherId, int currentPage, int pageSize); 28 | //获取学生填报志愿状态 29 | PageInfo getAllStudentWishStateForAdmin(int currentPage, int pageSize); 30 | //通过手机号回显新增教师 31 | Teacher getStudentByPhone(String teacherPhone); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/TitleOfStudentService.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service; 2 | 3 | import com.mikey.design.entity.Design; 4 | import com.mikey.design.entity.TitleOfStudent; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author Mikey 10 | * @Title: 11 | * @Description: 12 | * @Email:1625017540@qq.com 13 | * @date 2018/12/6 9:12 14 | * @Version 1.0 15 | */ 16 | public interface TitleOfStudentService { 17 | void addTitleOfStudent(TitleOfStudent titleOfStudent);//填报志愿 18 | void addTitleOfStudent(TitleOfStudent titleOfStudent1,TitleOfStudent titleOfStudent2);//提交第一第二志愿 19 | boolean fillWishOrNot(Integer studentId);//判断该学生是否已经填报志愿 20 | Design getFirstWish(Integer studentId);//获取第一志愿信息 21 | Design getSecondWish(Integer studentId);//获取第二志愿信息 22 | Integer getAdmitState(Integer studentId);//获取录取状态 23 | 24 | Design getAdmitDesign(Integer studentId);//查看学生志愿 25 | 26 | List getByTeacherId(Integer teacherId);//获取填报当前教师 的学生信息 27 | 28 | void admitStudentWish(TitleOfStudent titleOfStudent);//录取志愿 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/WishService.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service; 2 | 3 | import com.mikey.design.entity.Wish; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author Mikey 9 | * @Title: 10 | * @Description: 11 | * @Email:1625017540@qq.com 12 | * @date 2018/11/28 18:45 13 | * @Version 1.0 14 | */ 15 | public interface WishService { 16 | public void addWish(Wish wish); 17 | public void updateWish(Wish wish); 18 | public Wish getWish(int wishId); 19 | public List getAllWish(); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/impl/AdminServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service.impl; 2 | 3 | import com.mikey.design.entity.Admin; 4 | import com.mikey.design.mapper.AdminMapper; 5 | import com.mikey.design.mapper.DesignMapper; 6 | import com.mikey.design.mapper.StudentMapper; 7 | import com.mikey.design.mapper.TeacherMapper; 8 | import com.mikey.design.service.AdminService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | /** 13 | * @author Mikey 14 | * @Title: 15 | * @Description: 16 | * @Email:1625017540@qq.com 17 | * @date 2018/11/28 18:47 18 | * @Version 1.0 19 | */ 20 | @Service 21 | public class AdminServiceImpl implements AdminService { 22 | @Autowired 23 | private AdminMapper adminMapper; 24 | 25 | @Autowired 26 | private DesignMapper designMapper; 27 | 28 | @Autowired 29 | private TeacherMapper teacherMapper; 30 | 31 | @Autowired 32 | private StudentMapper studentMapper; 33 | 34 | @Override 35 | public long getTeacherNum() { 36 | return teacherMapper.countByExample(null); 37 | } 38 | 39 | @Override 40 | public long getStudentNum() { 41 | return studentMapper.countByExample(null); 42 | } 43 | /** 44 | * 获取全部题目总数 45 | * @return 46 | */ 47 | @Override 48 | public long allTitleNum() { 49 | return designMapper.countByExample(null); 50 | } 51 | 52 | /** 53 | * 管理员信息 54 | * @param adminId 55 | * @return 56 | */ 57 | @Override 58 | public Admin getAdmin(int adminId) { 59 | return adminMapper.selectByPrimaryKey(adminId); 60 | } 61 | 62 | /** 63 | * 更新管理员 64 | * @param admin 65 | */ 66 | @Override 67 | public void updataAdmin(Admin admin) { 68 | adminMapper.updateByPrimaryKey(admin); 69 | } 70 | 71 | /** 72 | *统计已经填报志愿的学生个数 73 | * @return 74 | */ 75 | @Override 76 | public long getAlreadyFillWishStudentNum() { 77 | return teacherMapper.getAlreadyFillWishStudentNum(); 78 | } 79 | 80 | /** 81 | * 统计未填报志愿的学生个数 82 | * @return 83 | */ 84 | @Override 85 | public long getNotFillWishStudentNum() { 86 | return teacherMapper.getNotFillWishStudentNum(); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/impl/DesignServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service.impl; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.mikey.design.entity.Design; 6 | import com.mikey.design.entity.DesignExample; 7 | import com.mikey.design.mapper.DesignMapper; 8 | import com.mikey.design.service.DesignService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * @author Mikey 16 | * @Title: 17 | * @Description: 18 | * @Email:1625017540@qq.com 19 | * @date 2018/11/28 18:48 20 | * @Version 1.0 21 | */ 22 | @Service 23 | public class DesignServiceImpl implements DesignService { 24 | @Autowired 25 | private DesignMapper designMapper; 26 | 27 | /** 28 | * 添加毕业设计 29 | * @param design 30 | */ 31 | @Override 32 | public void addDesign(Design design) { 33 | designMapper.insert(design); 34 | } 35 | 36 | /** 37 | * 更新毕业设计 38 | * @param design 39 | */ 40 | @Override 41 | public void updateDesign(Design design) { 42 | designMapper.updateByPrimaryKey(design); 43 | } 44 | 45 | /** 46 | * 删除毕业设计 47 | * @param designId 48 | */ 49 | @Override 50 | public void deleteDesign(int designId) { 51 | designMapper.deleteByPrimaryKey(designId); 52 | } 53 | 54 | /** 55 | * 获取全部毕业设计信息 56 | * @return 57 | */ 58 | @Override 59 | public List getAllDesign() { 60 | return designMapper.selectByExample(null); 61 | } 62 | 63 | /** 64 | * 分页查询毕业设计题目 65 | * @param currentPage 66 | * @param pageSize 67 | * @return 68 | */ 69 | @Override 70 | public PageInfo getDesignByPage(int currentPage, int pageSize) { 71 | 72 | PageHelper.startPage(currentPage,pageSize); 73 | 74 | List allBook=designMapper.selectByExample(null); 75 | 76 | PageInfo pageData = new PageInfo(allBook, pageSize); 77 | 78 | return pageData; 79 | } 80 | 81 | /** 82 | * 通过教师id获取他发布的题目 83 | * @param teacherId 84 | * @param currentPage 85 | * @param pageSize 86 | * @return 87 | */ 88 | @Override 89 | public PageInfo getSelfDesignByPage(int teacherId, int currentPage, int pageSize) { 90 | 91 | DesignExample designExample=new DesignExample(); 92 | 93 | DesignExample.Criteria criteria = designExample.createCriteria(); 94 | 95 | criteria.andDesignOfTeacherEqualTo(teacherId); 96 | 97 | PageHelper.startPage(currentPage,pageSize); 98 | 99 | List allBook=designMapper.selectByExample(designExample); 100 | 101 | PageInfo pageData = new PageInfo(allBook, pageSize); 102 | 103 | return pageData; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/impl/StudentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service.impl; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.mikey.design.entity.Student; 6 | import com.mikey.design.entity.StudentExample; 7 | import com.mikey.design.mapper.StudentMapper; 8 | import com.mikey.design.service.StudentService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * @author Mikey 16 | * @Title: 17 | * @Description: 18 | * @Email:1625017540@qq.com 19 | * @date 2018/11/28 18:25 20 | * @Version 1.0 21 | */ 22 | @Service 23 | public class StudentServiceImpl implements StudentService { 24 | @Autowired 25 | private StudentMapper studentMapper; 26 | 27 | /** 28 | * 添加学生 29 | * @param student 30 | */ 31 | @Override 32 | public void addStudent(Student student) { 33 | studentMapper.insertSelective(student); 34 | } 35 | 36 | /** 37 | * 修改学生 38 | * @param student 39 | */ 40 | @Override 41 | public void updateStudent(Student student) { 42 | 43 | studentMapper.updateByPrimaryKey(student); 44 | } 45 | 46 | /** 47 | * 删除学生 48 | * @param studentId 49 | */ 50 | @Override 51 | public void deleteStudent(int studentId) { 52 | 53 | studentMapper.deleteByPrimaryKey(studentId); 54 | } 55 | 56 | /** 57 | * 获取学生人数 58 | * @return 59 | */ 60 | @Override 61 | public int getStudentNum() { 62 | StudentExample studentExample=new StudentExample(); 63 | StudentExample.Criteria criteria = studentExample.createCriteria(); 64 | 65 | return (int) studentMapper.countByExample(null); 66 | } 67 | 68 | /** 69 | * 获取学生信息 70 | * @param studentId 71 | */ 72 | @Override 73 | public Student getStudent(int studentId) { 74 | 75 | return studentMapper.selectByPrimaryKey(studentId); 76 | } 77 | 78 | @Override 79 | public PageInfo getAllTeacherByPage(int currentPage, int pageSize) { 80 | 81 | PageHelper.startPage(currentPage,pageSize); 82 | 83 | List allBook=studentMapper.selectByExample(null); 84 | 85 | PageInfo pageData = new PageInfo(allBook, pageSize); 86 | 87 | return pageData; 88 | } 89 | 90 | /** 91 | * 通过手机号回显id 92 | * @param studentPhone 93 | * @return 94 | */ 95 | @Override 96 | public Student getStudentByPhone(String studentPhone) { 97 | 98 | StudentExample studentExample = new StudentExample(); 99 | 100 | StudentExample.Criteria criteria = studentExample.createCriteria(); 101 | 102 | criteria.andStudentPhoneEqualTo(studentPhone); 103 | 104 | List studentsList = studentMapper.selectByExample(studentExample); 105 | 106 | if (studentsList.size()>0)return studentsList.get(0); 107 | 108 | return new Student(); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/impl/TeacherServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service.impl; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.mikey.design.entity.Student; 6 | import com.mikey.design.entity.Teacher; 7 | import com.mikey.design.entity.TeacherExample; 8 | import com.mikey.design.entity.TitleOfStudent; 9 | import com.mikey.design.mapper.TeacherMapper; 10 | import com.mikey.design.service.TeacherService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @author Mikey 18 | * @Title: 教师 19 | * @Description: 20 | * @Email:1625017540@qq.com 21 | * @date 2018/11/28 18:48 22 | * @Version 1.0 23 | */ 24 | @Service 25 | public class TeacherServiceImpl implements TeacherService { 26 | @Autowired 27 | private TeacherMapper teacherMapper; 28 | 29 | /** 30 | * 获取教师人数 31 | * @return 32 | */ 33 | @Override 34 | public int getTeacherNum() { 35 | return 0; 36 | } 37 | 38 | /** 39 | * 添加教师 40 | * @param teacher 41 | */ 42 | @Override 43 | public void addTeacher(Teacher teacher) { 44 | 45 | teacherMapper.insertSelective(teacher); 46 | 47 | } 48 | /** 49 | * 修改教师 50 | * @param teacher 51 | */ 52 | @Override 53 | public void updateTeacherNum(Teacher teacher) { 54 | 55 | teacherMapper.updateByPrimaryKey(teacher); 56 | } 57 | /** 58 | * 删除教师 59 | * @param teacherId 60 | */ 61 | @Override 62 | public void deleteTeacherNum(int teacherId) { 63 | 64 | teacherMapper.deleteByPrimaryKey(teacherId); 65 | } 66 | 67 | /** 68 | * 获取单个教师信息 69 | * @param teacherId 70 | * @return 71 | */ 72 | @Override 73 | public Teacher getTeacher(int teacherId) { 74 | return teacherMapper.selectByPrimaryKey(teacherId); 75 | } 76 | 77 | /** 78 | * 直接获取全部教师信息 79 | * @return 80 | */ 81 | public List getAllTeacher(){ 82 | return teacherMapper.selectByExample(null); 83 | } 84 | /** 85 | * 分页查询教师信息列表 86 | * @param currentPage 87 | * @param pageSize 88 | * @return 89 | */ 90 | @Override 91 | public PageInfo getAllTeacherByPage(int currentPage,int pageSize) { 92 | 93 | PageHelper.startPage(currentPage,pageSize); 94 | 95 | List teacherList=teacherMapper.selectByExample(null); 96 | 97 | PageInfo pageData = new PageInfo(teacherList, pageSize); 98 | 99 | return pageData; 100 | } 101 | 102 | /** 103 | * 获取将要被录取的学生信息 104 | * @param teacherId 105 | * @return 106 | */ 107 | @Override 108 | public PageInfo getWillAdmitStudentMes(Integer teacherId, int currentPage, int pageSize){ 109 | 110 | PageHelper.startPage(currentPage,pageSize); 111 | 112 | List titleOfStudentList=teacherMapper.getWillAdmitStudentMes(teacherId); 113 | 114 | PageInfo pageData=new PageInfo(titleOfStudentList,pageSize); 115 | 116 | return pageData; 117 | } 118 | 119 | /** 120 | * 获取当前教师已经录取的学生信息 121 | * @param teacherId 122 | * @param currentPage 123 | * @param pageSize 124 | * @return 125 | */ 126 | @Override 127 | public PageInfo getAllAlreayAdmitStudent(Integer teacherId, int currentPage, int pageSize) { 128 | PageHelper.startPage(currentPage,pageSize); 129 | 130 | List titleOfStudentList=teacherMapper.getAllAlreayAdmitStudent(teacherId); 131 | 132 | PageInfo pageData=new PageInfo(titleOfStudentList,pageSize); 133 | 134 | return pageData; 135 | } 136 | 137 | /** 138 | * 获取学生填报志愿状态 139 | * @param currentPage 140 | * @param pageSize 141 | * @return 142 | */ 143 | @Override 144 | public PageInfo getAllStudentWishStateForAdmin(int currentPage, int pageSize) { 145 | 146 | PageHelper.startPage(currentPage,pageSize); 147 | 148 | List titleOfStudentList=teacherMapper.getAllStudentWishStateForAdmin(); 149 | 150 | PageInfo pageData=new PageInfo(titleOfStudentList,pageSize); 151 | 152 | return pageData; 153 | 154 | } 155 | 156 | /** 157 | * 通过手机号回显新增教师 158 | * @param teacherPhone 159 | * @return 160 | */ 161 | @Override 162 | public Teacher getStudentByPhone(String teacherPhone) { 163 | TeacherExample teacherExample=new TeacherExample(); 164 | 165 | TeacherExample.Criteria criteria = teacherExample.createCriteria(); 166 | 167 | criteria.andTeacherPhoneEqualTo(teacherPhone); 168 | 169 | List teacherList = teacherMapper.selectByExample(teacherExample); 170 | 171 | if (teacherList.size()>0)return teacherList.get(0); 172 | 173 | return new Teacher(); 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/impl/TitleOfStudentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service.impl; 2 | 3 | import com.mikey.design.entity.Design; 4 | import com.mikey.design.entity.DesignExample; 5 | import com.mikey.design.entity.TitleOfStudent; 6 | import com.mikey.design.entity.TitleOfStudentExample; 7 | import com.mikey.design.mapper.DesignMapper; 8 | import com.mikey.design.mapper.TitleOfStudentMapper; 9 | import com.mikey.design.service.TitleOfStudentService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * @author Mikey 17 | * @Title: 18 | * @Description: 19 | * @Email:1625017540@qq.com 20 | * @date 2018/12/6 9:16 21 | * @Version 1.0 22 | */ 23 | @Service 24 | public class TitleOfStudentServiceImpl implements TitleOfStudentService { 25 | @Autowired 26 | private TitleOfStudentMapper titleOfStudentMapper; 27 | 28 | @Autowired 29 | private DesignMapper designMapper; 30 | 31 | 32 | /** 33 | * 添加志愿 34 | * @param titleOfStudent 35 | */ 36 | @Override 37 | public void addTitleOfStudent(TitleOfStudent titleOfStudent) { 38 | titleOfStudentMapper.insert(titleOfStudent); 39 | } 40 | 41 | /** 42 | * 添加志愿 43 | * @param titleOfStudent1 44 | * @param titleOfStudent2 45 | */ 46 | @Override 47 | public void addTitleOfStudent(TitleOfStudent titleOfStudent1, TitleOfStudent titleOfStudent2) { 48 | titleOfStudentMapper.insert(titleOfStudent1); 49 | titleOfStudentMapper.insert(titleOfStudent2); 50 | } 51 | 52 | /** 53 | * 通过学生id判断是否已经进行志愿填报 54 | * @param studentId 55 | * @return 56 | */ 57 | @Override 58 | public boolean fillWishOrNot(Integer studentId) { 59 | TitleOfStudentExample titleOfStudentExample = new TitleOfStudentExample(); 60 | TitleOfStudentExample.Criteria criteria = titleOfStudentExample.createCriteria(); 61 | criteria.andDesOfStuEqualTo(studentId); 62 | return titleOfStudentMapper.countByExample(titleOfStudentExample)>0; 63 | } 64 | 65 | /** 66 | * 获取第一志愿信息 67 | * @param studentId 68 | * @return 69 | */ 70 | @Override 71 | public Design getFirstWish(Integer studentId) { 72 | 73 | TitleOfStudentExample titleOfStudentExample = new TitleOfStudentExample(); 74 | 75 | TitleOfStudentExample.Criteria criteria = titleOfStudentExample.createCriteria(); 76 | 77 | criteria.andDesOfStuEqualTo(studentId);//当前学生志愿 78 | 79 | criteria.andDesWishOrderEqualTo(0);//第一志愿 80 | 81 | List titleOfStudent= titleOfStudentMapper.selectByExample(titleOfStudentExample); 82 | 83 | if (titleOfStudent.size()>0) { 84 | return designMapper.selectByPrimaryKey(titleOfStudent.get(0).getDesOfTitle()); 85 | }else { 86 | return null; 87 | } 88 | } 89 | 90 | /** 91 | *获取第二志愿信息 92 | * @param studentId 93 | * @return 94 | */ 95 | @Override 96 | public Design getSecondWish(Integer studentId) { 97 | TitleOfStudentExample titleOfStudentExample = new TitleOfStudentExample(); 98 | 99 | TitleOfStudentExample.Criteria criteria = titleOfStudentExample.createCriteria(); 100 | 101 | criteria.andDesOfStuEqualTo(studentId);//当前学生志愿 102 | 103 | criteria.andDesWishOrderEqualTo(1);//第二志愿 104 | 105 | List titleOfStudent= titleOfStudentMapper.selectByExample(titleOfStudentExample); 106 | 107 | if (titleOfStudent.size()>0) { 108 | return designMapper.selectByPrimaryKey(titleOfStudent.get(0).getDesOfTitle()); 109 | }else { 110 | return null; 111 | } 112 | } 113 | 114 | /** 115 | * 获取录取的状态 116 | * @param studentId 117 | * @return 118 | */ 119 | @Override 120 | public Integer getAdmitState(Integer studentId) { 121 | 122 | TitleOfStudentExample titleOfStudentExample = new TitleOfStudentExample(); 123 | TitleOfStudentExample.Criteria criteria = titleOfStudentExample.createCriteria(); 124 | criteria.andDesOfStuEqualTo(studentId);//当前学生志愿 125 | criteria.andDesWishOrderEqualTo(0);//第一志愿 126 | List titleOfStudent=titleOfStudentMapper.selectByExample(titleOfStudentExample); 127 | 128 | if(titleOfStudent.size()>0&&titleOfStudent.get(0).getDesState()==0)return 0;//第一志愿待录取 129 | if(titleOfStudent.size()>0&&titleOfStudent.get(0).getDesState()==1)return 1;//第一志愿已经录取 130 | 131 | TitleOfStudentExample titleOfStudentExample2 = new TitleOfStudentExample(); 132 | TitleOfStudentExample.Criteria criteria2 = titleOfStudentExample.createCriteria(); 133 | criteria2.andDesOfStuEqualTo(studentId);//当前学生志愿 134 | criteria2.andDesWishOrderEqualTo(1);//第二志愿 135 | List titleOfStudent2= titleOfStudentMapper.selectByExample(titleOfStudentExample2); 136 | 137 | if(titleOfStudent2.size()>0){ 138 | return titleOfStudent2.get(0).getDesState(); 139 | } 140 | return 0; 141 | } 142 | 143 | /** 144 | * 获取录取的课设信息 145 | * @param studentId 146 | * @return 147 | */ 148 | @Override 149 | public Design getAdmitDesign(Integer studentId) { 150 | 151 | TitleOfStudentExample titleOfStudentExample = new TitleOfStudentExample(); 152 | 153 | TitleOfStudentExample.Criteria criteria = titleOfStudentExample.createCriteria(); 154 | 155 | criteria.andDesOfStuEqualTo(studentId);//当前学生志愿 156 | 157 | criteria.andDesStateEqualTo(1);//已经录取 158 | 159 | List titleOfStudent= titleOfStudentMapper.selectByExample(titleOfStudentExample); 160 | 161 | if (titleOfStudent.size()>0){ 162 | return designMapper.selectByPrimaryKey(titleOfStudent.get(0).getDesOfTitle()); 163 | }else { 164 | return null; 165 | } 166 | } 167 | 168 | /** 169 | * 170 | * @param teacherId 171 | * @return 172 | */ 173 | @Override 174 | public List getByTeacherId(Integer teacherId) { 175 | 176 | DesignExample designExample = new DesignExample(); 177 | 178 | DesignExample.Criteria criteria = designExample.createCriteria(); 179 | 180 | criteria.andDesignOfTeacherEqualTo(teacherId); 181 | 182 | List designList = designMapper.selectByExample(designExample);//查询出当前教师的所有毕业设计题目 183 | 184 | if (designList.size()>0){ 185 | 186 | } 187 | 188 | return null; 189 | } 190 | 191 | /** 192 | * 录取志愿 193 | * @param titleOfStudent 194 | */ 195 | @Override 196 | public void admitStudentWish(TitleOfStudent titleOfStudent) { 197 | 198 | titleOfStudent.setDesState(1);//录取 199 | 200 | titleOfStudentMapper.updateByPrimaryKey(titleOfStudent);//提交更新 201 | 202 | //TODO:将该学生的另一个志愿回档 203 | 204 | switch (titleOfStudent.getDesWishOrder()){ 205 | case 0://第一志愿被录取、将第二志愿回档 206 | titleOfStudentMapper.backSecondWish(titleOfStudent.getStudent().getStudentId()); 207 | break; 208 | case 1://第一志愿被录取、将第二志愿回档 209 | titleOfStudentMapper.backFirstWish(titleOfStudent.getStudent().getStudentId()); 210 | break; 211 | } 212 | 213 | } 214 | } 215 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/service/impl/WishServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.service.impl; 2 | 3 | import com.mikey.design.entity.Wish; 4 | import com.mikey.design.mapper.WishMapper; 5 | import com.mikey.design.service.WishService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @author Mikey 13 | * @Title: 14 | * @Description: 15 | * @Email:1625017540@qq.com 16 | * @date 2018/11/28 18:49 17 | * @Version 1.0 18 | */ 19 | @Service 20 | public class WishServiceImpl implements WishService { 21 | 22 | @Autowired 23 | private WishMapper wishMapper; 24 | 25 | /** 26 | * 添加志愿 27 | * @param wish 28 | */ 29 | @Override 30 | public void addWish(Wish wish) { 31 | 32 | wishMapper.insert(wish); 33 | } 34 | 35 | /** 36 | * 修改志愿 37 | * @param wish 38 | */ 39 | @Override 40 | public void updateWish(Wish wish) { 41 | wishMapper.updateByPrimaryKey(wish); 42 | 43 | } 44 | 45 | /** 46 | * 获取志愿信息 47 | * @param wishId 48 | * @return 49 | */ 50 | @Override 51 | public Wish getWish(int wishId) { 52 | return wishMapper.selectByPrimaryKey(wishId); 53 | } 54 | 55 | /** 56 | * 获取全部志愿 57 | * @return 58 | */ 59 | @Override 60 | public List getAllWish() { 61 | return wishMapper.selectByExample(null); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/utils/GBM.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.utils; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.mybatis.generator.api.MyBatisGenerator; 5 | import org.mybatis.generator.config.Configuration; 6 | import org.mybatis.generator.config.xml.ConfigurationParser; 7 | import org.mybatis.generator.internal.DefaultShellCallback; 8 | 9 | import java.io.File; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Mikey 15 | * @Title: 16 | * @Description: 17 | * @Email:1625017540@qq.com 18 | * @date 2018/11/27 12:41 19 | * @Version 1.0 20 | */ 21 | public class GBM { 22 | 23 | @Test 24 | public static void main(String[] args) throws Exception { 25 | List warnings = new ArrayList(); 26 | boolean overwrite = true; 27 | File configFile = new File("E:\\MIKEY\\MobileFile\\Image\\GraduationDesign\\src\\main\\resources\\GBM\\nbg.xml"); 28 | ConfigurationParser cp = new ConfigurationParser(warnings); 29 | Configuration config = cp.parseConfiguration(configFile); 30 | DefaultShellCallback callback = new DefaultShellCallback(overwrite); 31 | MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, 32 | callback, warnings); 33 | myBatisGenerator.generate(null); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/utils/SpringUtil.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.utils; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.beans.factory.NoSuchBeanDefinitionException; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.ApplicationContextAware; 7 | import org.springframework.stereotype.Component; 8 | /** 9 | * @author Mikey 10 | * @Title: 11 | * @Description: 12 | * @Email:1625017540@qq.com 13 | * @date 2018/12/3 21:57 14 | * @Version 1.0 15 | */ 16 | @Component 17 | public class SpringUtil implements ApplicationContextAware { 18 | private static ApplicationContext applicationContext = null; 19 | 20 | public SpringUtil() { 21 | } 22 | 23 | public void setApplicationContext(ApplicationContext arg0) throws BeansException { 24 | if (applicationContext == null) { 25 | applicationContext = arg0; 26 | } 27 | 28 | } 29 | 30 | public static ApplicationContext getApplicationContext() { 31 | return applicationContext; 32 | } 33 | 34 | public static void setAppCtx(ApplicationContext webAppCtx) { 35 | if (webAppCtx != null) { 36 | applicationContext = webAppCtx; 37 | } 38 | } 39 | 40 | /** 41 | * 拿到ApplicationContext对象实例后就可以手动获取Bean的注入实例对象 42 | */ 43 | public static T getBean(Class clazz) { 44 | return getApplicationContext().getBean(clazz); 45 | } 46 | 47 | public static T getBean(String name, Class clazz) throws ClassNotFoundException { 48 | return getApplicationContext().getBean(name, clazz); 49 | } 50 | 51 | public static final Object getBean(String beanName) { 52 | return getApplicationContext().getBean(beanName); 53 | } 54 | 55 | public static final Object getBean(String beanName, String className) throws ClassNotFoundException { 56 | Class clz = Class.forName(className); 57 | return getApplicationContext().getBean(beanName, clz.getClass()); 58 | } 59 | 60 | public static boolean containsBean(String name) { 61 | return getApplicationContext().containsBean(name); 62 | } 63 | 64 | public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException { 65 | return getApplicationContext().isSingleton(name); 66 | } 67 | 68 | public static Class getType(String name) throws NoSuchBeanDefinitionException { 69 | return getApplicationContext().getType(name); 70 | } 71 | 72 | public static String[] getAliases(String name) throws NoSuchBeanDefinitionException { 73 | return getApplicationContext().getAliases(name); 74 | } 75 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/utils/ThreadLocalUtil.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.utils; 2 | 3 | /** 4 | * @author Mikey 5 | * @Title: 6 | * @Description: 7 | * @Email:1625017540@qq.com 8 | * @date 2018/12/3 20:11 9 | * @Version 1.0 10 | */ 11 | public class ThreadLocalUtil { 12 | public static ThreadLocal threadLocal=new ThreadLocal(); 13 | 14 | /** 15 | * 添加登入用户到本地线程 16 | * @param object 17 | */ 18 | public static void set(Object object){ 19 | threadLocal.set(object); 20 | } 21 | 22 | /** 23 | * 获取登入用户数据 24 | * @return 25 | */ 26 | public static Object get(){ 27 | Object obj = threadLocal.get(); 28 | if (obj==null){ 29 | threadLocal.set(new String("本地线程无数据")); 30 | System.out.println("本地线程无数据"); 31 | } 32 | return obj; 33 | } 34 | 35 | /** 36 | * 清除登入用户数据 37 | */ 38 | public static void remove(){ 39 | threadLocal.remove(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/Frame1.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.Test; 2 | 3 | /** 4 | * @author Mikey 5 | * @Title: 6 | * @Description: 7 | * @Email:1625017540@qq.com 8 | * @date 2018/12/3 23:15 9 | * @Version 1.0 10 | */ 11 | 12 | import java.awt.*; 13 | import java.awt.event.*; 14 | import javax.swing.*; 15 | 16 | public class Frame1 extends JFrame implements ActionListener{ 17 | JButton button = new JButton(); 18 | public Frame1(){ 19 | button.addActionListener(this); //添加监视器 20 | this.add(button); 21 | this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //设置按关闭键即可关闭窗体 22 | this.setSize(400,300); 23 | this.setVisible(true); //可视化 24 | } 25 | public void actionPerformed(ActionEvent e) { 26 | this.setVisible(false); //窗体不可见 27 | new Frame2(); //创建新的窗体,以达到切换窗体的效果 28 | } 29 | public static void main(String[] args){ 30 | new Frame1(); 31 | } 32 | private class Frame2 extends JFrame{ 33 | public Frame2(){ 34 | JTextField text = new JTextField(); 35 | this.add(text); 36 | this.setSize(600, 480); 37 | this.setVisible(true); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/MyButtonEditor.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.Test; 2 | 3 | /** 4 | * @author Mikey 5 | * @Title: 6 | * @Description: 7 | * @Email:1625017540@qq.com 8 | * @date 2018/12/4 21:22 9 | * @Version 1.0 10 | */ 11 | import java.awt.BorderLayout; 12 | import java.awt.Component; 13 | import java.awt.event.ActionEvent; 14 | import java.awt.event.ActionListener; 15 | 16 | import javax.swing.AbstractCellEditor; 17 | import javax.swing.JButton; 18 | import javax.swing.JOptionPane; 19 | import javax.swing.JPanel; 20 | import javax.swing.JTable; 21 | import javax.swing.table.TableCellEditor; 22 | 23 | public class MyButtonEditor extends AbstractCellEditor implements TableCellEditor { 24 | 25 | private static final long serialVersionUID = -6546334664166791132L; 26 | 27 | private JPanel panel; 28 | 29 | private JButton button; 30 | 31 | private int num; 32 | 33 | public MyButtonEditor() { 34 | 35 | initButton(); 36 | 37 | initPanel(); 38 | 39 | panel.add(this.button, BorderLayout.CENTER); 40 | } 41 | 42 | private void initButton() { 43 | button = new JButton(); 44 | 45 | button.addActionListener(new ActionListener() { 46 | public void actionPerformed(ActionEvent e) { 47 | int res = JOptionPane.showConfirmDialog(null, 48 | "您确定要录取这位学生吗?", "确认录取", 49 | JOptionPane.YES_NO_OPTION); 50 | 51 | if(res == JOptionPane.YES_OPTION){ 52 | num++; 53 | } 54 | //stopped!!!! 55 | fireEditingStopped(); 56 | 57 | } 58 | }); 59 | 60 | } 61 | 62 | private void initPanel() { 63 | panel = new JPanel(); 64 | 65 | panel.setLayout(new BorderLayout()); 66 | } 67 | 68 | @Override 69 | public Component getTableCellEditorComponent(JTable table, Object value, 70 | boolean isSelected, int row, int column) { 71 | num = (Integer) value; 72 | 73 | button.setText(value == null ? "" : String.valueOf(value)); 74 | 75 | return panel; 76 | } 77 | 78 | @Override 79 | public Object getCellEditorValue() { 80 | return num; 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/MyButtonRenderer.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.Test; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Component; 5 | 6 | import javax.swing.JButton; 7 | import javax.swing.JPanel; 8 | import javax.swing.JTable; 9 | import javax.swing.table.TableCellRenderer; 10 | 11 | /** 12 | * @author Mikey 13 | * @Title: 14 | * @Description: 15 | * @Email:1625017540@qq.com 16 | * @date 2018/12/4 21:22 17 | * @Version 1.0 18 | */ 19 | public class MyButtonRenderer implements TableCellRenderer { 20 | private JPanel panel; 21 | 22 | private JButton button; 23 | 24 | private int num; 25 | 26 | public MyButtonRenderer() { 27 | initButton(); 28 | 29 | initPanel(); 30 | 31 | panel.add(button, BorderLayout.CENTER); 32 | } 33 | 34 | private void initButton() { 35 | button = new JButton(); 36 | 37 | } 38 | 39 | private void initPanel() { 40 | panel = new JPanel(); 41 | 42 | panel.setLayout(new BorderLayout()); 43 | } 44 | 45 | public Component getTableCellRendererComponent(JTable table, Object value, 46 | boolean isSelected, boolean hasFocus, int row, int column) { 47 | num = (Integer) value; 48 | 49 | button.setText(value == null ? "" : String.valueOf(value)); 50 | 51 | return panel; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/Test.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.Test; 2 | 3 | /** 4 | * @author Mikey 5 | * @Title: 6 | * @Description: 7 | * @Email:1625017540@qq.com 8 | * @date 2018/12/6 22:52 9 | * @Version 1.0 10 | */ 11 | 12 | import javax.swing.*; 13 | import java.awt.event.*; 14 | import java.awt.*; 15 | import javax.swing.table.*; 16 | 17 | public class Test extends JFrame implements ActionListener 18 | { 19 | 20 | private JButton button1; 21 | private JButton button2; 22 | private JButton button3; 23 | private DefaultTableModel model; 24 | private JTable table; 25 | private JProgressBar bar; 26 | private JScrollPane scrollpane; 27 | private JPanel panel; 28 | 29 | public Test() 30 | { 31 | button1=new JButton("演示1"); 32 | button2=new JButton("演示2"); 33 | button3=new JButton("清空"); 34 | panel=new JPanel(); 35 | bar=new JProgressBar(0,100); 36 | String[] colnames={"1","2","3","4","5","6"}; 37 | model=new DefaultTableModel(colnames,100); 38 | table=new JTable(model); 39 | scrollpane=new JScrollPane(table); 40 | panel.setLayout(new FlowLayout()); 41 | button1.addActionListener(this); 42 | button2.addActionListener(this); 43 | button3.addActionListener(this); 44 | panel.add(button1); 45 | panel.add(button2); 46 | panel.add(button3); 47 | panel.add(bar); 48 | this.setLayout(new GridLayout(2,1)); 49 | this.setSize(500,600); 50 | this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 51 | this.add(scrollpane); 52 | this.add(panel); 53 | } 54 | 55 | public void actionPerformed(ActionEvent e) 56 | { 57 | String command=e.getActionCommand(); 58 | if(command.equals("演示1")) 59 | { 60 | ShowModel show=new ShowModel(true); 61 | Thread thread=new Thread(show); 62 | thread.start(); 63 | } 64 | else if(command.equals("演示2")) 65 | { 66 | ShowModel show=new ShowModel(false); 67 | Thread thread=new Thread(show); 68 | thread.start(); 69 | } 70 | else 71 | { 72 | String[] colnames={"1","2","3","4","5","6"}; 73 | model=new DefaultTableModel(colnames,100); 74 | table.setModel(model); 75 | } 76 | } 77 | 78 | private class ShowModel implements Runnable 79 | { 80 | 81 | private boolean type;//当type为true时,则说明是“演示1”的线程,false则相反 82 | 83 | public ShowModel(boolean type) 84 | { 85 | this.type=type; 86 | } 87 | 88 | public void run() 89 | { 90 | 91 | if(type)//这个就是让线程睡眠,并且设置JTable的值 92 | { 93 | try{ 94 | 95 | for(int i=0;i<100;i++) 96 | { 97 | Test.this.table.setValueAt(String.valueOf(i),i,0); 98 | Test.this.table.setValueAt(String.valueOf(i),i,1); 99 | Thread.sleep(100); 100 | } 101 | 102 | }catch(Exception e) 103 | { 104 | e.printStackTrace(); 105 | } 106 | } 107 | else//这个就是进度条的演示 108 | { 109 | try{ 110 | Test.this.table.setVisible(false); 111 | for(int i=0;i<100;i++) 112 | { 113 | Test.this.table.setValueAt(String.valueOf(i),i,0); 114 | Test.this.table.setValueAt(String.valueOf(i),i,1); 115 | Test.this.bar.setValue(i+1); 116 | Test.this.bar.setString(String.valueOf(i+1)+"%"); 117 | Thread.sleep(40); 118 | if(i==99) 119 | { 120 | Test.this.table.setVisible(true); 121 | JOptionPane.showMessageDialog(Test.this,"OK"); 122 | Test.this.bar.setValue(0); 123 | } 124 | 125 | } 126 | 127 | }catch(Exception e) 128 | { 129 | e.printStackTrace(); 130 | } 131 | } 132 | } 133 | } 134 | 135 | public static void main(String[] args) 136 | { 137 | Test test=new Test(); 138 | test.setVisible(true); 139 | } 140 | 141 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/Test2.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.Test; 2 | 3 | /** 4 | * @author Mikey 5 | * @Title: 6 | * @Description: 7 | * @Email:1625017540@qq.com 8 | * @date 2018/12/4 21:08 9 | * @Version 1.0 10 | */ 11 | import java.awt.Component; 12 | import java.awt.FlowLayout; 13 | import java.awt.event.ActionEvent; 14 | import java.awt.event.ActionListener; 15 | import java.util.EventObject; 16 | 17 | import javax.swing.DefaultCellEditor; 18 | import javax.swing.JButton; 19 | import javax.swing.JFrame; 20 | import javax.swing.JOptionPane; 21 | import javax.swing.JPanel; 22 | import javax.swing.JTable; 23 | import javax.swing.JTextField; 24 | import javax.swing.UIManager; 25 | import javax.swing.table.DefaultTableModel; 26 | import javax.swing.table.TableCellRenderer; 27 | 28 | public class Test2 extends JFrame { 29 | 30 | JTable t; 31 | 32 | public Test2() { 33 | setBounds(100, 100, 200, 200); 34 | JPanel pane = new JPanel(); 35 | 36 | DefaultTableModel dm = new DefaultTableModel(); 37 | dm.setDataVector(new Object[][]{{"Button 1", "foo"}, 38 | {"Button 2", "bar"},{"Button 2", "bar"},{"Button 2", "bar"},{"Button 2", "bar"},{"Button 2", "bar"}}, 39 | new Object[]{"Button", "String"}); 40 | 41 | t = new JTable(dm); 42 | 43 | 44 | 45 | 46 | t.getColumn("Button").setCellRenderer(new ButtonRenderer()); 47 | t.getColumn("Button").setCellEditor(new ButtonEditor(new JTextField())); 48 | 49 | pane.setLayout(new FlowLayout()); 50 | pane.add(t); 51 | this.add(pane); 52 | setVisible(true); 53 | } 54 | } 55 | 56 | class ButtonEditor extends DefaultCellEditor { 57 | 58 | protected JButton button; 59 | private String label; 60 | private boolean isPushed; 61 | 62 | public ButtonEditor(JTextField checkBox) { 63 | super(checkBox); 64 | this.setClickCountToStart(1); 65 | button = new JButton(); 66 | button.setOpaque(true); 67 | button.addActionListener(new ActionListener() { 68 | 69 | public void actionPerformed(ActionEvent e) { 70 | fireEditingStopped(); 71 | } 72 | }); 73 | 74 | } 75 | 76 | public Component getTableCellEditorComponent(final JTable table, Object value, 77 | boolean isSelected,int row, int column) { 78 | if (isSelected) { 79 | button.setForeground(table.getSelectionForeground()); 80 | button.setBackground(table.getSelectionBackground()); 81 | } else { 82 | button.setForeground(table.getForeground()); 83 | button.setBackground(table.getBackground()); 84 | } 85 | label = (value == null) ? "" : value.toString(); 86 | button.setText(label); 87 | button.addActionListener(new ActionListener() { 88 | 89 | @Override 90 | public void actionPerformed(ActionEvent e) { 91 | System.out.println(table.getSelectedRow()) ; 92 | System.out.println(table.getSelectedColumn()) ; 93 | } 94 | }); 95 | isPushed = true; 96 | return button; 97 | } 98 | 99 | public Object getCellEditorValue() { 100 | if (isPushed) { 101 | // 102 | // 103 | // JOptionPane.showMessageDialog(button, label + ": Ouch!"); 104 | // System.out.println(label + ": Ouch!"); 105 | } 106 | isPushed = false; 107 | return new String(label); 108 | } 109 | 110 | public boolean stopCellEditing() { 111 | isPushed = false; 112 | return super.stopCellEditing(); 113 | } 114 | 115 | @Override 116 | public boolean shouldSelectCell(EventObject anEvent) { 117 | System.out.println(1); 118 | return super.shouldSelectCell(anEvent); 119 | } 120 | 121 | 122 | public static void main(String[] args){ 123 | Test2 test1 = new Test2() ; 124 | } 125 | } 126 | 127 | class ButtonRenderer extends JButton implements TableCellRenderer { 128 | 129 | public ButtonRenderer() { 130 | setOpaque(true); 131 | } 132 | 133 | public Component getTableCellRendererComponent(JTable table, Object value, 134 | boolean isSelected, boolean hasFocus, int row, int column) { 135 | if (isSelected) { 136 | setForeground(table.getSelectionForeground()); 137 | setBackground(table.getSelectionBackground()); 138 | } else { 139 | setForeground(table.getForeground()); 140 | setBackground(UIManager.getColor("UIManager")); 141 | } 142 | setText((value == null) ? "" : value.toString()); 143 | return this; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/TestListAndMap.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.Test; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Set; 6 | 7 | /** 8 | * @author Mikey 9 | * @Title: 10 | * @Description: 11 | * @Email:1625017540@qq.com 12 | * @date 2018/12/8 17:16 13 | * @Version 1.0 14 | */ 15 | public class TestListAndMap { 16 | public static void main(String[] args){ 17 | 18 | List list=new ArrayList<>(); 19 | list.add("1"); 20 | list.add("2"); 21 | list.add("3"); 22 | list.add("4"); 23 | list.add("5"); 24 | list.add("6"); 25 | System.out.println("length="+list.size()); 26 | System.out.println(list.get(2)); 27 | list.remove(2); 28 | System.out.println(list.get(2)); 29 | System.out.println("length="+list.size()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/TestPhone.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.Test; 2 | 3 | import java.util.regex.Pattern; 4 | 5 | /** 6 | * @author Mikey 7 | * @Title: 8 | * @Description: 9 | * @Email:1625017540@qq.com 10 | * @date 2018/12/7 14:29 11 | * @Version 1.0 12 | */ 13 | 14 | public class TestPhone { 15 | public static final String REGEX_MOBILE ="^[1](([3][0-9])|([4][5,7,9])|([5][^4,6,9])|([6][6])|([7][3,5,6,7,8])|([8][0-9])|([9][8,9]))[0-9]{8}$"; 16 | public static final String REGEX_PASSWORD = "^[a-zA-Z0-9]{6,20}$"; 17 | public static final String Name="^[\u4E00-\u9FA5]{2,4}$"; 18 | public static void main(String[] args){ 19 | String userPhone="18276297824"; 20 | System.out.println(Pattern.matches(REGEX_MOBILE,userPhone)); 21 | String pwd="123456aaVV"; 22 | System.out.println(Pattern.matches(REGEX_PASSWORD,pwd)); 23 | String name="麦3奇"; 24 | System.out.println(Pattern.matches(Name,name)); 25 | //表格所有行数据 26 | Object[][] rowData = { 27 | {"张三", 80, 80, 80,80, 24}, 28 | {"John", 70, 80, 80, 90, 240}, 29 | {"Sue", 70, 70, 70, 80, 210}, 30 | {"Jane", 80, 70, 60, 80, 210}, 31 | {"Joe_01", 80, 70, 60,80,210}, 32 | {"Joe_02", 80, 70, 60,80,210}, 33 | {"Joe_03", 80, 70, 60,80,210}, 34 | {"Joe_04", 80, 70, 60,80,210}, 35 | {"Joe_05", 80, 70, 60,80,210}, 36 | {"张三", 80, 80, 80, 80,24}, 37 | {"John", 70, 80, 90, 80,240}, 38 | {"Sue", 70, 70, 70, 80,210}, 39 | {"Jane", 80, 70, 60, 80, 210}, 40 | {"Joe_01", 80, 70, 60, 80, 210}, 41 | {"Joe_02", 80, 70, 60, 80, 210}, 42 | {"Joe_03", 80, 70, 60, 80, 210}, 43 | {"Joe_04", 80, 70, 60, 80, 210}, 44 | {"Joe_05", 80, 70, 60, 80, 21066}, 45 | {"Joe_04", 80, 70, 60, 80,210}, 46 | {"Joe_05", 80, 70, 60, 80,21066} 47 | }; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/TestTable.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.Test; 2 | 3 | /** 4 | * @author Mikey 5 | * @Title: 6 | * @Description: 7 | * @Email:1625017540@qq.com 8 | * @date 2018/12/4 21:23 9 | * @Version 1.0 10 | */ 11 | import java.awt.EventQueue; 12 | 13 | import javax.swing.JFrame; 14 | import javax.swing.JPanel; 15 | import javax.swing.JScrollPane; 16 | import javax.swing.JTable; 17 | import javax.swing.table.DefaultTableModel; 18 | 19 | public class TestTable { 20 | 21 | private JFrame frame; 22 | private JTable table; 23 | 24 | private Object[][] data = { 25 | {1, 2, 3}, 26 | {4, 5, 6}, 27 | {7, 8, 9} 28 | }; 29 | 30 | public static void main(String[] args) { 31 | EventQueue.invokeLater(new Runnable() { 32 | public void run() { 33 | try { 34 | TestTable window = new TestTable(); 35 | window.frame.setVisible(true); 36 | } catch (Exception e) { 37 | e.printStackTrace(); 38 | } 39 | } 40 | }); 41 | } 42 | 43 | 44 | public TestTable() { 45 | frame = new JFrame(); 46 | frame.setBounds(100, 100, 450, 300); 47 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 48 | frame.getContentPane().setLayout(null); 49 | 50 | JPanel panel = new JPanel(); 51 | panel.setBounds(10, 10, 414, 242); 52 | frame.getContentPane().add(panel); 53 | panel.setLayout(null); 54 | 55 | JScrollPane scrollPane = new JScrollPane(); 56 | scrollPane.setBounds(10, 10, 394, 222); 57 | panel.add(scrollPane); 58 | 59 | table = new JTable(); 60 | scrollPane.setViewportView(table); 61 | 62 | table.setModel(new DefaultTableModel() { 63 | @Override 64 | public Object getValueAt(int row, int column) { 65 | return data[row][column]; 66 | } 67 | 68 | @Override 69 | public int getRowCount() { 70 | return 3; 71 | } 72 | 73 | @Override 74 | public int getColumnCount() { 75 | return 3; 76 | } 77 | @Override 78 | public void setValueAt(Object aValue, int row, int column){ 79 | data[row][column] = aValue; 80 | fireTableCellUpdated(row, column); 81 | } 82 | 83 | @Override 84 | public boolean isCellEditable(int row, int column) { 85 | if (column == 2) { 86 | return true; 87 | } else { 88 | return false; 89 | } 90 | } 91 | }); 92 | 93 | table.getColumnModel().getColumn(2).setCellEditor( 94 | new MyButtonEditor()); 95 | 96 | table.getColumnModel().getColumn(2).setCellRenderer( 97 | new MyButtonRenderer()); 98 | 99 | table.setRowSelectionAllowed(false); 100 | } 101 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/change.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.Test; 2 | 3 | /** 4 | * @author Mikey 5 | * @Title: 6 | * @Description: 7 | * @Email:1625017540@qq.com 8 | * @date 2018/12/6 22:51 9 | * @Version 1.0 10 | */ 11 | public class change { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/table.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.Test; 2 | 3 | /** 4 | * @author Mikey 5 | * @Title: 6 | * @Description: 7 | * @Email:1625017540@qq.com 8 | * @date 2018/12/4 20:50 9 | * @Version 1.0 10 | */ 11 | 12 | 13 | import java.awt.*; 14 | import java.awt.event.*; 15 | import javax.swing.*; 16 | import javax.swing.table.*; 17 | 18 | public class table { 19 | 20 | JTable table = null; 21 | JButton viewButton2 = new JButton("hhh"); 22 | 23 | 24 | JButton editButton2 = new JButton("www"); 25 | DefaultTableModel model = null; 26 | 27 | 28 | public JComponent makeUI() { 29 | String[] columnNames = { "String", "Button" }; // When I increase the 30 | // number of columns it 31 | // hides another button 32 | Object[][] data = { { "AAA", null }, { "BBB", null } }; 33 | model = new DefaultTableModel(data, columnNames) { 34 | 35 | }; 36 | table = new JTable(model); 37 | table.setRowHeight(36); 38 | ActionPanelEditorRenderer er = new ActionPanelEditorRenderer(); 39 | TableColumn column = table.getColumnModel().getColumn(1); 40 | column.setCellRenderer(er); 41 | column.setCellEditor(er); 42 | 43 | JPanel p = new JPanel(new BorderLayout()); 44 | p.add(new JScrollPane(table)); 45 | p.setPreferredSize(new Dimension(320, 200)); 46 | return p; 47 | } 48 | 49 | public static void main(String[] args) { 50 | EventQueue.invokeLater(new Runnable() { 51 | @Override 52 | public void run() { 53 | createAndShowGUI(); 54 | } 55 | }); 56 | } 57 | 58 | public static void createAndShowGUI() { 59 | JFrame f = new JFrame(); 60 | f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 61 | f.getContentPane().add(new table().makeUI()); 62 | f.pack(); 63 | f.setLocationRelativeTo(null); 64 | f.setVisible(true); 65 | } 66 | 67 | 68 | 69 | class ActionPanelEditorRenderer extends AbstractCellEditor implements TableCellRenderer, TableCellEditor { 70 | JPanel panel1 = new JPanel(); 71 | JPanel panel2 = new JPanel(); 72 | 73 | public ActionPanelEditorRenderer() { 74 | super(); 75 | // JButton viewButton2 = new JButton(new AbstractAction("yy") { 76 | // 77 | // public void actionPerformed(ActionEvent e) { 78 | // JOptionPane.showMessageDialog(null, "Viewing"); 79 | // } 80 | // }); 81 | // JButton editButton2 = new JButton(new AbstractAction("edit2") { 82 | // ; 83 | // public void actionPerformed(ActionEvent e) { 84 | // JOptionPane.showMessageDialog(null, "Editing"); 85 | // } 86 | // }); 87 | //panel1.setOpaque(true); 88 | 89 | //panel2.setOpaque(true); 90 | 91 | 92 | panel2.add(viewButton2); 93 | panel2.add(editButton2); 94 | viewButton2.setBackground(Color.red); 95 | 96 | viewButton2.addActionListener(new ActionListener() { 97 | 98 | @Override 99 | public void actionPerformed(ActionEvent arg0) { 100 | // TODO Auto-generated method stub 101 | 102 | int i = table.getSelectedRow(); 103 | String s = (String)model.getValueAt(i, 0); 104 | 105 | JOptionPane.showMessageDialog(null, s); 106 | } 107 | }); 108 | } 109 | 110 | @Override 111 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, 112 | int row, int column) { 113 | panel2.setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); 114 | panel2.setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); 115 | 116 | 117 | 118 | // panel2.setBackground(table.getBackground()); 119 | return panel2; 120 | } 121 | 122 | @Override 123 | public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { 124 | panel2.setBackground(table.getSelectionBackground()); 125 | return panel2; 126 | } 127 | 128 | @Override 129 | public Object getCellEditorValue() { 130 | return null; 131 | } 132 | } 133 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/Test/test1.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.CardLayout; 5 | import java.awt.Color; 6 | import java.awt.Insets; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | import javax.swing.JButton; 10 | import javax.swing.JFrame; 11 | import javax.swing.JLabel; 12 | import javax.swing.JPanel; 13 | import javax.swing.UIManager; 14 | 15 | 16 | public class test1 extends JFrame { 17 | private JPanel pane = null; // 主要的JPanel,该JPanel的布局管理将被设置成CardLayout 18 | private JPanel p = null; // 放按钮的JPanel 19 | private CardLayout card = null; // CardLayout布局管理器 20 | private JButton button_1 = null; // 上一步 21 | private JButton button_2 = null; // 下一步 22 | private JButton b_1 = null, b_2 = null, b_3 = null; // 三个可直接翻转到JPanel组件的按钮 23 | private JPanel p_1 = null, p_2 = null, p_3 = null; // 要切换的三个JPanel 24 | 25 | public test1() { 26 | super("CardLayout Test"); 27 | setTitle("\u6A21\u578B\u5165\u5E93\u5DE5\u5177"); 28 | setResizable(false); 29 | try { 30 | // 将LookAndFeel设置成Windows样式 31 | UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); 32 | } catch (Exception ex) { 33 | ex.printStackTrace(); 34 | } 35 | 36 | card = new CardLayout(5, 5); 37 | pane = new JPanel(card); // JPanel的布局管理将被设置成CardLayout 38 | p = new JPanel(); // 构造放按钮的JPanel 39 | button_1 = new JButton("< 上一步"); 40 | button_2 = new JButton("下一步 >"); 41 | b_1 = new JButton("1"); 42 | b_2 = new JButton("2"); 43 | b_3 = new JButton("3"); 44 | // b_1.setMargin(new Insets(2,2,2,2)); 45 | // b_2.setMargin(new Insets(2,2,2,2)); 46 | // b_3.setMargin(new Insets(2,2,2,2)); 47 | p.add(button_1); 48 | p.add(b_1); 49 | p.add(b_2); 50 | p.add(b_3); 51 | p.add(button_2); 52 | p_1 = new JPanel(); 53 | p_2 = new JPanel(); 54 | p_3 = new JPanel(); 55 | // p_1.setBackground(Color.WHITE); 56 | // p_2.setBackground(Color.BLUE); 57 | // p_3.setBackground(Color.GREEN); 58 | p_1.add(new JLabel("JPanel_1")); 59 | p_2.add(new JLabel("JPanel_2")); 60 | p_3.add(new JLabel("JPanel_3")); 61 | pane.add(p_1, "p1"); 62 | pane.add(p_2, "p2"); 63 | pane.add(p_3, "p3"); 64 | 65 | button_1.addActionListener(new ActionListener(){ // 上一步的按钮动作 66 | public void actionPerformed(ActionEvent e) { 67 | card.previous(pane); 68 | } 69 | }); 70 | button_2.addActionListener(new ActionListener(){ // 下一步的按钮动作 71 | public void actionPerformed(ActionEvent e) { 72 | card.next(pane); 73 | } 74 | }); 75 | b_1.addActionListener(new ActionListener() { // 直接翻转到p_1 76 | public void actionPerformed(ActionEvent e) { 77 | card.show(pane, "p1"); 78 | } 79 | }); 80 | b_2.addActionListener(new ActionListener() { // 直接翻转到p_2 81 | public void actionPerformed(ActionEvent e) { 82 | card.show(pane, "p2"); 83 | } 84 | }); 85 | b_3.addActionListener(new ActionListener() { // 直接翻转到p_3 86 | public void actionPerformed(ActionEvent e) { 87 | card.show(pane, "p3"); 88 | } 89 | }); 90 | this.getContentPane().add(pane); 91 | this.getContentPane().add(p, BorderLayout.SOUTH); 92 | this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 93 | this.setSize(490, 387); 94 | this.setVisible(true); 95 | } 96 | 97 | public static void main(String[] args) { 98 | new test1(); 99 | } 100 | 101 | } 102 | 103 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/admin/AddStudentJpanel.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.admin; 2 | 3 | import com.mikey.design.entity.Student; 4 | import com.mikey.design.service.StudentService; 5 | import com.mikey.design.utils.SpringUtil; 6 | import com.mikey.design.views.common.UpdatePanel; 7 | 8 | import javax.swing.*; 9 | import java.awt.*; 10 | import java.awt.event.ActionEvent; 11 | import java.util.regex.Pattern; 12 | 13 | /** 14 | * @author Mikey 15 | * @Title: 16 | * @Description: 17 | * @Email:1625017540@qq.com 18 | * @date 2018/12/4 23:32 19 | * @Version 1.0 20 | */ 21 | public class AddStudentJpanel extends JPanel { 22 | 23 | private StudentService studentService; 24 | 25 | 26 | public AddStudentJpanel() { 27 | 28 | studentService = (StudentService) SpringUtil.getBean("studentServiceImpl"); 29 | 30 | //边缘布局 31 | setLayout(new BorderLayout()); 32 | //banner 33 | JPanel titleJpanel=new JPanel(); 34 | titleJpanel.setBackground(Color.LIGHT_GRAY); 35 | JLabel title=new JLabel("添加学生信息"); 36 | title.setFont(new Font("宋体",Font.BOLD, 20)); 37 | titleJpanel.add(title); 38 | add(titleJpanel,BorderLayout.NORTH); 39 | 40 | //更改个人信息 41 | JPanel mainJpanel=new JPanel(); 42 | mainJpanel.setLayout(new GridLayout(6,1)); 43 | //1.名字 44 | JPanel username=new JPanel(); 45 | JLabel nameJlabel=new JLabel("学生性名:"); 46 | JTextField nameJtextField=new JTextField("请输入学生性名"); 47 | username.add(nameJlabel); 48 | username.add(nameJtextField); 49 | //2.性别 50 | JPanel sex=new JPanel(); 51 | JLabel sexJlabel=new JLabel("性别:"); 52 | JComboBox sexboBox=new JComboBox();//下拉框 53 | sexboBox.addItem("女"); 54 | sexboBox.addItem("男"); 55 | sex.add(sexJlabel); 56 | sex.add(sexboBox); 57 | 58 | //3.联系电话 59 | JPanel phone=new JPanel(); 60 | JLabel phoneJlabel=new JLabel("联系方式:"); 61 | JTextField phoneJtextField=new JTextField("请输入电话号码"); 62 | phone.add(phoneJlabel); 63 | phone.add(phoneJtextField); 64 | 65 | JButton reselt=new JButton("重置输入"); 66 | reselt.addActionListener(new AbstractAction() { 67 | @Override 68 | public void actionPerformed(ActionEvent e) { 69 | nameJtextField.setText("请输入学生性名"); 70 | phoneJtextField.setText("请输入电话号码"); 71 | } 72 | }); 73 | //提交按钮 74 | JPanel submits=new JPanel(); 75 | JButton sunmit=new JButton("确认添加"); 76 | 77 | JPanel showTipMessageLocationJpanel=this; 78 | sunmit.addActionListener(new AbstractAction() { 79 | @Override 80 | public void actionPerformed(ActionEvent e) { 81 | //添加学生 82 | if (checkData(nameJtextField,sexboBox,phoneJtextField)) { 83 | 84 | int result = JOptionPane.showConfirmDialog(showTipMessageLocationJpanel, "确认添加学生?", "系统提示", JOptionPane.YES_NO_CANCEL_OPTION); 85 | /** 86 | * 提交保存 87 | */ 88 | if (result == JOptionPane.YES_NO_OPTION) { 89 | 90 | Student student = new Student(); 91 | student.setStudentName(nameJtextField.getText()); 92 | student.setStudentSex(sexboBox.getSelectedIndex()); 93 | student.setStudentPhone(phoneJtextField.getText()); 94 | 95 | studentService.addStudent(student);//添加学生 96 | 97 | Student studentByPhone = studentService.getStudentByPhone(student.getStudentPhone()); 98 | 99 | JOptionPane.showMessageDialog(showTipMessageLocationJpanel, "添加成功学号为:"+studentByPhone.getStudentId()); 100 | reselt.doClick(); 101 | } 102 | } 103 | } 104 | }); 105 | 106 | submits.add(sunmit); 107 | submits.add(reselt); 108 | 109 | 110 | mainJpanel.add(username); 111 | mainJpanel.add(sex); 112 | mainJpanel.add(phone); 113 | mainJpanel.add(submits); 114 | add(mainJpanel,BorderLayout.CENTER); 115 | } 116 | /** 117 | * 数据校验 118 | * @param nameJtextField 119 | * @param sexboBox 120 | * @param phoneJtextField 121 | * @return 122 | */ 123 | private boolean checkData(JTextField nameJtextField,JComboBox sexboBox, JTextField phoneJtextField){ 124 | 125 | String userName=nameJtextField.getText().trim();//姓名 126 | int userSex=sexboBox.getSelectedIndex();//获取性别 127 | String userPhone=phoneJtextField.getText().trim();//获取电话 128 | 129 | if (userName.equals("")||userName.length()<1||userName.equals("请输入学生性名")){ 130 | JOptionPane.showMessageDialog(this,"请输入学生性名","系统提示",JOptionPane.INFORMATION_MESSAGE); 131 | return false; 132 | } 133 | 134 | if (userPhone.equals("")||userPhone.length()<1||userPhone.equals("请输入电话号码")){ 135 | JOptionPane.showMessageDialog(this,"请输入联系电话","系统提示",JOptionPane.INFORMATION_MESSAGE); 136 | return false; 137 | } 138 | 139 | if(Pattern.matches(UpdatePanel.REGEX_USERNAME,userName)==false){ 140 | JOptionPane.showMessageDialog(this,"用户名由2-10汉字组成","系统提示",JOptionPane.INFORMATION_MESSAGE); 141 | return false; 142 | } 143 | if(Pattern.matches(UpdatePanel.REGEX_MOBILE,userPhone)==false){ 144 | JOptionPane.showMessageDialog(this,"请输入正确的移动电话号码","系统提示",JOptionPane.INFORMATION_MESSAGE); 145 | return false; 146 | } 147 | Student studentByPhone = studentService.getStudentByPhone(userPhone); 148 | if (studentByPhone.getStudentPhone()!=null){ 149 | JOptionPane.showMessageDialog(this,"该手机号码已经被使用","系统提示",JOptionPane.INFORMATION_MESSAGE); 150 | return false; 151 | } 152 | 153 | return true; 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/admin/AddTeacherJpanel.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.admin; 2 | 3 | import com.mikey.design.entity.Teacher; 4 | import com.mikey.design.service.TeacherService; 5 | import com.mikey.design.utils.SpringUtil; 6 | import com.mikey.design.views.common.UpdatePanel; 7 | 8 | import javax.swing.*; 9 | import java.awt.*; 10 | import java.awt.event.ActionEvent; 11 | import java.util.regex.Pattern; 12 | 13 | /** 14 | * @author Mikey 15 | * @Title: 16 | * @Description: 17 | * @Email:1625017540@qq.com 18 | * @date 2018/12/4 23:34 19 | * @Version 1.0 20 | */ 21 | public class AddTeacherJpanel extends JPanel { 22 | 23 | 24 | private TeacherService teacherService; 25 | 26 | 27 | public AddTeacherJpanel() { 28 | 29 | teacherService = (TeacherService) SpringUtil.getBean("teacherServiceImpl"); 30 | 31 | //边缘布局 32 | setLayout(new BorderLayout()); 33 | //banner 34 | JPanel titleJpanel=new JPanel(); 35 | titleJpanel.setBackground(Color.LIGHT_GRAY); 36 | JLabel title=new JLabel("添加教师信息"); 37 | title.setFont(new Font("宋体",Font.BOLD, 20)); 38 | titleJpanel.add(title); 39 | add(titleJpanel,BorderLayout.NORTH); 40 | 41 | //添加教师信息 42 | JPanel mainJpanel=new JPanel(); 43 | mainJpanel.setLayout(new GridLayout(6,1)); 44 | //1.名字 45 | JPanel username=new JPanel(); 46 | JLabel nameJlabel=new JLabel("教师性名:"); 47 | JTextField nameJtextField=new JTextField("请输入教师性名"); 48 | username.add(nameJlabel); 49 | username.add(nameJtextField); 50 | //2.性别 51 | JPanel sex=new JPanel(); 52 | JLabel sexJlabel=new JLabel("性别:"); 53 | JComboBox sexboBox=new JComboBox();//下拉框 54 | sexboBox.addItem("女"); 55 | sexboBox.addItem("男"); 56 | sex.add(sexJlabel); 57 | sex.add(sexboBox); 58 | 59 | //3.联系电话 60 | JPanel phone=new JPanel(); 61 | JLabel phoneJlabel=new JLabel("联系方式:"); 62 | JTextField phoneJtextField=new JTextField("请输入电话号码"); 63 | phone.add(phoneJlabel); 64 | phone.add(phoneJtextField); 65 | 66 | JButton reselt=new JButton("重置输入"); 67 | reselt.addActionListener(new AbstractAction() { 68 | @Override 69 | public void actionPerformed(ActionEvent e) { 70 | nameJtextField.setText("请输入教师性名"); 71 | phoneJtextField.setText("请输入电话号码"); 72 | } 73 | }); 74 | //提交按钮 75 | JPanel submits=new JPanel(); 76 | JButton sunmit=new JButton("确认添加"); 77 | 78 | 79 | JPanel showTipMessageLocationJpanel=this; 80 | 81 | sunmit.addActionListener(new AbstractAction() { 82 | @Override 83 | public void actionPerformed(ActionEvent e) { 84 | //添加学生 85 | if (checkData(nameJtextField,sexboBox,phoneJtextField)) { 86 | 87 | int result = JOptionPane.showConfirmDialog(showTipMessageLocationJpanel, "确认添加教师?", "系统提示", JOptionPane.YES_NO_CANCEL_OPTION); 88 | /** 89 | * 提交保存 90 | */ 91 | if (result == JOptionPane.YES_NO_OPTION) { 92 | 93 | Teacher teacher = new Teacher(); 94 | teacher.setTeacherName(nameJtextField.getText()); 95 | teacher.setTeacherSex(sexboBox.getSelectedIndex()); 96 | teacher.setTeacherPhone(phoneJtextField.getText()); 97 | 98 | teacherService.addTeacher(teacher);//添加学生 99 | 100 | Teacher teacherByPhone = teacherService.getStudentByPhone(phoneJtextField.getText()); 101 | 102 | JOptionPane.showMessageDialog(showTipMessageLocationJpanel, "添加成功工号为:"+teacherByPhone.getTeacherId()); 103 | reselt.doClick(); 104 | } 105 | } 106 | } 107 | }); 108 | 109 | submits.add(sunmit); 110 | submits.add(reselt); 111 | 112 | 113 | mainJpanel.add(username); 114 | mainJpanel.add(sex); 115 | mainJpanel.add(phone); 116 | mainJpanel.add(submits); 117 | add(mainJpanel,BorderLayout.CENTER); 118 | } 119 | /** 120 | * 数据校验 121 | * @param nameJtextField 122 | * @param sexboBox 123 | * @param phoneJtextField 124 | * @return 125 | */ 126 | private boolean checkData(JTextField nameJtextField,JComboBox sexboBox, JTextField phoneJtextField){ 127 | 128 | String userName=nameJtextField.getText().trim();//姓名 129 | int userSex=sexboBox.getSelectedIndex();//获取性别 130 | String userPhone=phoneJtextField.getText().trim();//获取电话 131 | 132 | if (userName.equals("")||userName.length()<1||userName.equals("请输入教师性名")){ 133 | JOptionPane.showMessageDialog(this,"请输入教师性名","系统提示",JOptionPane.INFORMATION_MESSAGE); 134 | return false; 135 | } 136 | 137 | if (userPhone.equals("")||userPhone.length()<1||userPhone.equals("请输入电话号码")){ 138 | JOptionPane.showMessageDialog(this,"请输入联系电话","系统提示",JOptionPane.INFORMATION_MESSAGE); 139 | return false; 140 | } 141 | 142 | if(Pattern.matches(UpdatePanel.REGEX_USERNAME,userName)==false){ 143 | JOptionPane.showMessageDialog(this,"用户名由2-10汉字组成","系统提示",JOptionPane.INFORMATION_MESSAGE); 144 | return false; 145 | } 146 | if(Pattern.matches(UpdatePanel.REGEX_MOBILE,userPhone)==false){ 147 | JOptionPane.showMessageDialog(this,"请输入正确的移动电话号码","系统提示",JOptionPane.INFORMATION_MESSAGE); 148 | return false; 149 | } 150 | Teacher studentByPhone = teacherService.getStudentByPhone(userPhone); 151 | if (studentByPhone.getTeacherPhone()!=null){ 152 | JOptionPane.showMessageDialog(this,"该手机号码已经被使用","系统提示",JOptionPane.INFORMATION_MESSAGE); 153 | return false; 154 | } 155 | 156 | return true; 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/admin/AdminMainView.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.admin; 2 | 3 | import com.mikey.design.listerner.common.LoginOut; 4 | import com.mikey.design.views.common.WelcomeJpanel; 5 | 6 | import javax.swing.*; 7 | import java.awt.*; 8 | import java.awt.event.ActionEvent; 9 | 10 | /** 11 | * @author Mikey 12 | * @Title: 管理员页面 13 | * @Description: 管理员操作面板 14 | * @Email:1625017540@qq.com 15 | * @date 2018/11/30 19:37 16 | * @Version 1.0 17 | */ 18 | public class AdminMainView extends JFrame { 19 | 20 | 21 | public AdminMainView() throws HeadlessException { 22 | } 23 | 24 | public AdminMainView(JFrame login) { 25 | //创建组件 26 | JPanel Menu=new JPanel(); 27 | Menu.setLayout(new GridLayout(10,1,3,3)); 28 | JButton menuChild1 = new JButton("浏览教师信息"); 29 | JButton menuChild2 = new JButton("浏览学生信息"); 30 | JButton menuChild3 = new JButton("志愿填报情况"); 31 | JButton menuChild4 = new JButton("统计志愿填报"); 32 | JButton menuChild5 = new JButton("添加学生信息"); 33 | JButton menuChild6 = new JButton("添加教师信息"); 34 | JButton menuChild7 = new JButton("退出登入"); 35 | Menu.add(menuChild1); 36 | Menu.add(menuChild2); 37 | Menu.add(menuChild3); 38 | Menu.add(menuChild4); 39 | Menu.add(menuChild5); 40 | Menu.add(menuChild6); 41 | Menu.add(menuChild7); 42 | 43 | Menu.setVisible(true); 44 | /** 45 | * 菜单栏 46 | */ 47 | JMenuBar menuBar = new JMenuBar(); 48 | JMenu fileMenu = new JMenu("文件"); 49 | JMenu editMenu = new JMenu("编辑"); 50 | JMenu viewMenu = new JMenu("视图"); 51 | JMenu aboutMenu = new JMenu("关于"); 52 | // 一级菜单添加到菜单栏 53 | menuBar.add(fileMenu); 54 | menuBar.add(editMenu); 55 | menuBar.add(viewMenu); 56 | menuBar.add(aboutMenu); 57 | /** 58 | * logo 59 | */ 60 | Toolkit took = Toolkit.getDefaultToolkit(); //设置窗口图标 //要用绝对路径 61 | Image image = took.getImage("src/main/resources/Images/logo.png"); 62 | setIconImage(image); 63 | 64 | //添加各个组件 65 | JPanel center=new JPanel(); 66 | center.setVisible(true); 67 | CardLayout cardLayout=new CardLayout(10,10); 68 | center.setLayout(cardLayout); 69 | 70 | JPanel lookTeacherJpanel=new LookTeacherJpanel();//浏览教师信息 71 | JPanel lookStudentPanel=new LookStudentJpanel();//浏览学生信息 72 | JPanel wishStatePanel=new StudentWishStateJpanel();//志愿填报情况 73 | JPanel countWishPanel=new WishDateCountJpanel();//统计志愿填报、填报人数、未填报人数 74 | JPanel addStudentJpanel=new AddStudentJpanel();//课设题目 75 | JPanel addTeacherJpanel=new AddTeacherJpanel();//更新个人信息 76 | 77 | menuChild1.addActionListener(new AbstractAction() { 78 | @Override 79 | public void actionPerformed(ActionEvent e) { 80 | ((LookTeacherJpanel) lookTeacherJpanel).refreshData(); 81 | cardLayout.show(center,"lookTeacherJpanel"); 82 | } 83 | }); 84 | menuChild2.addActionListener(new AbstractAction() { 85 | @Override 86 | public void actionPerformed(ActionEvent e) { 87 | ((LookStudentJpanel) lookStudentPanel).refreshData(); 88 | cardLayout.show(center,"lookStudentPanel"); 89 | } 90 | }); 91 | menuChild3.addActionListener(new AbstractAction() { 92 | @Override 93 | public void actionPerformed(ActionEvent e) { 94 | ((StudentWishStateJpanel) wishStatePanel).refreshData(); 95 | cardLayout.show(center,"wishStatePanel"); 96 | } 97 | }); 98 | menuChild4.addActionListener(new AbstractAction() { 99 | @Override 100 | public void actionPerformed(ActionEvent e) { 101 | ((WishDateCountJpanel) countWishPanel).refreshData(); 102 | cardLayout.show(center,"countWishPanel"); 103 | } 104 | }); 105 | menuChild5.addActionListener(new AbstractAction() { 106 | @Override 107 | public void actionPerformed(ActionEvent e) { 108 | cardLayout.show(center,"addStudentJpanel"); 109 | } 110 | }); 111 | menuChild6.addActionListener(new AbstractAction() { 112 | @Override 113 | public void actionPerformed(ActionEvent e) { 114 | cardLayout.show(center,"addTeacherJpanel"); 115 | } 116 | }); 117 | menuChild7.addActionListener(new LoginOut(login,this)); 118 | 119 | center.add(new WelcomeJpanel(),"welcomeJpanel"); 120 | center.add(lookTeacherJpanel,"lookTeacherJpanel"); 121 | center.add(lookStudentPanel,"lookStudentPanel"); 122 | center.add(wishStatePanel,"wishStatePanel"); 123 | center.add(countWishPanel,"countWishPanel"); 124 | center.add(addStudentJpanel,"addStudentJpanel"); 125 | center.add(addTeacherJpanel,"addTeacherJpanel"); 126 | 127 | this.add(center, BorderLayout.CENTER); //中间 128 | this.add(menuBar, BorderLayout.NORTH); //北边 129 | this.add(Menu, BorderLayout.WEST); //西边 130 | 131 | //设置窗体属性 132 | this.setTitle("毕业设计选题系统"); 133 | this.setSize(700, 500); 134 | this.setLocation(600, 300); 135 | this.setVisible(true); 136 | setResizable(false);//禁用最大化 137 | this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 138 | } 139 | } -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/admin/LookStudentJpanel.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.admin; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mikey.design.entity.Student; 5 | import com.mikey.design.service.StudentService; 6 | import com.mikey.design.views.renderer.MyTableCellRenderer; 7 | import com.mikey.design.utils.SpringUtil; 8 | 9 | import javax.swing.*; 10 | import javax.swing.table.TableColumn; 11 | import java.awt.*; 12 | import java.awt.event.ActionEvent; 13 | import java.util.List; 14 | 15 | /** 16 | * @author Mikey 17 | * @Title: 18 | * @Description: 19 | * @Email:1625017540@qq.com 20 | * @date 2018/12/4 23:30 21 | * @Version 1.0 22 | */ 23 | public class LookStudentJpanel extends JPanel { 24 | //service接口 25 | private StudentService studentService; 26 | //当前页 27 | private int currentPage=1; 28 | //每页显示条数 29 | private int pageSize=12; 30 | 31 | //表头(列名) 32 | private Object[] columnNames = {"姓名", "性别", "联系方式"}; 33 | //列表内容 34 | private Object[][] rowData=new Object[20][3]; 35 | //分页 36 | private PageInfo pageData; 37 | 38 | public void getData(){ 39 | studentService = (StudentService) SpringUtil.getBean("studentServiceImpl"); 40 | //进行分页、每页显示20行信息 41 | pageData = studentService.getAllTeacherByPage(currentPage,pageSize); 42 | 43 | rowData[0][0]="暂无";rowData[0][1]="暂无";rowData[0][2]="暂无"; 44 | 45 | 46 | List studentList=pageData.getList();//获取数据 47 | 48 | clearData(rowData);//清除数据 49 | 50 | if (studentList.size()>0){ 51 | int i=0; 52 | for(Student s:studentList){//赋值 53 | rowData[i][0]=s.getStudentName(); 54 | rowData[i][1]=s.getStudentSex()==0?'女':'男'; 55 | rowData[i][2]=s.getStudentPhone(); 56 | i++; 57 | } 58 | } 59 | 60 | } 61 | 62 | private void clearData(Object[][] rowData) { 63 | for (int i=0;i0){//判断是否有值 97 | 98 | for (int i=0;i teacherList=pageData.getList();//获取数据 48 | 49 | clearData(rowData);//清除数据 50 | 51 | if (teacherList.size()>0){ 52 | int i=0; 53 | for(Teacher t:teacherList){//赋值 54 | rowData[i][0]=t.getTeacherName(); 55 | rowData[i][1]=t.getTeacherSex()==0?'女':'男'; 56 | rowData[i][2]=t.getTeacherPhone(); 57 | rowData[i][3]=t.getTeacherInfo(); 58 | i++; 59 | } 60 | } 61 | 62 | } 63 | 64 | private void clearData(Object[][] rowData) { 65 | for (int i=0;i0){//判断是否有值 99 | 100 | for (int i=0;i titleOfStudentList=pageData.getList();//获取数据 43 | 44 | if (titleOfStudentList.size()<1){ 45 | rowData[0][0]="暂无";rowData[0][1]="暂无";rowData[0][2]="暂无";;rowData[0][3]="暂无"; 46 | } 47 | 48 | 49 | clearData(rowData);//初始化表格 50 | 51 | if (titleOfStudentList.size()>0){ 52 | int i=0; 53 | for(TitleOfStudent t:titleOfStudentList){//赋值 54 | rowData[i][0]=t.getStudent().getStudentName(); 55 | rowData[i][1]=t.getStudent().getStudentSex()==0?'女':'男'; 56 | rowData[i][2]=t.getStudent().getStudentPhone(); 57 | rowData[i][3]=t.getDesOfStuId()==null?"未填报":"已经填报"; 58 | i++; 59 | } 60 | } 61 | 62 | } 63 | 64 | private void clearData(Object[][] rowData) { 65 | for (int i=0;i0){//判断是否有值 99 | 100 | for (int i=0;i teacherList=pageData.getList();//获取数据 47 | 48 | clearData(rowData);//清除数据 49 | 50 | if (teacherList.size()>0){ 51 | int i=0; 52 | for(Teacher t:teacherList){//赋值 53 | rowData[i][0]=t.getTeacherName(); 54 | rowData[i][1]=t.getTeacherSex()==0?'女':'男'; 55 | rowData[i][2]=t.getTeacherPhone(); 56 | rowData[i][3]=t.getTeacherInfo(); 57 | i++; 58 | } 59 | } 60 | 61 | } 62 | 63 | private void clearData(Object[][] rowData) { 64 | for (int i=0;i0){//判断是否有值 98 | 99 | for (int i=0;i100){ 149 | JOptionPane.showMessageDialog(this,"请正确输入毕业设计题目","系统提示",JOptionPane.INFORMATION_MESSAGE); 150 | return false; 151 | } 152 | 153 | if (titleNum.equals("")||titleNum.length()<1||Pattern.matches(REGEX_ISNUM,titleNum)==false){ 154 | JOptionPane.showMessageDialog(this,"请输入一个正整数","系统提示",JOptionPane.INFORMATION_MESSAGE); 155 | return false; 156 | } 157 | 158 | if (titleRequire.equals("")||titleRequire.length()<1){ 159 | JOptionPane.showMessageDialog(this,"请正确输入毕设需求","系统提示",JOptionPane.INFORMATION_MESSAGE); 160 | return false; 161 | } 162 | return true; 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/teacher/AdmitStudentTable.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.teacher; 2 | 3 | import javax.swing.*; 4 | import javax.swing.table.DefaultTableModel; 5 | import javax.swing.table.TableColumnModel; 6 | import javax.swing.table.TableModel; 7 | import java.util.Vector; 8 | 9 | /** 10 | * @author Mikey 11 | * @Title: 继承JTable类 12 | * @Description: 设置表格数据不可修改 13 | * @Email:1625017540@qq.com 14 | * @date 2018/12/4 22:47 15 | * @Version 1.0 16 | */ 17 | public class AdmitStudentTable extends JTable { 18 | 19 | @Override 20 | public boolean isCellEditable(int row, int column) { 21 | if (column==5){//放行第五列可编辑 22 | return true; 23 | }else { 24 | return false; 25 | } 26 | } 27 | 28 | /** 29 | * 30 | * @param rowData 31 | * @param columnNames 32 | */ 33 | public AdmitStudentTable(final Object[][] rowData, final Object[] columnNames) { 34 | super( rowData, columnNames); 35 | } 36 | 37 | /** 38 | * 39 | * @param tableModel 40 | */ 41 | public AdmitStudentTable(DefaultTableModel tableModel) { 42 | super(tableModel); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/mikey/design/views/teacher/SelfDesignJpanel.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design.views.teacher; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mikey.design.entity.Design; 5 | import com.mikey.design.entity.Teacher; 6 | import com.mikey.design.service.DesignService; 7 | import com.mikey.design.views.renderer.MyTableCellRenderer; 8 | import com.mikey.design.utils.SpringUtil; 9 | import com.mikey.design.utils.ThreadLocalUtil; 10 | 11 | import javax.swing.*; 12 | import javax.swing.table.TableColumn; 13 | import java.awt.*; 14 | import java.awt.event.ActionEvent; 15 | import java.util.List; 16 | 17 | /** 18 | * @author Mikey 19 | * @Title: 当前教师的题目列表 20 | * @Description: 当前教师的题目列表面板 21 | * @Email:1625017540@qq.com 22 | * @date 2018/12/4 20:40 23 | * @Version 1.0 24 | */ 25 | public class SelfDesignJpanel extends JPanel { 26 | //service接口 27 | private DesignService designService; 28 | //当前页 29 | private int currentPage=1; 30 | //每页显示条数 31 | private int pageSize=12; 32 | //表头(列名)TODO:待添加剩余人数 33 | private Object[] columnNames = {"毕设题目", "毕设人数", "毕设需求"}; 34 | //列表内容 35 | private Object[][] rowData=new Object[20][3]; 36 | //分页 37 | private PageInfo pageData; 38 | 39 | private Teacher selfTeacher; 40 | 41 | public void getData(){ 42 | 43 | selfTeacher= (Teacher) ThreadLocalUtil.get();//获取当前登入的教师信息 44 | 45 | designService = (DesignService) SpringUtil.getBean("designServiceImpl"); 46 | 47 | //进行分页、每页显示20行信息 48 | pageData = designService.getSelfDesignByPage(selfTeacher.getTeacherId(),currentPage,pageSize); 49 | 50 | rowData[0][0]="暂无";rowData[0][1]="暂无";rowData[0][2]="暂无"; 51 | 52 | 53 | List designList=pageData.getList();//获取数据 54 | 55 | clearData(rowData);//清除数据 56 | 57 | if (designList.size()>0){ 58 | int i=0; 59 | for(Design d:designList){//赋值 60 | rowData[i][0]=d.getDesignTitle(); 61 | rowData[i][1]=d.getDesignNum(); 62 | rowData[i][2]=d.getDesignRequire(); 63 | i++; 64 | } 65 | } 66 | 67 | } 68 | 69 | private void clearData(Object[][] rowData) { 70 | for (int i=0;i0){//判断是否有值 104 | 105 | for (int i=0;i ) | \| ` \ ___/ \___ \| / /_/ > | \ 5 | \______ /__| (____ /\____ |____/(____ /__| |__|\____/|___| /_______ /\___ >____ >__\___ /|___| / 6 | \/ \/ \/ \/ \/ \/ \/ \/ /_____/ \/ 7 | =========================================================================================================== 8 | 毕业设计选题系统 9 | =========================================================================================================== 10 | 11 | __ __ .__ ____ ___ 12 | / \ / \ ____ | | ____ ____ _____ ____ | | \______ ____ 13 | \ \/\/ // __ \| | _/ ___\/ _ \ / \_/ __ \ | | / ___// __ \ 14 | \ /\ ___/| |_\ \__( <_> ) Y Y \ ___/ | | /\___ \\ ___/ 15 | \__/\ / \___ >____/\___ >____/|__|_| /\___ > |______//____ >\___ > 16 | \/ \/ \/ \/ \/ \/ \/ -------------------------------------------------------------------------------- /src/main/resources/doc/design.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeygithub/GraduationDesign/609a09caed0ef8b2cce696f58b2af298761f8947/src/main/resources/doc/design.docx -------------------------------------------------------------------------------- /src/main/resources/gbm/nbg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 |
42 |
43 |
44 |
45 |
46 |
47 | 48 |
49 |
-------------------------------------------------------------------------------- /src/main/resources/images/TIM图片20201229184207.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeygithub/GraduationDesign/609a09caed0ef8b2cce696f58b2af298761f8947/src/main/resources/images/TIM图片20201229184207.png -------------------------------------------------------------------------------- /src/main/resources/images/TIM图片20201229184239.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeygithub/GraduationDesign/609a09caed0ef8b2cce696f58b2af298761f8947/src/main/resources/images/TIM图片20201229184239.png -------------------------------------------------------------------------------- /src/main/resources/images/TIM图片20201229184248.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeygithub/GraduationDesign/609a09caed0ef8b2cce696f58b2af298761f8947/src/main/resources/images/TIM图片20201229184248.png -------------------------------------------------------------------------------- /src/main/resources/images/TIM图片20201229184256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeygithub/GraduationDesign/609a09caed0ef8b2cce696f58b2af298761f8947/src/main/resources/images/TIM图片20201229184256.png -------------------------------------------------------------------------------- /src/main/resources/images/TIM图片20201229184303.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeygithub/GraduationDesign/609a09caed0ef8b2cce696f58b2af298761f8947/src/main/resources/images/TIM图片20201229184303.png -------------------------------------------------------------------------------- /src/main/resources/images/TIM图片20201229184311.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikeygithub/GraduationDesign/609a09caed0ef8b2cce696f58b2af298761f8947/src/main/resources/images/TIM图片20201229184311.png -------------------------------------------------------------------------------- /src/test/java/com/mikey/design/GraduationDesignApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.mikey.design; 2 | 3 | import com.mikey.design.entity.Admin; 4 | import com.mikey.design.entity.Student; 5 | import com.mikey.design.entity.TitleOfStudent; 6 | import com.mikey.design.entity.TitleOfStudentExample; 7 | import com.mikey.design.mapper.DesignMapper; 8 | import com.mikey.design.mapper.StudentMapper; 9 | import com.mikey.design.mapper.TitleOfStudentMapper; 10 | import com.mikey.design.service.AdminService; 11 | import com.mikey.design.service.StudentService; 12 | import com.mikey.design.views.login.Login; 13 | import org.junit.Test; 14 | import org.junit.runner.RunWith; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.boot.test.context.SpringBootTest; 17 | import org.springframework.test.context.junit4.SpringRunner; 18 | 19 | import java.util.List; 20 | 21 | @RunWith(SpringRunner.class) 22 | @SpringBootTest 23 | public class GraduationDesignApplicationTests { 24 | 25 | @Autowired 26 | private StudentMapper studentMapper; 27 | @Autowired 28 | private StudentService studentService; 29 | @Autowired 30 | private AdminService adminService; 31 | @Autowired 32 | private TitleOfStudentMapper titleOfStudentMapper; 33 | 34 | @Autowired 35 | private DesignMapper designMapper; 36 | 37 | 38 | @Test 39 | public void contextLoads() { 40 | // Student student=studentMapper.selectByPrimaryKey(1); 41 | // System.out.println("Message="+student); 42 | 43 | // Student student=studentService.getStudent(1); 44 | // System.out.println("Message="+student); 45 | 46 | // System.setProperty("java.awt.headless", "false"); 47 | // new Login(); 48 | 49 | // Admin admin = adminService.getAdmin(1); 50 | // System.out.println("Message"+admin); 51 | 52 | // TitleOfStudent titleOfStudent = new TitleOfStudent(); 53 | // titleOfStudent.setDesOfTitle(1); 54 | // titleOfStudent.setDesOfStu(1); 55 | // titleOfStudentMapper.insert(titleOfStudent); 56 | // /** 57 | // * 测试是否已经填报志愿 58 | // */ 59 | // TitleOfStudentExample titleOfStudentExample = new TitleOfStudentExample(); 60 | // TitleOfStudentExample.Criteria criteria = titleOfStudentExample.createCriteria(); 61 | // criteria.andDesOfStuEqualTo(1); 62 | // System.out.println("Messge======"+ titleOfStudentMapper.countByExample(titleOfStudentExample)); 63 | 64 | 65 | /** 66 | * test get first wish 67 | */ 68 | TitleOfStudentExample titleOfStudentExample = new TitleOfStudentExample(); 69 | 70 | TitleOfStudentExample.Criteria criteria = titleOfStudentExample.createCriteria(); 71 | 72 | criteria.andDesOfStuEqualTo(1);//当前学生志愿 73 | 74 | criteria.andDesWishOrderEqualTo(0);//第一志愿 75 | 76 | 77 | List titleOfStudent= titleOfStudentMapper.selectByExample(titleOfStudentExample); 78 | 79 | System.out.println("Message==========="+titleOfStudent.get(0)); 80 | 81 | } 82 | 83 | } 84 | --------------------------------------------------------------------------------