master
sikadi 2023-12-01 16:20:11 +08:00
parent 9c931b6646
commit 37f45c4805
4 changed files with 11 additions and 9 deletions

View File

@ -29,9 +29,7 @@ public class VehiclelaunchController {
*/ */
@PostMapping("vehiclelaunch") @PostMapping("vehiclelaunch")
public Result vehiclelaunchs(@RequestBody Vehiclelaunch vehiclelaunch){ public Result vehiclelaunchs(@RequestBody Vehiclelaunch vehiclelaunch){
String topic = vehiclelaunchService.vehiclelaunch(vehiclelaunch); String topic = vehiclelaunchService.vehiclelaunch(vehiclelaunch);
return Result.success(topic); return Result.success(topic);
} }

View File

@ -14,4 +14,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface VehicleaunchMapper { public interface VehicleaunchMapper {
Car save(Vehiclelaunch vehiclelaunch); Car save(Vehiclelaunch vehiclelaunch);
int into(Vehiclelaunch vehiclelaunch);
} }

View File

@ -25,16 +25,14 @@ public class VehiclelaunchServiceimpl implements VehiclelaunchService {
if (StringUtils.isEmpty(vehiclelaunch.getVin())){ if (StringUtils.isEmpty(vehiclelaunch.getVin())){
return "vin为空"; return "vin为空";
} }
Car car = vehicleaunchMapper.save(vehiclelaunch); int i = vehicleaunchMapper.into(vehiclelaunch);
if( null == car){ if(i < 0){
return "失败";
return "连接不上,没有该车辆";
} }
String carVin = car.getCarVin();
String fate = "fate" + carVin.substring(3,7) + vehiclelaunch.getNonce(); String fate = "fate" + vehiclelaunch.getVin().substring(3,7) + vehiclelaunch.getNonce();
return fate; return fate;
} }

View File

@ -3,9 +3,13 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shiyi.launch.mapper.VehicleaunchMapper"> <mapper namespace="com.shiyi.launch.mapper.VehicleaunchMapper">
<insert id="into">
insert into t_car(car_vin) values
(#{vin})
</insert>
<select id="save" resultType="com.shiyi.launch.domain.Car"> <select id="save" resultType="com.shiyi.launch.domain.Car">
select * from t_car where car_vin = #{vin} select * from t_car where car_vin = #{vin}
</select> </select>
</mapper> </mapper>