fix(): 代码合并
parent
2a0bd1178e
commit
0ebf046e25
|
@ -1,3 +1,4 @@
|
||||||
com.muyu.cloud.common.saas.interceptor.WebMvcSaaSConfig
|
com.muyu.cloud.common.saas.interceptor.WebMvcSaaSConfig
|
||||||
com.muyu.cloud.common.many.datasource.ManyDataSource
|
com.muyu.cloud.common.many.datasource.ManyDataSource
|
||||||
com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory
|
com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory
|
||||||
|
com.muyu.cloud.common.many.datasource.init.InitDataSource
|
||||||
|
|
|
@ -30,6 +30,8 @@ public class AddDatabaseListener implements EventListener {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -52,11 +52,11 @@
|
||||||
<artifactId>kafka-clients</artifactId>
|
<artifactId>kafka-clients</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.baomidou</groupId>
|
<!-- <groupId>com.baomidou</groupId>-->
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<!-- <artifactId>mybatis-plus-boot-starter</artifactId>-->
|
||||||
<version>3.5.1</version>
|
<!-- <version>3.5.1</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
package com.muyu.server;
|
package com.muyu.server;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
||||||
|
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
||||||
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
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.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* saas模块启动类
|
* saas模块启动类
|
||||||
* @author YuPing
|
* @author YuPing
|
||||||
|
@ -11,7 +16,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* @Version 1.0
|
* @Version 1.0
|
||||||
* @Data 2024-09-28 17:34:31
|
* @Data 2024-09-28 17:34:31
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication(exclude = {
|
||||||
|
DataSourceAutoConfiguration.class,
|
||||||
|
DruidDataSourceAutoConfigure.class,
|
||||||
|
DynamicDataSourceAutoConfiguration.class
|
||||||
|
})
|
||||||
|
@EnableCustomConfig
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
public class SaasApplication {
|
public class SaasApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class CarTypeServiceImpl extends ServiceImpl<CarTypeMapper, CarType> implements CarTypeService{
|
public class CarTypeServiceImpl extends ServiceImpl<CarTypeMapper, CarType> implements CarTypeService{
|
||||||
|
|
||||||
@Resource
|
@Autowired
|
||||||
private CarTypeMapper carTypeMapper;
|
private CarTypeMapper carTypeMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,76 +11,6 @@ nacos:
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
kafka:
|
|
||||||
producer:
|
|
||||||
# Kafka服务器
|
|
||||||
bootstrap-servers: 150.158.33.234:9092
|
|
||||||
# 开启事务,必须在开启了事务的方法中发送,否则报错
|
|
||||||
transaction-id-prefix: kafkaTx-
|
|
||||||
# 发生错误后,消息重发的次数,开启事务必须设置大于0。
|
|
||||||
retries: 3
|
|
||||||
# acks=0 : 生产者在成功写入消息之前不会等待任何来自服务器的响应。
|
|
||||||
# acks=1 : 只要集群的首领节点收到消息,生产者就会收到一个来自服务器成功响应。
|
|
||||||
# acks=all :只有当所有参与复制的节点全部收到消息时,生产者才会收到一个来自服务器的成功响应。
|
|
||||||
acks: all
|
|
||||||
# 开启事务时,必须设置为all
|
|
||||||
# 当有多个消息需要被发送到同一个分区时,生产者会把它们放在同一个批次里。该参数指定了一个批次可以使用的内存大小,按照字节数计算。
|
|
||||||
batch-size: 16384
|
|
||||||
# 生产者内存缓冲区的大小。
|
|
||||||
buffer-memory: 1024000
|
|
||||||
# 键的序列化方式
|
|
||||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
|
||||||
# 值的序列化方式(建议使用Json,这种序列化方式可以无需额外配置传输实体类)
|
|
||||||
value-serializer: org.apache.kafka.common.serialization.StringSerializer
|
|
||||||
consumer:
|
|
||||||
# Kafka服务器
|
|
||||||
group-id: my-kafka
|
|
||||||
# 自动提交的时间间隔 在spring boot 2.X 版本中这里采用的是值的类型为Duration 需要符合特定的格式,如1S,1M,2H,5D
|
|
||||||
#auto-commit-interval: 2s
|
|
||||||
# 该属性指定了消费者在读取一个没有偏移量的分区或者偏移量无效的情况下该作何处理:
|
|
||||||
# earliest:当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费分区的记录
|
|
||||||
# latest:当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,消费新产生的该分区下的数据(在消费者启动之后生成的记录)
|
|
||||||
# none:当各分区都存在已提交的offset时,从提交的offset开始消费;只要有一个分区不存在已提交的offset,则抛出异常
|
|
||||||
auto-offset-reset: latest
|
|
||||||
# 是否自动提交偏移量,默认值是true,为了避免出现重复数据和数据丢失,可以把它设置为false,然后手动提交偏移量
|
|
||||||
enable-auto-commit: true
|
|
||||||
# 键的反序列化方式
|
|
||||||
#key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
|
||||||
key-deserializer: org.apache.kafka.common.serialization.StringSerializer
|
|
||||||
# 值的反序列化方式(建议使用Json,这种序列化方式可以无需额外配置传输实体类)
|
|
||||||
value-deserializer: org.apache.kafka.common.serialization.StringSerializer
|
|
||||||
# 这个参数定义了poll方法最多可以拉取多少条消息,默认值为500。如果在拉取消息的时候新消息不足500条,那有多少返回多少;如果超过500条,每次只返回500。
|
|
||||||
# 这个默认值在有些场景下太大,有些场景很难保证能够在5min内处理完500条消息,
|
|
||||||
# 如果消费者无法在5分钟内处理完500条消息的话就会触发reBalance,
|
|
||||||
# 然后这批消息会被分配到另一个消费者中,还是会处理不完,这样这批消息就永远也处理不完。
|
|
||||||
# 要避免出现上述问题,提前评估好处理一条消息最长需要多少时间,然后覆盖默认的max.poll.records参数
|
|
||||||
# 注:需要开启BatchListener批量监听才会生效,如果不开启BatchListener则不会出现reBalance情况
|
|
||||||
max-poll-records: 500
|
|
||||||
bootstrap-servers: 150.158.33.234:9092
|
|
||||||
auto-commit-interval: 5000
|
|
||||||
fetch-max-wait: 500
|
|
||||||
fetch-min-size: 1
|
|
||||||
heartbeat-interval: 3000
|
|
||||||
properties:
|
|
||||||
# 两次poll之间的最大间隔,默认值为5分钟。如果超过这个间隔会触发reBalance
|
|
||||||
max:
|
|
||||||
poll:
|
|
||||||
interval:
|
|
||||||
ms: 600000
|
|
||||||
# 当broker多久没有收到consumer的心跳请求后就触发reBalance,默认值是10s
|
|
||||||
session:
|
|
||||||
timeout:
|
|
||||||
ms: 10000
|
|
||||||
listener:
|
|
||||||
# 在侦听器容器中运行的线程数,一般设置为 机器数*分区数
|
|
||||||
concurrency: 4
|
|
||||||
# 自动提交关闭,需要设置手动消息确认
|
|
||||||
ack-mode: manual_immediate
|
|
||||||
# 消费监听接口监听的主题不存在时,默认会报错,所以设置为false忽略错误
|
|
||||||
missing-topics-fatal: false
|
|
||||||
# 两次poll之间的最大间隔,默认值为5分钟。如果超过这个间隔会触发reBalance
|
|
||||||
poll-timeout: 600000
|
|
||||||
|
|
||||||
mvc:
|
mvc:
|
||||||
pathmatch:
|
pathmatch:
|
||||||
matching-strategy: ant_path_matcher
|
matching-strategy: ant_path_matcher
|
||||||
|
|
|
@ -1,9 +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.muyu.server.mapper.CarTypeMapper">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -6,7 +6,7 @@
|
||||||
1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名
|
1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名
|
||||||
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
|
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
|
||||||
-->
|
-->
|
||||||
<mapper namespace="com.muyu.server.mapper.EnterpriseDao">
|
<mapper namespace="com.muyu.server.mapper.EnterpriseMapper">
|
||||||
|
|
||||||
<!--查询企业信息-->
|
<!--查询企业信息-->
|
||||||
<select id="selectEnterprise" resultType="HashMap" parameterType="Map">
|
<select id="selectEnterprise" resultType="HashMap" parameterType="Map">
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--新增企业信息-->
|
<!--新增企业信息-->
|
||||||
<insert id="insert" parameterType="com.muyu.server.mapper.EnterpriseDao">
|
<insert id="insert" parameterType="com.muyu.server.mapper.EnterpriseMapper">
|
||||||
insert into tb_enterprise
|
insert into tb_enterprise
|
||||||
set enterprise_name = #{enterpriseName},
|
set enterprise_name = #{enterpriseName},
|
||||||
enterprise_car_count = #{enterpriseCarCount},
|
enterprise_car_count = #{enterpriseCarCount},
|
||||||
|
|
Loading…
Reference in New Issue