2026-4-30:

1.后端代码2次更新
This commit is contained in:
朱春声99
2026-04-30 15:25:01 +08:00
parent 05770f7e56
commit 7f5211c703
68 changed files with 1970 additions and 734 deletions

View File

@@ -4,51 +4,422 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="d47bc58e-d36b-422c-92c6-393c467a25d3" name="Changes" comment="" /> <list default="true" id="d0fd3201-c24b-42c5-bb37-4c67b6c0d2a1" name="Changes" comment="2026-4-30: &#10;1.后端代码初始化">
<change beforePath="$PROJECT_DIR$/.gitattributes" beforeDir="false" afterPath="$PROJECT_DIR$/.gitattributes" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HELP.md" beforeDir="false" afterPath="$PROJECT_DIR$/HELP.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/LICENSE" beforeDir="false" afterPath="$PROJECT_DIR$/LICENSE" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mvnw.cmd" beforeDir="false" afterPath="$PROJECT_DIR$/mvnw.cmd" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/.mvn/wrapper/maven-wrapper.properties" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/.mvn/wrapper/maven-wrapper.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/RcznAdminApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/RcznAdminApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/config/CorsConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/config/CorsConfig.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/controller/ManageLogController.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/controller/RoleController.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/controller/RoleController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/controller/UserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/controller/UserController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/domain/ManageLog.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/domain/Permission.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/domain/Permission.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/mapper/ManageLogMapper.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/mapper/UserMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/mapper/UserMapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/service/ManageLogService.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/service/UserRoleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/service/UserRoleService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/service/UserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/service/UserService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/service/impl/ManageLogServiceImpl.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/service/impl/UserRoleServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/service/impl/UserRoleServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/service/impl/UserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/java/com/rczn/system/service/impl/UserServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/resources/application.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/resources/mapper/ManageLogMapper.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-admin/src/main/resources/mapper/UserMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-admin/src/main/resources/mapper/UserMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/.mvn/wrapper/maven-wrapper.properties" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/.mvn/wrapper/maven-wrapper.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/DevInfoController.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/DevInfoController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/DevParamController.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/DevParamController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/FlowInfoController.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/FlowInfoController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/GoodsFlowStatusController.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/GoodsFlowStatusController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/GoodsInfoController.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/GoodsInfoController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/StepInfoController.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/controller/StepInfoController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/DevInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/DevInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/DevParam.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/DevParam.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/GoodsFlowStatus.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/GoodsFlowStatus.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/GoodsInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/GoodsInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/IslandInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/IslandInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/IslandParam.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/IslandParam.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/StepInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/domain/StepInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/DevInfoMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/DevInfoMapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/DevParamMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/DevParamMapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/GoodsFlowStatusMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/GoodsFlowStatusMapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/GoodsInfoMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/GoodsInfoMapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/IslandInfoMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/IslandInfoMapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/StepInfoMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/mapper/StepInfoMapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/DevInfoService.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/DevInfoService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/DevParamService.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/DevParamService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/GoodsFlowStatusService.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/GoodsFlowStatusService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/GoodsInfoService.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/GoodsInfoService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/IslandInfoService.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/IslandInfoService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/StepInfoService.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/StepInfoService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/DevInfoServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/DevInfoServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/DevParamServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/DevParamServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/FlowInfoServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/FlowInfoServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/GoodsFlowStatusServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/GoodsFlowStatusServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/GoodsInfoServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/GoodsInfoServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/IslandInfoServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/IslandInfoServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/StepInfoServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/StepInfoServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/application-autoplc.yml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/application-autoplc.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/DevInfoMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/DevInfoMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/DevParamMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/DevParamMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/GoodsFlowStatusMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/GoodsFlowStatusMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/GoodsInfoMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/GoodsInfoMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/IslandInfoMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/IslandInfoMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/StepInfoMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper/StepInfoMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-common/.mvn/wrapper/maven-wrapper.properties" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-common/.mvn/wrapper/maven-wrapper.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-common/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-common/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-common/src/main/java/com/rczn/domain/BaseBean.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-common/src/main/java/com/rczn/domain/BaseBean.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-common/src/main/java/com/rczn/interceptors/LoginInterceptor.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-common/src/main/java/com/rczn/interceptors/LoginInterceptor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-common/src/main/java/com/rczn/utils/JwtUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-common/src/main/java/com/rczn/utils/JwtUtil.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rczn-common/src/main/resources/application-common.yml" beforeDir="false" afterPath="$PROJECT_DIR$/rczn-common/src/main/resources/application-common.yml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" /> <option name="LAST_RESOLUTION" value="IGNORE" />
</component> </component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Interface" />
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
</component> </component>
<component name="HighlightingSettingsPerFile">
<setting file="jar://$PROJECT_DIR$/../../../../maven/maven-respository/org/springframework/spring-web/6.1.15/spring-web-6.1.15.jar!/org/springframework/web/method/support/InvocableHandlerMethod.class" root0="SKIP_INSPECTION" />
</component>
<component name="MarkdownSettingsMigration"> <component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" /> <option name="stateVersion" value="1" />
</component> </component>
<component name="MavenImportPreferences"> <component name="MavenImportPreferences">
<option name="generalSettings"> <option name="generalSettings">
<MavenGeneralSettings> <MavenGeneralSettings>
<option name="mavenHome" value="$PROJECT_DIR$/../../../../maven/apache-maven-3.9.11" />
<option name="useMavenConfig" value="true" /> <option name="useMavenConfig" value="true" />
</MavenGeneralSettings> </MavenGeneralSettings>
</option> </option>
</component> </component>
<component name="ProjectId" id="37uy9ngFoDUVUddX8Yg9afHWRsn" /> <component name="MavenRunner">
<option name="skipTests" value="true" />
</component>
<component name="ProjectId" id="3707TWyPVcU9zg4vikGKPT5UCfw" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent"><![CDATA[{
"keyToString": { "keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true", "RequestMappingsPanelOrder0": "0",
"RequestMappingsPanelOrder1": "1",
"RequestMappingsPanelWidth0": "75",
"RequestMappingsPanelWidth1": "75",
"RunOnceActivity.ShowReadmeOnStart": "true", "RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false", "WebServerToolWindowFactoryState": "false",
"last_opened_file_path": "D:/java-work/融创智能PLC后台系统/RCZN-bs-program/rc_autoplc_backend/rczn-autoplc/src/main/resources/com/rczn/rcznautoplc/mapper",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"project.structure.last.edited": "SDKs",
"project.structure.proportion": "0.0",
"project.structure.side.proportion": "0.2",
"settings.editor.selected.configurable": "ai.codegeex.plugin.settings.ApplicationConfigurable",
"spring.configuration.checksum": "23e183287596c71f060f4e02bc43279b",
"ts.external.directory.path": "D:\\JetBrains\\IntelliJ IDEA 2023.1.7\\plugins\\javascript-impl\\jsLanguageServicesImpl\\external",
"vue.rearranger.settings.migration": "true" "vue.rearranger.settings.migration": "true"
} }
}]]></component> }]]></component>
<component name="ReactorSettings">
<option name="notificationShown" value="true" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\java-work\融创智能PLC后台系统\RCZN-bs-program\rc_autoplc_backend\rczn-autoplc\src\main\resources\com\rczn\rcznautoplc\mapper" />
<recent name="D:\java-work\融创智能PLC后台系统\RCZN-bs-program\rc_autoplc_backend\rczn-autoplc\src\main\java\com\rczn\rcznautoplc\domain\query" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\java-work\融创智能PLC后台系统\RCZN-bs-program\rc_autoplc_backend\rczn-autoplc\src\main\resources\com\rczn\rcznautoplc\mapper" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="com.rczn.rcznautoplc.domain" />
<recent name="com.rczn.rcznautoplc.service.impl" />
<recent name="com.rczn.rcznautoplc.service" />
<recent name="com.rczn.rcznautoplc.mapper" />
<recent name="com.rczn.rcznautoplc.controller" />
</key>
</component>
<component name="RunManager" selected="Spring Boot.RcznAdminApplication">
<configuration name="JwtUtil" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.rczn.utils.JwtUtil" />
<module name="rczn-common" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.rczn.utils.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Modbus4jUtils" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.rczn.modbus.Modbus4jUtils" />
<module name="rczn-common" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.rczn.modbus.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Modbus4jWriteUtils" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.rczn.modbus.Modbus4jWriteUtils" />
<module name="rczn-common" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.rczn.modbus.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="S7ConnectorPLC" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.rczn.plc_common.S7ConnectorPLC" />
<module name="rczn-common" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.rczn.plc_common.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TestCrc" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.rczn.task.TestCrc" />
<module name="rczn-common" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.rczn.task.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="RcznAdminApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
<module name="rczn-admin" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.rczn.RcznAdminApplication" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.JwtUtil" />
<item itemvalue="Application.TestCrc" />
<item itemvalue="Application.Modbus4jUtils" />
<item itemvalue="Application.Modbus4jWriteUtils" />
<item itemvalue="Application.S7ConnectorPLC" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager"> <component name="TaskManager">
<task active="true" id="Default" summary="Default task"> <task active="true" id="Default" summary="Default task">
<changelist id="d47bc58e-d36b-422c-92c6-393c467a25d3" name="Changes" comment="" /> <changelist id="d0fd3201-c24b-42c5-bb37-4c67b6c0d2a1" name="Changes" comment="" />
<created>1767767108230</created> <created>1766028143842</created>
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1767767108230</updated> <updated>1766028143842</updated>
<workItem from="1767767109651" duration="29000" /> <workItem from="1766028145530" duration="1451000" />
<workItem from="1766283894830" duration="62098000" />
<workItem from="1767753537413" duration="7970000" />
<workItem from="1767837865719" duration="63223000" />
<workItem from="1768545986983" duration="5686000" />
<workItem from="1768557683334" duration="399000" />
<workItem from="1768785585157" duration="608000" />
<workItem from="1768788802002" duration="7627000" />
<workItem from="1768894409522" duration="5762000" />
<workItem from="1768981335702" duration="2838000" />
<workItem from="1769071137917" duration="56137000" />
<workItem from="1769668157112" duration="28669000" />
<workItem from="1770189931161" duration="16330000" />
<workItem from="1770604190510" duration="33082000" />
<workItem from="1772499058397" duration="12045000" />
<workItem from="1772675300746" duration="17945000" />
<workItem from="1772757983648" duration="26817000" />
<workItem from="1773114361015" duration="25986000" />
<workItem from="1773201905058" duration="30316000" />
<workItem from="1773732191322" duration="24649000" />
<workItem from="1774492653648" duration="11932000" />
<workItem from="1774661220243" duration="2808000" />
<workItem from="1774831784250" duration="14488000" />
<workItem from="1775538246002" duration="14583000" />
<workItem from="1776302804897" duration="29985000" />
<workItem from="1776997692867" duration="18517000" />
<workItem from="1777532907631" duration="956000" />
</task> </task>
<task id="LOCAL-00001" summary="新曾业务bean和相关数据持久化controller restful 接口">
<option name="closed" value="true" />
<created>1766713813139</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1766713813139</updated>
</task>
<task id="LOCAL-00002" summary="新曾业务bean和相关数据持久化controller restful 接口">
<option name="closed" value="true" />
<created>1767508525605</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1767508525605</updated>
</task>
<task id="LOCAL-00003" summary="2026-1-12 : 完善样品表字段,和样品状态信息关联表结构,相关接口:增加,删除,不同查询方法,更新数据,关联查询等接口;数据持久化和视图查询">
<option name="closed" value="true" />
<created>1768210652081</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1768210652081</updated>
</task>
<task id="LOCAL-00004" summary="2026-1-16:增加用户认证jwt模块plc模块">
<option name="closed" value="true" />
<created>1768551076373</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1768551076373</updated>
</task>
<task id="LOCAL-00005" summary="2026-3-12: &#10;1.增加获取主plc状态对象接口&#10;2.确定样品+sop协议下发&#10;3.确定样品处理状态数据协议;&#10;4.从plc读取样品数据&#10;5.从plc读取样品处理状态数据">
<option name="closed" value="true" />
<created>1773295839395</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1773295839395</updated>
</task>
<task id="LOCAL-00006" summary="2026-4-20: &#10;1.增加权限管理对应接口实现">
<option name="closed" value="true" />
<created>1776670763874</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1776670763874</updated>
</task>
<task id="LOCAL-00007" summary="2026-4-20: &#10;1.增加权限管理对应接口实现">
<option name="closed" value="true" />
<created>1777527998835</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1777527998835</updated>
</task>
<task id="LOCAL-00008" summary="2026-4-20: &#10;1.测试TestCrc.java">
<option name="closed" value="true" />
<created>1777528107141</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1777528107141</updated>
</task>
<task id="LOCAL-00009" summary="2026-4-30: &#10;1.后端代码初始化">
<option name="closed" value="true" />
<created>1777533044176</created>
<option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" />
<updated>1777533044176</updated>
</task>
<option name="localTasksCounter" value="10" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="Vcs.Log.Tabs.Properties">
<option name="OPEN_GENERIC_TABS">
<map>
<entry key="5c2f062d-6d46-4784-979c-c347fc700e30" value="TOOL_WINDOW" />
</map>
</option>
<option name="TAB_STATES">
<map>
<entry key="5c2f062d-6d46-4784-979c-c347fc700e30">
<value>
<State>
<option name="FILTERS">
<map>
<entry key="branch">
<value>
<list>
<option value="HEAD" />
</list>
</value>
</entry>
<entry key="structure">
<value>
<list>
<option value="dir:D:/java-work/融创智能PLC后台系统/RCZN-bs-program/rc_autoplc_backend" />
</list>
</value>
</entry>
</map>
</option>
<option name="SHOW_ONLY_AFFECTED_CHANGES" value="true" />
</State>
</value>
</entry>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="新曾业务bean和相关数据持久化controller restful 接口" />
<MESSAGE value="2026-1-12 : 完善样品表字段,和样品状态信息关联表结构,相关接口:增加,删除,不同查询方法,更新数据,关联查询等接口;数据持久化和视图查询" />
<MESSAGE value="2026-1-16:增加用户认证jwt模块plc模块" />
<MESSAGE value="2026-3-12: &#10;1.增加获取主plc状态对象接口&#10;2.确定样品+sop协议下发&#10;3.确定样品处理状态数据协议;&#10;4.从plc读取样品数据&#10;5.从plc读取样品处理状态数据" />
<MESSAGE value="2026-4-20: &#10;1.增加权限管理对应接口实现" />
<MESSAGE value="2026-4-20: &#10;1.测试TestCrc.java" />
<MESSAGE value="2026-4-30: &#10;1.后端代码初始化" />
<option name="LAST_COMMIT_MESSAGE" value="2026-4-30: &#10;1.后端代码初始化" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/rczn-autoplc/src/main/java/com/rczn/rcznautoplc/service/impl/GoodsInfoServiceImpl.java</url>
<line>86</line>
<option name="timeStamp" value="21" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project> </project>

View File

@@ -85,16 +85,16 @@ distribution (with or without modification), making available to the
public, and in some countries other activities as well. public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through parties to make or receive copies. Mere interaction with a userBusy through
a computer network, with no transfer of a copy, is not conveying. a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices" An interactive userBusy interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2) feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the tells the userBusy that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a the interface presents a list of userBusy commands or options, such as a
menu, a prominent item in the list meets this criterion. menu, a prominent item in the list meets this criterion.
1. Source Code. 1. Source Code.
@@ -215,7 +215,7 @@ terms of section 4, provided that you also meet all of these conditions:
permission to license the work in any other way, but it does not permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it. invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display d) If the work has interactive userBusy interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your interfaces that do not display Appropriate Legal Notices, your
work need not make them do so. work need not make them do so.
@@ -287,9 +287,9 @@ tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product, into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a product received by a particular userBusy, "normally used" refers to a
typical or common use of that class of product, regardless of the status typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user of the particular userBusy or of the way in which the particular userBusy
actually uses, or expects or is expected to use, the product. A product actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent commercial, industrial or non-consumer uses, unless such uses represent

View File

@@ -35,3 +35,8 @@
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
#### 增加日志生成:
1. 2026-4-3用户登录日志信息
2. 2026-4-3SOP用户操作日志信息
3. 2026-4-3基础数据功能岛、SOP序列用户操作增-删-改)日志

View File

@@ -23,7 +23,7 @@
@REM @REM
@REM Optional ENV vars @REM Optional ENV vars
@REM MVNW_REPOURL - repo url base for downloading maven distribution @REM MVNW_REPOURL - repo url base for downloading maven distribution
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven @REM MVNW_USERNAME/MVNW_PASSWORD - userBusy and password for downloading maven
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
@REM ---------------------------------------------------------------------------- @REM ----------------------------------------------------------------------------

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.12</version> <version>3.2.12</version>
<relativePath/> <relativePath/>
</parent> </parent>
@@ -30,6 +30,7 @@
<jwt.version>4.4.0</jwt.version> <jwt.version>4.4.0</jwt.version>
<knife4j.version>4.5.0</knife4j.version> <knife4j.version>4.5.0</knife4j.version>
<jakarta.servlet-api.version>6.0.0</jakarta.servlet-api.version> <jakarta.servlet-api.version>6.0.0</jakarta.servlet-api.version>
<lombok.version>1.18.30</lombok.version>
</properties> </properties>
<!-- 使用 dependencyManagement 管理项目特定版本 --> <!-- 使用 dependencyManagement 管理项目特定版本 -->
@@ -75,6 +76,34 @@
<version>${jakarta.servlet-api.version}</version> <version>${jakarta.servlet-api.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- 在父模块的 dependencyManagement 中添加 -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.15.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.github.s7connector</groupId>
<artifactId>s7connector</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.12.0</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@@ -84,6 +113,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration> <configuration>
<source>${java.version}</source> <source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
@@ -92,6 +122,7 @@
<path> <path>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path> </path>
</annotationProcessorPaths> </annotationProcessorPaths>
</configuration> </configuration>

View File

@@ -67,6 +67,12 @@
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>org.springdoc</groupId>-->
<!-- <artifactId>springdoc-openapi-starter-common</artifactId>-->
<!-- <version>2.3.0</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<!-- 工具类 --> <!-- 工具类 -->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
@@ -79,10 +85,7 @@
<groupId>com.auth0</groupId> <groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId> <artifactId>java-jwt</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId> <artifactId>pagehelper-spring-boot-starter</artifactId>
@@ -92,6 +95,12 @@
<artifactId>jackson-datatype-jsr310</artifactId> <artifactId>jackson-datatype-jsr310</artifactId>
</dependency> </dependency>
<!-- modbus4j 核心依赖Java8+Spring Boot2/3均兼容 -->
<!-- <dependency>-->
<!-- <groupId>com.infiniteautomation</groupId>-->
<!-- <artifactId>modbus4j</artifactId>-->
<!-- <version>3.0.3</version>-->
<!-- </dependency>-->
<!-- 测试依赖 --> <!-- 测试依赖 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

View File

@@ -3,9 +3,11 @@ package com.rczn;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
@ComponentScan(value = "com.rczn.*") @ComponentScan(value = "com.rczn.*")
@EnableScheduling
public class RcznAdminApplication { public class RcznAdminApplication {
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -1,6 +1,10 @@
package com.rczn.config; package com.rczn.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -17,4 +21,25 @@ public class CorsConfig implements WebMvcConfigurer {
.allowCredentials(true) // 允许携带Cookie .allowCredentials(true) // 允许携带Cookie
.maxAge(3600); // 预检请求缓存1小时 .maxAge(3600); // 预检请求缓存1小时
} }
@Bean
public CorsFilter corsFilter() {
CorsConfiguration config = new CorsConfiguration();
// 1. 允许前端源(不要用*和withCredentials=true配合需指定具体源或用allowedOriginPatterns
config.addAllowedOriginPattern("*");
// 2. 允许携带凭证和前端withCredentials=true对应
config.setAllowCredentials(true);
// 3. 允许所有请求方法包含OPTIONS
config.addAllowedMethod("*");
// 4. 允许所有请求头包含Authorization
config.addAllowedHeader("*");
// 5. 预检请求缓存时间减少OPTIONS请求次数
config.setMaxAge(3600L);
// 配置生效路径
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
} }

View File

@@ -1,115 +0,0 @@
package com.rczn.controller;
import com.rczn.domain.PageBean;
import com.rczn.domain.Result;
import com.rczn.system.domain.ManageLog;
import com.rczn.system.service.ManageLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
@RestController
@RequestMapping("/manage-log")
@Tag(name = "操作日志管理", description = "操作日志增删改查+分页查询接口")
public class ManageLogController {
@Autowired
private ManageLogService manageLogService;
/**
* 分页查询日志
*/
@GetMapping(value = "/listPage", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "分页查询操作日志", description = "支持多条件筛选,空条件自动忽略")
@Parameters({
@Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY),
@Parameter(name = "logName", description = "日志名称(可选,模糊查询)", required = false, example = "登录操作", in = ParameterIn.QUERY),
@Parameter(name = "logType", description = "日志类型(可选,精准查询)", required = false, example = "LOGIN", in = ParameterIn.QUERY),
@Parameter(name = "createId", description = "创建人ID可选", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "logWritetimeStart", description = "日志开始时间可选格式yyyy-MM-dd HH:mm:ss", required = false, example = "2025-01-01 00:00:00", in = ParameterIn.QUERY),
@Parameter(name = "logWritetimeEnd", description = "日志结束时间可选格式yyyy-MM-dd HH:mm:ss", required = false, example = "2025-12-31 23:59:59", in = ParameterIn.QUERY)
})
public Result<PageBean<ManageLog>> getLogPage(
@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam(required = false) String logName,
@RequestParam(required = false) String logType,
@RequestParam(required = false) Long createId,
@RequestParam(required = false) LocalDateTime logWritetimeStart,
@RequestParam(required = false) LocalDateTime logWritetimeEnd) {
// 构建查询条件(空字段自动忽略)
ManageLog query = new ManageLog();
query.setLogName(logName);
query.setLogType(logType);
query.setCreateId(createId);
// 扩展字段用于时间范围查询实体类无需新增字段MyBatis 支持直接取参)
query.setStartTime(logWritetimeStart); // 实际用 logWritetimeStart这里仅为传递参数
query.setEndTime(logWritetimeEnd);
PageBean<ManageLog> pageBean = manageLogService.selectPage(pageNum, pageSize, query);
return Result.success(pageBean);
}
/**
* 按 ID 查询日志
*/
@GetMapping(value = "/getById/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询单个操作日志", description = "按日志ID查询详情")
public Result getLogById(@PathVariable Long id) {
ManageLog log = manageLogService.selectById(id);
return log != null ? Result.success(log) : Result.error("日志不存在或已删除");
}
/**
* 新增操作日志
*/
@PostMapping(value = "/add", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "新增操作日志", description = "日志名称、类型为必填项,其他字段可选")
public Result addLog(@RequestBody ManageLog manageLog) {
try {
Long logId = manageLogService.insert(manageLog);
return Result.success("日志新增成功");
} catch (IllegalArgumentException e) {
return Result.error(e.getMessage());
}
}
/**
* 更新操作日志
*/
@PutMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "更新操作日志", description = "需传入日志ID其他字段非空则更新")
public Result updateLog(@RequestBody ManageLog manageLog) {
try {
Boolean success = manageLogService.update(manageLog);
return success ? Result.success( "日志更新成功") : Result.error("更新失败(日志不存在或已删除)");
} catch (IllegalArgumentException e) {
return Result.error(e.getMessage());
}
}
/**
* 逻辑删除操作日志
*/
@DeleteMapping(value = "/del/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "删除操作日志", description = "逻辑删除设置delSign=1不物理删除")
public Result deleteLog(
@PathVariable Long id,
@RequestParam(required = false) Long updateId) {
try {
Boolean success = manageLogService.deleteById(id, updateId);
return success ? Result.success("日志删除成功") : Result.error("删除失败(日志不存在或已删除)");
} catch (IllegalArgumentException e) {
return Result.error(e.getMessage());
}
}
}

View File

@@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@@ -21,12 +22,8 @@ import java.util.List;
@Tag(name = "角色管理", description = "角色增删改查接口(支持分页+多条件查询+编码唯一性校验)") @Tag(name = "角色管理", description = "角色增删改查接口(支持分页+多条件查询+编码唯一性校验)")
public class RoleController { public class RoleController {
private final RoleService roleService; @Autowired
RoleService roleService;
// 构造器注入
public RoleController(RoleService roleService) {
this.roleService = roleService;
}
/** /**
* 1. 分页查询角色(多条件模糊查询) * 1. 分页查询角色(多条件模糊查询)

View File

@@ -1,18 +1,33 @@
package com.rczn.controller; package com.rczn.controller;
import com.fasterxml.jackson.databind.annotation.JsonAppend;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.domain.Result; import com.rczn.domain.Result;
import com.rczn.rcznautoplc.domain.ManageLog;
import com.rczn.rcznautoplc.domain.RecordInfo;
import com.rczn.rcznautoplc.service.ManageLogService;
import com.rczn.rcznautoplc.service.RecordInfoService;
import com.rczn.system.domain.Permission;
import com.rczn.system.domain.User; import com.rczn.system.domain.User;
import com.rczn.system.service.UserService; import com.rczn.system.service.UserService;
import com.rczn.utils.JwtUtil;
import com.rczn.utils.Md5Util;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.Pattern;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 用户管理 CRUD APIMyBatis+PageHelper 实现) * 用户管理 CRUD APIMyBatis+PageHelper 实现)
@@ -117,4 +132,108 @@ public class UserController {
Boolean success = userService.deleteById(id); Boolean success = userService.deleteById(id);
return success ? Result.success("删除用户成功") : Result.error("删除失败(用户不存在)"); return success ? Result.success("删除用户成功") : Result.error("删除失败(用户不存在)");
} }
@PostMapping("/register")
@Operation(summary = "注册", description = "用户名必须是2-16位的字母、数字、下划线或减号")
public Result register(@Pattern(regexp = "^[a-zA-Z0-9_-]{2,16}$", message = "用户名必须是2-16位的字母、数字、下划线或减号")
@Parameter(
name = "username",
description = "用户名"
)
@RequestParam
String username,
@Parameter(
name = "password",
description = "密码..."
)
@RequestParam
String password) {
//查询数据库是否有该用户
User user = userService.findeUserByUsername(username);
//注册
if (user == null) {
//如果用户不存在,则注册
int result = userService.register(username, password);
return Result.success("用户注册成功");
} else {
//用户存在,返回错误信息
return Result.error("该用户名已存在!");
}
}
@GetMapping("/getUserByUsername")
public Result getUserByUsername(String username) {
User user = userService.findeUserByUsername(username);
if (user == null) {
return Result.error("该用户不存在!");
} else {
return Result.success(user);
}
}
@Autowired
ManageLogService manageLogService;
@PostMapping("/login")
@Operation(summary = "用户登录接口",description = "根据用户名和密码登录返回JWT Token")
public Result login(
@Parameter(
name = "username",
description = "登录用户名2-16位的字母、数字、下划线或减号",
required = true, // 标记为必填参数
example = "string"
)
@RequestParam
String username,
@Parameter(
name = "password",
description = "登录密码",
required = true
)
@RequestParam
String password) {
//TODO 登录逻辑
//查询数据库是否有该用户
User user = userService.findeUserByUsername(username);
//登录
if (user == null) {
//如果用户不存在,返回错误信息
return Result.error("该用户不存在!");
} else {
//校验密码:
String encryptPassword = user.getPassword();
if (encryptPassword.equals(password)) {
//登录成功,增加登录日志:
LocalDateTime loginTime = LocalDateTime.now();
ManageLog info = new ManageLog();
info.setCreateId(user.getId());
info.setLogName("登录日志");
info.setLogType("登录日志");//1登录日志、2SOP操作日志、3基础数据操作日志
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("用户名:").append(user.getUserName()).append(",登录操作时间:").append(loginTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
info.setLogContent(stringBuilder.toString());
info.setCreateTime(loginTime);
manageLogService.insert(info);
// if (Md5Util.checkPassword(password, encryptPassword)) {
//生产token
Map<String, Object> claims = new HashMap<>();
claims.put("id", user.getId());
claims.put("username", user.getUserName());
//获取权限列表:
List<Permission> permissions = userService.findUserPermissions(user.getId());
List<String> permissionList = permissions.stream().map(Permission::getPermissionCode).collect(Collectors.toList());
claims.put("permissions", permissionList);
String jwtToken = JwtUtil.genToken(claims);
//密码正确,返回成功信息
return Result.success(jwtToken);
} else {
//密码错误,返回错误信息
return Result.error("密码错误!");
}
}
}
} }

View File

@@ -1,65 +0,0 @@
package com.rczn.system.domain;
import com.rczn.domain.BaseBean;
import java.time.LocalDateTime;
public class ManageLog extends BaseBean {
private String logName;
private String logType;
private LocalDateTime logWritetime;
private String logContent;
public ManageLog() {
}
public ManageLog(Long id, Long createId, LocalDateTime createTime, Long updateId, LocalDateTime updateTime, boolean delSign, String remark) {
super(id, createId, createTime, updateId, updateTime, delSign, remark);
}
@Override
public String toString() {
return "ManageLog{" +
"logName='" + logName + '\'' +
", logType='" + logType + '\'' +
", logWritetime=" + logWritetime +
", logContent='" + logContent + '\'' +
'}';
}
public String getLogName() {
return logName;
}
public void setLogName(String logName) {
this.logName = logName;
}
public String getLogType() {
return logType;
}
public void setLogType(String logType) {
this.logType = logType;
}
public LocalDateTime getLogWritetime() {
return logWritetime;
}
public void setLogWritetime(LocalDateTime logWritetime) {
this.logWritetime = logWritetime;
}
public String getLogContent() {
return logContent;
}
public void setLogContent(String logContent) {
this.logContent = logContent;
}
}

View File

@@ -1,16 +1,31 @@
package com.rczn.system.domain; package com.rczn.system.domain;
import com.rczn.domain.BaseBean; import com.rczn.domain.BaseBean;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Data import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Permission extends BaseBean{ public class Permission extends BaseBean{
private String permissionName;
private String permissionCode;} private Integer parentId;
private String permissionName;
private String permissionCode;
// 树形结构子节点 ✅
private List<Permission> children;
// getter & setter
public Integer getParentId() { return parentId; }
public void setParentId(Integer parentId) { this.parentId = parentId; }
public String getPermissionName() { return permissionName; }
public void setPermissionName(String permissionName) { this.permissionName = permissionName; }
public String getPermissionCode() { return permissionCode; }
public void setPermissionCode(String permissionCode) { this.permissionCode = permissionCode; }
// children
public List<Permission> getChildren() {
return children;
}
public void setChildren(List<Permission> children) {
this.children = children;
}
}

View File

@@ -1,26 +0,0 @@
package com.rczn.system.mapper;
import com.rczn.system.domain.ManageLog;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper // 标记为 MyBatis Mapper 接口,确保被 Spring 扫描
public interface ManageLogMapper {
// 新增日志(支持空字段,空字段用数据库默认值)
int insert(ManageLog manageLog);
// 逻辑删除日志(按 ID设置 delSign=1
int deleteById(Long id);
// 更新日志(仅更新非空字段,空字段不更新)
int update(ManageLog manageLog);
// 按 ID 查询日志(仅查未删除数据)
ManageLog selectById(Long id);
// 分页查询日志(支持按字段筛选,空字段忽略条件)
List<ManageLog> selectPage(ManageLog manageLog);
// 查询分页总数(与分页查询条件一致)
Long selectTotal(ManageLog manageLog);
}

View File

@@ -1,8 +1,11 @@
package com.rczn.system.mapper; package com.rczn.system.mapper;
import com.rczn.system.domain.Permission;
import com.rczn.system.domain.User; import com.rczn.system.domain.User;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
@Mapper @Mapper
@@ -31,4 +34,10 @@ public interface UserMapper {
@Param("sex") Integer sex, @Param("sex") Integer sex,
@Param("delSign") Boolean delSign @Param("delSign") Boolean delSign
); );
@Select("SELECT * FROM sys_user WHERE user_name = #{userName}")
User selectByUsername(String userName);
//根据用户id查询出对应的权限列表
List<Permission> findUserPermissions(Long userId);
} }

View File

@@ -1,21 +0,0 @@
package com.rczn.system.service;
import com.rczn.domain.PageBean;
import com.rczn.system.domain.ManageLog;
public interface ManageLogService {
// 新增日志
Long insert(ManageLog manageLog);
// 逻辑删除日志
Boolean deleteById(Long id, Long updateId);
// 更新日志(仅更新非空字段)
Boolean update(ManageLog manageLog);
// 按 ID 查询日志
ManageLog selectById(Long id);
// 分页查询日志(支持多条件筛选)
PageBean<ManageLog> selectPage(Integer pageNum, Integer pageSize, ManageLog manageLog);
}

View File

@@ -11,6 +11,13 @@ public interface UserRoleService {
Boolean deleteByRoleId(Integer roleId); Boolean deleteByRoleId(Integer roleId);
UserRole selectById(Long id); UserRole selectById(Long id);
List<UserRole> selectByUserId(Integer userId); List<UserRole> selectByUserId(Integer userId);
/**
* Selects user roles by the given role ID
*
* @param roleId The ID of the role to search for
* @return List of UserRole objects associated with the given role ID
*/
List<UserRole> selectByRoleId(Integer roleId); List<UserRole> selectByRoleId(Integer roleId);
PageBean<UserRole> selectPage(Integer pageNum, Integer pageSize, Integer userId, Integer roleId); PageBean<UserRole> selectPage(Integer pageNum, Integer pageSize, Integer userId, Integer roleId);
} }

View File

@@ -1,6 +1,7 @@
package com.rczn.system.service; package com.rczn.system.service;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.system.domain.Permission;
import com.rczn.system.domain.User; import com.rczn.system.domain.User;
import java.util.List; import java.util.List;
@@ -53,4 +54,25 @@ public interface UserService {
* @return 是否删除成功true/false * @return 是否删除成功true/false
*/ */
Boolean deleteById(Long id); Boolean deleteById(Long id);
/**
* 6. 根据用户名查询用户
* @param username 用户名
* @return 用户实体
*/
User findeUserByUsername(String username);
/**
* 7. 注册用户
* @param username 用户名
* @param password 密码
*/
int register(String username, String password);
/**
* 根据用户id查询出关联的用户权限对象列表
* 表直接的关系是:
* 用户表user--用户权限表user_role--权限表role-- 权限资源表role_resource--资源表resource
*/
List<Permission> findUserPermissions(Long userId);
} }

View File

@@ -1,86 +0,0 @@
package com.rczn.system.service.impl;
import com.github.pagehelper.Page;
import com.rczn.domain.PageBean;
import com.rczn.system.domain.ManageLog;
import com.github.pagehelper.PageHelper;
import com.rczn.system.domain.Position;
import com.rczn.system.mapper.ManageLogMapper;
import com.rczn.system.service.ManageLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.List;
@Service
public class ManageLogServiceImpl implements ManageLogService {
@Autowired
private ManageLogMapper manageLogMapper;
@Override
public Long insert(ManageLog manageLog) {
// 校验必填字段(日志名称和类型为必填)
Assert.notNull(manageLog.getLogName(), "日志名称不能为空");
Assert.notNull(manageLog.getLogType(), "日志类型不能为空");
//补充日志时间
if (manageLog.getLogWritetime() == null) {
manageLog.setLogWritetime(LocalDateTime.now());
}
// TODO 补充日志创建人信息
// manageLog.setCreateId(null);
manageLog.setCreateTime(LocalDateTime.now());
int rows = manageLogMapper.insert(manageLog);
return rows > 0 ? manageLog.getId() : null;
}
@Override
public Boolean deleteById(Long id, Long updateId) {
Assert.notNull(id, "日志ID不能为空");
int rows = manageLogMapper.deleteById(id);
return rows > 0;
}
@Override
public Boolean update(ManageLog manageLog) {
Assert.notNull(manageLog.getId(), "日志ID不能为空");
//如果更新时间为空,则自动更新
if (manageLog.getUpdateTime() == null) {
manageLog.setUpdateTime(LocalDateTime.now());
}
// TODO 补充日志更新人信息
// manageLog.setUpdateId(null);
int rows = manageLogMapper.update(manageLog);
return rows > 0;
}
@Override
public ManageLog selectById(Long id) {
Assert.notNull(id, "日志ID不能为空");
return manageLogMapper.selectById(id);
}
@Override
public PageBean<ManageLog> selectPage(Integer pageNum, Integer pageSize, ManageLog manageLog) {
// 校验分页参数
Assert.notNull(pageNum, "页码不能为空");
Assert.notNull(pageSize, "每页条数不能为空");
Assert.isTrue(pageNum > 0, "页码必须大于0");
Assert.isTrue(pageSize > 0 && pageSize <= 100000, "每页条数必须在1-10000之间");
// PageHelper 分页(自动拦截查询,添加 LIMIT 条件)
PageHelper.startPage(pageNum, pageSize);
List<ManageLog> logList = manageLogMapper.selectPage(manageLog);
Page<ManageLog> page = (Page<ManageLog>) logList;
PageBean<ManageLog> pageBean = new PageBean<>();
pageBean.setTotal(page.getTotal());
pageBean.setItems(page.getResult());
// 封装PageBean返回
return pageBean;
}
}

View File

@@ -3,6 +3,7 @@ package com.rczn.system.service.impl;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.system.domain.Permission;
import com.rczn.system.domain.Position; import com.rczn.system.domain.Position;
import com.rczn.system.domain.UserRole; import com.rczn.system.domain.UserRole;
import com.rczn.system.mapper.UserRoleMapper; import com.rczn.system.mapper.UserRoleMapper;

View File

@@ -3,6 +3,7 @@ package com.rczn.system.service.impl;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.system.domain.Permission;
import com.rczn.system.domain.User; import com.rczn.system.domain.User;
import com.rczn.system.mapper.UserMapper; import com.rczn.system.mapper.UserMapper;
import com.rczn.system.service.UserService; import com.rczn.system.service.UserService;
@@ -90,4 +91,41 @@ public class UserServiceImpl implements UserService {
int rows = userMapper.deleteById(id,null); int rows = userMapper.deleteById(id,null);
return rows > 0; return rows > 0;
} }
/**
* 6. 根据用户名查询用户
*
* @param username 用户名
* @return 用户实体
*/
@Override
public User findeUserByUsername(String username) {
return userMapper.selectByUsername(username);
}
/**
* 7. 注册用户
*
* @param username 用户名
* @param password 密码
*/
@Override
public int register(String username, String password) {
User user = new User();
user.setUserName(username);
user.setPassword(password);
return userMapper.insert(user);
}
/**
* 根据用户id查询出关联的用户权限对象列表
* 表直接的关系是:
* 用户表user--用户权限表user_role--权限表role-- 权限资源表role_resource--资源表resource
*
* @param userId
*/
@Override
public List<Permission> findUserPermissions(Long userId) {
return userMapper.findUserPermissions(userId);
}
} }

View File

@@ -14,7 +14,7 @@ spring:
# 数据源配置MySQL 8.x # 数据源配置MySQL 8.x
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://47.116.126.33:3306/rc_autoplc_program?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true url: jdbc:mysql://47.116.126.33:3306/rc_autoplc_program?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&allowMultiQueries=true
username: nianke username: nianke
password: Jy@.niankeCrm2025 password: Jy@.niankeCrm2025
# 解决跨域可选配合之前的CorsConfig # 解决跨域可选配合之前的CorsConfig
@@ -42,11 +42,12 @@ spring:
mybatis: mybatis:
configuration: configuration:
map-underscore-to-camel-case: true # 下划线转驼峰 map-underscore-to-camel-case: true # 下划线转驼峰
mapper-locations: classpath:mapper/**/*.xml # 补充指定Mapper.xml文件路径必加
type-aliases-package: com.rczn.**.domain # 补充:实体类别名包(可选)
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 关键SQL 打印到控制台 log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 关键SQL 打印到控制台
log-prefix: "[MyBatis] " # 可选:日志前缀,便于区分 SQL 日志 log-prefix: "[MyBatis] " # 可选:日志前缀,便于区分 SQL 日志
default-statement-timeout: 30 # 可选SQL 执行超时时间(秒) default-statement-timeout: 30 # 可选SQL 执行超时时间(秒)
mapper-locations: classpath:mapper/**/*.xml # 补充指定Mapper.xml文件路径必加
type-aliases-package: com.rczn.**.domain # 补充:实体类别名包(可选)
# HikariCP 连接池配置(关键) # HikariCP 连接池配置(关键)
hikari: hikari:
@@ -66,22 +67,22 @@ pagehelper:
support-methods-arguments: true # 支持通过 Mapper 接口参数传递分页参数 support-methods-arguments: true # 支持通过 Mapper 接口参数传递分页参数
params: count=countSql # 分页参数名映射 params: count=countSql # 分页参数名映射
#
# SpringDoc OpenAPI 3 核心配置适配Spring Boot 3.x ## SpringDoc OpenAPI 3 核心配置适配Spring Boot 3.x
springdoc: #springdoc:
packages-to-scan: com.rczn # 扫描的基础包Controller所在包 # packages-to-scan: com.rczn # 扫描的基础包Controller所在包
api-docs: # api-docs:
enabled: true # 启用/v3/api-docs接口 # enabled: true # 启用/v3/api-docs接口
path: /v3/api-docs # OpenAPI JSON数据路径默认 # path: /v3/api-docs # OpenAPI JSON数据路径默认
swagger-ui: # swagger-ui:
path: /swagger-ui.html # 自定义Swagger UI访问路径兼容Spring Boot 2.x习惯 # path: /swagger-ui.html # 自定义Swagger UI访问路径兼容Spring Boot 2.x习惯
tags-sorter: alpha # 标签字母排序 # tags-sorter: alpha # 标签字母排序
operations-sorter: alpha # 接口字母排序 # operations-sorter: alpha # 接口字母排序
disable-swagger-default-url: true # 禁用默认PetStore示例 # disable-swagger-default-url: true # 禁用默认PetStore示例
default-flat-param-object: false # 禁用扁平参数对象 # default-flat-param-object: false # 禁用扁平参数对象
paths-to-exclude: /error, /actuator/** # 排除错误接口/监控接口(可选) # paths-to-exclude: /error, /actuator/** # 排除错误接口/监控接口(可选)
#
# OpenAPI文档基础信息中文正常显示 ## OpenAPI文档基础信息中文正常显示
openapi: openapi:
info: info:
title: XX自动化编程系统API文档 title: XX自动化编程系统API文档
@@ -96,6 +97,40 @@ openapi:
- url: http://47.116.126.33:9090 # 测试环境地址 - url: http://47.116.126.33:9090 # 测试环境地址
description: 测试环境 description: 测试环境
# SpringDoc + Knife4j 核心配置
springdoc:
packages-to-scan: com.rczn # 扫描Controller所在包
api-docs:
enabled: true
path: /v3/api-docs
swagger-ui:
tags-sorter: alpha
operations-sorter: alpha
paths-to-exclude: /error, /actuator/**
# Knife4j增强配置可选开启中文UI
knife4j:
enable: true
setting:
language: zh_cn # 中文界面
enable-swagger-models: true # 显示模型
enable-document-manage: false # 关闭文档管理(开发环境)
# OpenAPI文档信息
#openapi:
# info:
# title: XX自动化编程系统API文档
# description: SpringBoot 3.x + Knife4j + OpenAPI 3 接口文档
# version: 1.0.0
# contact:
# name: 研发组
# email: xxx@xxx.com
# servers:
# - url: http://localhost:9090
# description: 本地开发环境
# - url: http://47.116.126.33:9090
# description: 测试环境
# Spring Boot 日志核心配置 # Spring Boot 日志核心配置
logging: logging:
# 1. 全局日志级别(可细化到包/类) # 1. 全局日志级别(可细化到包/类)

View File

@@ -1,175 +0,0 @@
<?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.rczn.system.mapper.ManageLogMapper">
<!-- 公共字段BaseBean 继承的字段) -->
<sql id="baseColumn">
id, create_id, create_time, update_id, update_time, del_sign, remark
</sql>
<!-- ManageLog 专属字段 -->
<sql id="logColumn">
log_name, log_type, log_writetime, log_content
</sql>
<!-- 结果集映射(关联数据库列与实体类字段) -->
<resultMap id="LogResultMap" type="com.rczn.system.domain.ManageLog">
<!-- 公共字段映射 -->
<id column="id" property="id"/>
<result column="create_id" property="createId"/>
<result column="create_time" property="createTime"/>
<result column="update_id" property="updateId"/>
<result column="update_time" property="updateTime"/>
<result column="del_sign" property="delSign"/>
<result column="remark" property="remark"/>
<!-- 专属字段映射 -->
<result column="log_name" property="logName"/>
<result column="log_type" property="logType"/>
<result column="log_writetime" property="logWritetime"/>
<result column="log_content" property="logContent"/>
</resultMap>
<!-- 1. 新增日志(空字段忽略,用数据库默认值) -->
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO sys_manage_log (
<trim suffixOverrides=",">
<!-- 专属字段 -->
<if test="logName != null and logName != ''"> log_name,</if>
<if test="logType != null and logType != ''"> log_type,</if>
<if test="logWritetime != null"> log_writetime,</if>
<if test="logContent != null and logContent != ''"> log_content,</if>
<!-- 公共字段 -->
<if test="createId != null"> create_id,</if>
<if test="createTime != null"> create_time,</if>
<if test="updateId != null"> update_id,</if>
<if test="updateTime != null"> update_time,</if>
<if test="delSign != null"> del_sign,</if>
<if test="remark != null and remark != ''"> remark,</if>
</trim>
) VALUES (
<trim suffixOverrides=",">
<!-- 专属字段:空字段传递 null数据库设默认值 -->
<if test="logName != null and logName != ''">#{logName},</if>
<if test="logType != null and logType != ''">#{logType},</if>
<if test="logWritetime != null">#{logWritetime},</if>
<if test="logContent != null and logContent != ''">#{logContent},</if>
<!-- 公共字段:空字段传递 null数据库设默认值 -->
<if test="createId != null">#{createId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateId != null">#{updateId},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delSign != null">#{delSign},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
)
</insert>
<!-- 2. 更新日志(仅更新非空字段) -->
<update id="update">
UPDATE sys_manage_log
<set>
<!-- 专属字段:非空才更新 -->
<if test="logName != null and logName != ''">log_name = #{logName},</if>
<if test="logType != null and logType != ''">log_type = #{logType},</if>
<if test="logWritetime != null">log_writetime = #{logWritetime},</if>
<if test="logContent != null and logContent != ''">log_content = #{logContent},</if>
<!-- 公共字段:非空才更新 -->
<if test="updateId != null">update_id = #{updateId},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="delSign != null">del_sign = #{delSign},</if>
<!-- 强制更新时间为当前时间 -->
update_time = NOW()
</set>
WHERE id = #{id}
AND del_sign = 0 <!-- 仅更新未删除的数据 -->
</update>
<!-- 3. 逻辑删除日志 -->
<delete id="deleteById">
UPDATE sys_manage_log
SET
del_sign = 1,
update_time = NOW(),
<if test="updateId != null">update_id = #{updateId}</if>
WHERE id = #{id}
AND del_sign = 0 <!-- 避免重复删除 -->
</delete>
<!-- 4. 按 ID 查询日志 -->
<select id="selectById" resultMap="LogResultMap">
SELECT
<include refid="baseColumn"/>,
<include refid="logColumn"/>
FROM sys_manage_log
WHERE id = #{id}
AND del_sign = 0 <!-- 仅查未删除数据 -->
</select>
<!-- 5. 分页查询日志(空字段忽略条件) -->
<select id="selectPage" resultMap="LogResultMap" parameterType="com.rczn.system.domain.ManageLog">
SELECT
<include refid="baseColumn"/>,
<include refid="logColumn"/>
FROM sys_manage_log
<where>
<!-- 默认查未删除数据,传 delSign=1 可查已删除 -->
<if test="delSign == null">
AND del_sign = 0
</if>
<if test="delSign != null">
AND del_sign = #{delSign}
</if>
<!-- 日志名称:模糊查询,空字段忽略 -->
<if test="logName != null and logName != ''">
AND log_name LIKE CONCAT('%', #{logName}, '%')
</if>
<!-- 日志类型:精准查询,空字段忽略 -->
<if test="logType != null and logType != ''">
AND log_type = #{logType}
</if>
<!-- 日志写入时间:范围查询(可选,空字段忽略) -->
<if test="startTime != null">
AND log_writetime >= #{startTime}
</if>
<if test="endTime != null">
AND log_writetime &lt;= #{endTime}
</if>
<!-- 创建人ID精准查询空字段忽略 -->
<if test="createId != null">
AND create_id = #{createId}
</if>
</where>
ORDER BY log_writetime DESC <!-- 按日志写入时间倒序 -->
</select>
<!-- 6. 查询分页总数(与分页查询条件一致) -->
<select id="selectTotal" resultType="java.lang.Long" parameterType="com.rczn.system.domain.ManageLog">
SELECT COUNT(*)
FROM sys_manage_log
<where>
<if test="delSign == null">
AND del_sign = 0
</if>
<if test="delSign != null">
AND del_sign = #{delSign}
</if>
<if test="logName != null and logName != ''">
AND log_name LIKE CONCAT('%', #{logName}, '%')
</if>
<if test="logType != null and logType != ''">
AND log_type = #{logType}
</if>
<if test="logWritetimeStart != null">
AND log_writetime >= #{logWritetimeStart}
</if>
<if test="logWritetimeEnd != null">
AND log_writetime &lt;= #{logWritetimeEnd}
</if>
<if test="createId != null">
AND create_id = #{createId}
</if>
</where>
</select>
</mapper>

View File

@@ -198,5 +198,24 @@
</if> </if>
</where> </where>
</select> </select>
<select id="findUserPermissions" resultType="com.rczn.system.domain.Permission">
SELECT
p.*
FROM
sys_user u
JOIN
sys_user_role ur ON u.id = ur.user_id
JOIN
sys_role r ON ur.role_id = r.id
JOIN
sys_role_permission rp ON r.id = rp.role_id
JOIN
sys_permission p ON rp.permission_id = p.id
WHERE
u.id = #{userId}
AND u.del_sign = 0
AND r.del_sign = 0
AND p.del_sign = 0;
</select>
</mapper> </mapper>

View File

@@ -38,6 +38,7 @@
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
@@ -46,12 +47,7 @@
<version>5.3.3</version> <version>5.3.3</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
<version>2.2.21</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId> <artifactId>mybatis</artifactId>
@@ -70,11 +66,15 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>io.swagger.core.v3</groupId>
<artifactId>springdoc-openapi-starter-common</artifactId> <artifactId>swagger-models-jakarta</artifactId>
<version>2.3.0</version> <version>2.2.19</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<!-- 这里可以添加PLC通信相关的依赖 --> <!-- 这里可以添加PLC通信相关的依赖 -->
<!-- 例如: <!-- 例如:

View File

@@ -1,5 +1,6 @@
package com.rczn.rcznautoplc.controller; package com.rczn.rcznautoplc.controller;
import com.rczn.domain.Result;
import com.rczn.rcznautoplc.domain.DevInfo; import com.rczn.rcznautoplc.domain.DevInfo;
import com.rczn.rcznautoplc.service.DevInfoService; import com.rczn.rcznautoplc.service.DevInfoService;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@@ -25,7 +26,7 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("/devInfo") @RequestMapping("/devInfo")
@Tag(name = "设备管理", description = "设备增删改查+分页查询+全量查询接口") @Tag(name = "动作单元管理", description = "设备增删改查+分页查询+全量查询接口")
public class DevInfoController { public class DevInfoController {
@Autowired @Autowired
@@ -35,15 +36,15 @@ public class DevInfoController {
* 新增设备 * 新增设备
*/ */
@PostMapping(value = "/add", produces = MediaType.APPLICATION_JSON_VALUE) @PostMapping(value = "/add", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "新增设备", description = "设备名称为必填项,其他字段可选(非空则入库)") @Operation(summary = "新增动作单元", description = "动作单元名称为必填项,其他字段可选(非空则入库)")
public ResponseEntity<Map<String, Object>> addDevInfo( public ResponseEntity<Map<String, Object>> addDevInfo(
@Parameter(name = "设备信息", description = "设备新增请求参数", required = true) @Parameter(name = "动作单元信息", description = "动作单元新增请求参数", required = true)
@RequestBody DevInfo devInfo) { @RequestBody DevInfo devInfo) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
try { try {
boolean success = devInfoService.addDevInfo(devInfo); boolean success = devInfoService.addDevInfo(devInfo);
result.put("success", success); result.put("success", success);
result.put("message", success ? "设备新增成功" : "设备新增失败"); result.put("message", success ? "动作单元新增成功" : "动作单元新增失败");
return ResponseEntity.ok(result); return ResponseEntity.ok(result);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
result.put("success", false); result.put("success", false);
@@ -60,15 +61,15 @@ public class DevInfoController {
* 根据ID删除设备逻辑删除 * 根据ID删除设备逻辑删除
*/ */
@DeleteMapping(value = "/del/{id}", produces = MediaType.APPLICATION_JSON_VALUE) @DeleteMapping(value = "/del/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "删除设备", description = "逻辑删除设置delSign=1不物理删除数据") @Operation(summary = "删除动作单元", description = "逻辑删除设置delSign=1不物理删除数据")
public ResponseEntity<Map<String, Object>> removeDevInfoById( public ResponseEntity<Map<String, Object>> removeDevInfoById(
@Parameter(name = "id", description = "设备ID", required = true, example = "1") @Parameter(name = "id", description = "动作单元ID", required = true, example = "1")
@PathVariable Long id) { @PathVariable Long id) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
try { try {
boolean success = devInfoService.removeDevInfoById(id); boolean success = devInfoService.removeDevInfoById(id);
result.put("success", success); result.put("success", success);
result.put("message", success ? "设备删除成功" : "设备不存在或已删除"); result.put("message", success ? "动作单元删除成功" : "动作单元不存在或已删除");
return ResponseEntity.ok(result); return ResponseEntity.ok(result);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
result.put("success", false); result.put("success", false);
@@ -85,15 +86,15 @@ public class DevInfoController {
* 更新设备 * 更新设备
*/ */
@PutMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE) @PutMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "修改设备", description = "需传入设备ID其他字段可选非空则更新") @Operation(summary = "修改动作单元", description = "需传入动作单元ID其他字段可选非空则更新")
public ResponseEntity<Map<String, Object>> updateDevInfo( public ResponseEntity<Map<String, Object>> updateDevInfo(
@Parameter(name = "设备信息", description = "设备修改请求参数含ID", required = true) @Parameter(name = "动作单元信息", description = "动作单元修改请求参数含ID", required = true)
@RequestBody DevInfo devInfo) { @RequestBody DevInfo devInfo) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
try { try {
boolean success = devInfoService.updateDevInfo(devInfo); boolean success = devInfoService.updateDevInfo(devInfo);
result.put("success", success); result.put("success", success);
result.put("message", success ? "设备更新成功" : "设备不存在或已删除"); result.put("message", success ? "动作单元更新成功" : "动作单元不存在或已删除");
return ResponseEntity.ok(result); return ResponseEntity.ok(result);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
result.put("success", false); result.put("success", false);
@@ -107,12 +108,12 @@ public class DevInfoController {
} }
/** /**
* 根据ID查询设备 * 根据ID查询动作单元
*/ */
@GetMapping(value = "/getById/{id}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/getById/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询单个设备", description = "根据设备ID查询设备完整信息") @Operation(summary = "查询单个动作单元", description = "根据动作单元ID查询动作单元完整信息")
public ResponseEntity<Map<String, Object>> getDevInfoById( public ResponseEntity<Map<String, Object>> getDevInfoById(
@Parameter(name = "id", description = "设备ID", required = true, example = "1") @Parameter(name = "id", description = "动作单元ID", required = true, example = "1")
@PathVariable Long id) { @PathVariable Long id) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
try { try {
@@ -122,7 +123,7 @@ public class DevInfoController {
result.put("data", devInfo); result.put("data", devInfo);
} else { } else {
result.put("success", false); result.put("success", false);
result.put("message", "设备不存在或已删除"); result.put("message", "动作单元不存在或已删除");
} }
return ResponseEntity.ok(result); return ResponseEntity.ok(result);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
@@ -137,33 +138,29 @@ public class DevInfoController {
} }
/** /**
* 分页查询设备 * 分页查询动作单元
* 示例:/devInfo/listPage?pageNum=1&pageSize=10&devName=设备1&status=0 * 示例:/devInfo/listPage?pageNum=1&pageSize=10&devName=动作单元1&status=0
*/ */
@GetMapping(value = "/listPage", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/listPage", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "分页查询设备", description = "支持设备名称、型号、IP、状态等多条件过滤默认查询未删除设备") @Operation(summary = "分页查询动作单元", description = "支持动作单元名称、型号、IP、状态等多条件过滤默认查询未删除动作单元")
@Parameters({ @Parameters({
@Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY), @Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY) @Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY)
// @Parameter(name = "devName", description = "设备名称(可选,模糊查询)", required = false, example = "PLC设备", in = ParameterIn.QUERY), // @Parameter(name = "devName", description = "设备名称(可选,模糊查询)", required = false, example = "PLC设备", in = ParameterIn.QUERY),
// @Parameter(name = "devModel", description = "设备型号(可选,模糊查询)", required = false, example = "S7-1200", in = ParameterIn.QUERY) // @Parameter(name = "devModel", description = "设备型号(可选,模糊查询)", required = false, example = "S7-1200", in = ParameterIn.QUERY)
}) })
public ResponseEntity<Map<String, Object>> getDevInfoPage( public Result getDevInfoPage(
@ParameterObject // 核心注解:标记该实体类从查询参数取值 @ParameterObject // 核心注解:标记该实体类从查询参数取值
@Schema(description = "设备查询条件(可选)") // 补充描述 @Schema(description = "设备查询条件(可选)") // 补充描述
DevInfo devInfo, // 接收查询条件devName、status等 DevInfo devInfo, // 接收查询条件devName、status等
@RequestParam Integer pageNum, @RequestParam Integer pageNum,
@RequestParam Integer pageSize) { @RequestParam Integer pageSize) {
Map<String, Object> result = new HashMap<>();
try { try {
PageInfo<DevInfo> pageInfo = devInfoService.getDevInfoPage(devInfo, pageNum, pageSize); PageInfo<DevInfo> pageInfo = devInfoService.getDevInfoPage(devInfo, pageNum, pageSize);
result.put("success", true); Result<PageInfo<DevInfo>> success = Result.success(pageInfo);
result.put("data", pageInfo); return success;
return ResponseEntity.ok(result);
} catch (Exception e) { } catch (Exception e) {
result.put("success", false); return Result.error("数据库异常!");
result.put("message", "服务器异常:" + e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
} }
} }

View File

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.domain.Result; import com.rczn.domain.Result;
import com.rczn.rcznautoplc.domain.DevParam; import com.rczn.rcznautoplc.domain.DevParam;
import com.rczn.rcznautoplc.domain.query.DevParamQuery;
import com.rczn.rcznautoplc.service.DevParamService; import com.rczn.rcznautoplc.service.DevParamService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
@@ -33,6 +34,7 @@ public class DevParamController {
@Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY), @Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY), @Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY),
@Parameter(name = "devId", description = "设备ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY), @Parameter(name = "devId", description = "设备ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "paramTypeData", description = "参数类型(可选,模糊查询)", required = false, example = "耗材,通用", in = ParameterIn.QUERY),
@Parameter(name = "paramName", description = "参数名称(可选,模糊查询)", required = false, example = "温度", in = ParameterIn.QUERY), @Parameter(name = "paramName", description = "参数名称(可选,模糊查询)", required = false, example = "温度", in = ParameterIn.QUERY),
@Parameter(name = "paramValue", description = "参数值(可选,模糊查询)", required = false, example = "25", in = ParameterIn.QUERY) @Parameter(name = "paramValue", description = "参数值(可选,模糊查询)", required = false, example = "25", in = ParameterIn.QUERY)
}) })
@@ -40,9 +42,10 @@ public class DevParamController {
@RequestParam Integer pageNum, @RequestParam Integer pageNum,
@RequestParam Integer pageSize, @RequestParam Integer pageSize,
@RequestParam(required = false) Integer devId, @RequestParam(required = false) Integer devId,
@RequestParam(required = false) String paramTypeData,
@RequestParam(required = false) String paramName, @RequestParam(required = false) String paramName,
@RequestParam(required = false) String paramValue) { @RequestParam(required = false) String paramValue) {
PageInfo<DevParam> pageBean = devParamService.selectPage(pageNum, pageSize, devId, paramName, paramValue); PageInfo<DevParam> pageBean = devParamService.selectPage(pageNum, pageSize, devId,paramTypeData, paramName, paramValue);
return Result.success(pageBean); return Result.success(pageBean);
} }
@@ -53,17 +56,57 @@ public class DevParamController {
@Operation(summary = "查询设备参数", description = "支持设备ID精准查询、参数名称/值模糊查询") @Operation(summary = "查询设备参数", description = "支持设备ID精准查询、参数名称/值模糊查询")
@Parameters({ @Parameters({
@Parameter(name = "devId", description = "设备ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY), @Parameter(name = "devId", description = "设备ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "paramTypeData", description = "参数类型(可选,模糊查询)", required = false, example = "耗材,通用", in = ParameterIn.QUERY),
@Parameter(name = "paramName", description = "参数名称(可选,模糊查询)", required = false, example = "温度", in = ParameterIn.QUERY), @Parameter(name = "paramName", description = "参数名称(可选,模糊查询)", required = false, example = "温度", in = ParameterIn.QUERY),
@Parameter(name = "paramValue", description = "参数值(可选,模糊查询)", required = false, example = "25", in = ParameterIn.QUERY) @Parameter(name = "paramValue", description = "参数值(可选,模糊查询)", required = false, example = "25", in = ParameterIn.QUERY)
}) })
public Result getDevParamPage( public Result getDevParamPage(
@RequestParam(required = false) Integer devId, @RequestParam(required = false) Integer devId,
@RequestParam(required = false) String paramTypeData,
@RequestParam(required = false) String paramName, @RequestParam(required = false) String paramName,
@RequestParam(required = false) String paramValue) { @RequestParam(required = false) String paramValue) {
List<DevParam> pageBean = devParamService.selectList( devId, paramName, paramValue);
DevParamQuery query = new DevParamQuery();
query.setDevId(devId);
query.setParamTypeData(paramTypeData);
query.setParamName(paramName);
query.setParamValue(paramValue);
List<DevParam> pageBean = devParamService.selectList( query);
return Result.success(pageBean); return Result.success(pageBean);
} }
/**
* 根据条件,查询设备参数
*/
@PostMapping(value = "/addDevId", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "为参数增加设备的devId", description = "为参数增加设备的devId")
@Parameters({
@Parameter(name = "devId", description = "设备ID", required = true, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "paramId", description = "参数Id", required = true, example = "1", in = ParameterIn.QUERY)
})
public Result addDevId(
@RequestParam(required = true) Integer devId,
@RequestParam(required = true) Integer paramId) {
Boolean result = devParamService.addDevId( devId, paramId );
return Result.success(result);
}
/**
* 根据条件,查询设备参数
*/
@PostMapping(value = "/delDevId", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "为参数减少设备的devId", description = "为参数减少设备的devId")
@Parameters({
@Parameter(name = "devId", description = "设备ID", required = true, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "paramId", description = "参数Id", required = true, example = "1", in = ParameterIn.QUERY)
})
public Result delDevId(
@RequestParam(required = true) Integer devId,
@RequestParam(required = true) Integer paramId) {
Boolean result = devParamService.reduceDevId( devId, paramId );
return Result.success(result);
}
/** /**
* 根据ID查询设备参数 * 根据ID查询设备参数
*/ */

View File

@@ -1,10 +1,13 @@
package com.rczn.rcznautoplc.controller; package com.rczn.rcznautoplc.controller;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean;
import com.rczn.domain.Result; import com.rczn.domain.Result;
import com.rczn.rcznautoplc.domain.FlowInfo; import com.rczn.rcznautoplc.domain.FlowInfo;
import com.rczn.rcznautoplc.domain.ManageLog;
import com.rczn.rcznautoplc.domain.UserBusy;
import com.rczn.rcznautoplc.service.FlowInfoService; import com.rczn.rcznautoplc.service.FlowInfoService;
import com.rczn.rcznautoplc.service.ManageLogService;
import com.rczn.utils.ThreadLocalUtil;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
@@ -14,7 +17,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping("/flowInfo") @RequestMapping("/flowInfo")
@@ -24,7 +30,6 @@ public class FlowInfoController {
@Autowired @Autowired
FlowInfoService flowInfoService; FlowInfoService flowInfoService;
@GetMapping(value = "/listPage", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/listPage", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "分页查询流程信息", description = "支持流程排序精准查询、流程名称/岛屿ID列表模糊查询") @Operation(summary = "分页查询流程信息", description = "支持流程排序精准查询、流程名称/岛屿ID列表模糊查询")
@Parameters({ @Parameters({
@@ -71,6 +76,23 @@ public class FlowInfoController {
public Result addFlowInfo(@RequestBody FlowInfo flowInfo) { public Result addFlowInfo(@RequestBody FlowInfo flowInfo) {
try { try {
Long flowInfoId = flowInfoService.insert(flowInfo); Long flowInfoId = flowInfoService.insert(flowInfo);
//记录操作样品执行SOP操作日志
LocalDateTime loginTime = LocalDateTime.now();
ManageLog info = new ManageLog();
// ========== 修复开始 ==========
Map<String, Object> mapClaims = ThreadLocalUtil.get();
UserBusy userBusy = new UserBusy();
userBusy.setId(Long.valueOf( mapClaims.get("id").toString()));
userBusy.setUserName((String) mapClaims.get("username"));
// ========== 修复结束 ==========
info.setCreateId(userBusy.getId());
info.setLogName("基础数据操作日志");
info.setLogType("基础数据操作日志");//1登录日志、2SOP操作日志、3基础数据操作日志
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("用户名:").append(userBusy.getUserName()).append("SOP配置添加操作时间").append(loginTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
info.setLogContent(stringBuilder.toString());
info.setCreateTime(loginTime);
manageLogService.insert(info);
return Result.success(flowInfoId); return Result.success(flowInfoId);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return Result.error(e.getMessage()); return Result.error(e.getMessage());
@@ -88,11 +110,31 @@ public class FlowInfoController {
} }
} }
@Autowired
ManageLogService manageLogService;
@DeleteMapping(value = "/del/{id}", produces = MediaType.APPLICATION_JSON_VALUE) @DeleteMapping(value = "/del/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "删除流程信息", description = "逻辑删除设置delSign=1不物理删除数据") @Operation(summary = "删除流程信息", description = "逻辑删除设置delSign=1不物理删除数据")
public Result deleteFlowInfo(@PathVariable Long id) { public Result deleteFlowInfo(@PathVariable Long id) {
try { try {
Boolean success = flowInfoService.deleteById(id); Boolean success = flowInfoService.deleteById(id);
//记录操作样品执行SOP操作日志
LocalDateTime loginTime = LocalDateTime.now();
ManageLog info = new ManageLog();
// ========== 修复开始 ==========
Map<String, Object> mapClaims = ThreadLocalUtil.get();
UserBusy userBusy = new UserBusy();
userBusy.setId(Long.valueOf( mapClaims.get("id").toString()));
userBusy.setUserName((String) mapClaims.get("username"));
// ========== 修复结束 ==========
info.setCreateId(userBusy.getId());
info.setLogName("基础数据操作日志");
info.setLogType("基础数据操作日志");//1登录日志、2SOP操作日志、3基础数据操作日志
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("用户名:").append(userBusy.getUserName()).append("SOP配置删除操作时间").append(loginTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
info.setLogContent(stringBuilder.toString());
info.setCreateTime(loginTime);
manageLogService.insert(info);
return success ? Result.success(true) : Result.error("删除失败(流程信息不存在或已删除)"); return success ? Result.success(true) : Result.error("删除失败(流程信息不存在或已删除)");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return Result.error(e.getMessage()); return Result.error(e.getMessage());

View File

@@ -4,16 +4,21 @@ import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.domain.Result; import com.rczn.domain.Result;
import com.rczn.rcznautoplc.domain.GoodsFlowStatus; import com.rczn.rcznautoplc.domain.GoodsFlowStatus;
import com.rczn.rcznautoplc.domain.query.GoodsFlowStatusQuery;
import com.rczn.rcznautoplc.service.GoodsFlowStatusService; import com.rczn.rcznautoplc.service.GoodsFlowStatusService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController @RestController
@RequestMapping("/goodsFlowStatus") @RequestMapping("/goodsFlowStatus")
@Tag(name = "样品流程信息管理", description = "样品流程状态增删改查+分页查询接口") @Tag(name = "样品流程信息管理", description = "样品流程状态增删改查+分页查询接口")
@@ -28,22 +33,29 @@ public class GoodsFlowStatusController {
@Parameters({ @Parameters({
@Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY), @Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY), @Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY),
@Parameter(name = "goodsId", description = "样品ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "flowId", description = "流程ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "islandId", description = "岛屿ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "status", description = "状态可选精准查询0-未执行1-执行10-通过11-失败)", required = false, example = "10", in = ParameterIn.QUERY)
}) })
public Result getGoodsFlowStatusPage( public Result getGoodsFlowStatusPage(
@RequestParam Integer pageNum, @RequestParam Integer pageNum,
@RequestParam Integer pageSize, @RequestParam Integer pageSize,
@RequestParam(required = false) Integer goodsId, @ParameterObject
@RequestParam(required = false) Integer flowId, @Schema(description = "样品ID、流程ID、岛屿ID、状态精准查询条件")
@RequestParam(required = false) Integer islandId, GoodsFlowStatusQuery goodsFlowStatus) {
@RequestParam(required = false) Integer status) { PageInfo<GoodsFlowStatus> pageBean = goodsFlowStatusService.selectPage(pageNum, pageSize, goodsFlowStatus);
PageInfo<GoodsFlowStatus> pageBean = goodsFlowStatusService.selectPage(pageNum, pageSize, goodsId, flowId, islandId, status);
return Result.success(pageBean); return Result.success(pageBean);
} }
@GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询样品流程状态", description = "支持样品ID、流程ID、岛屿ID、状态等精准查询")
@Parameters({
})
public Result getList(
@ParameterObject
@Schema(description = "样品ID、流程ID、岛屿ID、状态等精准查询条件")
GoodsFlowStatusQuery goodsFlowStatus) {
List<GoodsFlowStatus> list = goodsFlowStatusService.selectList( goodsFlowStatus);
return Result.success(list);
}
@GetMapping(value = "/getById/{id}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/getById/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询单个样品流程状态", description = "根据样品流程状态ID查询详情") @Operation(summary = "查询单个样品流程状态", description = "根据样品流程状态ID查询详情")
public Result getGoodsFlowStatusById(@PathVariable Long id) { public Result getGoodsFlowStatusById(@PathVariable Long id) {

View File

@@ -4,16 +4,21 @@ import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.domain.Result; import com.rczn.domain.Result;
import com.rczn.rcznautoplc.domain.GoodsInfo; import com.rczn.rcznautoplc.domain.GoodsInfo;
import com.rczn.rcznautoplc.domain.query.GoodsInfoQuery;
import com.rczn.rcznautoplc.service.GoodsInfoService; import com.rczn.rcznautoplc.service.GoodsInfoService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController @RestController
@RequestMapping("/goodsInfo") @RequestMapping("/goodsInfo")
@Tag(name = "样品信息管理", description = "样品信息增删改查+分页查询接口") @Tag(name = "样品信息管理", description = "样品信息增删改查+分页查询接口")
@@ -29,23 +34,37 @@ public class GoodsInfoController {
@Operation(summary = "分页查询样品信息", description = "支持样品名称/类型/来源模糊查询、批次精准查询") @Operation(summary = "分页查询样品信息", description = "支持样品名称/类型/来源模糊查询、批次精准查询")
@Parameters({ @Parameters({
@Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY), @Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY), @Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY)
@Parameter(name = "goodsName", description = "样品名称(可选,模糊查询)", required = false, example = "手机", in = ParameterIn.QUERY), // @Parameter(name = "goodsName", description = "样品名称(可选,模糊查询)", required = false, example = "手机", in = ParameterIn.QUERY),
@Parameter(name = "goodsType", description = "样品类型(可选,模糊查询)", required = false, example = "电子产品", in = ParameterIn.QUERY), // @Parameter(name = "goodsType", description = "样品类型(可选,模糊查询)", required = false, example = "电子产品", in = ParameterIn.QUERY),
@Parameter(name = "goodFrom", description = "样品来源(可选,模糊查询)", required = false, example = "深圳", in = ParameterIn.QUERY), // @Parameter(name = "goodFrom", description = "样品来源(可选,模糊查询)", required = false, example = "深圳", in = ParameterIn.QUERY),
@Parameter(name = "goodBatch", description = "样品批次(可选,精准查询)", required = false, example = "202501", in = ParameterIn.QUERY) // @Parameter(name = "goodBatch", description = "样品批次(可选,精准查询)", required = false, example = "202501", in = ParameterIn.QUERY)
}) })
public Result getGoodsInfoPage( public Result getGoodsInfoPage(
@RequestParam Integer pageNum, @RequestParam Integer pageNum,
@RequestParam Integer pageSize, @RequestParam Integer pageSize,
@RequestParam(required = false) String goodsName, @ParameterObject
@RequestParam(required = false) String goodsType, @Schema(description = "样品信息查询条件(可选)", name = "goodsInfo", required = false)
@RequestParam(required = false) String goodFrom, GoodsInfoQuery goodsInfo) {
@RequestParam(required = false) Integer goodBatch) { PageInfo<GoodsInfo> pageBean = goodsInfoService.selectPage(pageNum, pageSize, goodsInfo);
PageInfo<GoodsInfo> pageBean = goodsInfoService.selectPage(pageNum, pageSize, goodsName, goodsType, goodFrom, goodBatch);
return Result.success(pageBean); return Result.success(pageBean);
} }
/**
* 查询样品信息
*/
@GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询样品信息", description = "支持样品名称/类型/来源模糊查询、批次精准查询")
@Parameters({
})
public Result getList(
@ParameterObject
@Schema(description = "样品信息查询条件(可选)", name = "goodsInfo", required = false)
GoodsInfoQuery goodsInfo) {
List<GoodsInfo> list = goodsInfoService.selectList( goodsInfo);
return Result.success(list);
}
/** /**
* 根据ID查询样品信息 * 根据ID查询样品信息
*/ */
@@ -70,6 +89,21 @@ public class GoodsInfoController {
} }
} }
/**
* 扫码新增样品信息
* 扫码信息:样品类型、样品编码、样品名称、样品点位
*/
@PostMapping(value = "/scanAdd", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "扫描新增样品", description = "样品名称、类型、编码、点位为必填项")
public Result scanAdd(@RequestBody GoodsInfo goodsInfo) {
try {
GoodsInfo goodInfoResult = goodsInfoService.insertByScan(goodsInfo);
return Result.success(goodInfoResult);
} catch (IllegalArgumentException e) {
return Result.error(e.getMessage());
}
}
/** /**
* 修改样品信息 * 修改样品信息
*/ */

View File

@@ -4,12 +4,15 @@ import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.domain.Result; import com.rczn.domain.Result;
import com.rczn.rcznautoplc.domain.StepInfo; import com.rczn.rcznautoplc.domain.StepInfo;
import com.rczn.rcznautoplc.domain.query.StepInfoQuery;
import com.rczn.rcznautoplc.service.StepInfoService; import com.rczn.rcznautoplc.service.StepInfoService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -24,35 +27,31 @@ public class StepInfoController {
@Autowired @Autowired
StepInfoService stepInfoService; StepInfoService stepInfoService;
@GetMapping(value = "/listPage", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/listPage", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "分页查询步骤信息", description = "支持岛屿ID精准查询、步骤名称模糊查询") @Operation(summary = "分页查询步骤信息", description = "支持岛屿ID精准查询、步骤名称模糊查询")
@Parameters({ @Parameters({
@Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY), @Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY), @Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY)
@Parameter(name = "islandId", description = "岛屿ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "stepName", description = "步骤名称(可选,模糊查询)", required = false, example = "检测", in = ParameterIn.QUERY)
}) })
public Result getStepInfoPage( public Result getStepInfoPage(
@ParameterObject // 核心注解:标记该实体类从查询参数取值
@Schema(description = "设备查询条件(可选)") // 补充描述
StepInfoQuery stepInfo,
@RequestParam Integer pageNum, @RequestParam Integer pageNum,
@RequestParam Integer pageSize, @RequestParam Integer pageSize
@RequestParam(required = false) Integer islandId, ) {
@RequestParam(required = false) String stepName) { PageInfo<StepInfo> pageBean = stepInfoService.selectPage(pageNum, pageSize, stepInfo);
PageInfo<StepInfo> pageBean = stepInfoService.selectPage(pageNum, pageSize, islandId, stepName);
return Result.success(pageBean); return Result.success(pageBean);
} }
@GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询步骤信息", description = "支持岛屿ID精准查询、步骤名称模糊查询") @Operation(summary = "查询步骤信息", description = "支持岛屿ID精准查询、步骤名称模糊查询")
@Parameters({
@Parameter(name = "islandId", description = "岛屿ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "stepName", description = "步骤名称(可选,模糊查询)", required = false, example = "检测", in = ParameterIn.QUERY)
})
public Result getStepInfoList( public Result getStepInfoList(
@RequestParam(required = false) Integer islandId, @ParameterObject // 核心注解:标记该实体类从查询参数取值
@RequestParam(required = false) String stepName) { @Schema(description = "设备查询条件(可选)") // 补充描述
List<StepInfo> list = stepInfoService.selectList( islandId, stepName); StepInfoQuery stepInfo) {
List<StepInfo> list = stepInfoService.selectList( stepInfo);
return Result.success(list); return Result.success(list);
} }
@@ -74,6 +73,30 @@ public class StepInfoController {
} }
} }
@PostMapping(value = "/batchAdd", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "批量新增步骤信息", description = "岛屿ID、步骤名称为必填项")
public Result batchAddStepInfo(@RequestBody List<StepInfo> stepInfoList) {
try {
stepInfoService.insertBatch(stepInfoList);
return Result.success(true);
} catch (IllegalArgumentException e) {
return Result.error(e.getMessage());
}
}
//批量更新步骤信息
@PostMapping(value = "/batchUpdate", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "批量更新步骤信息", description = "岛屿ID、步骤名称为必填项")
public Result batchUpdateStepInfo(@RequestBody List<StepInfo> stepInfoList) {
try {
stepInfoService.updateBatch(stepInfoList);
return Result.success(true);
} catch (IllegalArgumentException e) {
return Result.error(e.getMessage());
}
}
@PutMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE) @PutMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "修改步骤信息", description = "需传入步骤信息ID其他字段可选非空则更新") @Operation(summary = "修改步骤信息", description = "需传入步骤信息ID其他字段可选非空则更新")
public Result updateStepInfo(@RequestBody StepInfo stepInfo) { public Result updateStepInfo(@RequestBody StepInfo stepInfo) {
@@ -95,4 +118,16 @@ public class StepInfoController {
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
} }
//批量删除步骤信息
@DeleteMapping(value = "/batchDel", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "批量删除步骤信息", description = "逻辑删除设置delSign=1不物理删除数据")
public Result batchDeleteStepInfo(@RequestBody List<Long> ids) {
try {
stepInfoService.deleteBatchByIds(ids);
return Result.success(true);
} catch (IllegalArgumentException e) {
return Result.error(e.getMessage());
}
}
} }

View File

@@ -1,6 +1,8 @@
package com.rczn.rcznautoplc.domain; package com.rczn.rcznautoplc.domain;
import com.rczn.domain.BaseBean; import com.rczn.domain.BaseBean;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -15,6 +17,9 @@ public class DevInfo extends BaseBean {
//设备型号 //设备型号
private String devModel; private String devModel;
//plc映射地址
private Integer plcAddr;
//设备IP地址 //设备IP地址
private String ipAddr; private String ipAddr;
@@ -26,6 +31,8 @@ public class DevInfo extends BaseBean {
private Integer status; // 0-空闲1-运行4-故障 private Integer status; // 0-空闲1-运行4-故障
private Integer runModel;//0-手动模式1-自动模式
private String devDesc; private String devDesc;
public DevInfo() { public DevInfo() {
@@ -59,6 +66,14 @@ public class DevInfo extends BaseBean {
this.devModel = devModel; this.devModel = devModel;
} }
public Integer getPlcAddr() {
return plcAddr;
}
public void setPlcAddr(Integer plcAddr) {
this.plcAddr = plcAddr;
}
public String getIpAddr() { public String getIpAddr() {
return ipAddr; return ipAddr;
} }
@@ -99,6 +114,14 @@ public class DevInfo extends BaseBean {
this.status = status; this.status = status;
} }
public Integer getRunModel() {
return runModel;
}
public void setRunModel(Integer runModel) {
this.runModel = runModel;
}
public String getDevDesc() { public String getDevDesc() {
return devDesc; return devDesc;
} }

View File

@@ -1,13 +1,21 @@
package com.rczn.rcznautoplc.domain; package com.rczn.rcznautoplc.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.rczn.domain.BaseBean; import com.rczn.domain.BaseBean;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime; import java.time.LocalDateTime;
public class DevParam extends BaseBean { public class DevParam extends BaseBean {
private Integer devId; private String devIds;
//字典类型-参数分类id
private Integer dicDataId;
private String paramName; private String paramName;
//plc映射地址
private Integer plcAddr;
private String paramValue; private String paramValue;
@@ -16,8 +24,10 @@ public class DevParam extends BaseBean {
private String paramUnit; private String paramUnit;
private String formType; private String formType;
private String paramDesc; private String paramDesc;
@JsonIgnore
private DevInfo devInfo; private DevInfo devInfo;
public DevParam() { public DevParam() {
@@ -27,12 +37,12 @@ public class DevParam extends BaseBean {
super(id, createId, createTime, updateId, updateTime, delSign, remark); super(id, createId, createTime, updateId, updateTime, delSign, remark);
} }
public Integer getDevId() { public String getDevIds() {
return devId; return devIds;
} }
public void setDevId(Integer devId) { public void setDevIds(String devIds) {
this.devId = devId; this.devIds = devIds;
} }
public String getParamName() { public String getParamName() {
@@ -59,6 +69,22 @@ public class DevParam extends BaseBean {
this.paramType = paramType; this.paramType = paramType;
} }
public Integer getPlcAddr() {
return plcAddr;
}
public void setPlcAddr(Integer plcAddr) {
this.plcAddr = plcAddr;
}
public Integer getDicDataId() {
return dicDataId;
}
public void setDicDataId(Integer dicDataId) {
this.dicDataId = dicDataId;
}
public String getParamUnit() { public String getParamUnit() {
return paramUnit; return paramUnit;
} }

View File

@@ -1,6 +1,9 @@
package com.rczn.rcznautoplc.domain; package com.rczn.rcznautoplc.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.rczn.domain.BaseBean; import com.rczn.domain.BaseBean;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -11,6 +14,8 @@ public class GoodsFlowStatus extends BaseBean {
private Integer islandId; private Integer islandId;
private Integer devId;
private Integer flowSort; private Integer flowSort;
private Integer status; // 0-未执行1-执行10-通过11-失败 private Integer status; // 0-未执行1-执行10-通过11-失败
@@ -60,6 +65,14 @@ public class GoodsFlowStatus extends BaseBean {
this.flowSort = flowSort; this.flowSort = flowSort;
} }
public Integer getDevId() {
return devId;
}
public void setDevId(Integer devId) {
this.devId = devId;
}
public Integer getStatus() { public Integer getStatus() {
return status; return status;
} }

View File

@@ -1,6 +1,10 @@
package com.rczn.rcznautoplc.domain; package com.rczn.rcznautoplc.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.rczn.domain.BaseBean; import com.rczn.domain.BaseBean;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.models.security.SecurityScheme;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -16,15 +20,25 @@ public class GoodsInfo extends BaseBean {
private Integer goodBatch; private Integer goodBatch;
//进样点位
private Integer pointNum;
//目标监测物
private String goalDetect;
//条码
private String barCode;
//国标id
private Integer flowId;
private Integer goodsStatus;
private String desc; private String desc;
public GoodsInfo() { public GoodsInfo() {
} }
public GoodsInfo(Long id, Long createId, LocalDateTime createTime, Long updateId, LocalDateTime updateTime, boolean delSign, String remark) {
super(id, createId, createTime, updateId, updateTime, delSign, remark);
}
public String getGoodsName() { public String getGoodsName() {
return goodsName; return goodsName;
} }
@@ -65,6 +79,46 @@ public class GoodsInfo extends BaseBean {
this.goodBatch = goodBatch; this.goodBatch = goodBatch;
} }
public Integer getPointNum() {
return pointNum;
}
public void setPointNum(Integer pointNum) {
this.pointNum = pointNum;
}
public String getGoalDetect() {
return goalDetect;
}
public void setGoalDetect(String goalDetect) {
this.goalDetect = goalDetect;
}
public String getBarCode() {
return barCode;
}
public void setBarCode(String barCode) {
this.barCode = barCode;
}
public Integer getFlowId() {
return flowId;
}
public void setFlowId(Integer flowId) {
this.flowId = flowId;
}
public Integer getGoodsStatus() {
return goodsStatus;
}
public void setGoodsStatus(Integer goodsStatus) {
this.goodsStatus = goodsStatus;
}
public String getDesc() { public String getDesc() {
return desc; return desc;
} }

View File

@@ -10,6 +10,9 @@ public class IslandInfo extends BaseBean {
private String islandCode; private String islandCode;
//plc映射地址
private Integer plcAddr;
private String islandLogo; private String islandLogo;
private String desc; private String desc;
@@ -17,10 +20,6 @@ public class IslandInfo extends BaseBean {
public IslandInfo() { public IslandInfo() {
} }
public IslandInfo(Long id, Long createId, LocalDateTime createTime, Long updateId, LocalDateTime updateTime, boolean delSign, String remark) {
super(id, createId, createTime, updateId, updateTime, delSign, remark);
}
public String getIslandName() { public String getIslandName() {
return islandName; return islandName;
} }
@@ -37,6 +36,14 @@ public class IslandInfo extends BaseBean {
this.islandCode = islandCode; this.islandCode = islandCode;
} }
public Integer getPlcAddr() {
return plcAddr;
}
public void setPlcAddr(Integer plcAddr) {
this.plcAddr = plcAddr;
}
public String getIslandLogo() { public String getIslandLogo() {
return islandLogo; return islandLogo;
} }

View File

@@ -1,6 +1,9 @@
package com.rczn.rcznautoplc.domain; package com.rczn.rcznautoplc.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.rczn.domain.BaseBean; import com.rczn.domain.BaseBean;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -19,8 +22,10 @@ public class IslandParam extends BaseBean {
private String formType; private String formType;
@JsonIgnore
private IslandInfo islandInfo; private IslandInfo islandInfo;
@JsonIgnore
private StepInfo stepInfo; private StepInfo stepInfo;
public IslandParam() { public IslandParam() {

View File

@@ -1,6 +1,9 @@
package com.rczn.rcznautoplc.domain; package com.rczn.rcznautoplc.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.rczn.domain.BaseBean; import com.rczn.domain.BaseBean;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -17,10 +20,12 @@ public class StepInfo extends BaseBean {
private String paramValue; private String paramValue;
private String formType; private String formType;
private Integer stepOrder;
private String stepName; private String stepName;
private String stepDesc; private String stepDesc;
@JsonIgnore
private IslandInfo islandInfo; private IslandInfo islandInfo;
public StepInfo() { public StepInfo() {
@@ -94,6 +99,14 @@ public class StepInfo extends BaseBean {
this.islandId = islandId; this.islandId = islandId;
} }
public Integer getStepOrder() {
return stepOrder;
}
public void setStepOrder(Integer stepOrder) {
this.stepOrder = stepOrder;
}
public String getStepName() { public String getStepName() {
return stepName; return stepName;
} }

View File

@@ -1,6 +1,7 @@
package com.rczn.rcznautoplc.mapper; package com.rczn.rcznautoplc.mapper;
import com.rczn.rcznautoplc.domain.DevInfo; import com.rczn.rcznautoplc.domain.DevInfo;
import com.rczn.rcznautoplc.domain.query.DevInfoQuery;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -23,6 +24,8 @@ public interface DevInfoMapper {
// 根据ID查询设备未删除 // 根据ID查询设备未删除
DevInfo selectById(@Param("id") Long id); DevInfo selectById(@Param("id") Long id);
//根据设备信息,查询设备信息列表
List<DevInfo> selectList(DevInfoQuery devInfo);
// 分页查询设备(支持多条件过滤) // 分页查询设备(支持多条件过滤)
List<DevInfo> selectPage(DevInfo devInfo); List<DevInfo> selectPage(DevInfo devInfo);

View File

@@ -1,6 +1,7 @@
package com.rczn.rcznautoplc.mapper; package com.rczn.rcznautoplc.mapper;
import com.rczn.rcznautoplc.domain.DevParam; import com.rczn.rcznautoplc.domain.DevParam;
import com.rczn.rcznautoplc.domain.query.DevParamQuery;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -31,5 +32,9 @@ public interface DevParamMapper {
/** /**
* 分页查询设备参数(支持条件过滤) * 分页查询设备参数(支持条件过滤)
*/ */
List<DevParam> selectPage(DevParam devParam); List<DevParam> selectPage(DevParamQuery devParam);
Boolean addDevId(@Param("devId") Integer devId,@Param("paramId") Integer paramId);
Boolean delDevId(@Param("devId")Integer devId,@Param("paramId") Integer paramId);
} }

View File

@@ -1,6 +1,7 @@
package com.rczn.rcznautoplc.mapper; package com.rczn.rcznautoplc.mapper;
import com.rczn.rcznautoplc.domain.GoodsFlowStatus; import com.rczn.rcznautoplc.domain.GoodsFlowStatus;
import com.rczn.rcznautoplc.domain.query.GoodsFlowStatusQuery;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -12,5 +13,5 @@ public interface GoodsFlowStatusMapper {
Boolean update(GoodsFlowStatus goodsFlowStatus); Boolean update(GoodsFlowStatus goodsFlowStatus);
Boolean deleteById(@Param("id") Long id); Boolean deleteById(@Param("id") Long id);
GoodsFlowStatus selectById(@Param("id") Long id); GoodsFlowStatus selectById(@Param("id") Long id);
List<GoodsFlowStatus> selectPage(GoodsFlowStatus goodsFlowStatus); List<GoodsFlowStatus> selectPage(GoodsFlowStatusQuery goodsFlowStatus);
} }

View File

@@ -1,6 +1,7 @@
package com.rczn.rcznautoplc.mapper; package com.rczn.rcznautoplc.mapper;
import com.rczn.rcznautoplc.domain.GoodsInfo; import com.rczn.rcznautoplc.domain.GoodsInfo;
import com.rczn.rcznautoplc.domain.query.GoodsInfoQuery;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -9,8 +10,16 @@ import java.util.List;
@Mapper @Mapper
public interface GoodsInfoMapper { public interface GoodsInfoMapper {
Long insert(GoodsInfo goodsInfo); Long insert(GoodsInfo goodsInfo);
//批量插入样品数据:
// Long batchInsert(List<GoodsInfo> goodsInfoList);
Boolean update(GoodsInfo goodsInfo); Boolean update(GoodsInfo goodsInfo);
Boolean deleteById(@Param("id") Long id); Boolean deleteById(@Param("id") Long id);
GoodsInfo selectById(@Param("id") Long id); GoodsInfo selectById(@Param("id") Long id);
List<GoodsInfo> selectPage(GoodsInfo goodsInfo);
List<GoodsInfo> selectByIdList(@Param("idList") List<Integer> idList);
GoodsInfo selectByBarCode(@Param("barCode") String barCode);
List<GoodsInfo> selectPage(GoodsInfoQuery goodsInfo);
} }

View File

@@ -1,6 +1,7 @@
package com.rczn.rcznautoplc.mapper; package com.rczn.rcznautoplc.mapper;
import com.rczn.rcznautoplc.domain.IslandInfo; import com.rczn.rcznautoplc.domain.IslandInfo;
import com.rczn.rcznautoplc.domain.query.IslandInfoQuery;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -12,5 +13,10 @@ public interface IslandInfoMapper {
Boolean update(IslandInfo islandInfo); Boolean update(IslandInfo islandInfo);
Boolean deleteById(@Param("id") Long id); Boolean deleteById(@Param("id") Long id);
IslandInfo selectById(@Param("id") Long id); IslandInfo selectById(@Param("id") Long id);
/**
* 查询功能岛信息List
*/
List<IslandInfo> selectList(IslandInfoQuery islandInfoQuery);
List<IslandInfo> selectPage(IslandInfo islandInfo); List<IslandInfo> selectPage(IslandInfo islandInfo);
} }

View File

@@ -1,6 +1,7 @@
package com.rczn.rcznautoplc.mapper; package com.rczn.rcznautoplc.mapper;
import com.rczn.rcznautoplc.domain.StepInfo; import com.rczn.rcznautoplc.domain.StepInfo;
import com.rczn.rcznautoplc.domain.query.StepInfoQuery;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -11,6 +12,13 @@ public interface StepInfoMapper {
Long insert(StepInfo stepInfo); Long insert(StepInfo stepInfo);
Boolean update(StepInfo stepInfo); Boolean update(StepInfo stepInfo);
Boolean deleteById(@Param("id") Long id); Boolean deleteById(@Param("id") Long id);
Long deleteBatchByIds(List<Long> ids);
StepInfo selectById(@Param("id") Long id); StepInfo selectById(@Param("id") Long id);
List<StepInfo> selectPage(StepInfo stepInfo); List<StepInfo> selectList(StepInfo stepInfo);
List<StepInfo> selectPage(StepInfoQuery stepInfo);
Long insertBatch(List<StepInfo> stepInfoList);
Long updateBatch(List<StepInfo> stepInfoList);
} }

View File

@@ -2,6 +2,7 @@ package com.rczn.rcznautoplc.service;
import com.rczn.rcznautoplc.domain.DevInfo; import com.rczn.rcznautoplc.domain.DevInfo;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.rcznautoplc.domain.query.DevInfoQuery;
import java.util.List; import java.util.List;
@@ -21,6 +22,15 @@ public interface DevInfoService {
// 根据ID查询设备 // 根据ID查询设备
DevInfo getDevInfoById(Long id); DevInfo getDevInfoById(Long id);
//根据设备信息查询设备列表数据
/**
* Retrieves a list of device information based on the provided query parameters.
*
* @param devInfo The query parameters used to filter device information
* @return List<DevInfo> A list of device information objects that match the query criteria
*/
List<DevInfo> getDevInfoList(DevInfoQuery devInfo);
// 分页查询设备 // 分页查询设备
PageInfo<DevInfo> getDevInfoPage(DevInfo devInfo, Integer pageNum, Integer pageSize); PageInfo<DevInfo> getDevInfoPage(DevInfo devInfo, Integer pageNum, Integer pageSize);

View File

@@ -3,6 +3,7 @@ package com.rczn.rcznautoplc.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.rcznautoplc.domain.DevParam; import com.rczn.rcznautoplc.domain.DevParam;
import com.rczn.rcznautoplc.domain.query.DevParamQuery;
import java.util.List; import java.util.List;
@@ -10,9 +11,9 @@ public interface DevParamService {
/** /**
* 分页查询 * 分页查询
*/ */
PageInfo<DevParam> selectPage(Integer pageNum, Integer pageSize, Integer devId, String paramName, String paramValue); PageInfo<DevParam> selectPage(Integer pageNum, Integer pageSize, Integer devId,String paramTypeData, String paramName, String paramValue);
List<DevParam> selectList(Integer devId, String paramName, String paramValue); List<DevParam> selectList(DevParamQuery queryParam);
/** /**
* 根据ID查询 * 根据ID查询
@@ -29,6 +30,16 @@ public interface DevParamService {
*/ */
Boolean update(DevParam devParam); Boolean update(DevParam devParam);
/**
* 为参数增加devId值
*/
Boolean addDevId(Integer devId, Integer paramId);
/**
* 根据paramId,减少devIds中的devId
*/
Boolean reduceDevId(Integer devId, Integer paramId);
/** /**
* 逻辑删除 * 逻辑删除
*/ */

View File

@@ -3,9 +3,13 @@ package com.rczn.rcznautoplc.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.rcznautoplc.domain.GoodsFlowStatus; import com.rczn.rcznautoplc.domain.GoodsFlowStatus;
import com.rczn.rcznautoplc.domain.query.GoodsFlowStatusQuery;
import java.util.List;
public interface GoodsFlowStatusService { public interface GoodsFlowStatusService {
PageInfo<GoodsFlowStatus> selectPage(Integer pageNum, Integer pageSize, Integer goodsId, Integer flowId, Integer islandId, Integer status); PageInfo<GoodsFlowStatus> selectPage(Integer pageNum, Integer pageSize, GoodsFlowStatusQuery goodsFlowStatus);
List<GoodsFlowStatus> selectList( GoodsFlowStatusQuery goodsFlowStatus);
GoodsFlowStatus selectById(Long id); GoodsFlowStatus selectById(Long id);
Long insert(GoodsFlowStatus goodsFlowStatus); Long insert(GoodsFlowStatus goodsFlowStatus);
Boolean update(GoodsFlowStatus goodsFlowStatus); Boolean update(GoodsFlowStatus goodsFlowStatus);

View File

@@ -1,25 +1,42 @@
package com.rczn.rcznautoplc.service; package com.rczn.rcznautoplc.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean;
import com.rczn.rcznautoplc.domain.GoodsInfo; import com.rczn.rcznautoplc.domain.GoodsInfo;
import com.rczn.rcznautoplc.domain.query.GoodsInfoQuery;
import java.util.List;
public interface GoodsInfoService { public interface GoodsInfoService {
/** /**
* 分页查询货物信息 * 分页查询货物信息
*/ */
PageInfo<GoodsInfo> selectPage(Integer pageNum, Integer pageSize, String goodsName, String goodsType, String goodFrom, Integer goodBatch); PageInfo<GoodsInfo> selectPage(Integer pageNum, Integer pageSize, GoodsInfoQuery goodsInfo);
/**
* 查询样品信息List
*/
List<GoodsInfo> selectList(GoodsInfoQuery goodsInfo);
/** /**
* 根据ID查询货物信息 * 根据ID查询货物信息
*/ */
GoodsInfo selectById(Long id); GoodsInfo selectById(Long id);
/**
* 根据ID列表查询货物列表信息
*/
List<GoodsInfo> selectByIdList(List<Integer> ids);
/** /**
* 新增货物信息 * 新增货物信息
*/ */
Long insert(GoodsInfo goodsInfo); Long insert(GoodsInfo goodsInfo);
/**
* 扫码新增货物信息
*/
GoodsInfo insertByScan(GoodsInfo goodsInfo);
/** /**
* 修改货物信息 * 修改货物信息
*/ */

View File

@@ -2,11 +2,22 @@ package com.rczn.rcznautoplc.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.rcznautoplc.domain.GoodsInfo;
import com.rczn.rcznautoplc.domain.IslandInfo; import com.rczn.rcznautoplc.domain.IslandInfo;
import com.rczn.rcznautoplc.domain.query.GoodsInfoQuery;
import com.rczn.rcznautoplc.domain.query.IslandInfoQuery;
import java.util.List;
public interface IslandInfoService { public interface IslandInfoService {
PageInfo<IslandInfo> selectPage(Integer pageNum, Integer pageSize, String islandName, String islandCode); PageInfo<IslandInfo> selectPage(Integer pageNum, Integer pageSize, String islandName, String islandCode);
IslandInfo selectById(Long id); IslandInfo selectById(Long id);
/**
* 查询功能岛信息List
*/
List<IslandInfo> selectList(IslandInfoQuery islandInfoQuery);
Long insert(IslandInfo islandInfo); Long insert(IslandInfo islandInfo);
Boolean update(IslandInfo islandInfo); Boolean update(IslandInfo islandInfo);
Boolean deleteById(Long id); Boolean deleteById(Long id);

View File

@@ -2,14 +2,32 @@ package com.rczn.rcznautoplc.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.rcznautoplc.domain.StepInfo; import com.rczn.rcznautoplc.domain.StepInfo;
import com.rczn.rcznautoplc.domain.query.StepInfoQuery;
import java.util.List; import java.util.List;
public interface StepInfoService { public interface StepInfoService {
PageInfo<StepInfo> selectPage(Integer pageNum, Integer pageSize, Integer islandId, String stepName); PageInfo<StepInfo> selectPage(Integer pageNum, Integer pageSize, StepInfoQuery stepInfo);
List<StepInfo> selectList( Integer islandId, String stepName); List<StepInfo> selectList( StepInfoQuery stepInfo);
StepInfo selectById(Long id); StepInfo selectById(Long id);
Long insert(StepInfo stepInfo); Long insert(StepInfo stepInfo);
Long insertBatch(List<StepInfo> stepInfoList);
Boolean update(StepInfo stepInfo); Boolean update(StepInfo stepInfo);
/**
* 批量更新
* @param stepInfoList
* @return
*/
Long updateBatch(List<StepInfo> stepInfoList);
Boolean deleteById(Long id); Boolean deleteById(Long id);
/**
* 批量删除
* @param ids
* @return
* @throws Exception
*/
Long deleteBatchByIds(List<Long> ids);
} }

View File

@@ -1,6 +1,7 @@
package com.rczn.rcznautoplc.service.impl; package com.rczn.rcznautoplc.service.impl;
import com.rczn.rcznautoplc.domain.DevInfo; import com.rczn.rcznautoplc.domain.DevInfo;
import com.rczn.rcznautoplc.domain.query.DevInfoQuery;
import com.rczn.rcznautoplc.mapper.DevInfoMapper; import com.rczn.rcznautoplc.mapper.DevInfoMapper;
import com.rczn.rcznautoplc.service.DevInfoService; import com.rczn.rcznautoplc.service.DevInfoService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@@ -29,6 +30,18 @@ public class DevInfoServiceImpl implements DevInfoService {
if (devInfo.getCreateTime() == null) { if (devInfo.getCreateTime() == null) {
devInfo.setCreateTime(java.time.LocalDateTime.now()); devInfo.setCreateTime(java.time.LocalDateTime.now());
} }
//判断设备是否是PLCPLC设备只有一个主PLCcompany-主站
if(devInfo.getDevModel().equals("PLC")&&devInfo.getCompany().equals("主站")){
//查询出devModel为PLCcompany为“主站”的设备
DevInfoQuery devInfo1 = new DevInfoQuery();
devInfo1.setDevModel("PLC");
devInfo1.setCompany("主站");
List<DevInfo> devInfoList = devInfoMapper.selectList(devInfo1);
if(devInfoList.size()>0){
//如果存在,报错抛出异常
throw new RuntimeException("主站PLC设备只能有一个");
}
}
// 调用Mapper新增 // 调用Mapper新增
return devInfoMapper.insert(devInfo) > 0; return devInfoMapper.insert(devInfo) > 0;
} }
@@ -51,6 +64,25 @@ public class DevInfoServiceImpl implements DevInfoService {
if (devInfo.getUpdateTime() == null) { if (devInfo.getUpdateTime() == null) {
devInfo.setUpdateTime(java.time.LocalDateTime.now()); devInfo.setUpdateTime(java.time.LocalDateTime.now());
} }
//判断设备是否是PLCPLC设备只有一个主PLCcompany-主站
if(devInfo.getDevModel().equals("PLC")&&devInfo.getCompany().equals("主站")){
//查询出devModel为PLCcompany为“主站”的设备
DevInfoQuery devInfo1 = new DevInfoQuery();
devInfo1.setDevModel("PLC");
devInfo1.setCompany("主站");
List<DevInfo> devInfoList = devInfoMapper.selectList(devInfo1);
if(devInfoList.size()>0){
for (DevInfo devInfo2 : devInfoList)
if(devInfo2.getId().equals(devInfo.getId()))
continue;
else {
//如果存在,报错抛出异常
throw new RuntimeException("主站PLC设备只能有一个");
}
}
}
// 调用Mapper更新 // 调用Mapper更新
return devInfoMapper.updateById(devInfo) > 0; return devInfoMapper.updateById(devInfo) > 0;
} }
@@ -61,6 +93,11 @@ public class DevInfoServiceImpl implements DevInfoService {
return devInfoMapper.selectById(id); return devInfoMapper.selectById(id);
} }
@Override
public List<DevInfo> getDevInfoList(DevInfoQuery devInfo) {
return devInfoMapper.selectList(devInfo);
}
@Override @Override
public PageInfo<DevInfo> getDevInfoPage(DevInfo devInfo, Integer pageNum, Integer pageSize) { public PageInfo<DevInfo> getDevInfoPage(DevInfo devInfo, Integer pageNum, Integer pageSize) {
// 分页参数默认值 // 分页参数默认值

View File

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.rcznautoplc.domain.DevParam; import com.rczn.rcznautoplc.domain.DevParam;
import com.rczn.rcznautoplc.domain.query.DevParamQuery;
import com.rczn.rcznautoplc.mapper.DevParamMapper; import com.rczn.rcznautoplc.mapper.DevParamMapper;
import com.rczn.rcznautoplc.service.DevParamService; import com.rczn.rcznautoplc.service.DevParamService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -18,12 +19,13 @@ public class DevParamServiceImpl implements DevParamService {
DevParamMapper devParamMapper; DevParamMapper devParamMapper;
@Override @Override
public PageInfo<DevParam> selectPage(Integer pageNum, Integer pageSize, Integer devId, String paramName, String paramValue) { public PageInfo<DevParam> selectPage(Integer pageNum, Integer pageSize, Integer devId, String paramTypeData, String paramName, String paramValue) {
// 1. 开启分页 // 1. 开启分页
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
// 2. 构建查询条件 // 2. 构建查询条件
DevParam queryParam = new DevParam(); DevParamQuery queryParam = new DevParamQuery();
queryParam.setDevId(devId); queryParam.setDevId(devId);
queryParam.setParamTypeData(paramTypeData);
queryParam.setParamName(paramName); queryParam.setParamName(paramName);
queryParam.setParamValue(paramValue); queryParam.setParamValue(paramValue);
// 3. 执行查询 // 3. 执行查询
@@ -40,12 +42,7 @@ public class DevParamServiceImpl implements DevParamService {
* @return * @return
*/ */
@Override @Override
public List<DevParam> selectList(Integer devId, String paramName, String paramValue) { public List<DevParam> selectList(DevParamQuery queryParam) {
// 1. 构建查询条件
DevParam queryParam = new DevParam();
queryParam.setDevId(devId);
queryParam.setParamName(paramName);
queryParam.setParamValue(paramValue);
// 3. 执行查询 // 3. 执行查询
List<DevParam> list = devParamMapper.selectPage(queryParam); List<DevParam> list = devParamMapper.selectPage(queryParam);
return list; return list;
@@ -61,8 +58,8 @@ public class DevParamServiceImpl implements DevParamService {
@Override @Override
public Long insert(DevParam devParam) { public Long insert(DevParam devParam) {
if (devParam.getDevId() == null) { if (devParam.getDevIds() == null) {
throw new IllegalArgumentException("设备ID不能为空"); devParam.setDevIds(";");
} }
if (devParam.getParamName() == null || devParam.getParamName().isEmpty()) { if (devParam.getParamName() == null || devParam.getParamName().isEmpty()) {
throw new IllegalArgumentException("参数名称不能为空"); throw new IllegalArgumentException("参数名称不能为空");
@@ -78,6 +75,28 @@ public class DevParamServiceImpl implements DevParamService {
return devParamMapper.update(devParam); return devParamMapper.update(devParam);
} }
/**
* 为参数增加devId值
*
* @param devId
* @param paramId
*/
@Override
public Boolean addDevId(Integer devId, Integer paramId) {
return devParamMapper.addDevId(devId, paramId);
}
/**
* 根据paramId,减少devIds中的devId
*
* @param devId
* @param paramId
*/
@Override
public Boolean reduceDevId(Integer devId, Integer paramId) {
return devParamMapper.delDevId(devId, paramId);
}
@Override @Override
public Boolean deleteById(Long id) { public Boolean deleteById(Long id) {
if (id == null) { if (id == null) {

View File

@@ -56,10 +56,8 @@ public class FlowInfoServiceImpl implements FlowInfoService {
if (flowInfo.getFlowName() == null || flowInfo.getFlowName().isEmpty()) { if (flowInfo.getFlowName() == null || flowInfo.getFlowName().isEmpty()) {
throw new IllegalArgumentException("流程名称不能为空"); throw new IllegalArgumentException("流程名称不能为空");
} }
if (flowInfo.getFlowIndex() == null) { Long result = flowInfoMapper.insert(flowInfo);
throw new IllegalArgumentException("流程排序不能为空"); return flowInfo.getId();
}
return flowInfoMapper.insert(flowInfo);
} }
@Override @Override

View File

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.rcznautoplc.domain.GoodsFlowStatus; import com.rczn.rcznautoplc.domain.GoodsFlowStatus;
import com.rczn.rcznautoplc.domain.query.GoodsFlowStatusQuery;
import com.rczn.rcznautoplc.mapper.GoodsFlowStatusMapper; import com.rczn.rcznautoplc.mapper.GoodsFlowStatusMapper;
import com.rczn.rcznautoplc.service.GoodsFlowStatusService; import com.rczn.rcznautoplc.service.GoodsFlowStatusService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -18,17 +19,19 @@ public class GoodsFlowStatusServiceImpl implements GoodsFlowStatusService {
GoodsFlowStatusMapper goodsFlowStatusMapper; GoodsFlowStatusMapper goodsFlowStatusMapper;
@Override @Override
public PageInfo<GoodsFlowStatus> selectPage(Integer pageNum, Integer pageSize, Integer goodsId, Integer flowId, Integer islandId, Integer status) { public PageInfo<GoodsFlowStatus> selectPage(Integer pageNum, Integer pageSize, GoodsFlowStatusQuery goodsFlowStatus){
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
GoodsFlowStatus queryParam = new GoodsFlowStatus();
queryParam.setGoodsId(goodsId); List<GoodsFlowStatus> list = goodsFlowStatusMapper.selectPage(goodsFlowStatus);
queryParam.setFlowId(flowId);
queryParam.setIslandId(islandId);
queryParam.setStatus(status);
List<GoodsFlowStatus> list = goodsFlowStatusMapper.selectPage(queryParam);
return new PageInfo<>(list); return new PageInfo<>(list);
} }
@Override
public List<GoodsFlowStatus> selectList(GoodsFlowStatusQuery goodsFlowStatus) {
List<GoodsFlowStatus> list = goodsFlowStatusMapper.selectPage(goodsFlowStatus);
return list;
}
@Override @Override
public GoodsFlowStatus selectById(Long id) { public GoodsFlowStatus selectById(Long id) {
if (id == null) throw new IllegalArgumentException("ID不能为空"); if (id == null) throw new IllegalArgumentException("ID不能为空");

View File

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean; import com.rczn.domain.PageBean;
import com.rczn.rcznautoplc.domain.GoodsInfo; import com.rczn.rcznautoplc.domain.GoodsInfo;
import com.rczn.rcznautoplc.domain.query.GoodsInfoQuery;
import com.rczn.rcznautoplc.mapper.GoodsInfoMapper; import com.rczn.rcznautoplc.mapper.GoodsInfoMapper;
import com.rczn.rcznautoplc.service.GoodsInfoService; import com.rczn.rcznautoplc.service.GoodsInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -18,21 +19,29 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
GoodsInfoMapper goodsInfoMapper; GoodsInfoMapper goodsInfoMapper;
@Override @Override
public PageInfo<GoodsInfo> selectPage(Integer pageNum, Integer pageSize, String goodsName, String goodsType, String goodFrom, Integer goodBatch) { public PageInfo<GoodsInfo> selectPage(Integer pageNum, Integer pageSize, GoodsInfoQuery goodsInfo) {
// 开启分页 // 开启分页
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
// 构建查询条件
GoodsInfo queryParam = new GoodsInfo();
queryParam.setGoodsName(goodsName);
queryParam.setGoodsType(goodsType);
queryParam.setGoodFrom(goodFrom);
queryParam.setGoodBatch(goodBatch);
// 执行查询 // 执行查询
List<GoodsInfo> list = goodsInfoMapper.selectPage(queryParam); List<GoodsInfo> list = goodsInfoMapper.selectPage(goodsInfo);
// 包装分页结果 // 包装分页结果
return new PageInfo<>(list); return new PageInfo<>(list);
} }
/**
* 查询样品信息
*
* @param goodsInfo
*/
@Override
public List<GoodsInfo> selectList(GoodsInfoQuery goodsInfo) {
// 执行查询
List<GoodsInfo> list = goodsInfoMapper.selectPage(goodsInfo);
// 包装分页结果
return list;
}
@Override @Override
public GoodsInfo selectById(Long id) { public GoodsInfo selectById(Long id) {
if (id == null) { if (id == null) {
@@ -41,6 +50,16 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
return goodsInfoMapper.selectById(id); return goodsInfoMapper.selectById(id);
} }
/**
* 根据ID列表查询货物列表信息
*
* @param ids
*/
@Override
public List<GoodsInfo> selectByIdList(List<Integer> ids) {
return goodsInfoMapper.selectByIdList(ids);
}
@Override @Override
public Long insert(GoodsInfo goodsInfo) { public Long insert(GoodsInfo goodsInfo) {
if (goodsInfo.getGoodsName() == null || goodsInfo.getGoodsName().isEmpty()) { if (goodsInfo.getGoodsName() == null || goodsInfo.getGoodsName().isEmpty()) {
@@ -55,6 +74,35 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
return goodsInfoMapper.insert(goodsInfo); return goodsInfoMapper.insert(goodsInfo);
} }
/**
* 扫码新增货物信息
*
* @param goodsInfo
*/
@Override
public GoodsInfo insertByScan(GoodsInfo goodsInfo) {
//根据业务扫码录入样品信息有:样品编码,样品类型,样品名称,样品录入时间,点位号
//根据样品编码查询数据库样品信息
GoodsInfo goodsInfo1 = goodsInfoMapper.selectByBarCode(goodsInfo.getBarCode());
if(goodsInfo1 != null){
return goodsInfo1;
}
if (goodsInfo.getGoodsName() == null || goodsInfo.getGoodsName().isEmpty()) {
throw new IllegalArgumentException("货物名称不能为空");
}
if (goodsInfo.getGoodsType() == null || goodsInfo.getGoodsType().isEmpty()) {
throw new IllegalArgumentException("货物类型不能为空");
}
if (goodsInfo.getIncomeTime() == null) {
throw new IllegalArgumentException("入库时间不能为空");
}
goodsInfoMapper.insert(goodsInfo);
return goodsInfo;
}
@Override @Override
public Boolean update(GoodsInfo goodsInfo) { public Boolean update(GoodsInfo goodsInfo) {
if (goodsInfo.getId() == null) { if (goodsInfo.getId() == null) {

View File

@@ -3,6 +3,7 @@ package com.rczn.rcznautoplc.service.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.rcznautoplc.domain.IslandInfo; import com.rczn.rcznautoplc.domain.IslandInfo;
import com.rczn.rcznautoplc.domain.query.IslandInfoQuery;
import com.rczn.rcznautoplc.mapper.IslandInfoMapper; import com.rczn.rcznautoplc.mapper.IslandInfoMapper;
import com.rczn.rcznautoplc.service.IslandInfoService; import com.rczn.rcznautoplc.service.IslandInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +33,16 @@ public class IslandInfoServiceImpl implements IslandInfoService {
return islandInfoMapper.selectById(id); return islandInfoMapper.selectById(id);
} }
/**
* 查询功能岛信息List
*
* @param islandInfoQuery
*/
@Override
public List<IslandInfo> selectList(IslandInfoQuery islandInfoQuery) {
return islandInfoMapper.selectList(islandInfoQuery);
}
@Override @Override
public Long insert(IslandInfo islandInfo) { public Long insert(IslandInfo islandInfo) {
if (islandInfo.getIslandName() == null || islandInfo.getIslandName().isEmpty()) { if (islandInfo.getIslandName() == null || islandInfo.getIslandName().isEmpty()) {

View File

@@ -3,6 +3,7 @@ package com.rczn.rcznautoplc.service.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.rczn.rcznautoplc.domain.StepInfo; import com.rczn.rcznautoplc.domain.StepInfo;
import com.rczn.rcznautoplc.domain.query.StepInfoQuery;
import com.rczn.rcznautoplc.mapper.StepInfoMapper; import com.rczn.rcznautoplc.mapper.StepInfoMapper;
import com.rczn.rcznautoplc.service.StepInfoService; import com.rczn.rcznautoplc.service.StepInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -17,21 +18,15 @@ public class StepInfoServiceImpl implements StepInfoService {
StepInfoMapper stepInfoMapper; StepInfoMapper stepInfoMapper;
@Override @Override
public PageInfo<StepInfo> selectPage(Integer pageNum, Integer pageSize, Integer islandId, String stepName) { public PageInfo<StepInfo> selectPage(Integer pageNum, Integer pageSize, StepInfoQuery stepInfo) {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
StepInfo queryParam = new StepInfo(); List<StepInfo> list = stepInfoMapper.selectPage(stepInfo);
queryParam.setIslandId(islandId);
queryParam.setStepName(stepName);
List<StepInfo> list = stepInfoMapper.selectPage(queryParam);
return new PageInfo<>(list); return new PageInfo<>(list);
} }
@Override @Override
public List<StepInfo> selectList(Integer islandId, String stepName) { public List<StepInfo> selectList(StepInfoQuery stepInfo) {
StepInfo queryParam = new StepInfo(); List<StepInfo> list = stepInfoMapper.selectPage(stepInfo);
queryParam.setIslandId(islandId);
queryParam.setStepName(stepName);
List<StepInfo> list = stepInfoMapper.selectPage(queryParam);
return list; return list;
} }
@@ -41,6 +36,8 @@ public class StepInfoServiceImpl implements StepInfoService {
return stepInfoMapper.selectById(id); return stepInfoMapper.selectById(id);
} }
@Override @Override
public Long insert(StepInfo stepInfo) { public Long insert(StepInfo stepInfo) {
if (stepInfo.getIslandId() == null) throw new IllegalArgumentException("岛屿ID不能为空"); if (stepInfo.getIslandId() == null) throw new IllegalArgumentException("岛屿ID不能为空");
@@ -50,15 +47,43 @@ public class StepInfoServiceImpl implements StepInfoService {
return stepInfoMapper.insert(stepInfo); return stepInfoMapper.insert(stepInfo);
} }
@Override
public Long insertBatch(List<StepInfo> stepInfoList) {
return stepInfoMapper.insertBatch(stepInfoList);
}
@Override @Override
public Boolean update(StepInfo stepInfo) { public Boolean update(StepInfo stepInfo) {
if (stepInfo.getId() == null) throw new IllegalArgumentException("ID不能为空"); if (stepInfo.getId() == null) throw new IllegalArgumentException("ID不能为空");
return stepInfoMapper.update(stepInfo); return stepInfoMapper.update(stepInfo);
} }
/**
* 批量更新
*
* @param stepInfoList
* @return
*/
@Override
public Long updateBatch(List<StepInfo> stepInfoList) {
return stepInfoMapper.updateBatch(stepInfoList);
}
@Override @Override
public Boolean deleteById(Long id) { public Boolean deleteById(Long id) {
if (id == null) throw new IllegalArgumentException("ID不能为空"); if (id == null) throw new IllegalArgumentException("ID不能为空");
return stepInfoMapper.deleteById(id); return stepInfoMapper.deleteById(id);
} }
/**
* 批量删除
*
* @param ids
* @return
* @throws Exception
*/
@Override
public Long deleteBatchByIds(List<Long> ids) {
return stepInfoMapper.deleteBatchByIds(ids);
}
} }

View File

@@ -8,7 +8,7 @@
<!-- 设备专属字段 --> <!-- 设备专属字段 -->
<sql id="devColumn"> <sql id="devColumn">
island_id, dev_name, dev_model, ip_addr, port, protocol_type, company, status, dev_desc island_id, dev_name, dev_model,plc_addr, ip_addr, port, protocol_type, company, status,run_model, dev_desc
</sql> </sql>
<!-- 结果集映射(下划线转驼峰已开启,可简化) --> <!-- 结果集映射(下划线转驼峰已开启,可简化) -->
@@ -25,11 +25,13 @@
<result column="island_id" property="islandId"/> <result column="island_id" property="islandId"/>
<result column="dev_name" property="devName"/> <result column="dev_name" property="devName"/>
<result column="dev_model" property="devModel"/> <result column="dev_model" property="devModel"/>
<result column="plc_addr" property="plcAddr"/>
<result column="ip_addr" property="ipAddr"/> <result column="ip_addr" property="ipAddr"/>
<result column="port" property="port"/> <result column="port" property="port"/>
<result column="protocol_type" property="protocolType"/> <result column="protocol_type" property="protocolType"/>
<result column="company" property="company"/> <result column="company" property="company"/>
<result column="status" property="status"/> <result column="status" property="status"/>
<result column="run_model" property="runModel"/>
<result column="dev_desc" property="devDesc"/> <result column="dev_desc" property="devDesc"/>
</resultMap> </resultMap>
@@ -41,11 +43,13 @@
<if test="islandId != null">island_id,</if> <if test="islandId != null">island_id,</if>
<if test="devName != null and devName != ''">dev_name,</if> <if test="devName != null and devName != ''">dev_name,</if>
<if test="devModel != null and devModel != ''">dev_model,</if> <if test="devModel != null and devModel != ''">dev_model,</if>
<if test="plcAddr != null">plc_addr,</if>
<if test="ipAddr != null and ipAddr != ''">ip_addr,</if> <if test="ipAddr != null and ipAddr != ''">ip_addr,</if>
<if test="port != null">port,</if> <if test="port != null">port,</if>
<if test="protocolType != null and protocolType != ''">protocol_type,</if> <if test="protocolType != null and protocolType != ''">protocol_type,</if>
<if test="company != null and company != ''">company,</if> <if test="company != null and company != ''">company,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="runModel != null">run_model,</if>
<if test="devDesc != null and devDesc != ''">`dev_desc`,</if> <!-- 核心修正dev_desc → devDesc + 反引号 --> <if test="devDesc != null and devDesc != ''">`dev_desc`,</if> <!-- 核心修正dev_desc → devDesc + 反引号 -->
<!-- 通用字段(仅保留必要的人工传入字段,时间字段由数据库/代码自动生成) --> <!-- 通用字段(仅保留必要的人工传入字段,时间字段由数据库/代码自动生成) -->
<if test="createId != null">create_id,</if> <if test="createId != null">create_id,</if>
@@ -61,11 +65,13 @@
<if test="islandId != null">#{islandId},</if> <if test="islandId != null">#{islandId},</if>
<if test="devName != null and devName != ''">#{devName},</if> <if test="devName != null and devName != ''">#{devName},</if>
<if test="devModel != null and devModel != ''">#{devModel},</if> <if test="devModel != null and devModel != ''">#{devModel},</if>
<if test="plcAddr != null ">#{plcAddr},</if>
<if test="ipAddr != null and ipAddr != ''">#{ipAddr},</if> <if test="ipAddr != null and ipAddr != ''">#{ipAddr},</if>
<if test="port != null">#{port},</if> <if test="port != null">#{port},</if>
<if test="protocolType != null and protocolType != ''">#{protocolType},</if> <if test="protocolType != null and protocolType != ''">#{protocolType},</if>
<if test="company != null and company != ''">#{company},</if> <if test="company != null and company != ''">#{company},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="runModel != null">#{runModel},</if>
<if test="devDesc != null and devDesc != ''">#{devDesc},</if> <!-- 核心修正dev_desc → devDesc --> <if test="devDesc != null and devDesc != ''">#{devDesc},</if> <!-- 核心修正dev_desc → devDesc -->
<!-- 通用字段(与上方字段一一对应) --> <!-- 通用字段(与上方字段一一对应) -->
<if test="createId != null">#{createId},</if> <if test="createId != null">#{createId},</if>
@@ -78,7 +84,6 @@
) )
</insert> </insert>
<!-- 逻辑删除设备 --> <!-- 逻辑删除设备 -->
<update id="deleteById"> <update id="deleteById">
UPDATE tb_dev_info UPDATE tb_dev_info
@@ -94,11 +99,13 @@
<if test="islandId != null">island_id = #{islandId},</if> <if test="islandId != null">island_id = #{islandId},</if>
<if test="devName != null and devName != ''">dev_name = #{devName},</if> <if test="devName != null and devName != ''">dev_name = #{devName},</if>
<if test="devModel != null and devModel != ''">dev_model = #{devModel},</if> <if test="devModel != null and devModel != ''">dev_model = #{devModel},</if>
<if test="plcAddr != null">plc_addr = #{plcAddr},</if>
<if test="ipAddr != null and ipAddr != ''">ip_addr = #{ipAddr},</if> <if test="ipAddr != null and ipAddr != ''">ip_addr = #{ipAddr},</if>
<if test="port != null">port = #{port},</if> <if test="port != null">port = #{port},</if>
<if test="protocolType != null and protocolType != ''">protocol_type = #{protocolType},</if> <if test="protocolType != null and protocolType != ''">protocol_type = #{protocolType},</if>
<if test="company != null and company != ''">company = #{company},</if> <if test="company != null and company != ''">company = #{company},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="runModel != null and runModel != ''">#{runModel},</if>
<!-- 核心修正dev_desc → devDesc + 反引号转义 --> <!-- 核心修正dev_desc → devDesc + 反引号转义 -->
<if test="devDesc != null and devDesc != ''">`dev_desc` = #{devDesc},</if> <if test="devDesc != null and devDesc != ''">`dev_desc` = #{devDesc},</if>
<!-- 通用字段 --> <!-- 通用字段 -->
@@ -113,6 +120,7 @@
<if test="!(islandId != null <if test="!(islandId != null
or (devName != null and devName != '') or (devName != null and devName != '')
or (devModel != null and devModel != '') or (devModel != null and devModel != '')
or plcAddr != null
or (ipAddr != null and ipAddr != '') or (ipAddr != null and ipAddr != '')
or port != null or port != null
or (protocolType != null and protocolType != '') or (protocolType != null and protocolType != '')
@@ -154,6 +162,9 @@
<if test="devModel != null and devModel != ''"> <if test="devModel != null and devModel != ''">
AND dev_model LIKE CONCAT('%', #{devModel}, '%') AND dev_model LIKE CONCAT('%', #{devModel}, '%')
</if> </if>
<if test="plcAddr != null">
and plc_addr = #{plcAddr}
</if>
<!-- IP地址精准查询 --> <!-- IP地址精准查询 -->
<if test="ipAddr != null and ipAddr != ''"> <if test="ipAddr != null and ipAddr != ''">
AND ip_addr = #{ipAddr} AND ip_addr = #{ipAddr}
@@ -162,6 +173,9 @@
<if test="status != null"> <if test="status != null">
AND status = #{status} AND status = #{status}
</if> </if>
<if test="runModel != null and runModel != ''">
and run_model = #{runModel}
</if>
<!-- 协议类型精准查询 --> <!-- 协议类型精准查询 -->
<if test="protocolType != null and protocolType != ''"> <if test="protocolType != null and protocolType != ''">
AND protocol_type = #{protocolType} AND protocol_type = #{protocolType}
@@ -183,12 +197,18 @@
<if test="devModel != null and devModel != ''"> <if test="devModel != null and devModel != ''">
AND dev_model LIKE CONCAT('%', #{devModel}, '%') AND dev_model LIKE CONCAT('%', #{devModel}, '%')
</if> </if>
<if test="plcAddr != null">
and plc_addr = #{plcAddr}
</if>
<if test="ipAddr != null and ipAddr != ''"> <if test="ipAddr != null and ipAddr != ''">
AND ip_addr = #{ipAddr} AND ip_addr = #{ipAddr}
</if> </if>
<if test="status != null"> <if test="status != null">
AND status = #{status} AND status = #{status}
</if> </if>
<if test="runModel != null">
AND run_model = #{runModel}
</if>
<if test="protocolType != null and protocolType != ''"> <if test="protocolType != null and protocolType != ''">
AND protocol_type = #{protocolType} AND protocol_type = #{protocolType}
</if> </if>
@@ -203,4 +223,44 @@
WHERE del_sign = 0 WHERE del_sign = 0
ORDER BY id ASC ORDER BY id ASC
</select> </select>
<!-- 根据devinfo信息 -->
<select id="selectList" resultType="com.rczn.rcznautoplc.domain.DevInfo">
SELECT
<include refid="baseColumn"/>,
<include refid="devColumn"/>
FROM tb_dev_info
WHERE del_sign = 0
<!-- 设备名称模糊查询 -->
<if test="devName != null and devName != ''">
AND dev_name LIKE CONCAT('%', #{devName}, '%')
</if>
<!-- 设备所属岛屿精准查询 -->
<if test="islandId != null">
AND island_id = #{islandId}
</if>
<!-- 设备型号模糊查询 -->
<if test="devModel != null and devModel != ''">
AND dev_model LIKE CONCAT('%', #{devModel}, '%')
</if>
<if test="plcAddr != null">
and plc_addr = #{plcAddr}
</if>
<!-- IP地址精准查询 -->
<if test="ipAddr != null and ipAddr != ''">
AND ip_addr = #{ipAddr}
</if>
<!-- 设备状态精准查询 -->
<if test="status != null">
AND status = #{status}
</if>
<if test="runModel != null and runModel != ''">
and run_model = #{runModel}
</if>
<!-- 协议类型精准查询 -->
<if test="protocolType != null and protocolType != ''">
AND protocol_type = #{protocolType}
</if>
ORDER BY update_time DESC
</select>
</mapper> </mapper>

View File

@@ -8,14 +8,16 @@
<!-- DevParam 业务字段 --> <!-- DevParam 业务字段 -->
<sql id="devParamColumn"> <sql id="devParamColumn">
dev_id, param_name, param_value,param_type,param_unit,form_type, param_desc dev_ids, param_name, plc_addr, dic_data_id, param_value, param_type, param_unit, form_type, param_desc
</sql> </sql>
<!-- 新增 --> <!-- 新增:修复逗号缺失问题,统一格式 -->
<insert id="insert" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tb_dev_param ( INSERT INTO tb_dev_param (
<trim suffixOverrides=","> <trim suffixOverrides=",">
<if test="devId != null">dev_id, </if> <if test="devIds != null">dev_ids,</if>
<if test="plcAddr != null">plc_addr,</if>
<if test="dicDataId != null">dic_data_id,</if>
<if test="paramName != null and paramName != ''">param_name,</if> <if test="paramName != null and paramName != ''">param_name,</if>
<if test="paramValue != null and paramValue != ''">param_value,</if> <if test="paramValue != null and paramValue != ''">param_value,</if>
<if test="paramType != null and paramType != ''">param_type,</if> <if test="paramType != null and paramType != ''">param_type,</if>
@@ -24,11 +26,16 @@
<if test="paramDesc != null and paramDesc != ''">param_desc,</if> <if test="paramDesc != null and paramDesc != ''">param_desc,</if>
<if test="createId != null">create_id,</if> <if test="createId != null">create_id,</if>
<if test="updateId != null">update_id,</if> <if test="updateId != null">update_id,</if>
create_time, update_time, del_sign create_time,
update_time,
del_sign
</trim> </trim>
) VALUES ( )
VALUES (
<trim suffixOverrides=","> <trim suffixOverrides=",">
<if test="devId != null">#{devId}, </if> <if test="devIds != null">#{devIds},</if>
<if test="plcAddr != null">#{plcAddr},</if>
<if test="dicDataId != null">#{dicDataId},</if>
<if test="paramName != null and paramName != ''">#{paramName},</if> <if test="paramName != null and paramName != ''">#{paramName},</if>
<if test="paramValue != null and paramValue != ''">#{paramValue},</if> <if test="paramValue != null and paramValue != ''">#{paramValue},</if>
<if test="paramType != null and paramType != ''">#{paramType},</if> <if test="paramType != null and paramType != ''">#{paramType},</if>
@@ -37,16 +44,20 @@
<if test="paramDesc != null and paramDesc != ''">#{paramDesc},</if> <if test="paramDesc != null and paramDesc != ''">#{paramDesc},</if>
<if test="createId != null">#{createId},</if> <if test="createId != null">#{createId},</if>
<if test="updateId != null">#{updateId},</if> <if test="updateId != null">#{updateId},</if>
NOW(), NOW(), 0 NOW(),
NOW(),
0
</trim> </trim>
) )
</insert> </insert>
<!-- 更新 --> <!-- 更新:无语法错误,保留原有逻辑 -->
<update id="update"> <update id="update">
UPDATE tb_dev_param UPDATE tb_dev_param
<set> <set>
<if test="devId != null">dev_id = #{devId},</if> <if test="devIds != null">dev_ids = #{devIds},</if>
<if test="plcAddr != null">plc_addr = #{plcAddr},</if>
<if test="dicDataId != null">dic_data_id = #{dicDataId},</if>
<if test="paramName != null and paramName != ''">param_name = #{paramName},</if> <if test="paramName != null and paramName != ''">param_name = #{paramName},</if>
<if test="paramValue != null and paramValue != ''">param_value = #{paramValue},</if> <if test="paramValue != null and paramValue != ''">param_value = #{paramValue},</if>
<if test="paramType != null and paramType != ''">param_type = #{paramType},</if> <if test="paramType != null and paramType != ''">param_type = #{paramType},</if>
@@ -54,19 +65,21 @@
<if test="formType != null and formType != ''">form_type = #{formType},</if> <if test="formType != null and formType != ''">form_type = #{formType},</if>
<if test="paramDesc != null and paramDesc != ''">param_desc = #{paramDesc},</if> <if test="paramDesc != null and paramDesc != ''">param_desc = #{paramDesc},</if>
<if test="updateId != null">update_id = #{updateId},</if> <if test="updateId != null">update_id = #{updateId},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
update_time = NOW() update_time = NOW()
</set> </set>
WHERE id = #{id} AND del_sign = 0 WHERE id = #{id} AND del_sign = 0
</update> </update>
<!-- 逻辑删除 --> <!-- 逻辑删除增加id非空判断防止全表更新 -->
<update id="deleteById"> <update id="deleteById">
UPDATE tb_dev_param UPDATE tb_dev_param
SET del_sign = 1, update_time = NOW() SET del_sign = 1, update_time = NOW()
WHERE id = #{id} AND del_sign = 0 WHERE id = #{id} AND del_sign = 0
<if test="id == null">AND 1=2</if>
</update> </update>
<!-- 根据ID查询 --> <!-- 根据ID查询:无语法错误 -->
<select id="selectById" resultType="com.rczn.rcznautoplc.domain.DevParam"> <select id="selectById" resultType="com.rczn.rcznautoplc.domain.DevParam">
SELECT SELECT
<include refid="baseColumn"/>, <include refid="baseColumn"/>,
@@ -75,16 +88,39 @@
WHERE id = #{id} AND del_sign = 0 WHERE id = #{id} AND del_sign = 0
</select> </select>
<!-- 分页查询(条件过滤) --> <!-- 分页查询修复参数名devId→devIds优化模糊匹配逻辑 -->
<select id="selectPage" resultType="com.rczn.rcznautoplc.domain.DevParam"> <select id="selectPage" resultType="com.rczn.rcznautoplc.domain.DevParam">
SELECT SELECT
<include refid="baseColumn"/>, <include refid="baseColumn"/>,
<include refid="devParamColumn"/> <include refid="devParamColumn"/>
FROM tb_dev_param FROM tb_dev_param
WHERE del_sign = 0 WHERE del_sign = 0
<if test="devId != null">AND dev_id = #{devId}</if> <if test="devId != null">
AND dev_ids LIKE CONCAT('%;', #{devId}, ';%')
</if>
<if test="paramTypeData != null and paramTypeData != ''">AND dic_data_id in (SELECT id FROM sys_dic_data WHERE dic_value LIKE CONCAT('%', #{paramTypeData}, '%'))</if>
<if test="paramName != null and paramName != ''">AND param_name LIKE CONCAT('%', #{paramName}, '%')</if> <if test="paramName != null and paramName != ''">AND param_name LIKE CONCAT('%', #{paramName}, '%')</if>
<if test="paramValue != null and paramValue != ''">AND param_value LIKE CONCAT('%', #{paramValue}, '%')</if> <if test="paramValue != null and paramValue != ''">AND param_value LIKE CONCAT('%', #{paramValue}, '%')</if>
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<!-- 新增devId优化分隔符避免重复拼接; -->
<update id="addDevId">
UPDATE tb_dev_param
SET dev_ids = CASE
WHEN dev_ids IS NULL OR dev_ids = '' THEN CONCAT(#{devId}, ';')
ELSE CONCAT(dev_ids, #{devId}, ';')
END
WHERE id = #{paramId}
<if test="paramId == null">AND 1=2</if>
</update>
<!-- 删除devId兼容全匹配场景清理空字符串 -->
<update id="delDevId">
UPDATE tb_dev_param
SET dev_ids = REPLACE(dev_ids, CONCAT(#{devId}, ';'), '')
WHERE id = #{paramId}
<if test="paramId == null">AND 1=2</if>
</update>
</mapper> </mapper>

View File

@@ -6,7 +6,7 @@
</sql> </sql>
<sql id="goodsFlowStatusColumn"> <sql id="goodsFlowStatusColumn">
goods_id, flow_id, island_id, flow_sort, status goods_id, flow_id, island_id,dev_id, flow_sort, status
</sql> </sql>
<insert id="insert" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" useGeneratedKeys="true" keyProperty="id">
@@ -14,7 +14,7 @@
<include refid="goodsFlowStatusColumn"/>, <include refid="goodsFlowStatusColumn"/>,
create_id, create_time, update_id, update_time, del_sign create_id, create_time, update_id, update_time, del_sign
) VALUES ( ) VALUES (
#{goodsId}, #{flowId}, #{islandId}, #{flowSort}, #{status}, #{goodsId}, #{flowId}, #{islandId},#{devId}, #{flowSort}, #{status},
#{createId}, NOW(), #{updateId}, NOW(), 0 #{createId}, NOW(), #{updateId}, NOW(), 0
) )
</insert> </insert>
@@ -26,6 +26,7 @@
<if test="flowId != null">flow_id = #{flowId},</if> <if test="flowId != null">flow_id = #{flowId},</if>
<if test="islandId != null">island_id = #{islandId},</if> <if test="islandId != null">island_id = #{islandId},</if>
<if test="flowSort != null">flow_sort = #{flowSort},</if> <if test="flowSort != null">flow_sort = #{flowSort},</if>
<if test="devId != null">dev_id = #{devId},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="updateId != null">update_id = #{updateId},</if> <if test="updateId != null">update_id = #{updateId},</if>
update_time = NOW() update_time = NOW()
@@ -56,6 +57,7 @@
<if test="goodsId != null">AND goods_id = #{goodsId}</if> <if test="goodsId != null">AND goods_id = #{goodsId}</if>
<if test="flowId != null">AND flow_id = #{flowId}</if> <if test="flowId != null">AND flow_id = #{flowId}</if>
<if test="islandId != null">AND island_id = #{islandId}</if> <if test="islandId != null">AND island_id = #{islandId}</if>
<if test="devId != null">AND dev_id = #{devId}</if>
<if test="status != null">AND status = #{status}</if> <if test="status != null">AND status = #{status}</if>
ORDER BY flow_sort ASC ORDER BY flow_sort ASC
</select> </select>

View File

@@ -6,7 +6,7 @@
</sql> </sql>
<sql id="goodsInfoColumn"> <sql id="goodsInfoColumn">
goods_name, goods_type, income_time, good_from, good_batch, `desc` goods_name, goods_type, income_time, good_from, good_batch,point_num ,goal_detect,bar_code,flow_id,goods_status, `desc`
</sql> </sql>
<insert id="insert" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" useGeneratedKeys="true" keyProperty="id">
@@ -14,7 +14,7 @@
<include refid="goodsInfoColumn"/>, <include refid="goodsInfoColumn"/>,
create_id, create_time, update_id, update_time, del_sign create_id, create_time, update_id, update_time, del_sign
) VALUES ( ) VALUES (
#{goodsName}, #{goodsType}, #{incomeTime}, #{goodFrom}, #{goodBatch}, #{desc}, #{goodsName}, #{goodsType}, #{incomeTime}, #{goodFrom}, #{goodBatch},#{pointNum},#{goalDetect}, #{barCode}, #{flowId}, #{goodsStatus}, #{desc},
#{createId}, NOW(), #{updateId}, NOW(), 0 #{createId}, NOW(), #{updateId}, NOW(), 0
) )
</insert> </insert>
@@ -27,6 +27,11 @@
<if test="incomeTime != null">income_time = #{incomeTime},</if> <if test="incomeTime != null">income_time = #{incomeTime},</if>
<if test="goodFrom != null and goodFrom != ''">good_from = #{goodFrom},</if> <if test="goodFrom != null and goodFrom != ''">good_from = #{goodFrom},</if>
<if test="goodBatch != null">good_batch = #{goodBatch},</if> <if test="goodBatch != null">good_batch = #{goodBatch},</if>
<if test="pointNum != null">point_num = #{pointNum},</if>
<if test="goalDetect != null">goal_detect = #{goalDetect},</if>
<if test="barCode != null and barCode != ''">bar_code = #{barCode},</if>
<if test="flowId != null">flow_id = #{flowId},</if>
<if test="goodsStatus != null and goodsStatus != ''">goods_status = #{goodsStatus},</if>
<if test="desc != null and desc != ''">`desc` = #{desc},</if> <if test="desc != null and desc != ''">`desc` = #{desc},</if>
<if test="updateId != null">update_id = #{updateId},</if> <if test="updateId != null">update_id = #{updateId},</if>
update_time = NOW() update_time = NOW()
@@ -48,6 +53,20 @@
WHERE id = #{id} AND del_sign = 0 WHERE id = #{id} AND del_sign = 0
</select> </select>
<!-- 批量根据ID列表查询新增 -->
<select id="selectByIdList" resultType="com.rczn.rcznautoplc.domain.GoodsInfo">
SELECT
<include refid="baseColumn"/>,
<include refid="goodsInfoColumn"/>
FROM tb_goods_info
WHERE del_sign = 0
AND id IN
<foreach collection="idList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
ORDER BY income_time DESC
</select>
<select id="selectPage" resultType="com.rczn.rcznautoplc.domain.GoodsInfo"> <select id="selectPage" resultType="com.rczn.rcznautoplc.domain.GoodsInfo">
SELECT SELECT
<include refid="baseColumn"/>, <include refid="baseColumn"/>,
@@ -58,6 +77,21 @@
<if test="goodsType != null and goodsType != ''">AND goods_type LIKE CONCAT('%', #{goodsType}, '%')</if> <if test="goodsType != null and goodsType != ''">AND goods_type LIKE CONCAT('%', #{goodsType}, '%')</if>
<if test="goodFrom != null and goodFrom != ''">AND good_from LIKE CONCAT('%', #{goodFrom}, '%')</if> <if test="goodFrom != null and goodFrom != ''">AND good_from LIKE CONCAT('%', #{goodFrom}, '%')</if>
<if test="goodBatch != null">AND good_batch = #{goodBatch}</if> <if test="goodBatch != null">AND good_batch = #{goodBatch}</if>
ORDER BY income_time DESC <if test="pointNum != null">AND point_num = #{pointNum}</if>
<if test="goalDetect != null">AND goal_detect = #{goalDetect}</if>
<if test="barCode != null and barCode != ''">AND bar_code LIKE CONCAT('%', #{barCode}, '%')</if>
<if test="flowId != null and flowId != ''">AND flow_id LIKE CONCAT('%', #{flowId}, '%')</if>
<if test="incomeTime != null and incomeTime!=''" >AND income_time = #{incomeTime}</if>
<if test="startTime != null" >AND income_time >= #{startTime}</if>
<if test="endTime != null" >AND income_time &lt;= #{endTime}</if>
<if test="goodsStatus != null and goodsStatus != ''">AND goods_status LIKE CONCAT('%', #{goodsStatus}, '%')</if>
ORDER BY income_time,point_num DESC
</select>
<select id="selectByBarCode" resultType="com.rczn.rcznautoplc.domain.GoodsInfo">
SELECT
<include refid="baseColumn"/>,
<include refid="goodsInfoColumn"/>
FROM tb_goods_info
WHERE bar_code = #{barCode} AND del_sign = 0
</select> </select>
</mapper> </mapper>

View File

@@ -6,7 +6,7 @@
</sql> </sql>
<sql id="islandInfoColumn"> <sql id="islandInfoColumn">
island_name, island_code, island_logo, `desc` island_name, island_code, plc_addr, island_logo, `desc`
</sql> </sql>
<insert id="insert" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" useGeneratedKeys="true" keyProperty="id">
@@ -14,7 +14,7 @@
<include refid="islandInfoColumn"/>, <include refid="islandInfoColumn"/>,
create_id, create_time, update_id, update_time, del_sign create_id, create_time, update_id, update_time, del_sign
) VALUES ( ) VALUES (
#{islandName}, #{islandCode}, #{islandLogo}, #{desc}, #{islandName}, #{islandCode},#{plcAddr}, #{islandLogo}, #{desc},
#{createId}, NOW(), #{updateId}, NOW(), 0 #{createId}, NOW(), #{updateId}, NOW(), 0
) )
</insert> </insert>
@@ -24,6 +24,7 @@
<set> <set>
<if test="islandName != null and islandName != ''">island_name = #{islandName},</if> <if test="islandName != null and islandName != ''">island_name = #{islandName},</if>
<if test="islandCode != null and islandCode != ''">island_code = #{islandCode},</if> <if test="islandCode != null and islandCode != ''">island_code = #{islandCode},</if>
<if test="plcAddr != null and plcAddr != ''">plc_addr = #{plcAddr},</if>
<if test="islandLogo != null and islandLogo != ''">island_logo = #{islandLogo},</if> <if test="islandLogo != null and islandLogo != ''">island_logo = #{islandLogo},</if>
<if test="desc != null and desc != ''">`desc` = #{desc},</if> <if test="desc != null and desc != ''">`desc` = #{desc},</if>
<if test="updateId != null">update_id = #{updateId},</if> <if test="updateId != null">update_id = #{updateId},</if>
@@ -46,6 +47,20 @@
WHERE id = #{id} AND del_sign = 0 WHERE id = #{id} AND del_sign = 0
</select> </select>
<!-- selectList:根据IslandInfo条件查询记录 -->
<select id="selectList" resultType="com.rczn.rcznautoplc.domain.query.IslandInfoQuery">
SELECT
<include refid="baseColumn"/>,
<include refid="islandInfoColumn"/>
FROM tb_island_info
WHERE del_sign = 0
<if test="islandName != null and islandName != ''">AND island_name LIKE CONCAT('%', #{islandName}, '%')</if>
<if test="islandCode != null and islandCode != ''">AND island_code LIKE CONCAT('%', #{islandCode}, '%')</if>
<if test="plcAddr != null ">AND plc_addr = #{plcAddr} </if>
ORDER BY create_time DESC
</select>
<!-- selectPage:根据IslandInfo条件查询分页记录 -->
<select id="selectPage" resultType="com.rczn.rcznautoplc.domain.IslandInfo"> <select id="selectPage" resultType="com.rczn.rcznautoplc.domain.IslandInfo">
SELECT SELECT
<include refid="baseColumn"/>, <include refid="baseColumn"/>,
@@ -54,6 +69,7 @@
WHERE del_sign = 0 WHERE del_sign = 0
<if test="islandName != null and islandName != ''">AND island_name LIKE CONCAT('%', #{islandName}, '%')</if> <if test="islandName != null and islandName != ''">AND island_name LIKE CONCAT('%', #{islandName}, '%')</if>
<if test="islandCode != null and islandCode != ''">AND island_code LIKE CONCAT('%', #{islandCode}, '%')</if> <if test="islandCode != null and islandCode != ''">AND island_code LIKE CONCAT('%', #{islandCode}, '%')</if>
<if test="plcAddr != null ">AND plc_addr = #{plcAddr} </if>
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
</mapper> </mapper>

View File

@@ -6,7 +6,7 @@
</sql> </sql>
<sql id="stepInfoColumn"> <sql id="stepInfoColumn">
island_id,dev_id, step_name, step_desc,flow_id,param_name,param_type,param_unit,param_value,form_type island_id,dev_id,step_order ,step_name, step_desc,flow_id,param_name,param_type,param_unit,param_value,form_type
</sql> </sql>
<insert id="insert" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" useGeneratedKeys="true" keyProperty="id">
@@ -21,6 +21,7 @@
<!-- 步骤表字段 --> <!-- 步骤表字段 -->
<if test="islandId != null">island_id, </if> <if test="islandId != null">island_id, </if>
<if test="devId != null">dev_id, </if> <if test="devId != null">dev_id, </if>
<if test="stepOrder != null" >step_order, </if>
<if test="stepName != null and stepName != ''">step_name, </if> <if test="stepName != null and stepName != ''">step_name, </if>
<if test="stepDesc != null and stepDesc != ''">step_desc, </if> <if test="stepDesc != null and stepDesc != ''">step_desc, </if>
<if test="flowId != null">flow_id, </if> <if test="flowId != null">flow_id, </if>
@@ -43,6 +44,7 @@
<!-- 步骤表字段 --> <!-- 步骤表字段 -->
<if test="islandId != null">#{islandId}, </if> <if test="islandId != null">#{islandId}, </if>
<if test="devId != null">#{devId}, </if> <if test="devId != null">#{devId}, </if>
<if test="stepOrder != null" >#{stepOrder}, </if>
<if test="stepName != null and stepName != ''">#{stepName}, </if> <if test="stepName != null and stepName != ''">#{stepName}, </if>
<if test="stepDesc != null and stepDesc != ''">#{stepDesc}, </if> <if test="stepDesc != null and stepDesc != ''">#{stepDesc}, </if>
<if test="flowId != null">#{flowId}, </if> <if test="flowId != null">#{flowId}, </if>
@@ -57,11 +59,178 @@
) )
</insert> </insert>
<!-- 新增批量插入SQL -->
<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tb_step_info (
<trim suffixOverrides=",">
create_id,
create_time,
update_id,
update_time,
remark,
del_sign,
island_id,
dev_id,
step_order,
step_name,
step_desc,
flow_id,
param_name,
param_type,
param_unit,
param_value,
form_type
</trim>
) VALUES
<foreach collection="stepInfoList" item="item" separator=",">
(
<trim suffixOverrides=",">
#{item.createId,jdbcType=BIGINT},
NOW(),
#{item.updateId,jdbcType=BIGINT},
NOW(),
<if test="item.remark != null and item.remark != ''">#{item.remark},</if>
<if test="item.remark == null or item.remark == ''">null,</if>
0,
<if test="item.islandId != null">#{item.islandId,jdbcType=INTEGER},</if>
<if test="item.islandId == null">null,</if>
<if test="item.devId != null">#{item.devId,jdbcType=INTEGER},</if>
<if test="item.devId == null">null,</if>
<if test="item.stepOrder != null">#{item.stepOrder,jdbcType=INTEGER},</if>
<if test="item.stepOrder == null">null,</if>
<if test="item.stepName != null and item.stepName != ''">#{item.stepName},</if>
<if test="item.stepName == null or item.stepName == ''">null,</if>
<if test="item.stepDesc != null and item.stepDesc != ''">#{item.stepDesc},</if>
<if test="item.stepDesc == null or item.stepDesc == ''">null,</if>
<if test="item.flowId != null">#{item.flowId,jdbcType=INTEGER},</if>
<if test="item.flowId == null">null,</if>
<if test="item.paramName != null and item.paramName != ''">#{item.paramName},</if>
<if test="item.paramName == null or item.paramName == ''">null,</if>
<if test="item.paramType != null and item.paramType != ''">#{item.paramType},</if>
<if test="item.paramType == null or item.paramType == ''">null,</if>
<if test="item.paramUnit != null and item.paramUnit != ''">#{item.paramUnit},</if>
<if test="item.paramUnit == null or item.paramUnit == ''">null,</if>
<if test="item.paramValue != null and item.paramValue != ''">#{item.paramValue},</if>
<if test="item.paramValue == null or item.paramValue == ''">null,</if>
<if test="item.formType != null and item.formType != ''">#{item.formType},</if>
<if test="item.formType == null or item.formType == ''">null,</if>
</trim>
)
</foreach>
</insert>
<update id="updateBatch">
<foreach collection="stepInfoList" item="item" separator=";">
UPDATE tb_step_info
<set>
<if test="item.updateId != null">update_id = #{item.updateId,jdbcType=BIGINT},</if>
<if test="item.remark != null and item.remark != ''">remark = #{item.remark},</if>
<if test="item.islandId != null">island_id = #{item.islandId,jdbcType=INTEGER},</if>
<if test="item.devId != null">dev_id = #{item.devId,jdbcType=INTEGER},</if>
<if test="item.stepOrder != null">step_order = #{item.stepOrder,jdbcType=INTEGER},</if>
<if test="item.stepName != null and item.stepName != ''">step_name = #{item.stepName},</if>
<if test="item.stepDesc != null and item.stepDesc != ''">step_desc = #{item.stepDesc},</if>
<if test="item.flowId != null">flow_id = #{item.flowId,jdbcType=INTEGER},</if>
<if test="item.paramName != null and item.paramName != ''">param_name = #{item.paramName},</if>
<if test="item.paramType != null and item.paramType != ''">param_type = #{item.paramType},</if>
<if test="item.paramUnit != null and item.paramUnit != ''">param_unit = #{item.paramUnit},</if>
<if test="item.paramValue != null and item.paramValue != ''">param_value = #{item.paramValue},</if>
<if test="item.formType != null and item.formType != ''">form_type = #{item.formType},</if>
update_time = NOW()
</set>
WHERE id = #{item.id,jdbcType=BIGINT}
AND del_sign = 0
</foreach>
</update>
<!-- <update id="updateBatch">-->
<!-- UPDATE tb_step_info-->
<!-- <trim prefix="SET" suffixOverrides=",">-->
<!-- &lt;!&ndash; 批量更新核心用CASE WHEN匹配id赋值 &ndash;&gt;-->
<!-- update_id = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.updateId,jdbcType=BIGINT}-->
<!-- </foreach>-->
<!-- END,-->
<!-- remark = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.remark}-->
<!-- </foreach>-->
<!-- END,-->
<!-- island_id = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.islandId,jdbcType=INTEGER}-->
<!-- </foreach>-->
<!-- END,-->
<!-- dev_id = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.devId,jdbcType=INTEGER}-->
<!-- </foreach>-->
<!-- END,-->
<!-- step_order = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.stepOrder,jdbcType=INTEGER}-->
<!-- </foreach>-->
<!-- END,-->
<!-- step_name = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.stepName}-->
<!-- </foreach>-->
<!-- END,-->
<!-- step_desc = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.stepDesc}-->
<!-- </foreach>-->
<!-- END,-->
<!-- flow_id = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.flowId,jdbcType=INTEGER}-->
<!-- </foreach>-->
<!-- END,-->
<!-- param_name = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.paramName}-->
<!-- </foreach>-->
<!-- END,-->
<!-- param_type = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.paramType}-->
<!-- </foreach>-->
<!-- END,-->
<!-- param_unit = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.paramUnit}-->
<!-- </foreach>-->
<!-- END,-->
<!-- param_value = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.paramValue}-->
<!-- </foreach>-->
<!-- END,-->
<!-- form_type = CASE-->
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.formType}-->
<!-- </foreach>-->
<!-- END,-->
<!-- &#45;&#45; 所有记录统一更新update_time-->
<!-- update_time = NOW()-->
<!-- </trim>-->
<!-- &lt;!&ndash; 只更新传入的id列表 &ndash;&gt;-->
<!-- WHERE id IN-->
<!-- <foreach collection="stepInfoList" item="item" open="(" separator="," close=")">-->
<!-- #{item.id,jdbcType=BIGINT}-->
<!-- </foreach>-->
<!-- AND del_sign = 0-->
<!-- </update>-->
<update id="update"> <update id="update">
UPDATE tb_step_info UPDATE tb_step_info
<set> <set>
<if test="islandId != null">island_id = #{islandId},</if> <if test="islandId != null">island_id = #{islandId},</if>
<if test="devId != null">dev_id = #{devId},</if> <if test="devId != null">dev_id = #{devId},</if>
<if test="stepOrder != null" >step_order = #{stepOrder},</if>
<if test="stepName != null and stepName != ''">step_name = #{stepName},</if> <if test="stepName != null and stepName != ''">step_name = #{stepName},</if>
<if test="stepDesc != null and stepDesc != ''">step_desc = #{stepDesc},</if> <if test="stepDesc != null and stepDesc != ''">step_desc = #{stepDesc},</if>
<if test="updateId != null">update_id = #{updateId},</if> <if test="updateId != null">update_id = #{updateId},</if>
@@ -83,6 +252,19 @@
WHERE id = #{id} AND del_sign = 0 WHERE id = #{id} AND del_sign = 0
</update> </update>
<update id="deleteBatchByIds">
<if test="ids != null and ids.size() > 0">
UPDATE tb_step_info
SET del_sign = 1, update_time = NOW()
WHERE id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
AND del_sign = 0
</if>
</update>
<select id="selectById" resultType="com.rczn.rcznautoplc.domain.StepInfo"> <select id="selectById" resultType="com.rczn.rcznautoplc.domain.StepInfo">
SELECT SELECT
<include refid="baseColumn"/>, <include refid="baseColumn"/>,
@@ -91,6 +273,39 @@
WHERE id = #{id} AND del_sign = 0 WHERE id = #{id} AND del_sign = 0
</select> </select>
<!-- 适配 List<StepInfo> selectList(StepInfo stepInfo) 接口的SQL -->
<select id="selectList" parameterType="com.rczn.rcznautoplc.domain.StepInfo" resultType="com.rczn.rcznautoplc.domain.StepInfo">
SELECT
<include refid="baseColumn"/>,
<include refid="stepInfoColumn"/>
FROM tb_step_info
WHERE del_sign = 0
<!-- 动态条件:非空参数才拼接 -->
<if test="islandId != null">
AND island_id = #{islandId}
</if>
<if test="devId != null">
AND dev_id = #{devId}
</if>
<if test="flowId != null">
AND flow_id = #{flowId}
</if>
<if test="stepName != null and stepName != ''">
AND step_name LIKE CONCAT('%', #{stepName}, '%')
</if>
<if test="paramName != null and paramName != ''">
AND param_name LIKE CONCAT('%', #{paramName}, '%')
</if>
<if test="formType != null and formType != ''">
AND form_type = #{formType}
</if>
<if test="stepOrder != null">
AND step_order = #{stepOrder}
</if>
<!-- 排序:按步骤顺序升序、创建时间降序 -->
ORDER BY step_order ASC, create_time DESC
</select>
<select id="selectPage" resultType="com.rczn.rcznautoplc.domain.StepInfo"> <select id="selectPage" resultType="com.rczn.rcznautoplc.domain.StepInfo">
SELECT SELECT
<include refid="baseColumn"/>, <include refid="baseColumn"/>,

View File

@@ -14,6 +14,47 @@
<description>rczn-common公共模块实体类、工具类、统一响应</description> <description>rczn-common公共模块实体类、工具类、统一响应</description>
<packaging>jar</packaging> <packaging>jar</packaging>
<!-- 若想引用modbus4j需要引入下列repository id:ias-snapshots id:ias-releases 两个 ,使用默认仓库下载,不要使用阿里云仓库-->
<repositories>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>ias-snapshots</id>
<name>Infinite Automation Snapshot Repository</name>
<url>https://maven.mangoautomation.net/repository/ias-snapshot/</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>ias-releases</id>
<name>Infinite Automation Release Repository</name>
<url>https://maven.mangoautomation.net/repository/ias-release/</url>
</repository>
<!-- ====================== 新增Spring AI 必须的仓库 ====================== -->
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
</repository>
<!-- ===================================================================== -->
</repositories>
<dependencies> <dependencies>
<!-- 核心依赖 --> <!-- 核心依赖 -->
<dependency> <dependency>
@@ -44,11 +85,6 @@
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>${jwt.version}</version>
</dependency>
<!-- 如果需要 Web 相关类(拦截器等) --> <!-- 如果需要 Web 相关类(拦截器等) -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
@@ -56,13 +92,41 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
</dependency>
<!-- springAI框架 -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.ai</groupId>-->
<!-- <artifactId>spring-ai-starter-model-openai</artifactId>-->
<!-- <version>1.0.0</version>-->
<!-- </dependency>-->
<!-- Servlet API --> <!-- Servlet API -->
<dependency> <dependency>
<groupId>jakarta.servlet</groupId> <groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId> <artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- S7connector 依赖 -->
<dependency>
<groupId>com.github.s7connector</groupId>
<artifactId>s7connector</artifactId>
<version>2.1</version>
</dependency>
<!-- modbus4j -->
<dependency>
<groupId>com.infiniteautomation</groupId>
<artifactId>modbus4j</artifactId>
<version>3.0.3</version> <!-- 或其他稳定版本 -->
</dependency>
<!-- 连接池(工业场景必加,优化多设备连接) -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.12.0</version>
</dependency>
<!-- Spring Context如果需要 @Component 等注解) --> <!-- Spring Context如果需要 @Component 等注解) -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
@@ -70,8 +134,9 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>com.auth0</groupId>
<artifactId>spring-webmvc</artifactId> <artifactId>java-jwt</artifactId>
<version>${jwt.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
@@ -89,6 +154,12 @@
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- websocket 核心依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -1,5 +1,7 @@
package com.rczn.domain; package com.rczn.domain;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
public class BaseBean { public class BaseBean {
@@ -15,6 +17,7 @@ public class BaseBean {
private String remark; private String remark;
private LocalDateTime startTime; private LocalDateTime startTime;
private LocalDateTime endTime; private LocalDateTime endTime;
// 无参构造器、全参构造器(同步修改 delSign 类型) // 无参构造器、全参构造器(同步修改 delSign 类型)

View File

@@ -9,13 +9,29 @@ import org.springframework.web.servlet.HandlerInterceptor;
import java.util.Map; import java.util.Map;
//@Component @Component
public class LoginInterceptor implements HandlerInterceptor { public class LoginInterceptor implements HandlerInterceptor {
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 1. 放行OPTIONS预检请求直接返回200 OK不做任何校验
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
response.setStatus(HttpServletResponse.SC_OK);
// 手动添加跨域响应头(兜底)
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "GET,POST,PATCH,PUT,DELETE,OPTIONS");
response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Max-Age", "3600");
return true; // 直接放行,不执行后续拦截逻辑
}
try { try {
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
String[] tokens = token.split(" ");
if(tokens.length>1){
token = tokens[1];
}
Map<String, Object> claims = JwtUtil.parseToken(token); Map<String, Object> claims = JwtUtil.parseToken(token);
//保存用户数据到ThreadLocalUtil //保存用户数据到ThreadLocalUtil
ThreadLocalUtil.set(claims); ThreadLocalUtil.set(claims);

View File

@@ -27,4 +27,11 @@ public class JwtUtil {
.asMap(); .asMap();
} }
public static void main(String[] args) {
String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGFpbXMiOnsicGVybWlzc2lvbnMiOlsiMTExMSIsIjIyMiIsIjU1NSJdLCJpZCI6MywidXNlcm5hbWUiOiJzdHJpbmcifSwiZXhwIjoxNzc2NzE2NzAyfQ.ynjs9Ys0CxoZjRstjz3mjr3c6NYMFiV3MmTGQYpJmKQ";//genToken(null);
System.out.println(token);
Map<String, Object> claims = parseToken(token);
System.out.println(claims);
}
} }

View File

@@ -1 +1,12 @@
##spring.application.name=rczn-common ##spring.application.name=rczn-common
#spring:
# ai:
# openai:
# api-key: "sk-b2b55f0bc7e140668e0326c0cc7a86df" #sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# base-url: "https://api.deepseek.com"
# chat:
# options:
# model: "deepseek-chat"
# # 关键:给语音模型也配置上,就不报错了
# speech:
# api-key: "sk-b2b55f0bc7e140668e0326c0cc7a86df"