当前位置: 首页 > news >正文

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

入参为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);@Autowiredprivate 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);@Autowiredprivate 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);@Autowiredprivate CarUserMapper carUserMapper;@Autowiredprivate TbCarUserInfoMapper tbCarUserInfoMapper;@Autowiredprivate TbCarUserSecondaryInfoMapper tbCarUserSecondaryInfoMapper;@Autowiredprivate TbDeviceInfoMapper tbDeviceInfoMapper;@Autowiredprivate TbCustStoreInfoMapper tbCustStoreInfoMapper;@Autowiredprivate StoreInfoService storeInfoService;@Autowiredprivate TbDistrictMapper tbDistrictMapper;@Autowiredprivate TbSupplierinfoMapper tbSupplierinfoMapper;@Autowiredprivate 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 {@Autowiredprivate 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");}}
}

相关文章:

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

入参为json&#xff0c;然后根据需要对多张表进行操作&#xff1a; 入参格式&#xff1a; {"username": "车主01","usertel": "11111111111","useridtype": "2","useridcard": null,"proname&qu…...

Jsp技术入门指南【六】jsp脚本原理及隐式对象

Jsp技术入门指南【六】jsp脚本原理及隐式对象 前言一、JSP 脚本元素1.1 声明1.2 表达式1.3 脚本标签 二、JSP 的隐式对象是什么三、隐式对象详解outrequestsessionapplicationconfigexception 前言 在之前的博客中&#xff0c;我们已经介绍了JSP的环境搭建、编译文件查找以及生…...

邮件自动回复助手(Rasa/SMTP)实现教程

在现代办公场景中&#xff0c;处理大量邮件是一项既耗时又容易出错的任务。为了提升工作效率&#xff0c;我们可以利用自然语言处理&#xff08;NLP&#xff09;和邮件传输协议&#xff08;SMTP&#xff09;技术&#xff0c;构建一个智能的邮件自动回复助手。本文将详细介绍如何…...

【vLLM 学习】Aqlm 示例

vLLM 是一款专为大语言模型推理加速而设计的框架&#xff0c;实现了 KV 缓存内存几乎零浪费&#xff0c;解决了内存管理瓶颈问题。 更多 vLLM 中文文档及教程可访问 →https://vllm.hyper.ai/ 源代码&#xff1a;vllm-project/vllm from vllm import LLM, SamplingParams fr…...

《数据结构之美--链表oj练习》

链表oj题分享 1. 移除链表元素 题目&#xff1a; 思路分析&#xff1a; 根据题目描述&#xff0c;可以看出该题是要将满足条件的链表元素删除&#xff0c;并且返回新的头结点. 首先我们想到的肯定是直接遍历该链表然后对满足条件的元素进行删除&#xff0c;但删除某个元素时…...

杂记-LeetCode中部分题思路详解与笔记-HOT100篇-其四

那今天我们就把Hot100的所有题都完结了吧&#xff0c;Hot100作为大多数人笔试题的入门之选&#xff0c;可以说是非常的经典了&#xff0c;但是俗话说得好&#xff0c;书读百遍&#xff0c;其意自现&#xff0c;我不支持反复地只刷部分算法题&#xff0c;但是我支持周期性地刷刷…...

SpringBoot私人西服系统开发与设计

概述 基于SpringBoot的私人西服系统项目&#xff0c;是一个实用的服装管理系统。该系统包含了西服选择、面料选择、预约管理等核心功能。 主要内容 1. 管理员功能模块 用户管理&#xff1a;管理注册用户信息服装款式管理&#xff1a;管理西服款式信息面料类别管理&#xff…...

2.2/Q2,Charls最新文章解读

文章题目&#xff1a;Association of uric acid to high-density lipoprotein cholesterol ratio with the presence or absence of hypertensive kidney function: results from the China Health and Retirement Longitudinal Study (CHARLS) DOI&#xff1a;10.1186/s12882-…...

云端免费训练 AI 大模型推荐(适用于个人学习)

学习 AI 大模型训练&#xff08;如LLM、扩散模型等&#xff09;&#xff0c;云端服务器是必不可少的&#xff0c;因为大模型对算力&#xff08;GPU/TPU&#xff09;和内存要求极高。以下是 适合不同学习阶段 的云端服务器推荐&#xff0c;涵盖 免费、低成本、高性能 选项&#…...

《操作系统真象还原》第九章(2)——线程

《操作系统真象还原》第九章&#xff08;2&#xff09;——线程 文章目录 《操作系统真象还原》第九章&#xff08;2&#xff09;——线程前言多线程调度简单优先级调度的基础任务调度器和任务切换注册时钟中断处理函数实现调度器schedule实现任务切换函数switch_to启用线程调度…...

Windows程序包管理器WinGet实战

概述 WinGet&#xff0c;Windows Package Manager&#xff0c;Windows软件包管理器&#xff0c;开源在GitHub&#xff0c;GitHub Releases可下载&#xff0c;官方文档。 WinGet由一个命令行工具和一组用于在Windows 10/11等版本上安装应用的服务组成&#xff0c;可帮助用户快…...

【特殊场景应对1】视觉设计:信息密度与美学的博弈——让简历在HR视网膜上蹦迪的科学指南

写在最前 作为一个中古程序猿,我有很多自己想做的事情,比如埋头苦干手搓一个低代码数据库设计平台(目前只针对写java的朋友),比如很喜欢帮身边的朋友看看简历,讲讲面试技巧,毕竟工作这么多年,也做到过高管,有很多面人经历,意见还算有用,大家基本都能拿到想要的offe…...

番外篇 | SEAM-YOLO:引入SEAM系列注意力机制,提升遮挡小目标的检测性能

前言:Hello大家好,我是小哥谈。SEAM(Squeeze-and-Excitation Attention Module)系列注意力机制是一种高效的特征增强方法,特别适合处理遮挡和小目标检测问题。该机制通过建模通道间关系来自适应地重新校准通道特征响应。在遮挡小目标检测中的应用优势包括:1)通道注意力增强…...

Top100(26-30)

二叉树的中序遍历 给定一个二叉树的根节点 root &#xff0c;返回 它的 中序 遍历 。 示例 1&#xff1a; 输入&#xff1a;root [1,null,2,3] 输出&#xff1a;[1,3,2] 示例 2&#xff1a; 输入&#xff1a;root [] 输出&#xff1a;[] 示例 3&#xff1a; 输入&#x…...

在 Vue 3 中将拆分后的数组合并回原数组

接上文Vue 3 中按照某个字段将数组分成多个数组_vue3怎么进行数组对象--分割对象-CSDN博客 方法一&#xff1a;使用 flat() 方法 // 假设这是拆分后的多维数组 const splitArrays [[{id: 1, category: A}, {id: 3, category: A}],[{id: 2, category: B}, {id: 5, category: …...

MyBatis如何配置数据库连接并实现交互?

如果你用过MyBatis&#xff0c;肯定知道它的核心功能之一就是数据库连接管理。但很多新手在第一次配置时总会遇到各种问题&#xff1a;数据源怎么配&#xff1f;连接池参数如何调优&#xff1f;XML和注解方式有什么区别&#xff1f;今天我们就来彻底搞懂MyBatis连接数据库的每一…...

PyTorch入门------卷积神经网络

前言 参考&#xff1a;神经网络 — PyTorch Tutorials 2.6.0cu124 文档 - PyTorch 深度学习库 一个典型的神经网络训练过程如下&#xff1a; 定义一个包含可学习参数&#xff08;或权重&#xff09;的神经网络 遍历输入数据集 将输入通过神经网络处理 计算损失&#xff08;即…...

Qt官方案例知识点总结(图形视图——Colliding Mice)

Colliding Mice 案例 图元可重写下面的方法&#xff0c;返回一个QPainterPath(形状)&#xff0c;该形状基于图形项自己的坐标系 返回的形状用于碰撞检测、命中测试等&#xff0c;形状越精确&#xff0c;那么碰撞检测等就越准确 不重写的话&#xff0c;默认取 boundingRect()…...

人工智能在后端开发中的革命:从架构到运维

后端开发作为应用程序的"大脑",正在经历人工智能带来的深刻变革。从智能API设计到自动化数据库优化,从异常预测到资源调度,AI技术正在重塑后端开发的各个方面。本文将全面探讨AI如何赋能现代后端系统开发,并通过实际案例展示这些技术的应用价值。 一、智能API开…...

电子电器架构 --- EOL 工厂刷写(产线)

我是穿拖鞋的汉子,魔都中坚持长期主义的汽车电子工程师。 老规矩,分享一段喜欢的文字,避免自己成为高知识低文化的工程师: 周末洗了一个澡,换了一身衣服,出了门却不知道去哪儿,不知道去找谁,漫无目的走着,大概这就是成年人最深的孤独吧! 旧人不知我近况,新人不知我过…...

AI数据分析与BI可视化结合:解锁企业决策新境界

大家好&#xff0c;今天我们来聊聊一个前沿而热门的话题——AI数据分析与BI可视化结合&#xff0c;如何携手推动企业决策迈向新高度。在数据爆炸的时代&#xff0c;企业如何高效利用这些数据&#xff0c;成为制胜的关键。AI数据分析与BI可视化的结合&#xff0c;正是解锁这一潜…...

深度学习3.2 线性回归的从零开始实现

3.2.1 生成数据集 %matplotlib inline import random import torch from d2l import torch as d2ldef synthetic_data(w, b, num_examples):# 生成特征矩阵X&#xff0c;形状为(num_examples, len(w))&#xff0c;符合标准正态分布X torch.normal(0, 1, (num_examples, len(w…...

ArcPy工具箱制作(下)

在上一篇博客中&#xff0c;我们已经初步了解了如何制作ArcPy工具箱&#xff0c;包括工具箱的基本概念、准备工作、脚本编写以及将脚本转换为工具箱的步骤。今天&#xff0c;我们将继续深入探讨ArcPy工具箱的制作&#xff0c;重点介绍一些进阶技巧和优化方法. 一、优化工具箱的…...

if/switch语句初始化功能

基础介绍 这个特性是在c17版本引入的&#xff0c;在这之前是不允许在if语句或者switch语句中使用赋值语句&#xff0c;不仅仅是if语句和switch语句&#xff0c;包括lambda表达式在c17版本也支持类在捕获表达式中支持赋值操作。言归正传&#xff0c;下面阐述这个特性的基本语法…...

cmake 语法大纲

1&#xff0c;基础语法 CMakeLists.txt 目录组织文件&#xff1b; *.cmake 脚本文件 运行: $ cmake -P xxx.cmake *.cmake 模块文件 include 命令来引用 模块文件。 自定义模块&#xff1b; cmake 预制模块&#xff1b; 单行注释 # com 括号注释 #…...

前端单元测试实战:如何开始?

实战&#xff1a;如何开始单元测试 1.安装依赖 npm install --save-dev jest2.简单的例子 首先&#xff0c;创建一个 sum.js 文件 ./sum.js function sum(a, b) {return a b; }module.exports sum;创建一个名为 sum.test.js 的文件&#xff0c;这个文件包含了实际测试内…...

《软件设计师》复习笔记(12.2)——成本管理、配置管理

目录 一、项目成本管理 1. 定义 2. 主要过程 3. 成本类型 4. 其他概念 真题示例&#xff1a; 二、软件配置管理 1. 定义 2. 主要活动 3. 配置项 4. 基线&#xff08;Baseline&#xff09; 5. 配置库类型 真题示例&#xff1a; 一、项目成本管理 1. 定义 在批准…...

edge browser for linux debian

下载地址 https://www.microsoft.com/en-us/edge/download?formMA13FJ 安装 # 下载安装包 wget https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_135.0.3179.85-1_amd64.deb?brandM102 # 安装 sudo dpkg -i microsoft…...

Python读取Excel表格数据并写成JSON格式文件(精简版)

&#x1f91f;致敬读者 &#x1f7e9;感谢阅读&#x1f7e6;笑口常开&#x1f7ea;生日快乐⬛早点睡觉 &#x1f4d8;博主相关 &#x1f7e7;博主信息&#x1f7e8;博客首页&#x1f7eb;专栏推荐&#x1f7e5;活动信息 文章目录 1. 步骤步骤 1: 安装必要的库步骤 2: 读取Ex…...

服务器的算力已经被被人占用了,我如何能“无缝衔接”?

今天遇到一个问题&#xff0c;服务器已经被别人占用了&#xff0c;我又不知道什么时候他能结束&#xff0c;因此很难去训练自己的模型&#xff0c;隔一会去看看别人是否结束又太麻烦&#xff0c;于是便可以写这个脚本文件来自动检测服务器是否空闲&#xff0c;一有空闲就可以自…...

rulego-server是一个开源程序,是一个轻量级、无依赖性的工作流自动化平台。支持 iPaaS、流式计算和 AI 能力。

一、软件介绍 文末提供程序和源码下载学习 RuleGo-Server 是一个基于 RuleGo 构建的轻量级、高性能、模块化和集成友好的自动化工作流程平台。可用于自动化编排、iPaaS&#xff08;集成平台即服务&#xff09;、API 编排、应用编排、AI 编排、数据处理、IoT 规则引擎、AI 助手…...

『前端样式分享』联系我们卡片式布局 自适应屏幕 hover动效 在wikijs中使用 (代码拿来即用)

目录 预览效果分析要点响应式网格布局卡片样式&#xff1a;阴影和过渡效果 代码优化希望 长短不一的邮箱地址在左右居中的同时,做到左侧文字对齐(wikijs可用)总结 欢迎关注 『前端布局样式』 专栏&#xff0c;持续更新中 欢迎关注 『前端布局样式』 专栏&#xff0c;持续更新中…...

航电系统之通信技术篇

航电系统&#xff08;航空电子系统&#xff09;的通信技术是现代航空器的核心技术之一&#xff0c;其核心目标是实现飞行器内部各系统之间以及飞行器与外部设备&#xff08;如地面控制中心、其他飞行器等&#xff09;之间高效、可靠的信息交互。随着航空技术的不断发展&#xf…...

4.3 熟悉字符串处理函数

作为一名C语言初学者&#xff0c;掌握字符串处理函数是编程道路上不可或缺的一步。字符串是C语言中处理文本数据的基础&#xff0c;而标准库提供了一系列强大的字符串处理函数&#xff0c;极大地方便了我们的开发工作。本文将带领大家熟悉这些常用的字符串处理函数&#xff0c;…...

二叉树理论基础

二叉树种类 满二叉树&#xff1a;每个非叶子节点都有且只有两个子节点。 和完全二叉树&#xff1a;除了最底层外&#xff0c;其他各层都是满的&#xff1b;最底层的节点都集中在左侧。 二叉搜索树&#xff1a;对于任意节点 u&#xff0c;左子树上所有节 点的值都小于 u.val…...

yarn的三个资源调度策略

### YARN 的三种资源调度策略及其工作原理与区别 #### 1. **FIFO Scheduler (先进先出调度器)** FIFO Scheduler 是一种最简单的调度方式&#xff0c;所有的应用程序都按顺序排队等待执行。其基本逻辑如下&#xff1a; - 应用程序按照提交的时间先后顺序依次进入队列。 - 当集…...

leetcode0112. 路径总和-easy

1 题目&#xff1a;路径总和 官方标定难度&#xff1a;易 给你二叉树的根节点 root 和一个表示目标和的整数 targetSum 。判断该树中是否存在 根节点到叶子节点 的路径&#xff0c;这条路径上所有节点值相加等于目标和 targetSum 。如果存在&#xff0c;返回 true &#xff1…...

铁氧体和纳米晶:车载定制电感的材料选择

最近有个做车载产品的粉丝问到&#xff1a;我们的定制电感产品既会用到铁氧体磁芯&#xff0c;也会用到纳米晶磁芯&#xff0c;那么这两种材料&#xff0c;该如何选择呢&#xff1f; 要回答这个问题&#xff0c;我们首先要对两种材料做一个基本的对比。 铁氧体材料成本低&…...

MCP认证难题破解

一、MCP 认证体系现状与核心挑战 微软认证专家(MCP)体系在 2020 年后逐步向基于角色的认证转型,例如 Azure 管理员(AZ-104)、数据分析师(DP-100)等,传统 MCP 考试已被取代。当前备考的核心难题集中在以下方面: 1. 技术栈快速迭代 云原生技术占比提升:Azure 认证中,…...

ROS机器人一般用哪些传感器?

以下是ROS机器人常用传感器的分层详解及思维导图总结,涵盖传感器分类、核心参数、ROS支持及典型应用: 一、环境感知传感器 1. 视觉传感器 类型 原理 ROS支持 数据类型 典型型号/驱动 优缺点及应用场景 单目摄像头 单镜头成像,通过透视变换获取2D图像,依赖算法推断深度 驱…...

【ubuntu】在Linux Yocto的基础上去适配Ubuntu的wifi模块

一、修改wifi的节点名 1.找到wifi模块的PID和VID ifconfig查看wifi模块网络节点的名字&#xff0c;发现是wlx44876393bb3a&#xff08;wlxmac地址&#xff09; 通过udevadm info -a /sys/class/net/wlx44876393bba路径的命令去查看wlx44876393bba的总线号&#xff0c;端口号…...

基于WebRTC技术的EasyRTC:支持任意平台设备的实时音视频通信解决方案

一、技术架构与核心优势 EasyRTC是一套基于WebRTC技术的实时音视频通信框架&#xff0c;旨在为开发者提供高效、稳定、跨平台的通信解决方案。其核心优势在于支持任意平台设备&#xff0c;包括Web端、移动端、桌面端和嵌入式设备&#xff0c;真正实现“一次开发&#xff0c;多…...

51单片机实验四:键盘检测原理及应用实现

目录 一、实验环境与实验器材 二、实验内容及实验步骤 1.独立键盘检测 2.独立键盘(简易版本&#xff09; 3&#xff0e;矩阵键盘检测 4.矩阵键盘&#xff08;简单版&#xff0c;单数码管&#xff09;&#xff1a; 一、实验环境与实验器材 环境&#xff1a;Keli&#xff0c…...

GN ninja 工程化构建例程

文章目录 1. 前言✨2. 工程实例🚩2.1 工程目录结构2.2 工程顶层.gn文件2.3 工具链配置.gn文件2.4 编译配置.gn文件2.5 编译目标配置.gn文件2.6 工程接口文件2.7 动态库编译.gn文件2.8 动态库源文件2.9 静态库编译.gn文件2.10 静态库源文件2.11 主程序编译.gn文件2.12 主程序源…...

STC定时器频率占空比程序

// // 一、宏定义区 // #include <STC15.H> //头文件 #include <intrins.h> //库函数文件 #define FOSC 12000000L //IRC频率 typedef …...

观察者 ➜ 事件总线:一路走来的碎碎念

写给未来的自己:每次手敲事件模型都要 Google,干脆把思路和踩坑一次性记清楚。文章很长,都是唠叨,目的是让自己看两眼就能把设计理由找回来。 目录 为什么我要折腾事件模型?V0 ─ 单一事件的观察者模式V1 ─ 多事件同步总线(类型拆分)V2 ─ 订阅者优先级(链式调用可控)…...

AOP基本概念

上述语句解释感觉太过玄妙不似常人能够听懂&#xff0c;所以结合自己理解&#xff0c;给自己留点备注&#xff1a; 首先 目标对象&#xff1a; 就是这要对哪个对象进行代理&#xff0c;因为AOP是面向切面编程&#xff0c;在OOP的基础上再次解耦合&#xff0c;这个过程需要提…...

不确定与非单调推理的概率方法

前文我们学习了“不确定与非单调推理的基本概念”,了解了不确定性推理是人工智能领域中处理不完整、不精确或模糊信息的推理方法,其核心是在前提条件或推理规则存在不确定性时,通过某种数学或逻辑机制推导出合理结论,并对结论的可靠性进行量化。不确定与非单调推理的基本概…...

device_fingerprint、device_id、hmac生成

文章目录 1. 写在前面2. 设备信息3. 数美指纹 【&#x1f3e0;作者主页】&#xff1a;吴秋霖 【&#x1f4bc;作者介绍】&#xff1a;擅长爬虫与JS加密逆向分析&#xff01;Python领域优质创作者、CSDN博客专家、阿里云博客专家、华为云享专家。一路走来长期坚守并致力于Python…...

centos下openjdk报:getVersion(FontConfiguration.java)异常,安装fontconfig无效问题的处理

TOC centos下openjdk报:getVersion(FontConfiguration.java)异常,安装fontconfig无效问题的处理 官网jdk包&#xff1a;Releases dragonwell-project/dragonwell8 背景&#xff1a; 为了适应国产化&#xff0c;使用东方通和国产jdk&#xff0c;从tomcat改为tongweb&#x…...