java+postgresql+swagger-多表关联insert操作(九)

news2025/4/23 2:58:21

入参为json,然后根据需要对多张表进行操作:

入参格式:

{"username": "车主01","usertel": "11111111111","useridtype": "2","useridcard": null,"proname": "天津市","cityname": "天津市市辖区","vinnumber": "2222222222","platenumber": "","cartype": "1","renttype": null,"totalperiods": null,"risklevel": null,"riskcontrolscore": null,"contractno": "","userclasstype": "6","overdueperiods": null,"loandate": null,"endrenttime": null,"inputtime": "2025-04-17T11:33:35","jsonreport": null,"createdbyid": "00000000-0000-0000-0000-000000000000","custstoreName":"swagger-测试经销商01","customerName":"swagger-测试客户01","applyid": "1111111111","credittype": null,"projectprocess": null,"yuqiperiod": null,"settledstatus": null,"startoffline": null,"endoffline": null,"offlineduration": null,"carmodel": "宝马8座 手动 1.5","carseries": "冷藏车老司e","carbrand": "澳柯玛增福改一下22","enginenumber": "","cooperativeunit": null,"lendtime": null,"devicenumber": "987654321","devicemodel": "ZRA5N-8-2","simnumber": "123456789","iswireless": "有线","installposition": "后备箱右侧","installtime": "2025-04-17 13:15:31","supplierid": "测试供应商01","suppliercode": "00001","displaystatus": 2,"simkinds": 1,"installproname": "新疆维吾尔自治区","installcityname": "阿克苏地区","installdistname": "温宿县","installlat": null,"installlng": null,"installperson": "XX000000","simservicecycle": null,"isdisplay": 0,"hosttype": null}

分别往下面表进行写数:

tb_custstoreinfo、tb_supplierinfo、tb_caruserinfo、tb_carusersecondaryinfo、tb_deviceinfo

1、实体:

1.1、表实体:

省略

1.2、入参实体:

package com.example.springbootmybatisplus.dto;

import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class CarUserDto {
    private String userName;
    private String userTel;
    private String userIdType;
    private String userIdCard;
    private String proName;
    private String cityName;
    private String vinNumber;
    private String plateNumber;
    private String carType;
    private String rentType;
    private Integer totalPeriods;
    private Integer riskLevel;
    private BigDecimal riskControlScore;
    private String contractNo;
    private String userClassType;
    private String overduePeriods;
    private Date loanDate;
    private Date endRentTime;
    private Date inputTime;
    private String jsonReport;
    private String createdById;
    private String custStoreName;
    private String customerName;
    private String applyId;
    private Integer creditType;
    private String projectProcess;
    private String yuqiPeriod;
    private String settledStatus;
    private String startOffline;
    private String endOffline;
    private BigDecimal offlineDuration;
    private String carModel;
    private String carSeries;
    private String carBrand;
    private String engineNumber;
    private String cooperativeUnit;
    private Date lendTime;
    private String deviceNumber;
    private String deviceModel;
    private String simNumber;
    private String isWireless;
    private String installPosition;
    private Date installTime;
    private String supplierId;
    private Short displayStatus;
    private Short simKinds;
    private String installProName;
    private String installCityName;
    private String installDistName;
    private BigDecimal installLat;
    private BigDecimal installLng;
    private String installPerson;
    private Short simServiceCycle;
    private Integer isDisplay;
    private Integer hostType;
    private String supplierCode;
}

1.3、其他中间实体:

package com.example.springbootmybatisplus.dto;

import lombok.Data;

@Data
public class DistrictDto {
    private String proCode;
    private String proName;
    private String cityCode;
    private String cityName;
    private String lat;
    private String lng;
}
package com.example.springbootmybatisplus.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.io.Serializable;
@Data
public class TbCustStore implements Serializable {
    /**
     * 主键(DL)
     */
    @TableId(value = "id", type = IdType.INPUT)
    private String id;

    /**
     * 客户Id
     */
    @TableField(value = "customerid")
    private String customerId;

    /**
     * 上级经销商Id
     */
    @TableField(value = "parentId")
    private String parentId;

    /**
     * 经销商编号
     */
    @TableField(value = "code")
    private String code;

    /**
     * 经销商名称
     */
    @TableField(value = "\"name\"")
    private String name;

    /**
     * 经销商等级
     */
    @TableField(value = "levelCode")
    private Short levelCode;
}

2、Mapper:

package com.example.springbootmybatisplus.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.springbootmybatisplus.entity.TbCarUserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface TbCarUserInfoMapper extends BaseMapper<TbCarUserInfo> {
    @Select("select Id as carid from tb_caruserinfo where vinnumber = #{vinNumber} and deleted=false limit 1")
    String getCarId(@Param("vinNumber") String vinNumber);

    @Select("select 'TC'||nextval('tc')")
    String getCarUserInfoId();
}
package com.example.springbootmybatisplus.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.springbootmybatisplus.entity.TbCarUserSecondaryInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface TbCarUserSecondaryInfoMapper extends BaseMapper<TbCarUserSecondaryInfo> {
    @Select("select 'CD'||nextval('cd')")
    String getCarUserSecondaryInfoId();
}
package com.example.springbootmybatisplus.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.springbootmybatisplus.entity.TbDeviceInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface TbDeviceInfoMapper extends BaseMapper<TbDeviceInfo> {
    @Select("select id as DeviceId from tb_deviceinfo where devicenumber = #{deviceNumber} and deleted=false ")
    String getDeviceId(@Param("deviceNumber") String deviceNumber);

    @Select("select 'DI'||nextval('di')")
    String getDeviceInfoId();
}
package com.example.springbootmybatisplus.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.springbootmybatisplus.entity.TbSupplierinfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface TbSupplierinfoMapper extends BaseMapper<TbSupplierinfo> {
    @Select("select * from tb_supplierinfo where name = #{name} and deleted=false limit 1")
    TbSupplierinfo getSupplierId(@Param("name") String name);

    @Select("select 'SU'||nextval('su')")
    String getSupplierinfoId();
}

3、Service:

3.1、对经销商信息进行处理的Service:

package com.example.springbootmybatisplus.service.impl;

import com.example.springbootmybatisplus.entity.TbCustStore;
import com.example.springbootmybatisplus.entity.TbCustStoreInfo;
import com.example.springbootmybatisplus.mapper.TbCustStoreInfoMapper;
import com.example.springbootmybatisplus.service.TbPropertyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Objects;
import java.util.UUID;

@Service
public class StoreInfoService {
    private static final Logger log = LoggerFactory.getLogger(TbPropertyService.class);

    @Autowired
    private TbCustStoreInfoMapper tbCustStoreInfoMapper;

    public void addCustSore(String inCustName, String inCustStoreName, Integer num) {
        try {
            if (inCustName == null && inCustStoreName == null) {
                log.info("输入的经销商或客户名称为空");
            } else {
                if (num == 1) {
                    TbCustStore existCustomerId = tbCustStoreInfoMapper.selectTbCustStoreInfo3(inCustName);
                    if (Objects.isNull(existCustomerId)) {
                        log.info("该客户在库中不存在,需要新建");
                        TbCustStoreInfo tbCustStoreInfo = insertTbCustomerInfo(inCustName, 1);
                        tbCustStoreInfoMapper.insert(tbCustStoreInfo);
                    } else {
                        log.info("该客户:{}在库中已存在", inCustName);
                    }
                }
                if (num == 2) {
                    TbCustStore existCustStoreId = tbCustStoreInfoMapper.selectTbCustStoreInfo3(inCustStoreName);
                    if (Objects.isNull(existCustStoreId)) {
                        log.info("该经销商在库中不存在,需要新建");
                        TbCustStoreInfo cc = new TbCustStoreInfo();
                        TbCustStore tbCustStore = tbCustStoreInfoMapper.selectTbCustStoreInfo3(inCustName);
                        cc.setId(UUID.randomUUID().toString());
                        cc.setCustomerId((tbCustStore.getCustomerId()));
                        cc.setParentId(tbCustStore.getId());
                        cc.setCustomerdealerid(tbCustStore.getId());
                        cc.setCode(tbCustStoreInfoMapper.getCustStoreCode(tbCustStore.getId()));
                        cc.setLevelCode((short) (tbCustStore.getLevelCode() + 1));
                        cc.setName(inCustStoreName);
                        cc.setType(2);
                        cc.setInsertTime(new Date());
                        tbCustStoreInfoMapper.insert(cc);
                    } else {
                        log.info("该经销商:{}在库中已存在", inCustStoreName);
                    }
                }
            }
        } catch (Exception e) {
            log.error("异常信息:" + e.getMessage());
        }
    }

    public TbCustStoreInfo insertTbCustomerInfo(String inCustName, Integer num) {
        TbCustStoreInfo bb = new TbCustStoreInfo();
        String inId = UUID.randomUUID().toString();
        bb.setId(inId);
        bb.setCustomerId(inId);
        bb.setParentId("DL9999999997");
        bb.setCustomerdealerid(inId);
        bb.setCode(tbCustStoreInfoMapper.getCustStoreCode("DL9999999997"));
        bb.setLevelCode(Short.parseShort("2"));
        bb.setName(inCustName);
        bb.setType(2);
        bb.setInsertTime(new Date());
        return bb;
    }

}

3.2、对供应商进行处理的Service:

package com.example.springbootmybatisplus.service.impl;

import com.example.springbootmybatisplus.entity.TbSupplierinfo;
import com.example.springbootmybatisplus.mapper.TbSupplierinfoMapper;
import com.example.springbootmybatisplus.service.TbPropertyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Objects;

@Service
public class SupplierInfoService {
    private static final Logger log = LoggerFactory.getLogger(TbPropertyService.class);

    @Autowired
    private TbSupplierinfoMapper tbSupplierinfoMapper;

    public void addSupplier(String msg, String code) {
        try {
            if (msg == null) {
                log.info("输入的供应商为空");
            } else {
                TbSupplierinfo existsTbSupplierinfo = tbSupplierinfoMapper.getSupplierId(msg);
                if (Objects.isNull(existsTbSupplierinfo)) {
                    log.info("该供应商在库中不存在,需要新建");
                    TbSupplierinfo tbSupplierinfo = insertTbSupplierinfo(msg, code);
                    tbSupplierinfoMapper.insert(tbSupplierinfo);
                } else {
                    log.info("该供应商:{}在库中已存在", msg);
                }
            }

        } catch (Exception e) {
            log.error("异常信息:" + e.getMessage());
        }
    }

    public TbSupplierinfo insertTbSupplierinfo(String name, String code) {
        TbSupplierinfo tbSupplierinfo = new TbSupplierinfo();
        tbSupplierinfo.setId(tbSupplierinfoMapper.getSupplierinfoId());
        tbSupplierinfo.setName(name);
        tbSupplierinfo.setCode(code);
        tbSupplierinfo.setCreatedById("00000000-0000-0000-0000-000000000000");
        tbSupplierinfo.setCreatedAt(new Date());
        tbSupplierinfo.setDeleted(false);
        return tbSupplierinfo;
    }

}

3.3、实现功能的Service:

package com.example.springbootmybatisplus.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.springbootmybatisplus.dto.CarUserDto;
import com.example.springbootmybatisplus.dto.DistrictDto;
import com.example.springbootmybatisplus.entity.*;
import com.example.springbootmybatisplus.mapper.*;
import com.example.springbootmybatisplus.service.impl.StoreInfoService;
import com.example.springbootmybatisplus.service.impl.SupplierInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Objects;

@Service
public class TbCarUserInfoService {
    private static final Logger log = LoggerFactory.getLogger(TbPropertyService.class);

    @Autowired
    private CarUserMapper carUserMapper;

    @Autowired
    private TbCarUserInfoMapper tbCarUserInfoMapper;

    @Autowired
    private TbCarUserSecondaryInfoMapper tbCarUserSecondaryInfoMapper;

    @Autowired
    private TbDeviceInfoMapper tbDeviceInfoMapper;

    @Autowired
    private TbCustStoreInfoMapper tbCustStoreInfoMapper;

    @Autowired
    private StoreInfoService storeInfoService;

    @Autowired
    private TbDistrictMapper tbDistrictMapper;

    @Autowired
    private TbSupplierinfoMapper tbSupplierinfoMapper;

    @Autowired
    private SupplierInfoService supplierInfoService;

    public void addCarUser(String msg) {
        try {
            CarUserDto carUserDto = JSON.parseObject(msg, CarUserDto.class);
            if (Objects.isNull(carUserDto)) {
                log.info("车辆信息为空");
                return;
            }
            storeInfoService.addCustSore(carUserDto.getCustomerName(), carUserDto.getCustStoreName(), 1);
            storeInfoService.addCustSore(carUserDto.getCustomerName(), carUserDto.getCustStoreName(), 2);
            supplierInfoService.addSupplier(carUserDto.getSupplierId(), carUserDto.getSupplierCode());

            if (Objects.isNull(carUserDto.getVinNumber())) {
                log.error("输入的车架号为空,车架号为非空字段");
            } else {
                String existsCarId = tbCarUserInfoMapper.getCarId(carUserDto.getVinNumber());
                if (Objects.isNull(existsCarId)) {
                    log.info("该车架号不存在系统中,需增加此车架号:{}的信息", carUserDto.getVinNumber());
                    TbCarUserInfo tbCarUserInfo = insertTbCarUserInfo(carUserDto);
                    tbCarUserInfoMapper.insert(tbCarUserInfo);

                    TbCarUserSecondaryInfo tbCarUserSecondaryInfo = insertTbCarUserSecondaryInfo(carUserDto);
                    tbCarUserSecondaryInfoMapper.insert(tbCarUserSecondaryInfo);
                } else {
                    log.warn("输入的车架号:{}信息已在库中存在,不做任何处理!", carUserDto.getVinNumber());
                }

                String existsDeviceId = tbDeviceInfoMapper.getDeviceId(carUserDto.getDeviceNumber());
                if (Objects.isNull(existsDeviceId)) {
                    log.info("该设备号不存在系统中,需增加此设备号:{}的信息", carUserDto.getDeviceNumber());
                    TbDeviceInfo tbDeviceInfo = insertTbDeviceInfo(carUserDto);
                    tbDeviceInfoMapper.insert(tbDeviceInfo);
                } else {
                    log.warn("输入的设备号:{}信息已在库中存在,不做任何处理!", carUserDto.getDeviceNumber());
                }
            }
        } catch (Exception e) {
            log.error("异常信息:" + e.getMessage());
        }
    }

    public TbCarUserInfo insertTbCarUserInfo(CarUserDto carUserDto) {
        TbCarUserInfo tbCarUserInfo = new TbCarUserInfo();
        DistrictDto districtDto = tbDistrictMapper.selectProCodeAndCityCode(carUserDto.getProName(), carUserDto.getCityName());
        TbCustStore tbCustStore=tbCustStoreInfoMapper.selectTbCustStoreInfo3(carUserDto.getCustStoreName());
        tbCarUserInfo.setId(tbCarUserInfoMapper.getCarUserInfoId());
        tbCarUserInfo.setUserName(carUserDto.getUserName());
        tbCarUserInfo.setUserTel(carUserDto.getUserTel());
        tbCarUserInfo.setUserIdType(carUserDto.getUserIdType());
        tbCarUserInfo.setUserIdCard(carUserDto.getUserIdCard());
        tbCarUserInfo.setProName(carUserDto.getProName());
        tbCarUserInfo.setProCode(districtDto.getProCode());
        tbCarUserInfo.setCityName(carUserDto.getCityName());
        tbCarUserInfo.setCityCode(districtDto.getCityCode());
        tbCarUserInfo.setVinNumber(carUserDto.getVinNumber());
        tbCarUserInfo.setPlateNumber(carUserDto.getPlateNumber());
        tbCarUserInfo.setCarType(carUserDto.getCarType());
        tbCarUserInfo.setRentType(carUserDto.getRentType());
        tbCarUserInfo.setTotalPeriods(carUserDto.getTotalPeriods());
        tbCarUserInfo.setRiskLevel(carUserDto.getRiskLevel());
        tbCarUserInfo.setRiskControlScore(carUserDto.getRiskControlScore());
        tbCarUserInfo.setContractNo(carUserDto.getContractNo());
        tbCarUserInfo.setUserClassType(carUserDto.getUserClassType());
        tbCarUserInfo.setOverduePeriods(carUserDto.getOverduePeriods());
        tbCarUserInfo.setLoanDate(carUserDto.getLoanDate() != null ? carUserDto.getLoanDate() : new Date());
        tbCarUserInfo.setEndRentTime(carUserDto.getEndRentTime());
        tbCarUserInfo.setInputTime(carUserDto.getInputTime() != null ? carUserDto.getInputTime() : new Date());
        tbCarUserInfo.setJsonReport(carUserDto.getJsonReport());
        tbCarUserInfo.setCreatedById("00000000-0000-0000-0000-000000000000");
        tbCarUserInfo.setCustomerId(tbCustStore.getCustomerId());
        tbCarUserInfo.setCuststoreId(tbCustStore.getId());
        tbCarUserInfo.setApplyId(carUserDto.getApplyId());
        tbCarUserInfo.setCreditType(carUserDto.getCreditType());
        tbCarUserInfo.setProjectProcess(carUserDto.getProjectProcess());
        tbCarUserInfo.setJsonString(JSONObject.toJSONString(carUserDto));
        tbCarUserInfo.setCreatedAt(new Date());
        tbCarUserInfo.setDeleted(false);
        return tbCarUserInfo;
    }

    public TbCarUserSecondaryInfo insertTbCarUserSecondaryInfo(CarUserDto carUserDto) {
        TbCarUserSecondaryInfo tbCarUserSecondaryInfo = new TbCarUserSecondaryInfo();
        tbCarUserSecondaryInfo.setId(tbCarUserSecondaryInfoMapper.getCarUserSecondaryInfoId());
        tbCarUserSecondaryInfo.setCarId(tbCarUserInfoMapper.getCarId(carUserDto.getVinNumber()));
        tbCarUserSecondaryInfo.setYuqiPeriod(carUserDto.getYuqiPeriod());
        tbCarUserSecondaryInfo.setSettledStatus(carUserDto.getSettledStatus());
        tbCarUserSecondaryInfo.setStartOffline(carUserDto.getStartOffline());
        tbCarUserSecondaryInfo.setEndOffline(carUserDto.getEndOffline());
        tbCarUserSecondaryInfo.setOfflineDuration(carUserDto.getOfflineDuration());
        tbCarUserSecondaryInfo.setCarModel(carUserDto.getCarModel());
        tbCarUserSecondaryInfo.setCarSeries(carUserDto.getCarSeries());
        tbCarUserSecondaryInfo.setCarBrand(carUserDto.getCarBrand());
        tbCarUserSecondaryInfo.setEngineNumber(carUserDto.getEngineNumber());
        tbCarUserSecondaryInfo.setCooperativeUnit(carUserDto.getCooperativeUnit());
        tbCarUserSecondaryInfo.setLendTime(carUserDto.getLendTime() != null ? carUserDto.getLendTime() : new Date());
        tbCarUserSecondaryInfo.setCreatedById("00000000-0000-0000-0000-000000000000");
        tbCarUserSecondaryInfo.setCreatedAt(new Date());
        tbCarUserSecondaryInfo.setDeleted(false);
        return tbCarUserSecondaryInfo;
    }

    public TbDeviceInfo insertTbDeviceInfo(CarUserDto carUserDto) {
        TbDeviceInfo tbDeviceInfo = new TbDeviceInfo();
        tbDeviceInfo.setId(tbDeviceInfoMapper.getDeviceInfoId());
        tbDeviceInfo.setCarId(tbCarUserInfoMapper.getCarId(carUserDto.getVinNumber()));
        tbDeviceInfo.setDeviceNumber(carUserDto.getDeviceNumber());
        tbDeviceInfo.setDeviceModel(carUserDto.getDeviceModel());
        tbDeviceInfo.setSimNumber(carUserDto.getSimNumber());
        String isWireless = carUserDto.getIsWireless();
        if ("有线".equals(isWireless)) {
            tbDeviceInfo.setIsWireless(Short.parseShort("0"));
        } else if ("无线".equals(isWireless)) {
            tbDeviceInfo.setIsWireless(Short.parseShort("1"));
        } else {
            tbDeviceInfo.setIsWireless(Short.parseShort("2"));
        }
        tbDeviceInfo.setInstallPosition(carUserDto.getInstallPosition());
        tbDeviceInfo.setInstallTime(carUserDto.getInstallTime());
        tbDeviceInfo.setSupplierid(tbSupplierinfoMapper.getSupplierId(carUserDto.getSupplierId()).getId());
        tbDeviceInfo.setDisplaystatus(carUserDto.getDisplayStatus());
        tbDeviceInfo.setSimkinds(carUserDto.getSimKinds());
        DistrictDto districtDto = tbDistrictMapper.selectProCodeAndCityCode(carUserDto.getInstallProName(), carUserDto.getInstallCityName());
        if (Objects.isNull(districtDto)){
            log.warn("未找到对应的省:{}和市:{}的code",carUserDto.getInstallProName(),carUserDto.getInstallCityName());
        }else {
            tbDeviceInfo.setInstallProCode(districtDto.getProCode());
            tbDeviceInfo.setInstallCityCode(districtDto.getCityCode());
        }
        tbDeviceInfo.setInstallProName(carUserDto.getInstallProName());
        tbDeviceInfo.setInstallCityName(carUserDto.getInstallCityName());
        DistrictDto districtDto1 = tbDistrictMapper.selectProCodeAndCityCode(carUserDto.getInstallCityName(), carUserDto.getInstallDistName());
        if (Objects.isNull(districtDto1)){
            log.warn("未找到对应的市:{}和区县:{}的code",carUserDto.getInstallCityName(),carUserDto.getInstallDistName());
        }else {
            tbDeviceInfo.setInstallDistCode(districtDto1.getCityCode());
        }
        tbDeviceInfo.setInstallDistName(carUserDto.getInstallDistName());
        tbDeviceInfo.setInstallLat(carUserDto.getInstallLat());
        tbDeviceInfo.setInstallLng(carUserDto.getInstallLng());
        tbDeviceInfo.setInstallPerson(carUserDto.getInstallPerson());
        tbDeviceInfo.setSimServiceCycle(carUserDto.getSimServiceCycle());
        tbDeviceInfo.setIsDisplay(carUserDto.getDisplayStatus());
        tbDeviceInfo.setHostType(carUserDto.getHostType());
        tbDeviceInfo.setCreatedByid("00000000-0000-0000-0000-000000000000");
        tbDeviceInfo.setCreatedAt(new Date());
        tbDeviceInfo.setDeleted(false);
        return tbDeviceInfo;
    }

}

4、Controller:

package com.example.springbootmybatisplus.contronller;

import com.example.springbootmybatisplus.service.TbCarUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@Controller
public class TbCarUserInfoController {
    @Autowired
    private TbCarUserInfoService tbCarUserInfoService;

    @PostMapping("/insert1")
    public ResponseEntity<String> insert1(@RequestBody String msg) {
        try {
            tbCarUserInfoService.addCarUser(msg);
            return ResponseEntity.status(HttpStatus.CREATED).body("Success");
        } catch (Exception e) {
            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed");
        }
    }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2340465.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Flink-01学习 介绍Flink及上手小项目之词频统计

flink简介 官网 概述&#xff1a; 学习Flink具体包括四个关键概念&#xff1a;流数据的持续处理&#xff0c;事件时间&#xff0c;有状态流处理和状态快照。 Apache Flink 是一个开源的流处理框架&#xff0c;旨在处理批处理和实时数据处理&#xff0c;具有高吞吐量和低延迟的…

目标检测篇---R-CNN梳理

目标检测系列文章 第一章 R-CNN 目录 目标检测系列文章&#x1f4c4; 论文标题&#x1f9e0; 论文逻辑梳理1. 引言部分梳理 (动机与思想) &#x1f4dd; 三句话总结&#x1f50d; 方法逻辑梳理&#x1f680; 关键创新点&#x1f517; 方法流程图补充边界框回归 (BBR)1. BBR 的…

C#处理网络传输中不完整的数据流

1、背景 在读取byte数组的场景&#xff08;例如&#xff1a;读取文件、网络传输数据&#xff09;中&#xff0c;特别是网络传输的场景中&#xff0c;非常有可能接收了不完整的byte数组&#xff0c;在将byte数组转换时&#xff0c;因字符的缺失/增多&#xff0c;转为乱码。如下…

HTML 初识

段落标签 <p><!-- 段落标签 -->Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat, voluptate iure. Obcaecati explicabo sint ipsum impedit! Dolorum omnis voluptas sint unde sed, ipsa molestiae quo sapiente quos et ad reprehenderit.&l…

MATLAB 训练CNN模型 yolo v4

学生对小车控制提出了更好的要求&#xff0c;能否加入深度学习模型。 考虑到小车用matlab来做&#xff0c;yolo v5及以上版本都需要在pytorch下训练&#xff0c;还是用早期版本来演示。 1 yolov4 调用 参考 trainYOLOv4ObjectDetector (mathworks.com) name "tiny-yo…

【前端】跟着maxkb学习logicflow流程图画法

文章目录 背景1. 选定学习对象-maxkb应用逻辑编排2. 确定实现框架3. 关键逻辑&#xff1a;查看app-node.js4. 学习开始节点绘制流程数据形式 5. 给节点增加表单输入框遇到过的问题 背景 看看前端如何绘制流程图&#xff0c;界面好看点。 "logicflow/core": "1.…

【漏洞复现】CVE-2024-38856(ApacheOfbiz RCE)

【漏洞复现】CVE-2024-38856&#xff08;ApacheOfbiz RCE&#xff09; 1. 漏洞描述 Apache OFBiz 是一个开源的企业资源规划&#xff08;ERP&#xff09;系统。它提供了一套企业应用程序&#xff0c;用于集成和自动化企业的许多业务流程。 这个漏洞是由于对 CVE-2023-51467 的…

超详细VMware虚拟机扩容磁盘容量-无坑版

1.环境&#xff1a; 虚拟机&#xff1a;VMware Workstation 17 Pro-17.5.2 Linux系统&#xff1a;Ubuntu 22.04 LTS 2.硬盘容量 虚拟机当前硬盘容量180G -> 扩展至 300G 3.操作步骤 &#xff08;1&#xff09;在虚拟机关机的状态下&#xff0c;虚拟机硬盘扩容之前必…

全面理解Linux 系统日志:核心文件与查看方法

全文目录 1 Linux 系统日志分类及功能1.1 通用日志1.1.1 ‌/var/log/messages1.1.2 ‌/var/log/syslog 1.2 安全相关日志1.2.1 ‌/var/log/auth.log‌&#xff08;Debian/Ubuntu&#xff09;或 ‌/var/log/secure‌&#xff08;RHEL/CentOS&#xff09;1.2.2 /var/log/audit/au…

机器学习-08-关联规则更新

总结 本系列是机器学习课程的系列课程&#xff0c;主要介绍机器学习中关联规则和协同过滤。 参考 机器学习&#xff08;三&#xff09;&#xff1a;Apriori算法&#xff08;算法精讲&#xff09; Apriori 算法 理论 重点 【手撕算法】【Apriori】关联规则Apriori原理、代码…

Flutter与FastAPI的OSS系统实现

作者&#xff1a;孙嘉成 目录 一、对象存储 二、FastAPI与对象存储 2.1 缤纷云S4服务API对接与鉴权实现 2.2 RESTful接口设计与异步路由优化 三、Flutter界面与数据交互开发 3.1 应用的创建 3.2页面的搭建 3.3 文件的上传 关键词&#xff1a;对象存储、FastAPI、Flutte…

Kubernetes控制平面组件:API Server详解(二)

云原生学习路线导航页&#xff08;持续更新中&#xff09; kubernetes学习系列快捷链接 Kubernetes架构原则和对象设计&#xff08;一&#xff09;Kubernetes架构原则和对象设计&#xff08;二&#xff09;Kubernetes架构原则和对象设计&#xff08;三&#xff09;Kubernetes控…

MySQL-锁机制3-意向共享锁与意向排它锁、死锁

文章目录 一、意向锁二、死锁应该如何避免死锁问题&#xff1f; 总结 一、意向锁 在表获取共享锁或者排它锁时&#xff0c;需要先检查该表有没有被其它事务获取过X锁&#xff0c;通过意向锁可以避免大量的行锁扫描&#xff0c;提升表获取锁的效率。意向锁是一种表级锁&#xf…

报告系统状态的连续日期 mysql + pandas(连续值判断)

本题用到知识点&#xff1a;row_number(), union, date_sub(), to_timedelta()…… 目录 思路 pandas Mysql 思路 链接&#xff1a;报告系统状态的连续日期 思路&#xff1a; 判断连续性常用的一个方法&#xff0c;增量相同的两个列的差值是固定的。 让日期与行号 * 天数…

Tailwind 武林奇谈:bg-blue-400 失效,如何重拾蓝衣神功?

前言 江湖有云,Tailwind CSS,乃前端武林中的轻功秘籍。习得此技,排版如行云流水,配色似御风随形,收放自如,随心所欲。 某日,小侠你奋笔敲码,正欲施展“蓝衣神功”(bg-blue-400),让按钮怒气冲冠、蓝光满面,怎料一招使出,画面竟一片白茫茫大地真干净,毫无半点杀气…

开始放飞之先搞个VSCode

文章目录 开始放飞之先搞个VSCode重要提醒安装VSCode下载MinGW-w64回到VSCode中去VSCode原生调试键盘问题遗留问题参考文献 开始放飞之先搞个VSCode 突然发现自己的新台式机上面连个像样的编程环境都没有&#xff0c;全是游戏了&#xff01;&#xff01;&#xff01;&#xff…

基于SA模拟退火算法的车间调度优化matlab仿真,输出甘特图和优化收敛曲线

目录 1.程序功能描述 2.测试软件版本以及运行结果展示 3.核心程序 4.本算法原理 5.完整程序 1.程序功能描述 基于SA模拟退火算法的车间调度优化matlab仿真,输出甘特图和优化收敛曲线。输出指标包括最小平均流动时间&#xff0c;最大完工时间&#xff0c;最小间隙时间。 2…

【仿Mudou库one thread per loop式并发服务器实现】SERVER服务器模块实现

SERVER服务器模块实现 1. Buffer模块2. Socket模块3. Channel模块4. Poller模块5. EventLoop模块5.1 TimerQueue模块5.2 TimeWheel整合到EventLoop5.1 EventLoop与线程结合5.2 EventLoop线程池 6. Connection模块7. Acceptor模块8. TcpServer模块 1. Buffer模块 Buffer模块&…

uniapp h5接入地图选点组件

uniapp h5接入地图选点组件 1、申请腾讯地图key2、代码接入2.1入口页面 &#xff08;pages/map/map&#xff09;templatescript 2.2选点页面&#xff08;pages/map/mapselect/mapselect&#xff09;templatescript 该内容只针对uniapp 打包h5接入地图选点组件做详细说明&#x…

【随缘更新,免积分下载】Selenium chromedriver驱动下载(最新版135.0.7049.42)

目录 一、chromedriver概述 二、chromedriver使用方式 三、chromedriver新版本下载&#x1f525;&#x1f525;&#x1f525; 四、Selenium与Chrome参数设置&#x1f525;&#x1f525; 五、Selenium直接操控已打开的Chrome浏览器&#x1f525;&#x1f525;&#x1f525;…