Browse Source

first

master
lijie 2 years ago
commit
dd206ae84d
124 changed files with 3355 additions and 0 deletions
  1. +0
    -0
      uartBackend/.idea/.gitignore
  2. +18
    -0
      uartBackend/.idea/compiler.xml
  3. +7
    -0
      uartBackend/.idea/encodings.xml
  4. +20
    -0
      uartBackend/.idea/jarRepositories.xml
  5. +14
    -0
      uartBackend/.idea/misc.xml
  6. +6
    -0
      uartBackend/.idea/vcs.xml
  7. +141
    -0
      uartBackend/.idea/workspace.xml
  8. +1
    -0
      uartBackend/README.md
  9. +125
    -0
      uartBackend/pom.xml
  10. +163
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/CodeGenerator.java
  11. +18
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/UartBackendApplication.java
  12. +51
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/config/GlobalException.java
  13. +37
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/config/Interceptor.java
  14. +26
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/config/InterceptorConfig.java
  15. +31
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/config/MybatisObjectHandler.java
  16. +90
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/core/CodeMsg.java
  17. +55
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/core/JwtUtil.java
  18. +91
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/core/Result.java
  19. +66
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/controller/CommandCollectionController.java
  20. +74
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/controller/CommandDetailController.java
  21. +72
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/controller/CommandTypeController.java
  22. +66
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/controller/DeviceCommandController.java
  23. +73
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/controller/DeviceConfigDetailController.java
  24. +137
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/entity/CommandCollection.java
  25. +175
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/entity/CommandDetail.java
  26. +49
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/entity/CommandType.java
  27. +49
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/entity/DeviceCommand.java
  28. +89
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/entity/DeviceConfigDetail.java
  29. +18
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/mapper/CommandCollectionMapper.java
  30. +18
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/mapper/CommandDetailMapper.java
  31. +20
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/mapper/CommandTypeMapper.java
  32. +20
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/mapper/DeviceCommandMapper.java
  33. +18
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/mapper/DeviceConfigDetailMapper.java
  34. +21
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/service/CommandCollectionService.java
  35. +21
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/service/CommandDetailService.java
  36. +23
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/service/CommandTypeService.java
  37. +31
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/service/DeviceCommandService.java
  38. +21
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/service/DeviceConfigDetailService.java
  39. +42
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/service/Impl/CommandCollectionServiceImpl.java
  40. +42
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/service/Impl/CommandDetailServiceImpl.java
  41. +47
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/service/Impl/CommandTypeServiceImpl.java
  42. +83
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/service/Impl/DeviceCommandServiceImpl.java
  43. +42
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/uart/service/Impl/DeviceConfigDetailServiceImpl.java
  44. +106
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/user/controller/UserController.java
  45. +83
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/user/entity/User.java
  46. +18
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/user/mapper/UserMapper.java
  47. +42
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/user/service/Impl/UserServiceImpl.java
  48. +21
    -0
      uartBackend/src/main/java/com/topsail/uartBackend/user/service/UserService.java
  49. +5
    -0
      uartBackend/src/main/resources/application-prod.properties
  50. +19
    -0
      uartBackend/src/main/resources/application.properties
  51. +5
    -0
      uartBackend/src/main/resources/mapper/CommandCollectionMapper.xml
  52. +5
    -0
      uartBackend/src/main/resources/mapper/CommandDetailMapper.xml
  53. +10
    -0
      uartBackend/src/main/resources/mapper/CommandTypeMapper.xml
  54. +9
    -0
      uartBackend/src/main/resources/mapper/DeviceCommandMapper.xml
  55. +5
    -0
      uartBackend/src/main/resources/mapper/DeviceConfigDetailMapper.xml
  56. +5
    -0
      uartBackend/src/main/resources/mapper/UserMapper.xml
  57. +66
    -0
      uartBackend/src/main/resources/templates/controller.ftl
  58. +170
    -0
      uartBackend/src/main/resources/templates/entity.ftl
  59. +22
    -0
      uartBackend/src/main/resources/templates/mapper.ftl
  60. +25
    -0
      uartBackend/src/main/resources/templates/service.ftl
  61. +48
    -0
      uartBackend/src/main/resources/templates/serviceImpl.ftl
  62. +5
    -0
      uartBackend/target/classes/application-prod.properties
  63. +19
    -0
      uartBackend/target/classes/application.properties
  64. BIN
      uartBackend/target/classes/com/topsail/uartBackend/CodeGenerator$1.class
  65. BIN
      uartBackend/target/classes/com/topsail/uartBackend/CodeGenerator$2.class
  66. BIN
      uartBackend/target/classes/com/topsail/uartBackend/CodeGenerator$3.class
  67. BIN
      uartBackend/target/classes/com/topsail/uartBackend/CodeGenerator.class
  68. BIN
      uartBackend/target/classes/com/topsail/uartBackend/UartBackendApplication.class
  69. BIN
      uartBackend/target/classes/com/topsail/uartBackend/config/GlobalException.class
  70. BIN
      uartBackend/target/classes/com/topsail/uartBackend/config/Interceptor.class
  71. BIN
      uartBackend/target/classes/com/topsail/uartBackend/config/InterceptorConfig.class
  72. BIN
      uartBackend/target/classes/com/topsail/uartBackend/config/MybatisObjectHandler.class
  73. BIN
      uartBackend/target/classes/com/topsail/uartBackend/core/CodeMsg.class
  74. BIN
      uartBackend/target/classes/com/topsail/uartBackend/core/JwtUtil.class
  75. BIN
      uartBackend/target/classes/com/topsail/uartBackend/core/Result.class
  76. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/controller/CommandCollectionController.class
  77. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/controller/CommandDetailController.class
  78. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/controller/CommandTypeController.class
  79. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/controller/DeviceCommandController.class
  80. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/controller/DeviceConfigDetailController.class
  81. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/entity/CommandCollection.class
  82. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/entity/CommandDetail.class
  83. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/entity/CommandType.class
  84. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/entity/DeviceCommand.class
  85. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/entity/DeviceConfigDetail.class
  86. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/mapper/CommandCollectionMapper.class
  87. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/mapper/CommandDetailMapper.class
  88. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/mapper/CommandTypeMapper.class
  89. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/mapper/DeviceCommandMapper.class
  90. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/mapper/DeviceConfigDetailMapper.class
  91. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/service/CommandCollectionService.class
  92. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/service/CommandDetailService.class
  93. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/service/CommandTypeService.class
  94. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/service/DeviceCommandService.class
  95. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/service/DeviceConfigDetailService.class
  96. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/service/Impl/CommandCollectionServiceImpl.class
  97. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/service/Impl/CommandDetailServiceImpl.class
  98. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/service/Impl/CommandTypeServiceImpl.class
  99. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/service/Impl/DeviceCommandServiceImpl.class
  100. BIN
      uartBackend/target/classes/com/topsail/uartBackend/uart/service/Impl/DeviceConfigDetailServiceImpl.class

+ 0
- 0
uartBackend/.idea/.gitignore View File


+ 18
- 0
uartBackend/.idea/compiler.xml View File

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

+ 7
- 0
uartBackend/.idea/encodings.xml View File

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

+ 20
- 0
uartBackend/.idea/jarRepositories.xml View File

@ -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/repositories/central/" />
</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>

+ 14
- 0
uartBackend/.idea/misc.xml View File

@ -0,0 +1,14 @@
<?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_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

+ 6
- 0
uartBackend/.idea/vcs.xml View File

@ -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>

+ 141
- 0
uartBackend/.idea/workspace.xml View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="8dd69acc-c1fb-426a-a98d-e312be913ab9" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
</component>
<component name="ProjectId" id="2C9NneJrnZyW2cuV3ASr3S1mbsi" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="1" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RequestMappingsPanelOrder0" value="0" />
<property name="RequestMappingsPanelOrder1" value="1" />
<property name="RequestMappingsPanelWidth0" value="75" />
<property name="RequestMappingsPanelWidth1" value="75" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/resources" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="File.Encoding" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="G:\bluetoothUart\bluetoothUart\uartBackend\src\main\resources" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="com.topsail.uartBackend" />
</key>
</component>
<component name="RunManager" selected="Spring Boot.UartBackendApplication">
<configuration name="CodeGenerator" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.topsail.uartBackend.CodeGenerator" />
<module name="uartBackend" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.topsail.uartBackend.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
<option name="arquillianRunConfiguration">
<value>
<option name="containerStateName" value="" />
</value>
</option>
<option name="TEST_OBJECT" value="class" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="UartBackendApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
<module name="uartBackend" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.topsail.uartBackend.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="SPRING_BOOT_MAIN_CLASS" value="com.topsail.uartBackend.UartBackendApplication" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Spring Boot.UartBackendApplication" />
<item itemvalue="Application.CodeGenerator" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="8dd69acc-c1fb-426a-a98d-e312be913ab9" name="Default Changelist" comment="" />
<created>1658211017210</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1658211017210</updated>
<workItem from="1658211020084" duration="25665000" />
<workItem from="1658710126220" duration="16418000" />
<workItem from="1658821529028" duration="12684000" />
<workItem from="1659073569153" duration="3806000" />
<workItem from="1659313474981" duration="41425000" />
</task>
<task id="LOCAL-00001" summary="[add]后端基本框架">
<created>1658716154918</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1658716154918</updated>
</task>
<task id="LOCAL-00002" summary="[add]">
<created>1659584068592</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1659584068592</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="[add]后端基本框架" />
<MESSAGE value="[add]" />
<option name="LAST_COMMIT_MESSAGE" value="[add]" />
</component>
</project>

+ 1
- 0
uartBackend/README.md View File

@ -0,0 +1 @@
111

+ 125
- 0
uartBackend/pom.xml View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>2.4.5</version>
</parent>
<groupId>com.topsail</groupId>
<artifactId>uartBackend</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>uartBackend</name>
<description>Demo project for Spring Boot</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- mysql -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
</dependency>
<!--mybatis-plus相关-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.2</version>
<exclusions>
<exclusion>
<artifactId>mybatis-plus-extension</artifactId>
<groupId>com.baomidou</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.3.0</version>
<exclusions>
<exclusion>
<artifactId>jsqlparser</artifactId>
<groupId>com.github.jsqlparser</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.20</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.30</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.3.0</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</exclusion>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

+ 163
- 0
uartBackend/src/main/java/com/topsail/uartBackend/CodeGenerator.java View File

@ -0,0 +1,163 @@
package com.topsail.uartBackend;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.FileType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* 代码生成启动类
*/
public class CodeGenerator {
/**
* <p>
* 读取控制台内容
* </p>
*/
public static String scanner(String tip) {
Scanner scanner = new Scanner(System.in);
StringBuilder help = new StringBuilder();
help.append("请输入" + tip + ":");
System.out.println(help.toString());
if (scanner.hasNext()) {
String ipt = scanner.next();
if (StringUtils.isNotEmpty(ipt)) {
return ipt;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
public static void main(String[] args) {
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
String projectPath = System.getProperty("user.dir");
//String projectPath="E:\\topsail_new_git\\test\\sxhy\\sxhyrl";//此处可以编写绝对路径直接到项目
gc.setOutputDir(projectPath + "/src/main/java");
gc.setAuthor("lj");
gc.setOpen(false); //默认true ,是否打开输出目录
//gc.setFileOverride(false); //默认false ,是否覆盖已生成文件
gc.setMapperName("%sMapper");
gc.setXmlName("%sMapper");
gc.setServiceName("%sService");
gc.setServiceImplName("%sServiceImpl");
gc.setControllerName("%sController");
//gc.setSwagger2(true); //实体属性 Swagger2 注解
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://rm-2ze77qng1ddlfur9g4o.mysql.rds.aliyuncs.com:3306/bluetooth_uart?useUnicode=true&useSSL=false&characterEncoding=utf8");
//dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setUsername("topsail");
dsc.setPassword("Topsail2020");
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
pc.setParent("com.topsail.uartBackend.uart");
pc.setController("controller");
pc.setEntity("entity");
pc.setService("service");
pc.setServiceImpl("service.Impl");
pc.setMapper("mapper");
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
// 如果模板引擎是 freemarker
String templatePath = "/templates/mapper.xml.ftl";
// 如果模板引擎是 velocity
// String templatePath = "/templates/mapper.xml.vm";
// 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>();
// 自定义配置会被优先输出
focList.add(new FileOutConfig(templatePath) {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 如果你 Entity 设置了前后缀此处注意 xml 的名称会跟着发生变化
return projectPath + "/src/main/resources/mapper/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
}
});
cfg.setFileCreate(new IFileCreate() {
@Override
public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
// 判断自定义文件夹是否需要创建
//checkDir("调用默认方法创建的目录,自定义目录用");
//if (fileType == FileType.MAPPER ||FileType.ENTITY==fileType) {
File file = new File(filePath);
boolean exist = file.exists();
if(exist){
if (FileType.ENTITY==fileType) {//重新生成实体类
// 已经生成 mapper,entity文件判断存在返回true重新生成
return new File(filePath).exists();
}else {
return false;//其他存在的都不重复生成
}
}
// 不存在的都生成
return true;
}
});
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
// 配置模板
TemplateConfig templateConfig = new TemplateConfig();
//指定自定义模板路径注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
// templateConfig.setEntity("templates/entity2.java");
// templateConfig.setService();
templateConfig.setController("/templates/controller");
//templateConfig.setService("");//这样配置指的是不生成此文件
templateConfig.setService("/templates/service");
templateConfig.setServiceImpl("/templates/serviceImpl");
templateConfig.setEntity("/templates/entity");
templateConfig.setMapper("/templates/mapper");
//templateConfig.setXml( "/templates/mapper.xml");
templateConfig.setXml(null);
mpg.setTemplate(templateConfig);
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true);
//strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
strategy.setInclude(new String[]{"command_collection","command_type","device_command","device_config_detail","command_detail"});
strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix(pc.getModuleName() + "_");
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute();
}
}

+ 18
- 0
uartBackend/src/main/java/com/topsail/uartBackend/UartBackendApplication.java View File

@ -0,0 +1,18 @@
package com.topsail.uartBackend;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.PropertySource;
/**
* <描述>
*
* @author lj
* @date 2022/07/19 14:15
*/
@SpringBootApplication
public class UartBackendApplication {
public static void main(String[] args) {
SpringApplication.run(UartBackendApplication.class,args);
}
}

+ 51
- 0
uartBackend/src/main/java/com/topsail/uartBackend/config/GlobalException.java View File

@ -0,0 +1,51 @@
package com.topsail.uartBackend.config;
import com.topsail.uartBackend.core.CodeMsg;
import com.topsail.uartBackend.core.Result;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.validation.BindException;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.ParseException;
import java.util.List;
/**
* <描述>
*
* @author lj
* @date 2022/07/21 10:09
*/
@ControllerAdvice
@ResponseBody
public class GlobalException {
@ExceptionHandler(value = Exception.class)//拦截所有异常
public Result<String> exceptionHandler(HttpServletRequest request, Exception e){
e.printStackTrace();
if(e instanceof BindException) {
BindException ex = (BindException)e;
List<ObjectError> errors = ex.getAllErrors();//绑定错误返回很多错误是一个错误列表只需要第一个错误
ObjectError error = errors.get(0);
String msg = error.getDefaultMessage();
return Result.error(CodeMsg.BIND_ERROR.fillArgs(msg));//给状态码填充参数
}else if(e instanceof ParseException){
return Result.error(CodeMsg.TIME_ERROR);
}else if(e instanceof DuplicateKeyException){
return Result.error(CodeMsg.DUPLICATEKEY_ERROR);
}else if(e instanceof IllegalStateException){
return Result.error(CodeMsg.TOKEN_INVALID);
}else {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return Result.error(new CodeMsg(500,sw.toString().substring(0,300)));//输出错误的堆栈信息
}
}
}

+ 37
- 0
uartBackend/src/main/java/com/topsail/uartBackend/config/Interceptor.java View File

@ -0,0 +1,37 @@
package com.topsail.uartBackend.config;
import com.topsail.uartBackend.core.JwtUtil;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* <描述>
*
* @author lj
* @date 2022/07/20 9:47
*/
public class Interceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (!(request.getRequestURI().contains("/user/login"))){
String token = request.getHeader("Authorization");
JwtUtil.validateToken(token);
}
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
}
}

+ 26
- 0
uartBackend/src/main/java/com/topsail/uartBackend/config/InterceptorConfig.java View File

@ -0,0 +1,26 @@
package com.topsail.uartBackend.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* <描述>
*
* @author lj
* @date 2022/07/20 10:09
*/
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
@Bean
public Interceptor interceptor(){
return new Interceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(interceptor())
// .addPathPatterns("/**")
.excludePathPatterns("/user/login","/user/logout");
}
}

+ 31
- 0
uartBackend/src/main/java/com/topsail/uartBackend/config/MybatisObjectHandler.java View File

@ -0,0 +1,31 @@
package com.topsail.uartBackend.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import java.util.Date;
/**
* <描述>
*
* @author lj
* @date 2022/07/20 9:40
*/
public class MybatisObjectHandler implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
if (metaObject.hasSetter("createTime")){
setFieldValByName("createTime",new Date(),metaObject);
}
if (metaObject.hasSetter("updateTime")){
setFieldValByName("updateTime",new Date(),metaObject);
}
}
@Override
public void updateFill(MetaObject metaObject) {
if(metaObject.hasSetter("updateTime")){
setFieldValByName("updateTime",new Date(),metaObject);
}
}
}

+ 90
- 0
uartBackend/src/main/java/com/topsail/uartBackend/core/CodeMsg.java View File

@ -0,0 +1,90 @@
package com.topsail.uartBackend.core;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* <描述>
*
* @author lj
* @date 2022/07/19 14:34
*/
public class CodeMsg {
private int code;
private String msg;
//通用的错误码
public static CodeMsg SUCCESS = new CodeMsg(0, "success");
public static CodeMsg FAILED = new CodeMsg(502, "failed");
public static CodeMsg TOKEN_EXPIRED = new CodeMsg(400, "token过期");
public static CodeMsg TOKEN_INVALID = new CodeMsg(502, "token解析异常");
public static CodeMsg USER_NOT_LOGGED_IN = new CodeMsg(402, "未登录,请登录!");
public static CodeMsg SIGNATURE_ERROR = new CodeMsg(506, "签名失败");
public static CodeMsg SERVER_ERROR = new CodeMsg(500, "服务端异常");
public static CodeMsg FILE_ERROR = new CodeMsg(501, "文件不存在");
public static CodeMsg FILE_EXIST = new CodeMsg(5012, "文件已存在");
public static CodeMsg TIME_ERROR = new CodeMsg(502, "时间格式错误,应为 yyyy-MM-dd HH:mm:ss");
public static CodeMsg DUPLICATEKEY_ERROR = new CodeMsg(502, "IMEI已注册");
public static CodeMsg TIMEMISS_ERROR = new CodeMsg(503, "查询时间缺失,应为 yyyy-MM-dd HH:mm:ss");
public static CodeMsg BIND_ERROR = new CodeMsg(504, "参数绑定异常");
public static CodeMsg CONTROL_ERROR = new CodeMsg(505, "命令下发失败,请检查设备相关信息是否存在或正确以及参数输入是否正确");
private CodeMsg() {
}
public CodeMsg(int code, String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
/**
* 返回带参数的错误码
* @param args
* @return
*/
public CodeMsg fillArgs(Object... args) {
int code = this.code;
String message = String.format(this.msg, args);
return new CodeMsg(code, message);
}
@Override
public String toString() {
return "CodeMsg [code=" + code + ", msg=" + msg + "]";
}
public static void main(String[] args) {
//String regex="^[+-@=](.*?)\\d$";
//String regex="^[\\u4e00-\\u9fa5]{0,}(.*?)\\d$";
String regex="(.*?)\\d+(\\.\\d+)?(.*?)\\d+(\\.\\d+)?";
String regex2="[\\u4e00-\\u9fa5](.*?:)[\\u4e00-\\u9fa5]?";//匹配所有汉字
String a="北一层:17*7.5\n东房:6.3*3";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(a);
List<String> result=new ArrayList<String>();
while(m.find()) {
System.out.println(m.group());
result.add(m.group());
}
System.out.println(result.toString());
}
}

+ 55
- 0
uartBackend/src/main/java/com/topsail/uartBackend/core/JwtUtil.java View File

@ -0,0 +1,55 @@
package com.topsail.uartBackend.core;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.exceptions.ValidateException;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.hutool.jwt.JWT;
import cn.hutool.jwt.JWTValidator;
import cn.hutool.jwt.signers.JWTSignerUtil;
import com.topsail.uartBackend.user.entity.User;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
/**
* <描述>
*
* @author lj
* @date 2022/07/19 14:45
*/
public class JwtUtil {
private final static String TOKEN_KEY = "DJASNCSALKNASNNHAbvkslmm1161";
public static String getToken(User user){
DateTime newTime = DateTime.now().offsetNew(DateField.SECOND, 60 * 60 * 24);
Map<String,Object>map = new HashMap<>();
map.put("user",user);
String token = JWT.create()
.addPayloads(map)
.setSigner(JWTSignerUtil.hs512(TOKEN_KEY.getBytes()))
.setExpiresAt(newTime)
.sign();
return "Bearer "+token;
}
public static User getUserFromToken(String token){
return JSONUtil.toBean((JSONObject)JWT.of(token.split(" ")[1]).getPayloads().get("user"),User.class);
}
public static void validateToken(String token){
try {
String newToken = token.split(" ")[1];
JWTValidator.of(newToken)
.validateAlgorithm(JWTSignerUtil.hs512(TOKEN_KEY.getBytes()))
.validateDate(DateTime.now());
}catch (ValidateException ex){
throw new ValidateException("token异常!");
}
}
}

+ 91
- 0
uartBackend/src/main/java/com/topsail/uartBackend/core/Result.java View File

@ -0,0 +1,91 @@
package com.topsail.uartBackend.core;
import com.github.pagehelper.PageInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <描述>
*
* @author lj
* @date 2022/07/19 14:38
*/
public class Result<T> {
private int code;
private String msg = "success";
private T data;
/**
* 成功时候的调用
* */
public static<T> Result<T> success(T data){
return new Result<T>(CodeMsg.SUCCESS,data);
}
/**
* 失败时候的调用
* */
public static <T> Result<T> error(CodeMsg codeMsg){
return new Result<T>(codeMsg);
}
public static<T> Map<String,Object> returnPageMap(List<T> t){
PageInfo<T> pageInfo=new PageInfo(t);
int count=(int)pageInfo.getTotal();
Map<String,Object> map=new HashMap<>();
map.put("list", new ArrayList(pageInfo.getList()));
map.put("count",count);
return map;
}
private Result(CodeMsg codeMsg) {
if(codeMsg != null) {
this.code = codeMsg.getCode();
this.msg = codeMsg.getMsg();
}
}
private Result(CodeMsg codeMsg,T data){
this.code = codeMsg.getCode();
this.msg = codeMsg.getMsg();
this.data = data;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
@Override
public String toString() {
return "Result{" +
"code=" + code +
", msg='" + msg + '\'' +
", data=" + data +
'}';
}
}

+ 66
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/controller/CommandCollectionController.java View File

@ -0,0 +1,66 @@
package com.topsail.uartBackend.uart.controller;
import com.topsail.uartBackend.core.CodeMsg;
import com.topsail.uartBackend.uart.service.CommandCollectionService;
import com.topsail.uartBackend.uart.entity.CommandCollection;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.topsail.uartBackend.core.Result;
/**
*
* Created by lj on '2022-08-01 14:14:15'.
*/
@RestController
//@RequestMapping("/command-collection")
@RequestMapping("commandCollection")
public class CommandCollectionController {
@Autowired
private CommandCollectionService commandCollectionService;
/**
* 新增
*/
@PostMapping("/insertCommandCollection")
public Result insertCommandCollection( @RequestBody CommandCollection commandCollection){
boolean rsp= commandCollectionService.save(commandCollection);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 删除
*/
@DeleteMapping("/deleteCommandCollection/{id}")
public Result deleteCommandCollection(@PathVariable Integer id){
boolean rsp= commandCollectionService.removeById(id);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 更新
*/
@PutMapping("/updateCommandCollection")
public Result updateCommandCollection(@RequestBody CommandCollection commandCollection){
boolean rsp= commandCollectionService.updateById(commandCollection);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 分页查询
*/
@GetMapping("/getCommandCollectionList")
public Result pageList(CommandCollection commandCollection,@RequestParam(required = false,defaultValue = "1")Integer pageNo, @RequestParam(required = false,defaultValue = "10")Integer pageSize) {
return Result.success(Result.returnPageMap(commandCollectionService.pageList(commandCollection,pageNo,pageSize)));
}
}

+ 74
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/controller/CommandDetailController.java View File

@ -0,0 +1,74 @@
package com.topsail.uartBackend.uart.controller;
import com.topsail.uartBackend.core.CodeMsg;
import com.topsail.uartBackend.uart.entity.DeviceCommand;
import com.topsail.uartBackend.uart.service.CommandDetailService;
import com.topsail.uartBackend.uart.entity.CommandDetail;
import com.topsail.uartBackend.uart.service.DeviceCommandService;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.topsail.uartBackend.core.Result;
import javax.annotation.Resource;
import java.util.List;
/**
*
* Created by lj on '2022-08-01 14:14:15'.
*/
@RestController
//@RequestMapping("/command-detail")
@RequestMapping("commandDetail")
public class CommandDetailController {
@Autowired
private CommandDetailService commandDetailService;
@Resource
private DeviceCommandService deviceCommandService;
/**
* 新增
*/
@PostMapping("/insertCommandDetail")
public Result insertCommandDetail(@RequestBody DeviceCommand deviceCommand){
deviceCommandService.insertList(deviceCommand);
return Result.success("成功");
}
/**
* 删除
*/
@DeleteMapping("/deleteCommandDetail/{id}")
public Result deleteCommandDetail(@PathVariable Integer deviceDetailId){
deviceCommandService.deleteByDevice(deviceDetailId);
return Result.success("成功");
}
/**
* 更新
*/
@PutMapping("/updateCommandDetail")
public Result updateCommandDetail(List<DeviceCommand>deviceCommands){
deviceCommandService.updateList(deviceCommands);
return Result.success("成功");
}
/**
* 分页查询
*/
@GetMapping("/getCommandDetailList")
public Result pageList(CommandDetail commandDetail,@RequestParam(required = false,defaultValue = "1")Integer pageNo, @RequestParam(required = false,defaultValue = "10")Integer pageSize) {
return Result.success(Result.returnPageMap(commandDetailService.pageList(commandDetail,pageNo,pageSize)));
}
}

+ 72
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/controller/CommandTypeController.java View File

@ -0,0 +1,72 @@
package com.topsail.uartBackend.uart.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.topsail.uartBackend.core.CodeMsg;
import com.topsail.uartBackend.uart.service.CommandTypeService;
import com.topsail.uartBackend.uart.entity.CommandType;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.topsail.uartBackend.core.Result;
/**
*
* Created by lj on '2022-08-01 14:14:15'.
*/
@RestController
//@RequestMapping("/command-type")
@RequestMapping("commandType")
public class CommandTypeController {
@Autowired
private CommandTypeService commandTypeService;
/**
* 新增
*/
@PostMapping("/insertCommandType")
public Result insertCommandType( @RequestBody CommandType commandType){
CommandType commandType1 = commandTypeService.selectByTypeId(commandType.getTypeId());
if (null!=commandType1){
return Result.error(new CodeMsg(502,"类型ID重复!"));
}
boolean rsp= commandTypeService.save(commandType);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 删除
*/
@DeleteMapping("/deleteCommandType/{id}")
public Result deleteCommandType(@PathVariable Integer id){
boolean rsp= commandTypeService.removeById(id);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 更新
*/
@PutMapping("/updateCommandType")
public Result updateCommandType(@RequestBody CommandType commandType){
boolean rsp= commandTypeService.updateById(commandType);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 分页查询
*/
@GetMapping("/getCommandTypeList")
public Result pageList(CommandType commandType,@RequestParam(required = false,defaultValue = "1")Integer pageNo, @RequestParam(required = false,defaultValue = "10")Integer pageSize) {
return Result.success(Result.returnPageMap(commandTypeService.pageList(commandType,pageNo,pageSize)));
}
}

+ 66
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/controller/DeviceCommandController.java View File

@ -0,0 +1,66 @@
package com.topsail.uartBackend.uart.controller;
import com.topsail.uartBackend.core.CodeMsg;
import com.topsail.uartBackend.uart.service.DeviceCommandService;
import com.topsail.uartBackend.uart.entity.DeviceCommand;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.topsail.uartBackend.core.Result;
/**
*
* Created by lj on '2022-08-01 14:14:15'.
*/
@RestController
//@RequestMapping("/device-command")
@RequestMapping("deviceCommand")
public class DeviceCommandController {
@Autowired
private DeviceCommandService deviceCommandService;
/**
* 新增
*/
@PostMapping("/insertDeviceCommand")
public Result insertDeviceCommand( @RequestBody DeviceCommand deviceCommand){
boolean rsp= deviceCommandService.save(deviceCommand);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 删除
*/
@DeleteMapping("/deleteDeviceCommand/{id}")
public Result deleteDeviceCommand(@PathVariable Integer id){
boolean rsp= deviceCommandService.removeById(id);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 更新
*/
@PutMapping("/updateDeviceCommand")
public Result updateDeviceCommand(@RequestBody DeviceCommand deviceCommand){
boolean rsp= deviceCommandService.updateById(deviceCommand);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 分页查询
*/
@GetMapping("/getDeviceCommandList")
public Result pageList(DeviceCommand deviceCommand,@RequestParam(required = false,defaultValue = "1")Integer pageNo, @RequestParam(required = false,defaultValue = "10")Integer pageSize) {
return Result.success(Result.returnPageMap(deviceCommandService.pageList(deviceCommand,pageNo,pageSize)));
}
}

+ 73
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/controller/DeviceConfigDetailController.java View File

@ -0,0 +1,73 @@
package com.topsail.uartBackend.uart.controller;
import com.topsail.uartBackend.core.CodeMsg;
import com.topsail.uartBackend.uart.entity.DeviceCommand;
import com.topsail.uartBackend.uart.service.DeviceCommandService;
import com.topsail.uartBackend.uart.service.DeviceConfigDetailService;
import com.topsail.uartBackend.uart.entity.DeviceConfigDetail;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.topsail.uartBackend.core.Result;
import javax.annotation.Resource;
/**
*
* Created by lj on '2022-08-01 14:14:15'.
*/
@RestController
//@RequestMapping("/device-config-detail")
@RequestMapping("deviceConfigDetail")
public class DeviceConfigDetailController {
@Autowired
private DeviceConfigDetailService deviceConfigDetailService;
@Resource
private DeviceCommandService deviceCommandService;
/**
* 新增
*/
@PostMapping("/insertDeviceConfigDetail")
public Result insertDeviceConfigDetail( @RequestBody DeviceConfigDetail deviceConfigDetail){
boolean rsp= deviceConfigDetailService.save(deviceConfigDetail);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 删除
*/
@DeleteMapping("/deleteDeviceConfigDetail/{id}")
public Result deleteDeviceConfigDetail(@PathVariable Integer id){
deviceCommandService.deleteByDevice(id);
boolean rsp= deviceConfigDetailService.removeById(id);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 更新
*/
@PutMapping("/updateDeviceConfigDetail")
public Result updateDeviceConfigDetail(@RequestBody DeviceConfigDetail deviceConfigDetail){
boolean rsp= deviceConfigDetailService.updateById(deviceConfigDetail);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 分页查询
*/
@GetMapping("/getDeviceConfigDetailList")
public Result pageList(DeviceConfigDetail deviceConfigDetail,@RequestParam(required = false,defaultValue = "1")Integer pageNo, @RequestParam(required = false,defaultValue = "10")Integer pageSize) {
return Result.success(Result.returnPageMap(deviceConfigDetailService.pageList(deviceConfigDetail,pageNo,pageSize)));
}
}

+ 137
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/entity/CommandCollection.java View File

@ -0,0 +1,137 @@
package com.topsail.uartBackend.uart.entity;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 指令集合表
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CommandCollection implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id ;
/**
* 指令大类ID
*/
private Integer commandType ;
/**
* 大类名称
*/
private String typeName ;
/**
* 指令名称
*/
private String commandName ;
/**
* 具体指令一般为四位
*/
private String commandDetail ;
/**
* 指令参数格式
*/
private String commandFormat ;
/**
* 指令示例
*/
private String commandExample ;
/**
* 输入类型btn按钮input(输入框)select(固定值选择)
*/
private String inputType ;
/**
* 为固定值选择的时候需要获取选择内容key,value形式
*/
private String inputValue ;
/**
* 取值最小值
*/
private String minValue ;
/**
* 取值最大值
*/
private String maxValue ;
/**
* 取值单位
*/
private String valueUnit ;
/**
* 取值范围描述用于界面展示文字不应过多
*/
private String rangeDesc ;
/**
* 指令描述
*/
private String commandDesc ;
/**
* 备注
*/
private String commandMsg ;
/**
* 适用的设备描述
*/
private String adaptDevice ;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
private Date createTime ;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime ;
}

+ 175
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/entity/CommandDetail.java View File

@ -0,0 +1,175 @@
package com.topsail.uartBackend.uart.entity;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* VIEW
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CommandDetail implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 指令ID
*/
private Integer commandId ;
/**
* 详细设备ID
*/
private Integer deviceDetailId ;
private Integer dcId ;
/**
* 指令大类ID
*/
private Integer commandType ;
/**
* 大类名称
*/
private String typeName ;
/**
* 指令名称
*/
private String commandName ;
/**
* 具体指令一般为四位
*/
private String commandDetail ;
/**
* 指令参数格式
*/
private String commandFormat ;
/**
* 指令示例
*/
private String commandExample ;
/**
* 输入类型btn按钮input(输入框)select(固定值选择)
*/
private String inputType ;
/**
* 为固定值选择的时候需要获取选择内容key,value形式
*/
private String inputValue ;
/**
* 取值最小值
*/
private String minValue ;
/**
* 取值最大值
*/
private String maxValue ;
/**
* 取值单位
*/
private String valueUnit ;
/**
* 取值范围描述用于界面展示文字不应过多
*/
private String rangeDesc ;
/**
* 指令描述
*/
private String commandDesc ;
/**
* 备注
*/
private String commandMsg ;
/**
* 适用的设备描述
*/
private String adaptDevice ;
/**
* 该类型设备的详细名称
*/
private String deviceName ;
/**
* 硬件版本号
*/
private String hardVersion ;
/**
* 软件版本号
*/
private String softVersion ;
/**
* 所属设备类型
*/
private String deviceType ;
/**
* 是否为TOPOS 1()2()
*/
private String topOs ;
/**
* 通用蓝牙名称蓝牙名称-前的内容
*/
private String blueName ;
/**
* 蓝牙后数字位数
*/
private Integer blueNumSize ;
}

+ 49
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/entity/CommandType.java View File

@ -0,0 +1,49 @@
package com.topsail.uartBackend.uart.entity;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 指令大类
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CommandType implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id ;
/**
* 设备类型ID
*/
private Integer typeId ;
/**
* 设备类型名称
*/
private String typeName ;
private String msg ;
}

+ 49
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/entity/DeviceCommand.java View File

@ -0,0 +1,49 @@
package com.topsail.uartBackend.uart.entity;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 设备-指令 关联表
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class DeviceCommand implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id ;
/**
* 指令ID
*/
private Integer commandId ;
/**
* 详细设备ID
*/
private Integer deviceDetailId ;
private List<Integer>ids;
}

+ 89
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/entity/DeviceConfigDetail.java View File

@ -0,0 +1,89 @@
package com.topsail.uartBackend.uart.entity;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 所有类型设备的详细配置表
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class DeviceConfigDetail implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id ;
/**
* 该类型设备的详细名称
*/
private String deviceName ;
/**
* 硬件版本号
*/
private String hardVersion ;
/**
* 软件版本号
*/
private String softVersion ;
/**
* 所属设备类型
*/
private String deviceType ;
/**
* 是否为TOPOS 1()2()
*/
private String topOs ;
/**
* 通用蓝牙名称蓝牙名称-前的内容
*/
private String blueName ;
/**
* 蓝牙后数字位数
*/
private Integer blueNumSize ;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
private Date createTime ;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime ;
}

+ 18
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/mapper/CommandCollectionMapper.java View File

@ -0,0 +1,18 @@
package com.topsail.uartBackend.uart.mapper;
import com.topsail.uartBackend.uart.entity.CommandCollection;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 指令集合表 Mapper 接口
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Mapper
public interface CommandCollectionMapper extends BaseMapper<CommandCollection> {
}

+ 18
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/mapper/CommandDetailMapper.java View File

@ -0,0 +1,18 @@
package com.topsail.uartBackend.uart.mapper;
import com.topsail.uartBackend.uart.entity.CommandDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* VIEW Mapper 接口
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Mapper
public interface CommandDetailMapper extends BaseMapper<CommandDetail> {
}

+ 20
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/mapper/CommandTypeMapper.java View File

@ -0,0 +1,20 @@
package com.topsail.uartBackend.uart.mapper;
import com.topsail.uartBackend.uart.entity.CommandType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 指令大类 Mapper 接口
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Mapper
public interface CommandTypeMapper extends BaseMapper<CommandType> {
CommandType selectByTypeId(@Param("typeId")Integer typeId);
}

+ 20
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/mapper/DeviceCommandMapper.java View File

@ -0,0 +1,20 @@
package com.topsail.uartBackend.uart.mapper;
import com.topsail.uartBackend.uart.entity.DeviceCommand;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 设备-指令 关联表 Mapper 接口
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Mapper
public interface DeviceCommandMapper extends BaseMapper<DeviceCommand> {
//删除某个设备类型时调用
Boolean deleteByDevice(Integer deviceDetailId);
}

+ 18
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/mapper/DeviceConfigDetailMapper.java View File

@ -0,0 +1,18 @@
package com.topsail.uartBackend.uart.mapper;
import com.topsail.uartBackend.uart.entity.DeviceConfigDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 所有类型设备的详细配置表 Mapper 接口
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Mapper
public interface DeviceConfigDetailMapper extends BaseMapper<DeviceConfigDetail> {
}

+ 21
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/service/CommandCollectionService.java View File

@ -0,0 +1,21 @@
package com.topsail.uartBackend.uart.service;
import com.topsail.uartBackend.uart.entity.CommandCollection;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 指令集合表 服务类
* </p>
*
* @author lj
* @since 2022-08-01
*/
public interface CommandCollectionService extends IService<CommandCollection> {
/**
*分页查询
*/
public List<CommandCollection> pageList(CommandCollection commandCollection,Integer pageNo, Integer pageSize);
}

+ 21
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/service/CommandDetailService.java View File

@ -0,0 +1,21 @@
package com.topsail.uartBackend.uart.service;
import com.topsail.uartBackend.uart.entity.CommandDetail;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* VIEW 服务类
* </p>
*
* @author lj
* @since 2022-08-01
*/
public interface CommandDetailService extends IService<CommandDetail> {
/**
*分页查询
*/
public List<CommandDetail> pageList(CommandDetail commandDetail,Integer pageNo, Integer pageSize);
}

+ 23
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/service/CommandTypeService.java View File

@ -0,0 +1,23 @@
package com.topsail.uartBackend.uart.service;
import com.topsail.uartBackend.uart.entity.CommandType;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 指令大类 服务类
* </p>
*
* @author lj
* @since 2022-08-01
*/
public interface CommandTypeService extends IService<CommandType> {
/**
*分页查询
*/
public List<CommandType> pageList(CommandType commandType,Integer pageNo, Integer pageSize);
CommandType selectByTypeId(Integer typeId);
}

+ 31
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/service/DeviceCommandService.java View File

@ -0,0 +1,31 @@
package com.topsail.uartBackend.uart.service;
import com.topsail.uartBackend.uart.entity.DeviceCommand;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 设备-指令 关联表 服务类
* </p>
*
* @author lj
* @since 2022-08-01
*/
public interface DeviceCommandService extends IService<DeviceCommand> {
/**
*分页查询
*/
public List<DeviceCommand> pageList(DeviceCommand deviceCommand,Integer pageNo, Integer pageSize);
Boolean deleteByDevice(Integer deviceDetailId);
@Transactional
Boolean insertList(DeviceCommand deviceCommand);
@Transactional
Boolean updateList(List<DeviceCommand> deviceCommands);
}

+ 21
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/service/DeviceConfigDetailService.java View File

@ -0,0 +1,21 @@
package com.topsail.uartBackend.uart.service;
import com.topsail.uartBackend.uart.entity.DeviceConfigDetail;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 所有类型设备的详细配置表 服务类
* </p>
*
* @author lj
* @since 2022-08-01
*/
public interface DeviceConfigDetailService extends IService<DeviceConfigDetail> {
/**
*分页查询
*/
public List<DeviceConfigDetail> pageList(DeviceConfigDetail deviceConfigDetail,Integer pageNo, Integer pageSize);
}

+ 42
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/service/Impl/CommandCollectionServiceImpl.java View File

@ -0,0 +1,42 @@
package com.topsail.uartBackend.uart.service.Impl;
import com.topsail.uartBackend.uart.entity.CommandCollection;
import com.topsail.uartBackend.uart.mapper.CommandCollectionMapper;
import com.topsail.uartBackend.uart.service.CommandCollectionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.github.pagehelper.PageHelper;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* <p>
* 指令集合表 服务实现类
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Service
@Slf4j
public class CommandCollectionServiceImpl extends ServiceImpl<CommandCollectionMapper, CommandCollection> implements CommandCollectionService {
@Autowired
private CommandCollectionMapper commandCollectionMapper;
/**
*分页查询
*/
@Override
public List<CommandCollection> pageList(CommandCollection commandCollection,Integer pageNo, Integer pageSize) {
QueryWrapper<CommandCollection> wrapper = new QueryWrapper<>();
wrapper.setEntity(commandCollection);
PageHelper.startPage(pageNo,pageSize);
List<CommandCollection> list=list(wrapper);
return list;
}
}

+ 42
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/service/Impl/CommandDetailServiceImpl.java View File

@ -0,0 +1,42 @@
package com.topsail.uartBackend.uart.service.Impl;
import com.topsail.uartBackend.uart.entity.CommandDetail;
import com.topsail.uartBackend.uart.mapper.CommandDetailMapper;
import com.topsail.uartBackend.uart.service.CommandDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.github.pagehelper.PageHelper;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* <p>
* VIEW 服务实现类
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Service
@Slf4j
public class CommandDetailServiceImpl extends ServiceImpl<CommandDetailMapper, CommandDetail> implements CommandDetailService {
@Autowired
private CommandDetailMapper commandDetailMapper;
/**
*分页查询
*/
@Override
public List<CommandDetail> pageList(CommandDetail commandDetail,Integer pageNo, Integer pageSize) {
QueryWrapper<CommandDetail> wrapper = new QueryWrapper<>();
wrapper.setEntity(commandDetail);
PageHelper.startPage(pageNo,pageSize);
List<CommandDetail> list=list(wrapper);
return list;
}
}

+ 47
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/service/Impl/CommandTypeServiceImpl.java View File

@ -0,0 +1,47 @@
package com.topsail.uartBackend.uart.service.Impl;
import com.topsail.uartBackend.uart.entity.CommandType;
import com.topsail.uartBackend.uart.mapper.CommandTypeMapper;
import com.topsail.uartBackend.uart.service.CommandTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.github.pagehelper.PageHelper;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* <p>
* 指令大类 服务实现类
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Service
@Slf4j
public class CommandTypeServiceImpl extends ServiceImpl<CommandTypeMapper, CommandType> implements CommandTypeService {
@Autowired
private CommandTypeMapper commandTypeMapper;
/**
*分页查询
*/
@Override
public List<CommandType> pageList(CommandType commandType,Integer pageNo, Integer pageSize) {
QueryWrapper<CommandType> wrapper = new QueryWrapper<>();
wrapper.setEntity(commandType);
PageHelper.startPage(pageNo,pageSize);
List<CommandType> list=list(wrapper);
return list;
}
@Override
public CommandType selectByTypeId(Integer typeId){
return this.commandTypeMapper.selectByTypeId(typeId);
}
}

+ 83
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/service/Impl/DeviceCommandServiceImpl.java View File

@ -0,0 +1,83 @@
package com.topsail.uartBackend.uart.service.Impl;
import com.topsail.uartBackend.uart.entity.DeviceCommand;
import com.topsail.uartBackend.uart.mapper.DeviceCommandMapper;
import com.topsail.uartBackend.uart.service.DeviceCommandService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import com.github.pagehelper.PageHelper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
/**
* <p>
* 设备-指令 关联表 服务实现类
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Transactional
@Service
@Slf4j
public class DeviceCommandServiceImpl extends ServiceImpl<DeviceCommandMapper, DeviceCommand> implements DeviceCommandService {
@Autowired
private DeviceCommandMapper deviceCommandMapper;
/**
*分页查询
*/
@Override
public List<DeviceCommand> pageList(DeviceCommand deviceCommand,Integer pageNo, Integer pageSize) {
QueryWrapper<DeviceCommand> wrapper = new QueryWrapper<>();
wrapper.setEntity(deviceCommand);
PageHelper.startPage(pageNo,pageSize);
List<DeviceCommand> list=list(wrapper);
return list;
}
@Override
public Boolean deleteByDevice(Integer deviceDetailId){
return this.deviceCommandMapper.deleteByDevice(deviceDetailId);
}
@Override
@Transactional
public Boolean insertList( DeviceCommand deviceCommand){
DeviceCommand deviceCommand1 = new DeviceCommand();
if (null!= deviceCommand.getDeviceDetailId()){
deviceCommandMapper.deleteByDevice(deviceCommand.getDeviceDetailId());
if (deviceCommand.getIds().size()!=0){
deviceCommand.getIds().forEach(id->{
deviceCommand1.setCommandId(id);
deviceCommand1.setDeviceDetailId(deviceCommand.getDeviceDetailId());
deviceCommandMapper.insert(deviceCommand1);
});
}
}
return true;
}
@Override
@Transactional
public Boolean updateList(List<DeviceCommand> deviceCommands){
deviceCommands.forEach(deviceCommand -> {
deviceCommandMapper.deleteByDevice(deviceCommand.getDeviceDetailId());
deviceCommandMapper.insert(deviceCommand);
});
return true;
}
}

+ 42
- 0
uartBackend/src/main/java/com/topsail/uartBackend/uart/service/Impl/DeviceConfigDetailServiceImpl.java View File

@ -0,0 +1,42 @@
package com.topsail.uartBackend.uart.service.Impl;
import com.topsail.uartBackend.uart.entity.DeviceConfigDetail;
import com.topsail.uartBackend.uart.mapper.DeviceConfigDetailMapper;
import com.topsail.uartBackend.uart.service.DeviceConfigDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.github.pagehelper.PageHelper;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* <p>
* 所有类型设备的详细配置表 服务实现类
* </p>
*
* @author lj
* @since 2022-08-01
*/
@Service
@Slf4j
public class DeviceConfigDetailServiceImpl extends ServiceImpl<DeviceConfigDetailMapper, DeviceConfigDetail> implements DeviceConfigDetailService {
@Autowired
private DeviceConfigDetailMapper deviceConfigDetailMapper;
/**
*分页查询
*/
@Override
public List<DeviceConfigDetail> pageList(DeviceConfigDetail deviceConfigDetail,Integer pageNo, Integer pageSize) {
QueryWrapper<DeviceConfigDetail> wrapper = new QueryWrapper<>();
wrapper.setEntity(deviceConfigDetail);
PageHelper.startPage(pageNo,pageSize);
List<DeviceConfigDetail> list=list(wrapper);
return list;
}
}

+ 106
- 0
uartBackend/src/main/java/com/topsail/uartBackend/user/controller/UserController.java View File

@ -0,0 +1,106 @@
package com.topsail.uartBackend.user.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.topsail.uartBackend.core.CodeMsg;
import com.topsail.uartBackend.core.JwtUtil;
import com.topsail.uartBackend.user.service.UserService;
import com.topsail.uartBackend.user.entity.User;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.topsail.uartBackend.core.Result;
import java.util.HashMap;
import java.util.Map;
/**
*
* Created by pz on '2022-07-19 14:59:56'.
*/
@RestController
//@RequestMapping("/user")
@RequestMapping("user")
public class UserController {
@Autowired
private UserService userService;
/**
* 新增
*/
@PostMapping("/insertUser")
public Result insertUser( @RequestBody User user){
User newUser = new User();
if (null != user.getId() ){
newUser = userService.getOne(new QueryWrapper<>(user));
}
if (newUser == null){
return Result.error(new CodeMsg(502,"用户重复!"));
}
boolean rsp= userService.save(user);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 删除
*/
@DeleteMapping("/deleteUser/{id}")
public Result deleteUser(@PathVariable Integer id){
boolean rsp= userService.removeById(id);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 更新
*/
@PutMapping("/updateUser")
public Result updateUser(@RequestBody User user){
boolean rsp= userService.updateById(user);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 分页查询
*/
@GetMapping("/getUserList")
public Result pageList(User user,@RequestParam(required = false,defaultValue = "1")Integer pageNo, @RequestParam(required = false,defaultValue = "10")Integer pageSize) {
return Result.success(Result.returnPageMap(userService.pageList(user,pageNo,pageSize)));
}
/**
* 登录
* */
@PostMapping("/login")
public Result login(@RequestBody User user){
User newUser = new User();
if (null != user ){
newUser = userService.getOne(new QueryWrapper<>(user));
}else {
return Result.error(new CodeMsg(502,"登录失败,请检查账号或密码!"));
}
if (null == newUser){
return Result.error(new CodeMsg(502,"登录失败,请检查账号或密码!"));
}
String token = JwtUtil.getToken(user);
Map<String, Object> map = new HashMap<>();
map.put("token",token);
map.put("user",newUser);
if (2 == newUser.getStatus()){
return Result.error(new CodeMsg(502,"该账户暂停使用!"));
}
return Result.success(map);
}
}

+ 83
- 0
uartBackend/src/main/java/com/topsail/uartBackend/user/entity/User.java View File

@ -0,0 +1,83 @@
package com.topsail.uartBackend.user.entity;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 用户表
* </p>
*
* @author lj
* @since 2022-07-21
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id ;
/**
* 用户名
*/
private String userName ;
/**
* 别名
*/
private String anotherName ;
/**
* 密码
*/
private String password ;
/**
* 所属公司
*/
private String company ;
/**
* 角色ID
*/
private Integer roleId ;
/**
* 账号状态(1正常2暂停使用)
*/
private Integer status ;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
private Date createTime ;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime ;
}

+ 18
- 0
uartBackend/src/main/java/com/topsail/uartBackend/user/mapper/UserMapper.java View File

@ -0,0 +1,18 @@
package com.topsail.uartBackend.user.mapper;
import com.topsail.uartBackend.user.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 用户表 Mapper 接口
* </p>
*
* @author lj
* @since 2022-07-19
*/
@Mapper
public interface UserMapper extends BaseMapper<User> {
}

+ 42
- 0
uartBackend/src/main/java/com/topsail/uartBackend/user/service/Impl/UserServiceImpl.java View File

@ -0,0 +1,42 @@
package com.topsail.uartBackend.user.service.Impl;
import com.topsail.uartBackend.user.entity.User;
import com.topsail.uartBackend.user.mapper.UserMapper;
import com.topsail.uartBackend.user.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.github.pagehelper.PageHelper;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* <p>
* 用户表 服务实现类
* </p>
*
* @author lj
* @since 2022-07-19
*/
@Service
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
@Autowired
private UserMapper userMapper;
/**
*分页查询
*/
@Override
public List<User> pageList(User user,Integer pageNo, Integer pageSize) {
QueryWrapper<User> wrapper = new QueryWrapper<>();
wrapper.setEntity(user);
PageHelper.startPage(pageNo,pageSize);
List<User> list=list(wrapper);
return list;
}
}

+ 21
- 0
uartBackend/src/main/java/com/topsail/uartBackend/user/service/UserService.java View File

@ -0,0 +1,21 @@
package com.topsail.uartBackend.user.service;
import com.topsail.uartBackend.user.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 用户表 服务类
* </p>
*
* @author lj
* @since 2022-07-19
*/
public interface UserService extends IService<User> {
/**
*分页查询
*/
public List<User> pageList(User user,Integer pageNo, Integer pageSize);
}

+ 5
- 0
uartBackend/src/main/resources/application-prod.properties View File

@ -0,0 +1,5 @@
spring.datasource.url=jdbc:mysql://rm-2ze77qng1ddlfur9g4o.mysql.rds.aliyuncs.com:3306/bluetooth_uart?useUnicode=true&characterEncoding=UTF-8&useSSL=false
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=topsail
spring.datasource.password=Topsail2020

+ 19
- 0
uartBackend/src/main/resources/application.properties View File

@ -0,0 +1,19 @@
server.port=7425
spring.profiles.active=prod
spring.application.name=bluetooth-uart
#mybatis-plus
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
mybatis-plus.global-config.db-config.update-strategy=not_empty
mybatis-plus.global-config.db-config.select-strategy=not_empty
mybatis-plus.mapper-locations=classpath:mapper/*.xml
mybatis-plus.configuration.call-setters-on-nulls=true
#pagehelper
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
pagehelper.support-methods-arguments=true
pagehelper.params=count=countSql
spring.jackson.time-zone=GMT+8

+ 5
- 0
uartBackend/src/main/resources/mapper/CommandCollectionMapper.xml View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.topsail.uartBackend.uart.mapper.CommandCollectionMapper">
</mapper>

+ 5
- 0
uartBackend/src/main/resources/mapper/CommandDetailMapper.xml View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.topsail.uartBackend.uart.mapper.CommandDetailMapper">
</mapper>

+ 10
- 0
uartBackend/src/main/resources/mapper/CommandTypeMapper.xml View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.topsail.uartBackend.uart.mapper.CommandTypeMapper">
<select id="selectByTypeId" resultType="com.topsail.uartBackend.uart.entity.CommandType">
select * from command_type where type_id = #{typeId}
</select>
</mapper>

+ 9
- 0
uartBackend/src/main/resources/mapper/DeviceCommandMapper.xml View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.topsail.uartBackend.uart.mapper.DeviceCommandMapper">
<delete id="deleteByDevice">
delete from device_command where device_detail_id = #{deviceDetailId}
</delete>
</mapper>

+ 5
- 0
uartBackend/src/main/resources/mapper/DeviceConfigDetailMapper.xml View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.topsail.uartBackend.uart.mapper.DeviceConfigDetailMapper">
</mapper>

+ 5
- 0
uartBackend/src/main/resources/mapper/UserMapper.xml View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.topsail.uartBackend.user.mapper.UserMapper">
</mapper>

+ 66
- 0
uartBackend/src/main/resources/templates/controller.ftl View File

@ -0,0 +1,66 @@
package ${package.Controller};
import com.topsail.uartBackend.core.CodeMsg;
import ${package.Service}.${table.serviceName};
import ${package.Entity}.${entity};
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.topsail.uartBackend.core.Result;
/**
*
* Created by pz on '${.now?string('yyyy-MM-dd HH:mm:ss')}'.
*/
@RestController
//@RequestMapping("<#if package.ModuleName??>/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
@RequestMapping("${entity?uncap_first}")
public class ${entity}Controller {
@Autowired
private ${entity}Service ${entity?uncap_first}Service;
/**
* 新增
*/
@PostMapping("/insert${entity}")
public Result insert${entity}( @RequestBody ${entity} ${entity?uncap_first}){
boolean rsp= ${entity?uncap_first}Service.save(${entity?uncap_first});
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 删除
*/
@DeleteMapping("/delete${entity}/{id}")
public Result delete${entity}(@PathVariable Integer id){
boolean rsp= ${entity?uncap_first}Service.removeById(id);
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 更新
*/
@PutMapping("/update${entity}")
public Result update${entity}(@RequestBody ${entity} ${entity?uncap_first}){
boolean rsp= ${entity?uncap_first}Service.updateById(${entity?uncap_first});
return rsp?Result.success("成功"):Result.error(new CodeMsg(502,"失败"));
}
/**
* 分页查询
*/
@GetMapping("/get${entity}List")
public Result pageList(${entity} ${entity?uncap_first},@RequestParam(required = false,defaultValue = "1")Integer pageNo, @RequestParam(required = false,defaultValue = "10")Integer pageSize) {
return Result.success(Result.returnPageMap(${entity?uncap_first}Service.pageList(${entity?uncap_first},pageNo,pageSize)));
}
}

+ 170
- 0
uartBackend/src/main/resources/templates/entity.ftl View File

@ -0,0 +1,170 @@
package ${package.Entity};
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.FieldFill;
<#list table.importPackages as pkg>
import ${pkg};
</#list>
<#if swagger2>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
</#if>
<#if entityLombokModel>
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
</#if>
/**
* <p>
* ${table.comment!}
* </p>
*
* @author ${author}
* @since ${date}
*/
<#if entityLombokModel>
@Data
<#if superEntityClass??>
@EqualsAndHashCode(callSuper = true)
<#else>
@EqualsAndHashCode(callSuper = false)
</#if>
@Accessors(chain = true)
</#if>
<#if table.convert>
@TableName("${table.name}")
</#if>
<#if swagger2>
@ApiModel(value="${entity}对象", description="${table.comment!}")
</#if>
<#if superEntityClass??>
public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
<#elseif activeRecord>
public class ${entity} extends Model<${entity}> {
<#else>
public class ${entity} implements Serializable {
</#if>
<#if entitySerialVersionUID>
private static final long serialVersionUID = 1L;
</#if>
<#-- ---------- BEGIN 字段循环遍历 ---------->
<#list table.fields as field>
<#if field.keyFlag>
<#assign keyPropertyName="${field.propertyName}"/>
</#if>
<#if field.comment!?length gt 0>
<#if swagger2>
@ApiModelProperty(value = "${field.comment}")
<#else>
/**
* ${field.comment}
*/
</#if>
</#if>
<#if field.keyFlag>
<#-- 主键 -->
<#if field.keyIdentityFlag>
@TableId(value = "${field.name}", type = IdType.AUTO)
<#elseif idType??>
@TableId(value = "${field.name}", type = IdType.${idType})
<#elseif field.convert>
@TableId("${field.name}")
</#if>
<#-- 普通字段 -->
<#elseif field.fill??>
<#-- ----- 存在字段填充设置 ----->
<#if field.convert>
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
<#else>
@TableField(fill = FieldFill.${field.fill})
</#if>
<#elseif field.convert>
@TableField("${field.name}")
</#if>
<#-- 乐观锁注解 -->
<#if (versionFieldName!"") == field.name>
@Version
</#if>
<#-- 逻辑删除注解 -->
<#if (logicDeleteFieldName!"") == field.name>
@TableLogic
</#if>
<#-- 时间类型处理-->
<#if (field.propertyType) == "LocalDateTime">
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
<#if (field.propertyName) == "createTime">
@TableField(fill = FieldFill.INSERT)
</#if>
<#if (field.propertyName) == "updateTime">
@TableField(fill = FieldFill.INSERT_UPDATE)
</#if>
private Date ${field.propertyName} ;
<#else>
private ${field.propertyType} ${field.propertyName} ;
</#if>
</#list>
<#------------ END 字段循环遍历 ---------->
<#if !entityLombokModel>
<#list table.fields as field>
<#if field.propertyType == "boolean">
<#assign getprefix="is"/>
<#else>
<#assign getprefix="get"/>
</#if>
public ${field.propertyType} ${getprefix}${field.capitalName}() {
return ${field.propertyName};
}
<#if entityBuilderModel>
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
<#else>
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
</#if>
this.${field.propertyName} = ${field.propertyName};
<#if entityBuilderModel>
return this;
</#if>
}
</#list>
</#if>
<#if entityColumnConstant>
<#list table.fields as field>
public static final String ${field.name?upper_case} = "${field.name}";
</#list>
</#if>
<#if activeRecord>
@Override
protected Serializable pkVal() {
<#if keyPropertyName??>
return this.${keyPropertyName};
<#else>
return null;
</#if>
}
</#if>
<#if !entityLombokModel>
@Override
public String toString() {
return "${entity}{" +
<#list table.fields as field>
<#if field_index==0>
"${field.propertyName}=" + ${field.propertyName} +
<#else>
", ${field.propertyName}=" + ${field.propertyName} +
</#if>
</#list>
"}";
}
</#if>
}

+ 22
- 0
uartBackend/src/main/resources/templates/mapper.ftl View File

@ -0,0 +1,22 @@
package ${package.Mapper};
import ${package.Entity}.${entity};
import ${superMapperClassPackage};
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* ${table.comment!} Mapper 接口
* </p>
*
* @author ${author}
* @since ${date}
*/
<#if kotlin>
interface ${table.mapperName} : ${superMapperClass}<${entity}>
<#else>
@Mapper
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
}
</#if>

+ 25
- 0
uartBackend/src/main/resources/templates/service.ftl View File

@ -0,0 +1,25 @@
package ${package.Service};
import ${package.Entity}.${entity};
import ${superServiceClassPackage};
import java.util.List;
/**
* <p>
* ${table.comment!} 服务类
* </p>
*
* @author ${author}
* @since ${date}
*/
<#if kotlin>
interface ${table.serviceName} : ${superServiceClass}<${entity}>
<#else>
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
/**
*分页查询
*/
public List<${entity}> pageList(${entity} ${entity?uncap_first},Integer pageNo, Integer pageSize);
}
</#if>

+ 48
- 0
uartBackend/src/main/resources/templates/serviceImpl.ftl View File

@ -0,0 +1,48 @@
package ${package.ServiceImpl};
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.github.pagehelper.PageHelper;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* <p>
* ${table.comment!} 服务实现类
* </p>
*
* @author ${author}
* @since ${date}
*/
@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
}
<#else>
@Slf4j
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
@Autowired
private ${entity}Mapper ${entity?uncap_first}Mapper;
/**
*分页查询
*/
@Override
public List<${entity}> pageList(${entity} ${entity?uncap_first},Integer pageNo, Integer pageSize) {
QueryWrapper<${entity}> wrapper = new QueryWrapper<>();
wrapper.setEntity(${entity?uncap_first});
PageHelper.startPage(pageNo,pageSize);
List<${entity}> list=list(wrapper);
return list;
}
}
</#if>

+ 5
- 0
uartBackend/target/classes/application-prod.properties View File

@ -0,0 +1,5 @@
spring.datasource.url=jdbc:mysql://rm-2ze77qng1ddlfur9g4o.mysql.rds.aliyuncs.com:3306/bluetooth_uart?useUnicode=true&characterEncoding=UTF-8&useSSL=false
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=topsail
spring.datasource.password=Topsail2020

+ 19
- 0
uartBackend/target/classes/application.properties View File

@ -0,0 +1,19 @@
server.port=7425
spring.profiles.active=prod
spring.application.name=bluetooth-uart
#mybatis-plus
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
mybatis-plus.global-config.db-config.update-strategy=not_empty
mybatis-plus.global-config.db-config.select-strategy=not_empty
mybatis-plus.mapper-locations=classpath:mapper/*.xml
mybatis-plus.configuration.call-setters-on-nulls=true
#pagehelper
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
pagehelper.support-methods-arguments=true
pagehelper.params=count=countSql
spring.jackson.time-zone=GMT+8

BIN
uartBackend/target/classes/com/topsail/uartBackend/CodeGenerator$1.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/CodeGenerator$2.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/CodeGenerator$3.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/CodeGenerator.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/UartBackendApplication.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/config/GlobalException.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/config/Interceptor.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/config/InterceptorConfig.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/config/MybatisObjectHandler.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/core/CodeMsg.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/core/JwtUtil.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/core/Result.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/controller/CommandCollectionController.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/controller/CommandDetailController.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/controller/CommandTypeController.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/controller/DeviceCommandController.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/controller/DeviceConfigDetailController.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/entity/CommandCollection.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/entity/CommandDetail.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/entity/CommandType.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/entity/DeviceCommand.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/entity/DeviceConfigDetail.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/mapper/CommandCollectionMapper.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/mapper/CommandDetailMapper.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/mapper/CommandTypeMapper.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/mapper/DeviceCommandMapper.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/mapper/DeviceConfigDetailMapper.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/service/CommandCollectionService.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/service/CommandDetailService.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/service/CommandTypeService.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/service/DeviceCommandService.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/service/DeviceConfigDetailService.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/service/Impl/CommandCollectionServiceImpl.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/service/Impl/CommandDetailServiceImpl.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/service/Impl/CommandTypeServiceImpl.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/service/Impl/DeviceCommandServiceImpl.class View File


BIN
uartBackend/target/classes/com/topsail/uartBackend/uart/service/Impl/DeviceConfigDetailServiceImpl.class View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save