commit
db400b3fa6
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1,8 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ApifoxUploaderProjectSetting">
|
||||||
|
<option name="apiAccessToken" value="APS-jypWPSEx9vrD2XNCHYYQnIv8CAFfmMum" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="true" />
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="Dormitory_bussiness" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
<component name="JavacSettings">
|
||||||
|
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||||
|
<module name="Dormitory_bussiness" options="-parameters" />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="yue_dorm本地数据库" uuid="86f42667-c9d0-4f14-b0ff-e2102745a595">
|
||||||
|
<driver-ref>mysql.8</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<imported>true</imported>
|
||||||
|
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mysql://localhost:3306/?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true</jdbc-url>
|
||||||
|
<jdbc-additional-properties>
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||||
|
</jdbc-additional-properties>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="SqlDialectMappings">
|
||||||
|
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/86f42667-c9d0-4f14-b0ff-e2102745a595/console.sql" dialect="MySQL" />
|
||||||
|
<file url="PROJECT" dialect="MySQL" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,115 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.6.3</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>cn.for</groupId>
|
||||||
|
<artifactId>Dormitory_bussiness</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<name>springboot</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>11</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency><!--
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
</dependency>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- mybatis-plus-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- JSON net.sf.json.JSONObject -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-beanutils</groupId>
|
||||||
|
<artifactId>commons-beanutils</artifactId>
|
||||||
|
<version>1.9.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-collections</groupId>
|
||||||
|
<artifactId>commons-collections</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sf.ezmorph</groupId>
|
||||||
|
<artifactId>ezmorph</artifactId>
|
||||||
|
<version>1.0.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sf.json-lib</groupId>
|
||||||
|
<artifactId>json-lib</artifactId>
|
||||||
|
<version>2.2.3</version>
|
||||||
|
<classifier>jdk15</classifier><!-- jdk版本 -->
|
||||||
|
</dependency>
|
||||||
|
<!-- fastjson-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>1.2.28</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- hutool-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.7.3</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.example.springboot;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.example.springboot.mapper")
|
||||||
|
public class SpringbootApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(SpringbootApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.example.springboot.common;
|
||||||
|
|
||||||
|
import com.example.springboot.entity.DormRoom;
|
||||||
|
|
||||||
|
public class CalPeopleNum {
|
||||||
|
|
||||||
|
public static int calNum(DormRoom dormRoom) {
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
if (dormRoom.getFirstBed() != null) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if (dormRoom.getSecondBed() != null) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if (dormRoom.getThirdBed() != null) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if (dormRoom.getFourthBed() != null) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.example.springboot.common;
|
||||||
|
|
||||||
|
public class JudgeBedName {
|
||||||
|
|
||||||
|
private static String bedName;
|
||||||
|
|
||||||
|
public static String getBedName(int num) {
|
||||||
|
switch (num) {
|
||||||
|
case 1:
|
||||||
|
return bedName = "first_bed";
|
||||||
|
case 2:
|
||||||
|
return bedName = "second_bed";
|
||||||
|
case 3:
|
||||||
|
return bedName = "third_bed";
|
||||||
|
case 4:
|
||||||
|
return bedName = "fourth_bed";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.example.springboot.common;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MyBatisPlusConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||||
|
return interceptor;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.example.springboot.common;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Result<T> {
|
||||||
|
private String code;
|
||||||
|
private String msg;
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public Result(T data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result success() {
|
||||||
|
Result result = new Result<>();
|
||||||
|
result.setCode("0");
|
||||||
|
result.setMsg("成功");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> success(T data) {
|
||||||
|
Result<T> result = new Result<>(data);
|
||||||
|
result.setCode("0");
|
||||||
|
result.setMsg("成功");
|
||||||
|
result.setData(data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public static Result error(String msg) {
|
||||||
|
Result result = new Result<>();
|
||||||
|
result.setCode("400");
|
||||||
|
result.setMsg(msg);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Result error(String code, String msg) {
|
||||||
|
Result result = new Result<>();
|
||||||
|
result.setCode(code);
|
||||||
|
result.setMsg(msg);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.common;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class UID {
|
||||||
|
public String produceUID() {
|
||||||
|
return UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.example.springboot.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.SpringBootConfiguration;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*水电费配置类
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties(prefix = "cost")
|
||||||
|
public class CostConfig {
|
||||||
|
|
||||||
|
private Integer waterCost;
|
||||||
|
|
||||||
|
private Integer electricCost;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.example.springboot.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.example.springboot.common.Result;
|
||||||
|
import com.example.springboot.entity.AdjustRoom;
|
||||||
|
import com.example.springboot.service.AdjustRoomService;
|
||||||
|
import com.example.springboot.service.DormRoomService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/adjustRoom")
|
||||||
|
public class AdjustRoomController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdjustRoomService adjustRoomService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DormRoomService dormRoomService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加订单
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<?> add(@RequestBody AdjustRoom adjustRoom) {
|
||||||
|
|
||||||
|
int result = adjustRoomService.addApply(adjustRoom);
|
||||||
|
if (result == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新订单
|
||||||
|
*/
|
||||||
|
@PutMapping("/update/{state}")
|
||||||
|
public Result<?> update(@RequestBody AdjustRoom adjustRoom, @PathVariable Boolean state) {
|
||||||
|
if (state) {
|
||||||
|
// 更新房间表信息
|
||||||
|
int i = dormRoomService.adjustRoomUpdate(adjustRoom);
|
||||||
|
if (i == -1) {
|
||||||
|
return Result.error("-1", "重复操作");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//更新调宿表信息
|
||||||
|
int i = adjustRoomService.updateApply(adjustRoom);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除订单
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete/{id}")
|
||||||
|
public Result<?> delete(@PathVariable Integer id) {
|
||||||
|
int i = adjustRoomService.deleteAdjustment(id);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查找订单
|
||||||
|
*/
|
||||||
|
@GetMapping("/find")
|
||||||
|
public Result<?> findPage(@RequestParam(defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||||
|
@RequestParam(defaultValue = "") String search) {
|
||||||
|
Page page = adjustRoomService.find(pageNum, pageSize, search);
|
||||||
|
if (page != null) {
|
||||||
|
return Result.success(page);
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.example.springboot.controller;
|
||||||
|
|
||||||
|
import com.example.springboot.common.Result;
|
||||||
|
import com.example.springboot.common.UID;
|
||||||
|
import com.example.springboot.entity.Admin;
|
||||||
|
import com.example.springboot.entity.User;
|
||||||
|
import com.example.springboot.service.AdminService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin")
|
||||||
|
public class AdminController {
|
||||||
|
|
||||||
|
String uid = new UID().produceUID();
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminService adminService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员注册
|
||||||
|
*/
|
||||||
|
@PostMapping("/register")
|
||||||
|
|
||||||
|
public Result<?> register(@RequestBody Admin admin) {
|
||||||
|
try {
|
||||||
|
int result = adminService.registerAdmin(admin);
|
||||||
|
if (result == 1) {
|
||||||
|
return Result.success("注册成功");
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "注册失败");
|
||||||
|
}
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return Result.error("-1", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 管理员登录
|
||||||
|
*/
|
||||||
|
@PostMapping("/login")
|
||||||
|
public Result<?> login(@RequestBody User user, HttpSession session) {
|
||||||
|
Object o = adminService.adminLogin(user.getUsername(), user.getPassword());
|
||||||
|
if (o != null) {
|
||||||
|
System.out.println(o);
|
||||||
|
//存入session
|
||||||
|
session.setAttribute("Identity", "admin");
|
||||||
|
session.setAttribute("User", o);
|
||||||
|
return Result.success(o);
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "用户名或密码错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员信息更新
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
public Result<?> update(@RequestBody Admin admin) {
|
||||||
|
int i = adminService.updateAdmin(admin);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.example.springboot.controller;
|
||||||
|
|
||||||
|
import com.example.springboot.common.Result;
|
||||||
|
import com.example.springboot.config.CostConfig;
|
||||||
|
import com.example.springboot.entity.Cost;
|
||||||
|
import com.example.springboot.service.CostService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员修改水电费价格
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/change")
|
||||||
|
public class ChangeCostController {
|
||||||
|
|
||||||
|
|
||||||
|
private final CostService costService;
|
||||||
|
|
||||||
|
private final CostConfig costConfig;
|
||||||
|
|
||||||
|
public ChangeCostController(CostService costService, CostConfig costConfig) {
|
||||||
|
this.costService = costService;
|
||||||
|
this.costConfig = costConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员修改水费价格
|
||||||
|
*/
|
||||||
|
@PutMapping("/water")
|
||||||
|
public Result<?> changeWaterCost(@RequestParam Integer waterCost) {
|
||||||
|
boolean success = costService.ChangeWaterCost(waterCost);
|
||||||
|
if (success) {
|
||||||
|
return Result.success("Water cost updated successfully");
|
||||||
|
} else {
|
||||||
|
return Result.error("Failed to update water cost");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员修改电费价格
|
||||||
|
*/
|
||||||
|
@PutMapping("/electricity")
|
||||||
|
public Result<?> changeElectricityCost(@RequestParam Integer electricCost) {
|
||||||
|
boolean success = costService.ChangeElectricCost(electricCost);
|
||||||
|
if (success) {
|
||||||
|
return Result.success("Electricity cost updated successfully");
|
||||||
|
} else {
|
||||||
|
return Result.error("Failed to update electricity cost");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取水电费价格
|
||||||
|
*/
|
||||||
|
@GetMapping("get/cost")
|
||||||
|
public Result<Cost> getCost() {
|
||||||
|
Integer water_cost=costConfig.getWaterCost();
|
||||||
|
Integer electric_cost=costConfig.getElectricCost();
|
||||||
|
Cost cost=new Cost();
|
||||||
|
cost.setElectricity_cost(electric_cost);
|
||||||
|
cost.setWater_cost(water_cost);
|
||||||
|
return Result.success(cost);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.example.springboot.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.example.springboot.common.Result;
|
||||||
|
import com.example.springboot.entity.DormBuild;
|
||||||
|
import com.example.springboot.service.DormBuildService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/building")
|
||||||
|
public class DormBuildController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DormBuildService dormBuildService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 楼宇添加
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<?> add(@RequestBody DormBuild dormBuild) {
|
||||||
|
int i = dormBuildService.addNewBuilding(dormBuild);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "添加失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 楼宇信息更新
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
public Result<?> update(@RequestBody DormBuild dormBuild) {
|
||||||
|
int i = dormBuildService.updateNewBuilding(dormBuild);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 楼宇删除
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete/{dormBuildId}")
|
||||||
|
public Result<?> delete(@PathVariable Integer dormBuildId) {
|
||||||
|
int i = dormBuildService.deleteBuilding(dormBuildId);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 楼宇查找
|
||||||
|
*/
|
||||||
|
@GetMapping("/find")
|
||||||
|
public Result<?> findPage(@RequestParam(defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||||
|
@RequestParam(defaultValue = "") String search) {
|
||||||
|
Page page = dormBuildService.find(pageNum, pageSize, search);
|
||||||
|
if (page != null) {
|
||||||
|
return Result.success(page);
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页Echarts 获取楼宇信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/getBuildingName")
|
||||||
|
public Result<?> getBuildingName() {
|
||||||
|
List<DormBuild> buildingName = dormBuildService.getBuildingId();
|
||||||
|
List<Integer> buildingId = buildingName.stream()
|
||||||
|
.map(dormBuildId -> dormBuildId.getDormBuildId())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return !buildingId.isEmpty() ?
|
||||||
|
Result.success(buildingId) : Result.error("-1", "查询失败");
|
||||||
|
}
|
||||||
|
// if (!buildingId.isEmpty()) {
|
||||||
|
// return Result.success(buildingId);
|
||||||
|
// } else {
|
||||||
|
// return Result.error("-1", "查询失败");
|
||||||
|
// }
|
||||||
|
}
|
@ -0,0 +1,107 @@
|
|||||||
|
package com.example.springboot.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.example.springboot.common.Result;
|
||||||
|
import com.example.springboot.entity.DormManager;
|
||||||
|
import com.example.springboot.entity.User;
|
||||||
|
import com.example.springboot.service.DormManagerService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/dormManager")
|
||||||
|
public class DormManagerController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DormManagerService dormManagerService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管注册
|
||||||
|
*/
|
||||||
|
@PostMapping("/register")
|
||||||
|
public Result<?> register(@RequestBody DormManager dormManager) {
|
||||||
|
try {
|
||||||
|
int result = dormManagerService.registerDormManager(dormManager);
|
||||||
|
if (result == 1) {
|
||||||
|
return Result.success("注册成功");
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "注册失败");
|
||||||
|
}
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return Result.error("-1", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管添加
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<?> add(@RequestBody DormManager dormManager) {
|
||||||
|
int i = dormManagerService.addNewDormManager(dormManager);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "添加失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管信息更新
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
public Result<?> update(@RequestBody DormManager dormManager) {
|
||||||
|
int i = dormManagerService.updateNewDormManager(dormManager);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管删除
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete/{username}")
|
||||||
|
public Result<?> delete(@PathVariable String username) {
|
||||||
|
int i = dormManagerService.deleteDormManager(username);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管查找
|
||||||
|
*/
|
||||||
|
@GetMapping("/find")
|
||||||
|
public Result<?> findPage(@RequestParam(defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||||
|
@RequestParam(defaultValue = "") String search) {
|
||||||
|
Page page = dormManagerService.find(pageNum, pageSize, search);
|
||||||
|
if (page != null) {
|
||||||
|
return Result.success(page);
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管登录
|
||||||
|
*/
|
||||||
|
@PostMapping("/login")
|
||||||
|
public Result<?> login(@RequestBody User user, HttpSession session) {
|
||||||
|
Object o = dormManagerService.dormManagerLogin(user.getUsername(), user.getPassword());
|
||||||
|
if (o != null) {
|
||||||
|
System.out.println(o);
|
||||||
|
//存入session
|
||||||
|
session.setAttribute("Identity", "dormManager");
|
||||||
|
session.setAttribute("User", o);
|
||||||
|
return Result.success(o);
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "用户名或密码错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.example.springboot.controller;
|
||||||
|
|
||||||
|
import com.example.springboot.common.Result;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/main")
|
||||||
|
public class MainController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取身份信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/loadIdentity")
|
||||||
|
public Result<?> loadIdentity(HttpSession session) {
|
||||||
|
Object identity = session.getAttribute("Identity");
|
||||||
|
|
||||||
|
if (identity != null) {
|
||||||
|
return Result.success(identity);
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "加载失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取个人信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/loadUserInfo")
|
||||||
|
public Result<?> loadUserInfo(HttpSession session) {
|
||||||
|
Object User = session.getAttribute("User");
|
||||||
|
|
||||||
|
if (User != null) {
|
||||||
|
return Result.success(User);
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "加载失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录
|
||||||
|
*/
|
||||||
|
@GetMapping("/signOut")
|
||||||
|
public Result<?> signOut(HttpSession session) {
|
||||||
|
session.removeAttribute("User");
|
||||||
|
session.removeAttribute("Identity");
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.example.springboot.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.example.springboot.common.Result;
|
||||||
|
import com.example.springboot.entity.Notice;
|
||||||
|
import com.example.springboot.service.NoticeService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/notice")
|
||||||
|
public class NoticeController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
NoticeService noticeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告添加
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<?> add(@RequestBody Notice notice) {
|
||||||
|
int i = noticeService.addNewNotice(notice);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "添加失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告更新
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
public Result<?> update(@RequestBody Notice notice) {
|
||||||
|
int i = noticeService.updateNewNotice(notice);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告删除
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete/{id}")
|
||||||
|
public Result<?> delete(@PathVariable Integer id) {
|
||||||
|
int i = noticeService.deleteNotice(id);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告查找
|
||||||
|
*/
|
||||||
|
@GetMapping("/find")
|
||||||
|
public Result<?> findPage(@RequestParam(defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||||
|
@RequestParam(defaultValue = "") String search) {
|
||||||
|
Page page = noticeService.find(pageNum, pageSize, search);
|
||||||
|
if (page != null) {
|
||||||
|
return Result.success(page);
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页公告展示
|
||||||
|
*/
|
||||||
|
@GetMapping("/homePageNotice")
|
||||||
|
public Result<?> homePageNotice() {
|
||||||
|
List<?> list = noticeService.homePageNotice();
|
||||||
|
if (list != null) {
|
||||||
|
return Result.success(list);
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "首页公告查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.example.springboot.controller;
|
||||||
|
import com.example.springboot.common.Result;
|
||||||
|
import com.example.springboot.entity.Order;
|
||||||
|
import com.example.springboot.service.OrderService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/order")
|
||||||
|
public class OrderController {
|
||||||
|
|
||||||
|
private final OrderService orderService;
|
||||||
|
|
||||||
|
public OrderController(OrderService orderService) {
|
||||||
|
this.orderService = orderService;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 学生点名
|
||||||
|
@PostMapping("/orderAttendance")
|
||||||
|
public Result<?> orderAttendance(@RequestParam Integer studentId) {
|
||||||
|
// 调用服务层的点名方法,返回成功或失败
|
||||||
|
boolean success = orderService.order(studentId);
|
||||||
|
if (success) {
|
||||||
|
return Result.success("点名成功");
|
||||||
|
}
|
||||||
|
return Result.error("400","点名失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 管理员查看所有学生的点名记录
|
||||||
|
@GetMapping("/getAllOrders")
|
||||||
|
public Result<?> getAllOrders() {
|
||||||
|
// 获取所有点名记录
|
||||||
|
List<Order> orderList = orderService.getAllOrders();
|
||||||
|
if (orderList.isEmpty()) {
|
||||||
|
return Result.error("400","没有点名记录");
|
||||||
|
}
|
||||||
|
return Result.success(orderList);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package com.example.springboot.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.example.springboot.common.Result;
|
||||||
|
import com.example.springboot.entity.Visitor;
|
||||||
|
import com.example.springboot.service.VisitorService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/visitor")
|
||||||
|
public class VisitorController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private VisitorService visitorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访客添加
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<?> add(@RequestBody Visitor visitor) {
|
||||||
|
int i = visitorService.addNewVisitor(visitor);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "添加失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访客信息更新
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
public Result<?> update(@RequestBody Visitor visitor) {
|
||||||
|
int i = visitorService.updateNewVisitor(visitor);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访客删除
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete/{id}")
|
||||||
|
public Result<?> delete(@PathVariable Integer id) {
|
||||||
|
int i = visitorService.deleteVisitor(id);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success();
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访客查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/find")
|
||||||
|
public Result<?> findPage(@RequestParam(defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||||
|
@RequestParam(defaultValue = "") String search) {
|
||||||
|
Page page = visitorService.find(pageNum, pageSize, search);
|
||||||
|
if (page != null) {
|
||||||
|
return Result.success(page);
|
||||||
|
} else {
|
||||||
|
return Result.error("-1", "查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AdjustRoom {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
@TableField(value = "username")
|
||||||
|
private String username;
|
||||||
|
@TableField(value = "name")
|
||||||
|
private String name;
|
||||||
|
@TableField(value = "currentroom_id")
|
||||||
|
private int currentRoomId;
|
||||||
|
@TableField(value = "currentbed_id")
|
||||||
|
private int currentBedId;
|
||||||
|
@TableField(value = "towardsroom_id")
|
||||||
|
private int towardsRoomId;
|
||||||
|
@TableField(value = "towardsbed_id")
|
||||||
|
private int towardsBedId;
|
||||||
|
@TableField("state")
|
||||||
|
private String state;
|
||||||
|
@TableField("apply_time")
|
||||||
|
private String applyTime;
|
||||||
|
@TableField("finish_time")
|
||||||
|
private String finishTime;
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统管理员
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
|
||||||
|
@TableName(value = "admin")
|
||||||
|
public class Admin {
|
||||||
|
|
||||||
|
@TableId(value = "username")
|
||||||
|
private String username;
|
||||||
|
@TableField(value = "password")
|
||||||
|
private String password;
|
||||||
|
@TableField(value = "name")
|
||||||
|
private String name;
|
||||||
|
@TableField(value = "gender")
|
||||||
|
private String gender;
|
||||||
|
@TableField(value = "age")
|
||||||
|
private int age;
|
||||||
|
@TableField(value = "phone_num")
|
||||||
|
private String phoneNum;
|
||||||
|
@TableField(value = "email")
|
||||||
|
private String email;
|
||||||
|
@TableField("avatar")
|
||||||
|
private String avatar;
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
|
||||||
|
public class Cost {
|
||||||
|
|
||||||
|
|
||||||
|
private Integer water_cost;
|
||||||
|
|
||||||
|
private Integer electricity_cost;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿舍楼
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
|
||||||
|
@TableName(value = "dorm_build")
|
||||||
|
public class DormBuild {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
@TableField("dormbuild_id")
|
||||||
|
private int dormBuildId;
|
||||||
|
@TableField("dormbuild_name")
|
||||||
|
private String dormBuildName;
|
||||||
|
@TableField("dormbuild_detail")
|
||||||
|
private String dormBuildDetail;
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿舍管理员
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
|
||||||
|
@TableName(value = "dorm_manager")
|
||||||
|
public class DormManager {
|
||||||
|
|
||||||
|
@TableId("username")
|
||||||
|
private String username;
|
||||||
|
@TableField("password")
|
||||||
|
private String password;
|
||||||
|
@TableField("dormbuild_id")
|
||||||
|
private int dormBuildId;
|
||||||
|
@TableField("name")
|
||||||
|
private String name;
|
||||||
|
@TableField("gender")
|
||||||
|
private String gender;
|
||||||
|
@TableField("age")
|
||||||
|
private int age;
|
||||||
|
@TableField("phone_num")
|
||||||
|
private String phoneNum;
|
||||||
|
@TableField("email")
|
||||||
|
private String email;
|
||||||
|
@TableField("avatar")
|
||||||
|
private String avatar;
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿舍房间
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
|
||||||
|
@TableName(value = "dorm_room")
|
||||||
|
public class DormRoom {
|
||||||
|
|
||||||
|
@TableId(value = "dormroom_id")
|
||||||
|
private Integer dormRoomId;
|
||||||
|
@TableField("dormbuild_id")
|
||||||
|
private int dormBuildId;
|
||||||
|
@TableField("floor_num")
|
||||||
|
private int floorNum;
|
||||||
|
@TableField("max_capacity")
|
||||||
|
private int maxCapacity;
|
||||||
|
@TableField("current_capacity")
|
||||||
|
private int currentCapacity;
|
||||||
|
@TableField("first_bed")
|
||||||
|
private String firstBed;
|
||||||
|
@TableField("second_bed")
|
||||||
|
private String secondBed;
|
||||||
|
@TableField("third_bed")
|
||||||
|
private String thirdBed;
|
||||||
|
@TableField("fourth_bed")
|
||||||
|
private String fourthBed;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@EntityScan
|
||||||
|
@Data
|
||||||
|
public class ElectricCost {
|
||||||
|
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private Integer dorm_id;
|
||||||
|
private Integer electric_cost;
|
||||||
|
private LocalDateTime create_time;
|
||||||
|
private LocalDateTime end_time;
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
|
||||||
|
@TableName(value = "notice")
|
||||||
|
public class Notice {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
@TableField("title")
|
||||||
|
private String title;
|
||||||
|
@TableField("content")
|
||||||
|
private String content;
|
||||||
|
@TableField("author")
|
||||||
|
private String author;
|
||||||
|
@TableField("release_time")
|
||||||
|
private String releaseTime;
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
/**
|
||||||
|
*用户点名的实体类
|
||||||
|
*/
|
||||||
|
@EntityScan
|
||||||
|
@Data
|
||||||
|
public class Order {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String user_id;
|
||||||
|
|
||||||
|
private LocalDate order_time;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*学生缴费的凭证
|
||||||
|
*/
|
||||||
|
@EntityScan
|
||||||
|
@Data
|
||||||
|
public class PayRecord {
|
||||||
|
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer studentId;//缴费学生的id
|
||||||
|
|
||||||
|
private Integer dormId;//缴费的宿舍id
|
||||||
|
|
||||||
|
private Integer NeedPayNumber;//学生的需要缴费的金额
|
||||||
|
|
||||||
|
private String PayNumber;//学生实际缴费的金额
|
||||||
|
|
||||||
|
private String PayTime;//学生没有缴费的金额
|
||||||
|
|
||||||
|
private LocalDate PayDate;//缴费日期
|
||||||
|
|
||||||
|
private String PayType;//截止时间
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报修单
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
|
||||||
|
@TableName(value = "repair")
|
||||||
|
public class Repair {
|
||||||
|
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
@TableField("repairer")
|
||||||
|
private String repairer;
|
||||||
|
@TableField("dormbuild_id")
|
||||||
|
private int dormBuildId;
|
||||||
|
@TableField("dormroom_id")
|
||||||
|
private int dormRoomId;
|
||||||
|
@TableField("title")
|
||||||
|
private String title;
|
||||||
|
@TableField("content")
|
||||||
|
private String content;
|
||||||
|
@TableField("state")
|
||||||
|
private String state;
|
||||||
|
@TableField("order_buildtime")
|
||||||
|
private String orderBuildTime;
|
||||||
|
@TableField("order_finishtime")
|
||||||
|
private String orderFinishTime;
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class User {
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String identity;
|
||||||
|
private String avatar;
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访客
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
|
||||||
|
@TableName(value = "visitor")
|
||||||
|
public class Visitor {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
@TableField("name")
|
||||||
|
private String visitorName;
|
||||||
|
@TableField("gender")
|
||||||
|
private String gender;
|
||||||
|
@TableField("phone_num")
|
||||||
|
private String phoneNum;
|
||||||
|
@TableField("origin_city")
|
||||||
|
private String originCity;
|
||||||
|
@TableField("visit_time")
|
||||||
|
private String visitTime;
|
||||||
|
@TableField("content")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.example.springboot.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.sf.ezmorph.array.IntArrayMorpher;
|
||||||
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*学生宿舍水电费
|
||||||
|
*/
|
||||||
|
@EntityScan
|
||||||
|
@Data
|
||||||
|
public class WaterCost {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private Integer dorm_id;
|
||||||
|
private Integer water_cost;
|
||||||
|
private LocalDateTime create_time;//订单创建时间
|
||||||
|
private LocalDateTime end_time;//截止时间
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.AdjustRoom;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AdjustRoomMapper extends BaseMapper<AdjustRoom> {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.Admin;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AdminMapper extends BaseMapper<Admin> {
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.DormBuild;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DormBuildMapper extends BaseMapper<DormBuild> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.DormManager;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DormManagerMapper extends BaseMapper<DormManager> {
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.DormRoom;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DormRoomMapper extends BaseMapper<DormRoom> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.ElectricCost;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ElectricCostMapper extends BaseMapper<ElectricCost> {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.Notice;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface NoticeMapper extends BaseMapper<Notice> {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.Order;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface OrderMapper extends BaseMapper<Order> {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.Repair;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RepairMapper extends BaseMapper<Repair> {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.Student;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface StudentMapper extends BaseMapper<Student> {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.Visitor;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface VisitorMapper extends BaseMapper<Visitor> {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.example.springboot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.springboot.entity.WaterCost;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface WaterCostMapper extends BaseMapper<WaterCost> {
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.example.springboot.entity.AdjustRoom;
|
||||||
|
|
||||||
|
public interface AdjustRoomService extends IService<AdjustRoom> {
|
||||||
|
|
||||||
|
//查询调宿申请
|
||||||
|
Page find(Integer pageNum, Integer pageSize, String search);
|
||||||
|
|
||||||
|
//删除调宿申请
|
||||||
|
int deleteAdjustment(Integer id);
|
||||||
|
|
||||||
|
//更新
|
||||||
|
int updateApply(AdjustRoom adjustRoom);
|
||||||
|
|
||||||
|
// 添加
|
||||||
|
int addApply(AdjustRoom adjustRoom);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.example.springboot.entity.Admin;
|
||||||
|
|
||||||
|
|
||||||
|
public interface AdminService extends IService<Admin> {
|
||||||
|
|
||||||
|
|
||||||
|
//管理员登陆
|
||||||
|
Admin adminLogin(String username, String password);
|
||||||
|
|
||||||
|
//更新管理员信息
|
||||||
|
int updateAdmin(Admin admin);
|
||||||
|
|
||||||
|
int registerAdmin(Admin admin);
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
public interface CostService {
|
||||||
|
Boolean ChangeWaterCost(Integer waterCost);
|
||||||
|
|
||||||
|
Boolean ChangeElectricCost(Integer electricCost);
|
||||||
|
|
||||||
|
Integer getWaterCost();
|
||||||
|
|
||||||
|
Integer getElectricCost();
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.example.springboot.entity.DormBuild;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface DormBuildService extends IService<DormBuild> {
|
||||||
|
|
||||||
|
//新增楼宇
|
||||||
|
int addNewBuilding(DormBuild dormBuild);
|
||||||
|
|
||||||
|
//查询楼宇
|
||||||
|
Page find(Integer pageNum, Integer pageSize, String search);
|
||||||
|
|
||||||
|
//更新楼宇信息
|
||||||
|
int updateNewBuilding(DormBuild dormBuild);
|
||||||
|
|
||||||
|
//删除楼宇信息
|
||||||
|
int deleteBuilding(Integer id);
|
||||||
|
|
||||||
|
List<DormBuild> getBuildingId();
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.example.springboot.entity.DormManager;
|
||||||
|
|
||||||
|
|
||||||
|
public interface DormManagerService extends IService<DormManager> {
|
||||||
|
|
||||||
|
//学生登陆
|
||||||
|
DormManager dormManagerLogin(String username, String password);
|
||||||
|
|
||||||
|
//新增学生
|
||||||
|
int addNewDormManager(DormManager dormManager);
|
||||||
|
|
||||||
|
//查询学生
|
||||||
|
Page find(Integer pageNum, Integer pageSize, String search);
|
||||||
|
|
||||||
|
//更新学生信息
|
||||||
|
int updateNewDormManager(DormManager dormManager);
|
||||||
|
|
||||||
|
//删除学生信息
|
||||||
|
int deleteDormManager(String username);
|
||||||
|
|
||||||
|
int registerDormManager(DormManager dormManager);
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.example.springboot.entity.AdjustRoom;
|
||||||
|
import com.example.springboot.entity.DormRoom;
|
||||||
|
|
||||||
|
|
||||||
|
public interface DormRoomService extends IService<DormRoom> {
|
||||||
|
//统计没有住满的宿舍数量
|
||||||
|
public int notFullRoom();
|
||||||
|
|
||||||
|
//新增房间
|
||||||
|
int addNewRoom(DormRoom dormRoom);
|
||||||
|
|
||||||
|
//查询房间
|
||||||
|
Page find(Integer pageNum, Integer pageSize, String search);
|
||||||
|
|
||||||
|
//更新房间信息
|
||||||
|
int updateNewRoom(DormRoom dormRoom);
|
||||||
|
|
||||||
|
//删除房间信息
|
||||||
|
int deleteRoom(Integer dormRoomId);
|
||||||
|
|
||||||
|
//删除床位上的学生信息
|
||||||
|
int deleteBedInfo(String bedName, Integer dormRoomId, int calCurrentNum);
|
||||||
|
|
||||||
|
//床位信息,查询该学生是否已有宿舍
|
||||||
|
DormRoom judgeHadBed(String username);
|
||||||
|
|
||||||
|
//主页 住宿人数
|
||||||
|
Long selectHaveRoomStuNum();
|
||||||
|
|
||||||
|
//获取每栋宿舍学生总人数
|
||||||
|
Long getEachBuildingStuNum(int dormBuildId);
|
||||||
|
|
||||||
|
//根据调宿申请 更新房间住宿信息
|
||||||
|
int adjustRoomUpdate(AdjustRoom adjustRoom);
|
||||||
|
|
||||||
|
// 检查该房间是否满了
|
||||||
|
DormRoom checkRoomState(Integer dormRoomId);
|
||||||
|
|
||||||
|
// 检查房间是否存在
|
||||||
|
DormRoom checkRoomExist(Integer dormRoomId);
|
||||||
|
|
||||||
|
// 检查床位是否有人
|
||||||
|
DormRoom checkBedState(Integer dormRoomId, int bedNum);
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.example.springboot.entity.Notice;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface NoticeService extends IService<Notice> {
|
||||||
|
|
||||||
|
|
||||||
|
//新增通知
|
||||||
|
int addNewNotice(Notice notice);
|
||||||
|
|
||||||
|
//查询
|
||||||
|
Page find(Integer pageNum, Integer pageSize, String search);
|
||||||
|
|
||||||
|
//更新通知信息
|
||||||
|
int updateNewNotice(Notice notice);
|
||||||
|
|
||||||
|
//删除通知
|
||||||
|
int deleteNotice(Integer id);
|
||||||
|
|
||||||
|
// 首页通知展示
|
||||||
|
List<?> homePageNotice();
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
import com.example.springboot.entity.Order;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface OrderService {
|
||||||
|
|
||||||
|
List<Order> getAllOrders();
|
||||||
|
|
||||||
|
Boolean order(Integer studentId);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.example.springboot.entity.Repair;
|
||||||
|
|
||||||
|
|
||||||
|
public interface RepairService extends IService<Repair> {
|
||||||
|
|
||||||
|
//显示订单数量
|
||||||
|
public int showOrderNum();
|
||||||
|
|
||||||
|
//新增订单
|
||||||
|
int addNewOrder(Repair repair);
|
||||||
|
|
||||||
|
//查询
|
||||||
|
Page find(Integer pageNum, Integer pageSize, String search);
|
||||||
|
|
||||||
|
//查询
|
||||||
|
Page individualFind(Integer pageNum, Integer pageSize, String search, String name);
|
||||||
|
|
||||||
|
//更新订单信息
|
||||||
|
int updateNewOrder(Repair repair);
|
||||||
|
|
||||||
|
//删除订单
|
||||||
|
int deleteOrder(Integer id);
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.example.springboot.entity.Student;
|
||||||
|
|
||||||
|
|
||||||
|
public interface StudentService extends IService<Student> {
|
||||||
|
|
||||||
|
//学生登陆
|
||||||
|
Student stuLogin(String username, String password);
|
||||||
|
|
||||||
|
//新增学生
|
||||||
|
int addNewStudent(Student student);
|
||||||
|
|
||||||
|
//查询学生
|
||||||
|
Page find(Integer pageNum, Integer pageSize, String search);
|
||||||
|
|
||||||
|
//更新学生信息
|
||||||
|
int updateNewStudent(Student student);
|
||||||
|
|
||||||
|
//删除学生信息
|
||||||
|
int deleteStudent(String username);
|
||||||
|
|
||||||
|
//统计学生人数
|
||||||
|
int stuNum();
|
||||||
|
|
||||||
|
//床位信息,查询该学生信息
|
||||||
|
Student stuInfo(String username);
|
||||||
|
|
||||||
|
int registerStudent(Student student);
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.example.springboot.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.example.springboot.entity.Visitor;
|
||||||
|
|
||||||
|
|
||||||
|
public interface VisitorService extends IService<Visitor> {
|
||||||
|
|
||||||
|
//新增订单
|
||||||
|
int addNewVisitor(Visitor visitor);
|
||||||
|
|
||||||
|
//查询
|
||||||
|
Page find(Integer pageNum, Integer pageSize, String search);
|
||||||
|
|
||||||
|
//更新订单信息
|
||||||
|
int updateNewVisitor(Visitor visitor);
|
||||||
|
|
||||||
|
//删除订单
|
||||||
|
int deleteVisitor(Integer id);
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.example.springboot.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.example.springboot.entity.AdjustRoom;
|
||||||
|
import com.example.springboot.mapper.AdjustRoomMapper;
|
||||||
|
import com.example.springboot.service.AdjustRoomService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AdjustRoomServiceImpl extends ServiceImpl<AdjustRoomMapper, AdjustRoom> implements AdjustRoomService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdjustRoomMapper adjustRoomMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加调宿申请
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int addApply(AdjustRoom adjustRoom) {
|
||||||
|
int insert = adjustRoomMapper.insert(adjustRoom);
|
||||||
|
return insert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查找调宿申请
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page find(Integer pageNum, Integer pageSize, String search) {
|
||||||
|
Page page = new Page<>(pageNum, pageSize);
|
||||||
|
QueryWrapper<AdjustRoom> qw = new QueryWrapper<>();
|
||||||
|
qw.like("username", search);
|
||||||
|
Page orderPage = adjustRoomMapper.selectPage(page, qw);
|
||||||
|
return orderPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除调宿申请
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteAdjustment(Integer id) {
|
||||||
|
int i = adjustRoomMapper.deleteById(id);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新调宿申请
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateApply(AdjustRoom adjustRoom) {
|
||||||
|
int i = adjustRoomMapper.updateById(adjustRoom);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.example.springboot.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.example.springboot.entity.Admin;
|
||||||
|
import com.example.springboot.mapper.AdminMapper;
|
||||||
|
import com.example.springboot.service.AdminService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements AdminService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注入DAO层对象
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private AdminMapper adminMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员登录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Admin adminLogin(String username, String password) {
|
||||||
|
QueryWrapper<Admin> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("username", username);
|
||||||
|
qw.eq("password", password);
|
||||||
|
Admin admin = adminMapper.selectOne(qw);
|
||||||
|
if (admin != null) {
|
||||||
|
return admin;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员信息更新
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateAdmin(Admin admin) {
|
||||||
|
int i = adminMapper.updateById(admin);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 管理员注册
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int registerAdmin(Admin admin) {
|
||||||
|
QueryWrapper<Admin> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("username", admin.getUsername());
|
||||||
|
long count = adminMapper.selectCount(qw);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new IllegalArgumentException("用户名已存在");
|
||||||
|
}
|
||||||
|
return adminMapper.insert(admin);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.example.springboot.service.impl;
|
||||||
|
|
||||||
|
import com.example.springboot.config.CostConfig;
|
||||||
|
import com.example.springboot.entity.Cost;
|
||||||
|
import com.example.springboot.service.CostService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CostServiceImpl implements CostService {
|
||||||
|
|
||||||
|
private final CostConfig costConfig;
|
||||||
|
|
||||||
|
public CostServiceImpl(CostConfig costConfig) {
|
||||||
|
this.costConfig = costConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean ChangeWaterCost(Integer waterCost) {
|
||||||
|
try {
|
||||||
|
costConfig.setWaterCost(waterCost);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean ChangeElectricCost(Integer electricCost) {
|
||||||
|
try {
|
||||||
|
costConfig.setElectricCost(electricCost);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取水费
|
||||||
|
public Integer getWaterCost() {
|
||||||
|
return costConfig.getWaterCost();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取电费
|
||||||
|
public Integer getElectricCost() {
|
||||||
|
return costConfig.getElectricCost();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package com.example.springboot.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.example.springboot.entity.DormBuild;
|
||||||
|
import com.example.springboot.mapper.DormBuildMapper;
|
||||||
|
import com.example.springboot.service.DormBuildService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DormBuildImpl extends ServiceImpl<DormBuildMapper, DormBuild> implements DormBuildService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注入DAO层对象
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private DormBuildMapper dormBuildMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 楼宇添加
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int addNewBuilding(DormBuild dormBuild) {
|
||||||
|
int insert = dormBuildMapper.insert(dormBuild);
|
||||||
|
return insert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 楼宇查找
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page find(Integer pageNum, Integer pageSize, String search) {
|
||||||
|
Page page = new Page<>(pageNum, pageSize);
|
||||||
|
QueryWrapper<DormBuild> qw = new QueryWrapper<>();
|
||||||
|
qw.like("DormBuild_id", search);
|
||||||
|
Page buildingPage = dormBuildMapper.selectPage(page, qw);
|
||||||
|
return buildingPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 楼宇信息更新
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateNewBuilding(DormBuild dormBuild) {
|
||||||
|
int i = dormBuildMapper.updateById(dormBuild);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 楼宇删除
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBuilding(Integer id) {
|
||||||
|
int i = dormBuildMapper.deleteById(id);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页 获取建筑名称
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DormBuild> getBuildingId() {
|
||||||
|
QueryWrapper<DormBuild> qw = new QueryWrapper<>();
|
||||||
|
qw.select("dormbuild_id");
|
||||||
|
List<DormBuild> dormBuilds = dormBuildMapper.selectList(qw);
|
||||||
|
return dormBuilds;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
package com.example.springboot.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.example.springboot.entity.DormManager;
|
||||||
|
import com.example.springboot.mapper.DormManagerMapper;
|
||||||
|
import com.example.springboot.service.DormManagerService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DormManagerServiceImpl extends ServiceImpl<DormManagerMapper, DormManager> implements DormManagerService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注入DAO层对象
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private DormManagerMapper dormManagerMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管登录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DormManager dormManagerLogin(String username, String password) {
|
||||||
|
QueryWrapper<DormManager> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("username", username);
|
||||||
|
qw.eq("password", password);
|
||||||
|
DormManager dormManager = dormManagerMapper.selectOne(qw);
|
||||||
|
if (dormManager != null) {
|
||||||
|
return dormManager;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管新增
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int addNewDormManager(DormManager dormManager) {
|
||||||
|
int insert = dormManagerMapper.insert(dormManager);
|
||||||
|
return insert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管查找
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page find(Integer pageNum, Integer pageSize, String search) {
|
||||||
|
Page page = new Page<>(pageNum, pageSize);
|
||||||
|
QueryWrapper<DormManager> qw = new QueryWrapper<>();
|
||||||
|
qw.like("name", search);
|
||||||
|
Page dormManagerPage = dormManagerMapper.selectPage(page, qw);
|
||||||
|
return dormManagerPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管信息更新
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateNewDormManager(DormManager dormManager) {
|
||||||
|
int i = dormManagerMapper.updateById(dormManager);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管删除
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDormManager(String username) {
|
||||||
|
int i = dormManagerMapper.deleteById(username);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宿管注册
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int registerDormManager(DormManager dormManager) {
|
||||||
|
Assert.notNull(dormManager, "宿管信息不能为空");
|
||||||
|
Assert.isTrue(StringUtils.hasText(dormManager.getUsername()), "用户名不能为空");
|
||||||
|
Assert.isTrue(StringUtils.hasText(dormManager.getPassword()), "密码不能为空");
|
||||||
|
|
||||||
|
// 检查用户名是否已存在
|
||||||
|
QueryWrapper<DormManager> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("username", dormManager.getUsername());
|
||||||
|
Long count = dormManagerMapper.selectCount(queryWrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new IllegalArgumentException("用户名已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 插入新的宿管记录
|
||||||
|
return dormManagerMapper.insert(dormManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.example.springboot.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.example.springboot.entity.Notice;
|
||||||
|
import com.example.springboot.mapper.NoticeMapper;
|
||||||
|
import com.example.springboot.service.NoticeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements NoticeService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注入DAO层对象
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private NoticeMapper noticeMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告添加
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int addNewNotice(Notice notice) {
|
||||||
|
int insert = noticeMapper.insert(notice);
|
||||||
|
return insert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告查找
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page find(Integer pageNum, Integer pageSize, String search) {
|
||||||
|
Page page = new Page<>(pageNum, pageSize);
|
||||||
|
QueryWrapper<Notice> qw = new QueryWrapper<>();
|
||||||
|
qw.like("title", search);
|
||||||
|
// Assert.notNull(qw,"不可为空");
|
||||||
|
Page noticePage = noticeMapper.selectPage(page, qw);
|
||||||
|
return noticePage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告更新
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateNewNotice(Notice notice) {
|
||||||
|
int i = noticeMapper.updateById(notice);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告删除
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteNotice(Integer id) {
|
||||||
|
int i = noticeMapper.deleteById(id);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页公告展示
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<?> homePageNotice() {
|
||||||
|
QueryWrapper<Notice> qw = new QueryWrapper<>();
|
||||||
|
qw.orderByDesc("release_time");
|
||||||
|
List<Notice> noticeList = noticeMapper.selectList(qw);
|
||||||
|
return noticeList;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.example.springboot.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.example.springboot.entity.Order;
|
||||||
|
import com.example.springboot.mapper.OrderMapper;
|
||||||
|
import com.example.springboot.service.OrderService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class OrderServiceImpl implements OrderService {
|
||||||
|
|
||||||
|
private final OrderMapper orderMapper;
|
||||||
|
|
||||||
|
|
||||||
|
public OrderServiceImpl(OrderMapper orderMapper) {
|
||||||
|
this.orderMapper = orderMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Order> getAllOrders() {
|
||||||
|
|
||||||
|
QueryWrapper<Order> queryWrapper = new QueryWrapper<>();
|
||||||
|
return orderMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean order(Integer studentId) {
|
||||||
|
|
||||||
|
Order order = new Order();
|
||||||
|
order.setUser_id(String.valueOf(studentId));
|
||||||
|
order.setOrder_time(java.time.LocalDate.now());
|
||||||
|
|
||||||
|
|
||||||
|
QueryWrapper<Order> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("user_id", studentId);
|
||||||
|
|
||||||
|
|
||||||
|
Order existingOrder = orderMapper.selectOne(queryWrapper);
|
||||||
|
if (existingOrder != null) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int rowsAffected = orderMapper.insert(order);
|
||||||
|
return rowsAffected > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.example.springboot.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.example.springboot.entity.Visitor;
|
||||||
|
import com.example.springboot.mapper.VisitorMapper;
|
||||||
|
import com.example.springboot.service.VisitorService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class VisitorServiceImpl extends ServiceImpl<VisitorMapper, Visitor> implements VisitorService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private VisitorMapper visitorMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访客添加
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int addNewVisitor(Visitor visitor) {
|
||||||
|
int insert = visitorMapper.insert(visitor);
|
||||||
|
return insert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访客查询
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page find(Integer pageNum, Integer pageSize, String search) {
|
||||||
|
// return visitorMapper.selectPage(new Page<>(pageNum, pageSize), new QueryWrapper<Visitor>().like("name", search));
|
||||||
|
Page newPage = new Page<>(pageNum, pageSize);
|
||||||
|
QueryWrapper<Visitor> qw = new QueryWrapper<>();
|
||||||
|
qw.like("name", search);
|
||||||
|
Page visitorPage = visitorMapper.selectPage(newPage, qw);
|
||||||
|
return visitorPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访客信息更新
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateNewVisitor(Visitor visitor) {
|
||||||
|
int i = visitorMapper.updateById(visitor);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访客删除
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteVisitor(Integer id) {
|
||||||
|
int i = visitorMapper.deleteById(id);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
server:
|
||||||
|
port: 8083
|
||||||
|
cost:
|
||||||
|
electric-cost: 20 #设置基础水费
|
||||||
|
water-cost: 10 # 设置基础电费
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/yue_dorm?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.example.springboot;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class SpringbootApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,9 @@
|
|||||||
|
server:
|
||||||
|
port: 8083
|
||||||
|
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://47.122.61.54:3306/yue_dorm?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true
|
||||||
|
username: root
|
||||||
|
password: GHLgjw168168+
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue