连接数据

master
sikadi 2023-12-01 16:43:50 +08:00
parent 37f45c4805
commit 449118c06d
3 changed files with 22 additions and 2 deletions

View File

@ -62,6 +62,14 @@
<artifactId>mysql-connector-j</artifactId>
<version>8.0.33</version>
</dependency>
<!-- rabbitMQ -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>

View File

@ -8,6 +8,9 @@ import com.shiyi.launch.service.VehiclelaunchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.UUID;
/**
* @Description : 线
* @Author : YangHaoYu
@ -25,6 +28,15 @@ public class VehiclelaunchServiceimpl implements VehiclelaunchService {
if (StringUtils.isEmpty(vehiclelaunch.getVin())){
return "vin为空";
}
long time = new Date().getTime();
vehiclelaunch.setTimestamp(String.valueOf(time));
String uuid = UUID.randomUUID().toString().replaceAll("-","").substring(0,8);
vehiclelaunch.setNonce(uuid);
int i = vehicleaunchMapper.into(vehiclelaunch);
if(i < 0){

View File

@ -4,8 +4,8 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shiyi.launch.mapper.VehicleaunchMapper">
<insert id="into">
insert into t_car(car_vin) values
(#{vin})
insert into t_car(car_vin,car_address,car_license,car_name) values
(#{vin},#{timestamp},#{nonce},#{userName})
</insert>