2024.7.9
- 一、数据库的排序和统一问题。utf8mb4和utf8的不同
- 1.1 发现问题
- 1.2 解决问题-在idea中用sql生成器,生成sql语句,然后在里面修改
- 1.3 utf8和utf8mb4的区别
- 二、若依前后端框架。代码生成器(还没研究懂,但有三个方案)
- 2.1 若依框架的优缺点(十分片面)
- 2.2 若依框架的下载,安装和运行:
- 2.3 遇到的问题(希望有人能帮到我)
- 2.3.1 pom
- 2.3.2 mapper.xml能和mapper用mybatis连接上跳转。
- 2.3.3 报的错误
- 2.4 解决了的问题
- 2.4.1 xml中 type=、parameterType=报错,见图(这是修改过的了)
- 2.4.2 在我们的实体类上面增加一个注解@Alias("TmsTb01"):
- 2.4.3 @Alias(我的理解是别名)
- 2.5 使用mybatis-generator (没咋看懂,还有git上的代码生成器,和若依差不多。)
- 三、gitee
- 1 为什么使用到gitee了
- 2 gitee的登录和创建仓库以及邀请组员
- 2.1 gitee官网:[https://gitee.com/](https://gitee.com/)
- 2.2 然后创建仓库:
- 2.3 邀请组员
- 2.4 推拉数据
- 四、前端vue的下载修复和启动
- 1 运行和下载npm run dev、npm install
- 2 下载完进行修复npm audit fix(好习惯!)
- 3 npm audit和npm audit fix的不同:
一、数据库的排序和统一问题。utf8mb4和utf8的不同
1.1 发现问题
在我们小组的分工合作完,建好数据库表之后,合并的时候,发现有冲突。因为三个组员使用的Navicat,没有utf8,用的是默认的utf8mb4和utf8mb4_general_ci这两个字符集和排序规则。导致我们总和数据库的时候,发现问题。
1.2 解决问题-在idea中用sql生成器,生成sql语句,然后在里面修改
把每个表最后的utf8mb4修改为utf8后,保存,重新执行。
1.3 utf8和utf8mb4的区别
utf8 是 Mysql 中的一种字符集,只支持最长三个字节的 UTF-8字符,也就是 Unicode 中的基本多文本平面。要在 Mysql 中保存 4 字节长度的 UTF-8 字符,需要使用 utf8mb4 字符集,但只有 5.5.3 版本以后的才支持。
如果遇到 4 字节的字符就会出现错误了。三个字节的 UTF-8 最大能编码的 Unicode 字符是 0xFFFF,也就是 Unicode 中的基本多文平面(BMP)。也就是说,任何不在基本多文平面的 Unicode字符,都无法使用MySQL原有的 utf8 字符集存储。这些不在BMP中的字符包括哪些呢?最常见的就是Emoji 表情(Emoji 是一种特殊的 Unicode 编码,常见于 ios 和 android 手机上),和一些不常用的汉字,以及任何新增的 Unicode 字符等等。
二、若依前后端框架。代码生成器(还没研究懂,但有三个方案)
2.1 若依框架的优缺点(十分片面)
对于我来说,这是一个没有深入研究过的东西,是小组成员商讨然后使用。对于若依的前后端分离框架:
优点是:数据库的字段超级多,我们也需要相应的元素,和一些重复的代码开发,使用若依可以直接专注于代码的开发,前后端都已经是较为完善的了。
缺点是:对于刚接触若依框架的我们来说,很多模块,功能有点找不清,而且我们需要开发的话,固定在rouyi-system里面来写,需要花大量时间去继续研究代码的含义,以及如何去重新开一个模块,写自己的代码。(我知道,还是我业务能力低,大佬早就解决了,接触时间太少了,后续多接触,再回来改)。
2.2 若依框架的下载,安装和运行:
直接看大佬的吧:https://blog.csdn.net/moran_3346/article/details/131803190
2.3 遇到的问题(希望有人能帮到我)
我想独立出一个模块来写自己的代码,所以我创建了一个空模块,然后去重新写所有的配置
代码太多了,我只粘出部分重要的代码:
2.3.1 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.8.8</version>
</parent>
<groupId>com.fst</groupId>
<version>3.8.8</version>
<artifactId>Shipping_lists</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
</dependencies>
</project>
2.3.2 mapper.xml能和mapper用mybatis连接上跳转。
<?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.fst.mapper.ShipInfoChangeMapper">
<resultMap type="TmsTb01" id="ShipInfoChangeResult">
<result property="omTermInfoId" column="om_term_info_id" />
<result property="newOutRegionId" column="new_out_region_id" />
<result property="oldOutRegionId" column="old_out_region_id" />
<result property="newTakeAddress" column="new_take_address" />
<result property="oldTakeAddress" column="old_take_address" />
<result property="newBranchName" column="new_branch_name" />
<result property="oldBranchName" column="old_branch_name" />
<result property="newBankContacts" column="new_bank_contacts" />
<result property="oldBankContacts" column="old_bank_contacts" />
<result property="newBankTel" column="new_bank_tel" />
<result property="oldBankTel" column="old_bank_tel" />
<result property="newOutLogisticsProviderInfoId" column="new_out_logistics_provider_info_id" />
<result property="oldOutLogisticsProviderInfoId" column="old_out_logistics_provider_info_id" />
</resultMap>
<sql id="selectShipInfoChangeVo">
select om_term_info_id, new_out_region_id, old_out_region_id, new_take_address, old_take_address, new_branch_name, old_branch_name, new_bank_contacts, old_bank_contacts, new_bank_tel, old_bank_tel, new_out_logistics_provider_info_id, old_out_logistics_provider_info_id from ship_info_change
</sql>
<select id="selectShipInfoChangeList" parameterType="TmsTb01" resultMap="ShipInfoChangeResult">
<include refid="selectShipInfoChangeVo"/>
<where>
<if test="newOutRegionId != null "> and new_out_region_id = #{newOutRegionId}</if>
<if test="oldOutRegionId != null "> and old_out_region_id = #{oldOutRegionId}</if>
<if test="newTakeAddress != null and newTakeAddress != ''"> and new_take_address = #{newTakeAddress}</if>
<if test="oldTakeAddress != null and oldTakeAddress != ''"> and old_take_address = #{oldTakeAddress}</if>
<if test="newBranchName != null and newBranchName != ''"> and new_branch_name like concat('%', #{newBranchName}, '%')</if>
<if test="oldBranchName != null and oldBranchName != ''"> and old_branch_name like concat('%', #{oldBranchName}, '%')</if>
<if test="newBankContacts != null and newBankContacts != ''"> and new_bank_contacts = #{newBankContacts}</if>
<if test="oldBankContacts != null and oldBankContacts != ''"> and old_bank_contacts = #{oldBankContacts}</if>
<if test="newBankTel != null and newBankTel != ''"> and new_bank_tel = #{newBankTel}</if>
<if test="oldBankTel != null and oldBankTel != ''"> and old_bank_tel = #{oldBankTel}</if>
<if test="newOutLogisticsProviderInfoId != null "> and new_out_logistics_provider_info_id = #{newOutLogisticsProviderInfoId}</if>
<if test="oldOutLogisticsProviderInfoId != null "> and old_out_logistics_provider_info_id = #{oldOutLogisticsProviderInfoId}</if>
</where>
</select>
<select id="selectShipInfoChangeByOmTermInfoId" parameterType="Long" resultMap="ShipInfoChangeResult">
<include refid="selectShipInfoChangeVo"/>
where om_term_info_id = #{omTermInfoId}
</select>
<insert id="insertShipInfoChange" parameterType="TmsTb01">
insert into ship_info_change
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="omTermInfoId != null">om_term_info_id,</if>
<if test="newOutRegionId != null">new_out_region_id,</if>
<if test="oldOutRegionId != null">old_out_region_id,</if>
<if test="newTakeAddress != null">new_take_address,</if>
<if test="oldTakeAddress != null">old_take_address,</if>
<if test="newBranchName != null">new_branch_name,</if>
<if test="oldBranchName != null">old_branch_name,</if>
<if test="newBankContacts != null">new_bank_contacts,</if>
<if test="oldBankContacts != null">old_bank_contacts,</if>
<if test="newBankTel != null">new_bank_tel,</if>
<if test="oldBankTel != null">old_bank_tel,</if>
<if test="newOutLogisticsProviderInfoId != null">new_out_logistics_provider_info_id,</if>
<if test="oldOutLogisticsProviderInfoId != null">old_out_logistics_provider_info_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="omTermInfoId != null">#{omTermInfoId},</if>
<if test="newOutRegionId != null">#{newOutRegionId},</if>
<if test="oldOutRegionId != null">#{oldOutRegionId},</if>
<if test="newTakeAddress != null">#{newTakeAddress},</if>
<if test="oldTakeAddress != null">#{oldTakeAddress},</if>
<if test="newBranchName != null">#{newBranchName},</if>
<if test="oldBranchName != null">#{oldBranchName},</if>
<if test="newBankContacts != null">#{newBankContacts},</if>
<if test="oldBankContacts != null">#{oldBankContacts},</if>
<if test="newBankTel != null">#{newBankTel},</if>
<if test="oldBankTel != null">#{oldBankTel},</if>
<if test="newOutLogisticsProviderInfoId != null">#{newOutLogisticsProviderInfoId},</if>
<if test="oldOutLogisticsProviderInfoId != null">#{oldOutLogisticsProviderInfoId},</if>
</trim>
</insert>
<update id="updateShipInfoChange" parameterType="TmsTb01">
update ship_info_change
<trim prefix="SET" suffixOverrides=",">
<if test="newOutRegionId != null">new_out_region_id = #{newOutRegionId},</if>
<if test="oldOutRegionId != null">old_out_region_id = #{oldOutRegionId},</if>
<if test="newTakeAddress != null">new_take_address = #{newTakeAddress},</if>
<if test="oldTakeAddress != null">old_take_address = #{oldTakeAddress},</if>
<if test="newBranchName != null">new_branch_name = #{newBranchName},</if>
<if test="oldBranchName != null">old_branch_name = #{oldBranchName},</if>
<if test="newBankContacts != null">new_bank_contacts = #{newBankContacts},</if>
<if test="oldBankContacts != null">old_bank_contacts = #{oldBankContacts},</if>
<if test="newBankTel != null">new_bank_tel = #{newBankTel},</if>
<if test="oldBankTel != null">old_bank_tel = #{oldBankTel},</if>
<if test="newOutLogisticsProviderInfoId != null">new_out_logistics_provider_info_id = #{newOutLogisticsProviderInfoId},</if>
<if test="oldOutLogisticsProviderInfoId != null">old_out_logistics_provider_info_id = #{oldOutLogisticsProviderInfoId},</if>
</trim>
where om_term_info_id = #{omTermInfoId}
</update>
<delete id="deleteShipInfoChangeByOmTermInfoId" parameterType="Long">
delete from ship_info_change where om_term_info_id = #{omTermInfoId}
</delete>
<delete id="deleteShipInfoChangeByOmTermInfoIds" parameterType="String">
delete from ship_info_change where om_term_info_id in
<foreach item="omTermInfoId" collection="array" open="(" separator="," close=")">
#{omTermInfoId}
</foreach>
</delete>
</mapper>
2.3.3 报的错误
19:38:33.049 [restartedMain] INFO c.r.RuoYiApplication - [logStarting,55] - Starting RuoYiApplication using Java 21.0.1 on fst with PID 1456 (E:\project1\mybatis-generator-gui-master\production-system\production-system-master\ruoyi-admin\target\classes started by feng in E:\project1\mybatis-generator-gui-master\production-system)
19:38:33.052 [restartedMain] DEBUG c.r.RuoYiApplication - [logStarting,56] - Running with Spring Boot v2.5.15, Spring v5.3.33
19:38:33.052 [restartedMain] INFO c.r.RuoYiApplication - [logStartupProfileInfo,686] - The following 1 profile is active: "druid"
19:38:33.053 [background-preinit] INFO o.h.v.i.util.Version - [<clinit>,21] - HV000001: Hibernate Validator 6.2.5.Final
19:38:35.560 [restartedMain] INFO o.a.c.c.AprLifecycleListener - [log,173] - Loaded Apache Tomcat Native library [1.2.39] using APR version [1.7.4].
19:38:35.561 [restartedMain] INFO o.a.c.c.AprLifecycleListener - [log,173] - APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [true].
19:38:35.561 [restartedMain] INFO o.a.c.c.AprLifecycleListener - [log,173] - APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
19:38:35.582 [restartedMain] INFO o.a.c.c.AprLifecycleListener - [log,173] - OpenSSL successfully initialized [OpenSSL 3.0.11 19 Sep 2023]
19:38:35.595 [restartedMain] INFO o.a.c.h.Http11NioProtocol - [log,173] - Initializing ProtocolHandler ["http-nio-8080"]
19:38:35.595 [restartedMain] INFO o.a.c.c.StandardService - [log,173] - Starting service [Tomcat]
19:38:35.596 [restartedMain] INFO o.a.c.c.StandardEngine - [log,173] - Starting Servlet engine: [Apache Tomcat/9.0.75]
19:38:35.779 [restartedMain] INFO o.a.c.c.C.[.[.[/] - [log,173] - Initializing Spring embedded WebApplicationContext
19:38:36.364 [restartedMain] DEBUG c.r.f.s.f.JwtAuthenticationTokenFilter - [init,242] - Filter 'jwtAuthenticationTokenFilter' configured for use
19:38:38.517 [restartedMain] INFO c.a.d.p.DruidDataSource - [init,1002] - {dataSource-1} inited
19:38:39.011 [restartedMain] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - [refresh,599] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'captchaController': Unsatisfied dependency expressed through field 'configService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysConfigServiceImpl': Unsatisfied dependency expressed through field 'configMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysConfigMapper' defined in file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\ruoyi-system\target\classes\com\ruoyi\system\mapper\SysConfigMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ruoyi/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.io.IOException: Failed to parse mapping resource: 'file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\Shipping_lists\target\classes\mapper\list\ShipInfoChangeMapper.xml]'
19:38:39.011 [restartedMain] INFO c.a.d.p.DruidDataSource - [close,2204] - {dataSource-1} closing ...
19:38:39.015 [restartedMain] INFO c.a.d.p.DruidDataSource - [close,2277] - {dataSource-1} closed
19:38:39.033 [restartedMain] INFO o.a.c.c.StandardService - [log,173] - Stopping service [Tomcat]
19:38:39.066 [restartedMain] ERROR o.s.b.SpringApplication - [reportFailure,870] - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'captchaController': Unsatisfied dependency expressed through field 'configService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysConfigServiceImpl': Unsatisfied dependency expressed through field 'configMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysConfigMapper' defined in file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\ruoyi-system\target\classes\com\ruoyi\system\mapper\SysConfigMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ruoyi/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.io.IOException: Failed to parse mapping resource: 'file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\Shipping_lists\target\classes\mapper\list\ShipInfoChangeMapper.xml]'
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:713)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:693)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:408)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:453)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:343)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1370)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1359)
at com.ruoyi.RuoYiApplication.main(RuoYiApplication.java:18)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysConfigServiceImpl': Unsatisfied dependency expressed through field 'configMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysConfigMapper' defined in file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\ruoyi-system\target\classes\com\ruoyi\system\mapper\SysConfigMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ruoyi/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.io.IOException: Failed to parse mapping resource: 'file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\Shipping_lists\target\classes\mapper\list\ShipInfoChangeMapper.xml]'
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:713)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:693)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:408)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:710)
... 23 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysConfigMapper' defined in file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\ruoyi-system\target\classes\com\ruoyi\system\mapper\SysConfigMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ruoyi/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.io.IOException: Failed to parse mapping resource: 'file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\Shipping_lists\target\classes\mapper\list\ShipInfoChangeMapper.xml]'
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1534)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:710)
... 37 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ruoyi/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.io.IOException: Failed to parse mapping resource: 'file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\Shipping_lists\target\classes\mapper\list\ShipInfoChangeMapper.xml]'
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:646)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:626)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1519)
... 48 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.io.IOException: Failed to parse mapping resource: 'file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\Shipping_lists\target\classes\mapper\list\ShipInfoChangeMapper.xml]'
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:641)
... 61 common frames omitted
Caused by: java.io.IOException: Failed to parse mapping resource: 'file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\Shipping_lists\target\classes\mapper\list\ShipInfoChangeMapper.xml]'
at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:700)
at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:577)
at org.mybatis.spring.SqlSessionFactoryBean.getObject(SqlSessionFactoryBean.java:720)
at com.ruoyi.framework.config.MyBatisConfig.sqlSessionFactory(MyBatisConfig.java:130)
at com.ruoyi.framework.config.MyBatisConfig$$EnhancerBySpringCGLIB$$ebba123a.CGLIB$sqlSessionFactory$0(<generated>)
at com.ruoyi.framework.config.MyBatisConfig$$EnhancerBySpringCGLIB$$ebba123a$$FastClassBySpringCGLIB$$74fc26c.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at com.ruoyi.framework.config.MyBatisConfig$$EnhancerBySpringCGLIB$$ebba123a.sqlSessionFactory(<generated>)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 62 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\project1\mybatis-generator-gui-master\production-system\production-system-master\Shipping_lists\target\classes\mapper\list\ShipInfoChangeMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'TmsTb01'. Cause: java.lang.ClassNotFoundException: Cannot find class: TmsTb01
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:128)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:100)
at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:698)
... 73 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'TmsTb01'. Cause: java.lang.ClassNotFoundException: Cannot find class: TmsTb01
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:270)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:262)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:254)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:124)
... 75 common frames omitted
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'TmsTb01'. Cause: java.lang.ClassNotFoundException: Cannot find class: TmsTb01
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:128)
at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:150)
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)
... 79 common frames omitted
Caused by: java.lang.ClassNotFoundException: Cannot find class: TmsTb01
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:226)
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:103)
at org.apache.ibatis.io.Resources.classForName(Resources.java:322)
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:124)
... 81 common frames omitted
进程已结束,退出代码为 1
2.4 解决了的问题
2.4.1 xml中 type=、parameterType=报错,见图(这是修改过的了)
2.4.2 在我们的实体类上面增加一个注解@Alias(“TmsTb01”):
2.4.3 @Alias(我的理解是别名)
使用前提
在配置文件中配置 type-aliases-package 告诉spring boot (项目)你改别名的包是哪里
如:type-aliases-package: com.ye.test.pojo
实体类使用方法
@Alias("oppo")
public class Teacher {
private Integer id;
private String name;
mapper.xml 使用方法
mapper.xml 文件中可以直接使用 oppo,代替 com.ye.test.pojo.Teacher
如:javaType=“oppo” resultType=“oppo” parameterType=“oppo”
注意:使用@Alias 起别名之后,mapper.xml 文件 不能再使用 Teacher/teacher,但可以使用全类名 com.ye.test.pojo.Teacher
2.5 使用mybatis-generator (没咋看懂,还有git上的代码生成器,和若依差不多。)
大佬的:
https://blog.csdn.net/qq_43813351/article/details/119913372
https://developer.aliyun.com/article/1463287
三、gitee
1 为什么使用到gitee了
因为我们小组开发,还使用到了gitee来进行代码的整理和下放,很久之前在黑马的视频里面使用过gitee对自己的代码进行推,拉,合并,今天重温一下。主要的使用场景还是在idea里面。
2 gitee的登录和创建仓库以及邀请组员
2.1 gitee官网:https://gitee.com/
2.2 然后创建仓库:
根据需求进行创建
2.3 邀请组员
打开自己的仓库,点击管理,然后仓库成员管理
然后就可以根据链接和二维码进行分享和邀请了!!!
2.4 推拉数据
推数据:
拉数据
从头拉项目
四、前端vue的下载修复和启动
被组员吐槽了,是一点前端不会啊哈哈哈
1 运行和下载npm run dev、npm install
2 下载完进行修复npm audit fix(好习惯!)
3 npm audit和npm audit fix的不同:
npm audit安全漏洞的扫描器
npm audit fix:自动修复漏洞的利器
npm audit fix要慎重使用,这个命令可能会引发依赖问题,比如A包依赖B包,结果B包强制更新后,A包的依赖找不到了。
所以,搭配使用:
我们来看一个具体的例子。假设你的项目中有一个名为“express”的依赖包,但是这个包存在一个已知的安全漏洞。当你运行npm audit时,它会报告这个漏洞并给出相应的警告信息。接下来,你就可以查看升级之后,是否会造成其他冲突,然后尝试运行npm audit fix来自动修复这个问题。系统会自动更新“express”依赖包的版本,将其升级到一个没有安全漏洞的版本。