导入导出功能未完成

This commit is contained in:
bunny 2024-03-25 20:31:39 +08:00
parent 26eb9bd5fa
commit a7b8646010
101 changed files with 277 additions and 546 deletions

8
.idea/.gitignore vendored
View File

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitCommitMessageStorage">
<option name="messageStorage">
<MessageStorage />
</option>
</component>
</project>

View File

@ -2,7 +2,6 @@
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<annotationProcessing> <annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true"> <profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />

View File

@ -1,21 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true"> <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="2@106.15.251.123" uuid="19038c18-1db8-4f8c-9f3b-a9a117411997"> <data-source source="LOCAL" name="db_spzx@106.15.251.123" uuid="83fbf708-5dbd-4ac9-80b8-e3b47596811f">
<driver-ref>redis</driver-ref>
<synchronize>true</synchronize>
<imported>true</imported>
<jdbc-driver>jdbc.RedisDriver</jdbc-driver>
<jdbc-url>jdbc:redis://106.15.251.123:6379/2</jdbc-url>
<jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
<property name="com.intellij.clouds.kubernetes.db.container.port" />
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
<data-source source="LOCAL" name="db_spzx@106.15.251.123" uuid="0d0ed36e-608f-48d9-a72a-8d0bff52ef98">
<driver-ref>mysql.8</driver-ref> <driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize> <synchronize>true</synchronize>
<imported>true</imported> <imported>true</imported>
@ -28,5 +14,18 @@
</jdbc-additional-properties> </jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir> <working-dir>$ProjectFileDir$</working-dir>
</data-source> </data-source>
<data-source source="LOCAL" name="2@106.15.251.123" uuid="7948c4f2-c26d-4886-b6da-d40f6a617678">
<driver-ref>redis</driver-ref>
<synchronize>true</synchronize>
<imported>true</imported>
<jdbc-driver>jdbc.RedisDriver</jdbc-driver>
<jdbc-url>jdbc:redis://106.15.251.123:6379/2</jdbc-url>
<jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
<property name="com.intellij.clouds.kubernetes.db.container.port" />
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component> </component>
</project> </project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" autoUpload="Always" remoteFilesAllowedToDisappearOnAutoupload="false" autoUploadExternalChanges="true">
<option name="myAutoUpload" value="ALWAYS" />
</component>
</project>

View File

@ -2,40 +2,12 @@
<project version="4"> <project version="4">
<component name="Encoding"> <component name="Encoding">
<file url="file://$PROJECT_DIR$/spzx-common/common-service/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-common/common-service/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-common/common-service/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-common/common-service/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-common/common-util/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-common/common-util/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-common/common-util/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-common/common-util/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-common/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-common/src/main/resources" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-common/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-manager/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-manager/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-manager/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-manager/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-model/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-model/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-model/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-model/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-common/common-service/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-common/common-service/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-common/common-service/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-common/common-util/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-common/common-util/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-common/common-util/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-common/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-manager/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-manager/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-manager/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-model/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-model/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/spzx-model/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-parent/src/main/resources-filtered" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources-filtered" charset="UTF-8" />
</component> </component>
</project> </project>

View File

@ -1,14 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="IncorrectHttpHeaderInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="customHeaders">
<set>
<option value="token" />
</set>
</option>
</inspection_tool>
<inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UNCHECKED_WARNING" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -4,12 +4,9 @@
<component name="MavenProjectsManager"> <component name="MavenProjectsManager">
<option name="originalFiles"> <option name="originalFiles">
<list> <list>
<option value="$PROJECT_DIR$/spzx-parent/pom.xml" />
<option value="$PROJECT_DIR$/pom.xml" /> <option value="$PROJECT_DIR$/pom.xml" />
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK" />
<output url="file://$PROJECT_DIR$/out" />
</component>
</project> </project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PrettierConfiguration">
<option name="myRunOnSave" value="true" />
</component>
</project>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

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

View File

@ -1,23 +1,25 @@
package com.atguigu.spzx.manger; <?xml version="1.0" encoding="UTF-8"?>
<configuration>
import lombok.extern.slf4j.Slf4j; <contextName>logback</contextName>
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Slf4j <!-- 日志的输出目录 -->
@MapperScan("com.atguigu.spzx.manger.mapper") <property name="log.path" value="D://logs//spzx-manager//logs" />
@EnableCaching// 开启缓存注解
@ComponentScan("com.atguigu") <!--控制台日志格式彩色日志-->
@EnableScheduling <!-- magenta:洋红 -->
@SpringBootApplication <!-- boldMagenta:粗红-->
@EnableTransactionManagement // 开启注解方式的事务管理 <!-- cyan:青色 -->
public class MangerApplication { <!-- white:白色 -->
public static void main(String[] args) { <!-- magenta:洋红 -->
SpringApplication.run(MangerApplication.class, args); <property name="CONSOLE_LOG_PATTERN" value="%yellow(%date{yyyy-MM-dd HH:mm:ss}) %highlight([%-5level]) %green(%logger) %msg%n"/>
}
} <!--文件日志格式-->
<property name="FILE_LOG_PATTERN" value="%date{yyyy-MM-dd HH:mm:ss} [%-5level] %thread %file:%line %logger %msg%n" />
<!--编码-->
<property name="ENCODING" value="UTF-8" />
<!-- 控制台日志 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!-- 临界值过滤器 -

View File

@ -0,0 +1,42 @@
package com.atguigu.spzx.manger.controller;
import com.atguigu.spzx.manger.service.CategoryService;
import com.atguigu.spzx.model.entity.product.Category;
import com.atguigu.spzx.model.vo.result.Result;
import com.atguigu.spzx.model.vo.result.ResultCodeEnum;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@Tag(name = "分类管理")
@RestController
@RequestMapping(value = "/admin/product/category")
public class CategoryController {
@Autowired
private CategoryService categoryService;
@Operation(summary = "根据parentId获取下级节点", description = "根据parentId获取下级节点")
@GetMapping(value = "findByParentId/{parentId}")
public Result<List<Category>> findByParentId(@PathVariable Long parentId) {
List<Category> list = categoryService.findByParentId(parentId);
return Result.success(list);
}
@Operation(summary = "导出数据",description = "导出数据")
@GetMapping(value = "/exportData")
public void exportData(HttpServletResponse response) {
categoryService.exportData(response);
}
@Operation(summary = "导入功能",description = "导入功能")
@PostMapping("importData")
public Result<String > importData(MultipartFile file) {
categoryService.importData(file);
return Result.success();
}
}

View File

@ -1,65 +1,52 @@
package com.atguigu.spzx.manger.controller; package com.atguigu.spzx.manger.controller;
import com.atguigu.context.BaseContext; import com.atguigu.context.BaseContext;
import com.atguigu.spzx.manger.service.SysMenuService; import com.atguigu.spzx.manger.service.SysMenuService;
import com.atguigu.spzx.manger.service.SysUserService; import com.atguigu.spzx.manger.service.SysUserService;
import com.atguigu.spzx.manger.service.ValidateCodeService; import com.atguigu.spzx.manger.service.ValidateCodeService;
import com.atguigu.spzx.model.dto.system.LoginDto; import com.atguigu.spzx.model.dto.system.LoginDto;
import com.atguigu.spzx.model.entity.system.SysUser; import com.atguigu.spzx.model.entity.system.SysUser;
import com.atguigu.spzx.model.vo.result.Result; import com.atguigu.spzx.model.vo.result.Result;
import com.atguigu.spzx.model.vo.system.LoginVo; import com.atguigu.spzx.model.vo.system.LoginVo;
import com.atguigu.spzx.model.vo.system.SysMenuVo; import com.atguigu.spzx.model.vo.system.SysMenuVo;
import com.atguigu.spzx.model.vo.system.ValidateCodeVo; import com.atguigu.spzx.model.vo.system.ValidateCodeVo;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@Tag(name = "用户相关接口") @Tag(name = "用户相关接口")
@RestController @RestController
@RequestMapping("/admin/system/index") @RequestMapping("/admin/system/index")
public class IndexController { public class IndexController {
@Autowired @Autowired
private SysUserService sysUserService; private SysUserService sysUserService;
@Autowired @Autowired
private SysMenuService sysMenuService; private SysMenuService sysMenuService;
@Autowired @Autowired
private ValidateCodeService validateCodeService; private ValidateCodeService validateCodeService;
@Operation(summary = "生成验证码", description = "生成验证码信息") @Operation(summary = "生成验证码", description = "生成验证码信息")
@GetMapping("generateValidateCode") @GetMapping("generateValidateCode")
public Result<ValidateCodeVo> generateValidateCode() { public Result<ValidateCodeVo> generateValidateCode() {
ValidateCodeVo vo = validateCodeService.generateValidateCode(); ValidateCodeVo vo = validateCodeService.generateValidateCode();
return Result.success(vo); return Result.success(vo);
} }
@Operation(summary = "登录请求", description = "登录请求实现") @Operation(summary = "登录请求", description = "登录请求实现")
@PostMapping("login") @PostMapping("login")
public Result<LoginVo> login(@RequestBody LoginDto loginDto) { public Result<LoginVo> login(@RequestBody LoginDto loginDto) {
LoginVo vo = sysUserService.login(loginDto); LoginVo vo = sysUserService.login(loginDto);
return Result.success(vo); return Result.success(vo);
} }
@Operation(summary = "获取登录用户信息", description = "获取当前登录用户信息") @Operation(summary = "获取登录用户信息", description = "获取当前登录用户信息")
@GetMapping("getUserInfo") @GetMapping("getUserInfo")
public Result<SysUser> getUserInfo() { public Result<SysUser> getUserInfo() {
SysUser sysUser = BaseContext.getSysUser(); SysUser sysUser = BaseContext.getSysUser();
return Result.success(sysUser); return Result.success(sysUser);
} }
@Operation(summary = "用户退出", description = "用户退出接口") @Operation(summary = "用户退出", description = "用户退出接口")
@GetMapping(value = "/logout")
public Result logout(@RequestHeader(value = "token") String token) {
sysUserService.logout(token);
return Result.success();
}
@Operation(summary = "动态菜单", description = "动态菜单")
@GetMapping("menus")
public Result<List<SysMenuVo>> menus() {
List<SysMenuVo> sysMenuVoList = sysMenuService.findUserMenuList();
return Result.success(sysMenuVoList);
}
}

View File

@ -0,0 +1,25 @@
package com.atguigu.spzx.manger.mapper;
import com.atguigu.spzx.model.entity.product.Category;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CategoryMapper {
/**
* 根据分类id查询它下面的所有的子分类数据
*
* @param parentId 父级ID
* @return 分类实体类列表
*/
List<Category> selectByParentId(Long parentId);
/**
* 查询该分类下子分类的数量
*
* @param id ID
* @return int
*/
int countByParentId(Long id);
}

View File

@ -0,0 +1,28 @@
package com.atguigu.spzx.manger.service;
import com.atguigu.spzx.model.entity.product.Category;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
public interface CategoryService {
/**
* 根据父级id查找
* @param parentId 父级id
* @return 菜单列表
*/
List<Category> findByParentId(Long parentId);
/**
* 导出数据
* @param response HttpServletResponse
*/
void exportData(HttpServletResponse response);
/**
* 导入功能
* @param file Excel文件
*/
void importData(MultipartFile file);
}

View File

@ -0,0 +1,65 @@
package com.atguigu.spzx.manger.service.impl;
import com.alibaba.excel.EasyExcel;
import com.atguigu.spzx.manger.mapper.CategoryMapper;
import com.atguigu.spzx.manger.service.CategoryService;
import com.atguigu.spzx.model.entity.product.Category;
import com.atguigu.spzx.model.vo.product.CategoryExcelVo;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@Service
public class CategoryServiceImpl implements CategoryService {
@Autowired
private CategoryMapper categoryMapper;
/**
* 根据parentId获取下级节点
*
* @param parentId 父级ID
* @return 分类实体类列表
*/
@Override
public List<Category> findByParentId(Long parentId) {
// 根据分类id查询它下面的所有的子分类数据
List<Category> categoryList = categoryMapper.selectByParentId(parentId);
if (!CollectionUtils.isEmpty(categoryList)) {
categoryList.forEach(item -> {
// 查询该分类下子分类的数量
int count = categoryMapper.countByParentId(item.getId());
item.setHasChildren(count > 0);
});
}
return categoryList;
}
/**
* 导出数据
*
* @param response HttpServletResponse
*/
@Override
public void exportData(HttpServletResponse response) {
// TODO 导出数据
}
/**
* 导入功能
*
* @param file Excel文件
*/
@Override
public void importData(MultipartFile file) {
// TODO 导入功能
}
}

View File

@ -0,0 +1,26 @@
<?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.atguigu.spzx.manger.mapper.CategoryMapper">
<resultMap id="categoryMap" type="com.atguigu.spzx.model.entity.product.Category" autoMapping="true"/>
<!-- 用于select查询公用抽取的列 -->
<sql id="columns">
id,name,image_url,parent_id,status,order_num,create_time,update_time,is_deleted
</sql>
<!-- 根据分类id查询它下面的所有的子分类数据 -->
<select id="selectByParentId" resultType="com.atguigu.spzx.model.entity.product.Category">
select
<include refid="columns"/>
from category
where parent_id=#{parentId} and is_deleted=0 order by id desc
</select>
<!-- 查询该分类下子分类的数量 -->
<select id="countByParentId" resultType="java.lang.Integer">
select count(id)
from category
where parent_id = #{id}
and is_deleted = 0
</select>
</mapper>

View File

@ -1,23 +0,0 @@
bunny:
datasource:
host: 106.15.251.123
port: 3305
sqlData: db_spzx
username: root
password: "02120212"
redis:
host: 106.15.251.123
port: 6379
database: 2
minio:
endpointUrl: "http://129.211.31.58:9000"
bucket-name: spzx-bucket
accessKey: "bunny"
secretKey: "02120212"
noAuthUrls:
- /admin/system/index/login
- /admin/system/index/generateValidateCode
- /v3/**

View File

@ -1,48 +0,0 @@
server:
port: 8501
spring:
application:
name: service-spzx
profiles:
active: dev
main:
allow-bean-definition-overriding: true
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
username: ${bunny.datasource.username}
password: "${bunny.datasource.password}"
data:
redis:
host: ${bunny.redis.host}
port: ${bunny.redis.port}
database: ${bunny.redis.database}
logging:
level:
com.atguigu.mapper: debug
com.atguigu.controller: info
com.atguigu.service: info
pattern:
dateformat: HH:mm:ss:SSS
file:
path: "logs/${spring.application.name}"
mybatis:
type-aliases-package: com.atguigu.spzx.model
mapper-locations: classpath:mapper/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
auto-mapping-behavior: full
bunny:
minio:
endpointUrl: ${bunny.minio.endpointUrl}
accessKey: ${bunny.minio.accessKey}
secretKey: ${bunny.minio.secretKey}
bucket-name: ${bunny.minio.bucket-name}

View File

@ -1,16 +0,0 @@
-----------------▄██-█▄---------
-----------------███▄██▄--------
-----------------███████--------
-----------------▀███████-------
-------------------██████▄▄-----
-------------------█████████▄---
-------------------██████▄████--
-------▄███████████████████████-
-----▄███████████████████████▀--
---▄██████████████████████------
---███████████████████████------
---███████████████████████------
-▄▄██████████████████████▀------
-█████████████████▀█████--------
-▀██████████████▀▀-▀█████▄------
-------▀▀▀▀▀▀▀▀▀------▀▀▀▀------

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<contextName>logback</contextName>
<!-- 日志的输出目录 -->
<property name="log.path" value="logs//spzx-manager//logs"/>
<!--控制台日志格式:彩色日志-->
<!-- magenta:洋红 -->
<!-- boldMagenta:粗红-->
<!-- cyan:青色 -->
<!-- white:白色 -->
<!-- magenta:洋红 -->
<property name="CONSOLE_LOG_PATTERN"
value="%yellow(%date{yyyy-MM-dd HH:mm:ss}) %highlight([%-5level]) %green(%logger) %msg%n"/>
<!--文件日志格式-->
<property name="FILE_LOG_PATTERN" value="%date{yyyy-MM-dd HH:mm:ss} [%-5level] %thread %file:%line %logger %msg%n"/>
<!--编码-->
<property name="ENCODING" value="UTF-8"/>
<!-- 控制台日志 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!-- 临界值过滤器 -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>${ENCODING}</charset>
</encoder>
</appender>
<!-- 文件日志 -->
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${log.path}//log.log</file>
<append>true</append>
<encoder>
<pattern>%date{yyyy-MM-dd HH:mm:ss} %msg%n</pattern>
<charset>${ENCODING}</charset>
</encoder>
</appender>
<!-- 开发环境 -->
<springProfile name="dev">
<!-- com.atguigu日志记录器业务程序INFO级别 -->
<logger name="com.atguigu" level="INFO"/>
<!-- 根日志记录器INFO级别 -->
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</springProfile>
</configuration>

View File

@ -1,76 +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.atguigu.spzx.manger.mapper.SysUserMapper">
<!-- 用于select查询公用抽取的列 -->
<sql id="columns">
id,username userName ,password,name,phone,avatar,description,status,create_time,update_time,is_deleted
</sql>
<!-- 添加用户 -->
<insert id="save">
insert into sys_user (id, username, password, name, phone, avatar, description, status)
values (#{id}, #{userName}, #{password}, #{name}, #{phone}, #{avatar}, #{description}, #{status});
</insert>
<!-- 修改用户 -->
<update id="updateSysUser">
update sys_user
set
<if test="userName != null and userName != ''">
username = #{userName},
</if>
<if test="password != null and password != ''">
password = #{password},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="description != null and description != ''">
description = #{description},
</if>
<if test="status != null and status != ''">
status = #{status},
</if>
update_time = now()
where id = #{id}
</update>
<!-- 根据id删除用户 -->
<update id="deleteById">
update sys_user
set is_deleted = 1,
update_time = now()
where id = #{id}
</update>
<!-- 根据username查询用户信息 -->
<select id="selectByUsername" resultType="com.atguigu.spzx.model.entity.system.SysUser">
select
<include refid="columns"/>
from sys_user
where username = #{username};
</select>
<!-- 查询用户 -->
<select id="findByPage" resultType="com.atguigu.spzx.model.entity.system.SysUser">
select
<include refid="columns"/>
from sys_user
<where>
<if test="keyword != null and keyword != ''">
and username like CONCAT('%',#{keyword},'%')
</if>
<if test="createTimeBegin != null and createTimeBegin != ''">
and create_time >= #{createTimeBegin}
</if>
<if test="createTimeEnd != null and createTimeEnd != ''">
and create_time &lt;= #{createTimeEnd}
</if>
and is_deleted = 0
</where>
order by id desc
</select>
</mapper>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC
"-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 设置驼峰标识 -->
<setting name="mapUnderscoreToCamelCase" value="true"/>
<!-- 打印SQL语句 -->
<setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
<plugins>
<!-- 分页插件 -->
<plugin interceptor="com.github.pagehelper.PageInterceptor"/>
</plugins>
</configuration>

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