暑假基于springboot开发的工厂项目学习总结

1.软件环境(兵马未动,粮草先行)

系统:Windows 10
JDK:JDK1.8
IDE::Intellij IDEA 2020
构建工具:Maven 3.6.3
Spring Boot:Spring Boot 2.5.6
MySql:MySql 8.0及其以上
参考书籍:Springboot趣味实战(刘水镜)

关于环境的注意事项:
1.环境版本之间存在兼容性,请严格按照标准适配。
2.Maven镜像配置极其重要,可能部分依赖在镜像仓库中不存在而导致拉取失败,所以建议使用Maven默认镜像:

<mirror>
    <id>official</id>
    <url>https://repo.maven.apache.org/maven2</url>
</mirror>

2.文件结构(不识庐山真面目,只缘身在此山中)

Spring Boot的文件结构由所不一样,因为Spring Boot采用的是三层架构,下面介绍其文件结构以及每个结构的作用

2.1三层架构

Controller(UI)界面控制层
Service(BLL)业务逻辑服务层
Dao(DAL)数据访问层
在这里插入图片描述
注意:因为这个项目用到的是mybatis plus,mapper就是dao

文字解释
如果你学过jee,里面也由Controller层(后称为cj),Controller(UI)界面控制层、Service(BLL)业务逻辑服务层与Dao(DAL)数据访问层可以说是共同组成了cjController负责给请求分配要访问的ServiceService可能会调取Dao(是否需要操作数据库)

简而言之,springboot将旧版的Controller分开了,提高了类聚,降低了耦合

画图解释:
在这里插入图片描述
举个例子,我是一个用户,我要去银行(银行Controller,用户发送一个去中国银行的请求),然后门口的工作人员会接待你,并问你是来创建账户还是修改信息(这就是Controller里面的一个方法,因为都涉及到修改,所有可以放到同一个方法里判断,当然也可以在两个方法里),你说是新建账户,他就会叫你到新建账户的窗口去(Service),然后业务员会调用数据库给你新建一个账户。

2.2application.yml还是application.properties

在resource文件夹下有一个application的文件,这是一个配置文件,里面可以配置一些功能,比如修改服务器8080端口为其他端口等。该文件默认为properties格式,但建议使用yml格式(修改后缀即可)
对比这两种格式:

properties:

server.port=8080
server.servlet.context-path=/springboot
server.servlet.session.timeout=57600

yml:

server:
  port: 8080
  servlet:
    context-path: /springboot
    session:
      timeout: 57600

yml的层次结构更清晰,更具有整体性和层次感,而且更加简洁

2.3Maven简单使用

Maven是一个工具,方便用户下载使用一些库

给出本项目的完整依赖(.pom文件)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
    <!--parent是继承,继承某一个模块,每个,模块有GAV,对应的是组织,唯一ID,版本 -->
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.6</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.dachuang</groupId><!-- 这是本项目的GAV -->
    <artifactId>factorySystem</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>factorySystem</name><!-- 名字 -->
    <description>factorySystem project for Spring Boot</description><!-- 描述 -->
    <properties><!-- java版本 -->
        <java.version>8</java.version>
    </properties>
    <dependencies><!-- 依赖(也就是用到的库) -->
        <dependency><!-- springframework框架 -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId><!-- 注意这里是starter 而且没有版本号了,后面会提到-->
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId><!-- 切面,本项目没用到,但属于核心 -->
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId><!-- 参数校验 -->
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId><!-- 测试,没用到,自动生成的 -->
            <scope>test</scope>
        </dependency>

        <!-- Swagger 依赖,Swagger 是一个自动生成接口的工具 -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version><!-- 版本-->
        </dependency>
<!--        <dependency>-->
<!--            <groupId>com.github.xiaoymin</groupId>-->
<!--            <artifactId>knife4j-spring-boot-starter</artifactId>-->
<!--            <version>3.0.2</version>-->
<!--        </dependency>-->
 		<!-- 需要在idea里面安装lombok插件,用来省略getter,setter -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- 数据库连接 -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!-- mybatis-plus 一个持久化层框架-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
        </dependency>
        <!-- 阿里巴巴的连接池-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
        </dependency>
<!--        <dependency>-->
<!--            <groupId>org.springframework.boot</groupId>-->
<!--            <artifactId>spring-boot-starter-security</artifactId>-->
<!--        </dependency>-->
		<!-- mybatis-plus 自动生成代码器-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-generator</artifactId>
        </dependency>
        <!-- spring-boot框架-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-freemarker</artifactId>
        </dependency>
        <!-- poi-tl 操作word-->
        <dependency>
            <groupId>com.deepoove</groupId>
            <artifactId>poi-tl</artifactId>
            <version>1.12.0</version>
        </dependency>
        
        <dependency>
            <groupId>com.vaadin.external.google</groupId>
            <artifactId>android-json</artifactId>
            <version>0.0.20131108.vaadin1</version>
            <scope>compile</scope>
        </dependency>
        <!-- 操作JSON的,没用这个,用的是下面阿里巴巴的-->
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier>
        </dependency>
        <!-- alibabaJSON操作-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.73</version>
        </dependency>
    </dependencies>
    <!-- dependencyManagement是管理版本的,比如又有一个项目继承了这个项目,那个项目要添加下面这些依赖,不需要输入版本号也行,单这不是上面输入starter的原因,starter是一个套件,里面自己定义了各个框架的版本,自动适配的,所以不需要版本号-->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>mybatis-plus-boot-starter</artifactId>
                <version>3.4.2</version>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid-spring-boot-starter</artifactId>
                <version>1.2.5</version>
            </dependency>
            <dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>mybatis-plus-generator</artifactId>
                <version>3.4.1</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

在没有starter的日子,一个功能会拉取很多包,还要定义相应版本,太痛苦了

2.4前端网页放到哪里

在这里插入图片描述

resource文件夹里,并不是所用文件夹都能被前端链接访问的,默认static文件夹(没有自建)是能被访问的,将前端页面放到里面即可,其他文件夹默认只能后端访问。但也可以通过配置application来开放其他文件夹,具体可以自行搜索。

工厂流程与项目展示(灵感来源)

工厂生产线分为
1.物料
2.装配
3.测试
4.包装

每一次生产对应了一个生产订单,生产订单有各种状态,后续发现异常会产生批退。

工厂使用的是内网,文件和信息一般由内部邮箱发送或文件服务器。

于是我把这些功能集成在了一起

登录:
在这里插入图片描述

注册:

在这里插入图片描述
邮件:
在这里插入图片描述
文件服务器:
在这里插入图片描述
收件箱
在这里插入图片描述
信息列表
在这里插入图片描述
统计
在这里插入图片描述
统计
在这里插入图片描述

总结:

这两个月实习以学习为主,以实践带学习全方位提高自己的技术能力。在注重学习的同时狠抓实践,在实践中利用所学知识用知识指导实践全方位的提高自己的技术能力和水平。

团队意识和人际交往是做好工作的金钥匙,在实习期间,无时无刻看到各个部门的人员相互协作,团结鼓励。大概一周我已经适应组织环境,在长期磨合过程中渐渐形成稳定的工作安排。

由于周期比较短,未能参与到工厂的实际开发中,减轻项目改善组负担,我深感抱歉。非常感谢大家的关照。

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

I Am Rex

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值