新增题目接口开发
文章目录
- 1.基本设计
- 2.生成CRUD代码
- 1.生成五张表的代码
- 1.subject_info
- 2.subject_brief
- 3.subject_judge
- 4.subject_multiple
- 5.subject_radio
- 2.将所有的dao放到mapper文件夹
- 3.将所有实体类使用lombok简化
- 4.删除所有mapper的@Param("pageable") Pageable pageable
- 5.删除所有service的分页查询接口
- 3.具体实现
- 1.sun-club-application-controller
- 1.dto
- 1.SubjectInfoDTO.java
- 2.SubjectAnswerDTO.java
- 2.convert
- 1.SubjectAnswerDTOConverter.java
- 2.SubjectInfoDTOConverter.java
- 2.sun-club-domain
- 1.entity
- 1.SubjectAnswerBO.java
- 2.SubjectInfoBO.java
- 2.convert
- 1.SubjectInfoConverter.java
- 3.service
- 1.SubjectInfoDomainService.java
- 3.sun-club-common
- 1.enums
- 1.SubjectInfoTypeEnum.java 题目类型枚举
- 4.sun-club-domain
- 1.subject包构建一个题目类型工厂
- 1.SubjectTypeHandler.java
- 2.BriefTypeHandler.java
- 3.JudgeTypeHandler.java
- 4.MultipleTypeHandler.java
- 5.RadioTypeHandler.java
- 6.SubjectTypeHandlerFactory.java
- 2.service包来注入工厂,调用插入方法
- 1.SubjectInfoDomainService.java
- 2.SubjectInfoDomainServiceImpl.java
- 3.单选题的插入
- 1.RadioTypeHandler.java
- 5.sun-club-infra
- 1.SubjectMappingDao.xml的批量插入如果逻辑删除字段为空就设置成0
- 2.SubjectRadioDao.xml 如果逻辑删除字段为空就设置成0
- 6.sun-club-application-controller
- SubjectController.java
- 7.接口测试
1.基本设计

2.生成CRUD代码
1.生成五张表的代码
1.subject_info

2.subject_brief

3.subject_judge

4.subject_multiple

5.subject_radio

2.将所有的dao放到mapper文件夹

3.将所有实体类使用lombok简化
4.删除所有mapper的@Param(“pageable”) Pageable pageable
5.删除所有service的分页查询接口
3.具体实现
1.sun-club-application-controller
1.dto
1.SubjectInfoDTO.java
package com.sunxiansheng.subject.application.dto;import lombok.Data;import java.io.Serializable;
import java.util.List;/*** 题目信息表(SubjectInfo)实体类** @author makejava* @since 2024-05-26 17:26:43*/
@Data
public class SubjectInfoDTO implements Serializable {private static final long serialVersionUID = -99877276843752542L;/*** 题目名称*/private String subjectName;/*** 题目难度*/private Integer subjectDifficult;/*** 题目类型 1单选 2多选 3判断 4简答*/private Integer subjectType;/*** 题目分数*/private Integer subjectScore;/*** 题目解析*/private String subjectParse;/*** 题目答案*/private String subjectAnswer;/*** 分类id*/private List<Integer> categoryIds;/*** 标签id*/private List<Integer> labelIds;/*** 答案选项*/private List<SubjectAnswerDTO> optionList;
}
2.SubjectAnswerDTO.java
package com.sunxiansheng.subject.application.dto;import lombok.Data;import java.io.Serializable;/*** Description: 题目答案dto* @Author sun* @Create 2024/5/27 13:39* @Version 1.0*/
@Data
public class SubjectAnswerDTO implements Serializable {/*** 答案选项标识*/private Integer optionType;/*** 答案*/private String optionContent;/*** 是否正确*/private Integer isCorrect;}
2.convert
1.SubjectAnswerDTOConverter.java
package com.sunxiansheng.subject.application.convert;import com.sunxiansheng.subject.application.dto.SubjectAnswerDTO;
import com.sunxiansheng.subject.domain.entity.SubjectAnswerBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;import java.util.List;/*** Description: DTO与BO转换* @Author sun* @Create 2024/5/24 9:40* @Version 1.0*/
@Mapper
public interface SubjectAnswerDTOConverter {SubjectAnswerDTOConverter INSTANCE= Mappers.getMapper(SubjectAnswerDTOConverter.class);// 将SubjectAnswerDTO转换为SubjectAnswerBOSubjectAnswerBO convertDTO2BO(SubjectAnswerDTO subjectAnswerDTO);// 将SubjectAnswerBO转换为SubjectAnswerDTOSubjectAnswerDTO convertBO2DTO(SubjectAnswerBO subjectAnswerBO);// 将SubjectAnswerDTO集合转换为SubjectAnswerBO集合List<SubjectAnswerBO> convertDTO2BO(List<SubjectAnswerDTO> subjectAnswerDTOList);// 将SubjectAnswerBO集合转换为SubjectAnswerDTO集合List<SubjectAnswerDTO> convertBO2DTO(List<SubjectAnswerBO> subjectAnswerBOList);
}
2.SubjectInfoDTOConverter.java
package com.sunxiansheng.subject.application.convert;import com.sunxiansheng.subject.application.dto.SubjectInfoDTO;
import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;import java.util.List;/*** Description: DTO与BO转换* @Author sun* @Create 2024/5/24 9:40* @Version 1.0*/
@Mapper
public interface SubjectInfoDTOConverter {SubjectInfoDTOConverter INSTANCE= Mappers.getMapper(SubjectInfoDTOConverter.class);// 将SubjectInfoDTO转换为SubjectInfoBOSubjectInfoBO convertDTO2BO(SubjectInfoDTO subjectInfoDTO);// 将SubjectInfoBO转换为SubjectInfoDTOSubjectInfoDTO convertBO2DTO(SubjectInfoBO subjectInfoBO);// 将SubjectInfoDTO集合转换为SubjectInfoBO集合List<SubjectInfoBO> convertDTO2BO(List<SubjectInfoDTO> subjectInfoDTOList);// 将SubjectInfoBO集合转换为SubjectInfoDTO集合List<SubjectInfoDTO> convertBO2DTO(List<SubjectInfoBO> subjectInfoBOList);
}
2.sun-club-domain
1.entity
1.SubjectAnswerBO.java
package com.sunxiansheng.subject.domain.entity;import lombok.Data;import java.io.Serializable;/*** Description: 题目答案dto* @Author sun* @Create 2024/5/27 13:39* @Version 1.0*/
@Data
public class SubjectAnswerBO implements Serializable {/*** 答案选项标识*/private Integer optionType;/*** 答案*/private String optionContent;/*** 是否正确*/private Integer isCorrect;}
2.SubjectInfoBO.java
package com.sunxiansheng.subject.domain.entity;import lombok.Data;import java.io.Serializable;
import java.util.List;/*** 题目信息表(SubjectInfo)实体类** @author makejava* @since 2024-05-26 17:26:43*/
@Data
public class SubjectInfoBO implements Serializable {private static final long serialVersionUID = -99877276843752542L;/*** 题目名称*/private String subjectName;/*** 题目难度*/private Integer subjectDifficult;/*** 题目类型 1单选 2多选 3判断 4简答*/private Integer subjectType;/*** 题目分数*/private Integer subjectScore;/*** 题目解析*/private String subjectParse;/*** 题目答案*/private String subjectAnswer;/*** 分类id*/private List<Integer> categoryIds;/*** 标签id*/private List<Integer> labelIds;/*** 答案选项*/private List<SubjectAnswerBO> optionList;
}
2.convert
1.SubjectInfoConverter.java
package com.sunxiansheng.subject.domain.convert;import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;
import com.sunxiansheng.subject.infra.basic.entity.SubjectInfo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;import java.util.List;/*** Description: 题目标签转换器* @Author sun* @Create 2024/5/24 9:18* @Version 1.0*/
@Mapper // mapstruct的注解
public interface SubjectInfoConverter {SubjectInfoConverter INSTANCE = Mappers.getMapper(SubjectInfoConverter.class);// 将BO转换为entitySubjectInfo convertBoToSubjectInfo(SubjectInfoBO subjectInfoBO);// 将entity转换为BOSubjectInfoBO convertSubjectInfoToBo(SubjectInfo subjectInfo);// 将List<entity>转换为List<BO>List<SubjectInfoBO> convertSubjectInfoToBo(List<SubjectInfo> subjectInfoList);// 将List<BO>转换为List<entity>List<SubjectInfo> convertBoToSubjectInfo(List<SubjectInfoBO> subjectInfoBOList);
}
3.service
1.SubjectInfoDomainService.java
package com.sunxiansheng.subject.domain.service;import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;/*** Description:* @Author sun* @Create 2024/5/24 9:03* @Version 1.0*/
public interface SubjectInfoDomainService {/*** 新增题目* @param subjectInfoBO*/Boolean add(SubjectInfoBO subjectInfoBO);}
3.sun-club-common
1.enums
1.SubjectInfoTypeEnum.java 题目类型枚举
package com.sunxiansheng.subject.common.enums;import lombok.Getter;/*** Description: 题目类型枚举* @Author sun* @Create 2024/5/24 9:53* @Version 1.0*/
@Getter
public enum SubjectInfoTypeEnum {RADIO(1,"单选"),MULTIPLE(2,"多选"),JUDGE(3,"判断"),BRIEF(4,"简答");public int code;public String desc;SubjectInfoTypeEnum(int code, String desc) {this.code = code;this.desc = desc;}/*** 根据code获取枚举* @param code* @return*/public static SubjectInfoTypeEnum getByCode(int code) {for (SubjectInfoTypeEnum value : values()) {if (value.code == code) {return value;}}return null;}
}
4.sun-club-domain
1.subject包构建一个题目类型工厂
1.SubjectTypeHandler.java
package com.sunxiansheng.subject.domain.handler.subject;import com.sunxiansheng.subject.common.enums.SubjectInfoTypeEnum;
import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;/*** Description:* @Author sun* @Create 2024/5/27 21:12* @Version 1.0*/
public interface SubjectTypeHandler {/*** 枚举身份的识别* @return*/SubjectInfoTypeEnum getHandlerType();/*** 实际题目的插入* @param subjectInfoBO*/void add(SubjectInfoBO subjectInfoBO);
}
2.BriefTypeHandler.java
package com.sunxiansheng.subject.domain.handler.subject;import com.sunxiansheng.subject.common.enums.SubjectInfoTypeEnum;
import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;
import org.springframework.stereotype.Component;/*** Description:* @Author sun* @Create 2024/5/27 21:16* @Version 1.0*/
@Component
public class BriefTypeHandler implements SubjectTypeHandler{@Overridepublic SubjectInfoTypeEnum getHandlerType() {return SubjectInfoTypeEnum.BRIEF;}@Overridepublic void add(SubjectInfoBO subjectInfoBO) {}
}
3.JudgeTypeHandler.java
package com.sunxiansheng.subject.domain.handler.subject;import com.sunxiansheng.subject.common.enums.SubjectInfoTypeEnum;
import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;
import org.springframework.stereotype.Component;/*** Description:* @Author sun* @Create 2024/5/27 21:16* @Version 1.0*/
@Component
public class JudgeTypeHandler implements SubjectTypeHandler{@Overridepublic SubjectInfoTypeEnum getHandlerType() {return SubjectInfoTypeEnum.JUDGE;}@Overridepublic void add(SubjectInfoBO subjectInfoBO) {}
}
4.MultipleTypeHandler.java
package com.sunxiansheng.subject.domain.handler.subject;import com.sunxiansheng.subject.common.enums.SubjectInfoTypeEnum;
import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;
import org.springframework.stereotype.Component;/*** Description:* @Author sun* @Create 2024/5/27 21:16* @Version 1.0*/
@Component
public class MultipleTypeHandler implements SubjectTypeHandler{@Overridepublic SubjectInfoTypeEnum getHandlerType() {return SubjectInfoTypeEnum.MULTIPLE;}@Overridepublic void add(SubjectInfoBO subjectInfoBO) {}
}
5.RadioTypeHandler.java
package com.sunxiansheng.subject.domain.handler.subject;import com.sunxiansheng.subject.common.enums.SubjectInfoTypeEnum;
import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;
import org.springframework.stereotype.Component;/*** Description:* @Author sun* @Create 2024/5/27 21:16* @Version 1.0*/
@Component
public class RadioTypeHandler implements SubjectTypeHandler{@Overridepublic SubjectInfoTypeEnum getHandlerType() {return SubjectInfoTypeEnum.RADIO;}@Overridepublic void add(SubjectInfoBO subjectInfoBO) {// 单选题目的插入}
}
6.SubjectTypeHandlerFactory.java
package com.sunxiansheng.subject.domain.handler.subject;import com.sunxiansheng.subject.common.enums.SubjectInfoTypeEnum;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** Description: 题目类型工厂* @Author sun* @Create 2024/5/27 21:25* @Version 1.0*/
@Component
public class SubjectTypeHandlerFactory implements InitializingBean {// 将所有的题目类型对象注入到List中@Resourceprivate List<SubjectTypeHandler> subjectTypeHandlerList;// 这个map是存储题目类型枚举和具体的题目类型对象的,方便取出private Map<SubjectInfoTypeEnum, SubjectTypeHandler> handlerMap = new HashMap<>();/*** 简单工厂核心方法:根据输入的类型,返回对应类型的对象* @param subjectType* @return*/public SubjectTypeHandler getHandler(int subjectType) {// 首先根据这个枚举码来获取对应的枚举对象SubjectInfoTypeEnum subjectInfoTypeEnum = SubjectInfoTypeEnum.getByCode(subjectType);// 然后通过map,根据不同类型的枚举码,返回对应类型的题目类型对象return handlerMap.get(subjectInfoTypeEnum);}/*** 这个方法bean装载完毕之后就会执行,可以进行初始化操作* @throws Exception*/@Overridepublic void afterPropertiesSet() throws Exception {// 初始化存储题目类型的mapsubjectTypeHandlerList.forEach(subjectTypeHandler -> {handlerMap.put(subjectTypeHandler.getHandlerType(), subjectTypeHandler);});}
}
2.service包来注入工厂,调用插入方法
1.SubjectInfoDomainService.java
package com.sunxiansheng.subject.domain.service;import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;/*** Description:* @Author sun* @Create 2024/5/24 9:03* @Version 1.0*/
public interface SubjectInfoDomainService {/*** 新增题目* @param subjectInfoBO*/void add(SubjectInfoBO subjectInfoBO);}
2.SubjectInfoDomainServiceImpl.java
package com.sunxiansheng.subject.domain.service.impl;import com.google.common.collect.Lists;
import com.sunxiansheng.subject.domain.convert.SubjectInfoConverter;
import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;
import com.sunxiansheng.subject.domain.handler.subject.SubjectTypeHandler;
import com.sunxiansheng.subject.domain.handler.subject.SubjectTypeHandlerFactory;
import com.sunxiansheng.subject.domain.service.SubjectInfoDomainService;
import com.sunxiansheng.subject.infra.basic.entity.SubjectInfo;
import com.sunxiansheng.subject.infra.basic.entity.SubjectMapping;
import com.sunxiansheng.subject.infra.basic.service.SubjectInfoService;
import com.sunxiansheng.subject.infra.basic.service.SubjectMappingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;/*** Description:* @Author sun* @Create 2024/5/24 9:03* @Version 1.0*/
@Service
@Slf4j
public class SubjectInfoDomainServiceImpl implements SubjectInfoDomainService {@Resourceprivate SubjectInfoService subjectInfoService;@Resourceprivate SubjectMappingService subjectMappingService;@Resourceprivate SubjectTypeHandlerFactory subjectTypeHandlerFactory;@Overridepublic void add(SubjectInfoBO subjectInfoBO) {// 打印日志if (log.isInfoEnabled()) {log.info("SubjectInfoDomainServiceImpl add SubjectInfoBO, SubjectInfoBO:{}", subjectInfoBO);}// 将BO转换为entitySubjectInfo subjectInfo = SubjectInfoConverter.INSTANCE.convertBoToSubjectInfo(subjectInfoBO);// 向SubjectInfo表中插入数据subjectInfoService.insert(subjectInfo);// 从工厂中获取对应的题目对象,并执行对应的插入逻辑SubjectTypeHandler handler = subjectTypeHandlerFactory.getHandler(subjectInfo.getSubjectType());handler.add(subjectInfoBO);// 处理映射表// 首先获取分类idList<Long> categoryIds = subjectInfoBO.getCategoryIds();// 然后获取标签idList<Long> labelIds = subjectInfoBO.getLabelIds();// 这个映射表是多对多的关系,假如有两个分类id和两个标签id则会有四条映射记录// 构建一个list,用于存储映射表的实体类List<SubjectMapping> subjectMappings = new ArrayList<>();labelIds.forEach(laberId -> {categoryIds.forEach(categoryId -> {SubjectMapping subjectMapping = new SubjectMapping();subjectMapping.setSubjectId(subjectInfoBO.getId());subjectMapping.setLabelId(laberId);subjectMapping.setCategoryId(categoryId);subjectMappings.add(subjectMapping);});});// 批量插入映射表subjectMappingService.insertBatch(subjectMappings);}
}
3.单选题的插入
1.RadioTypeHandler.java
package com.sunxiansheng.subject.domain.handler.subject;import com.sunxiansheng.subject.common.enums.SubjectInfoTypeEnum;
import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;
import com.sunxiansheng.subject.infra.basic.entity.SubjectRadio;
import com.sunxiansheng.subject.infra.basic.service.SubjectRadioService;
import org.springframework.stereotype.Component;import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;/*** Description:* @Author sun* @Create 2024/5/27 21:16* @Version 1.0*/
@Component
public class RadioTypeHandler implements SubjectTypeHandler {@Resourceprivate SubjectRadioService subjectRadioService;@Overridepublic SubjectInfoTypeEnum getHandlerType() {return SubjectInfoTypeEnum.RADIO;}@Overridepublic void add(SubjectInfoBO subjectInfoBO) {// 一个单选题目是有多个选项,所以需要一个listList<SubjectRadio> subjectRadioList = new ArrayList<>();// 将bo中的选项列表转换为list<SubjectRadio>subjectInfoBO.getOptionList().forEach(subjectAnswerBO -> {SubjectRadio subjectRadio = new SubjectRadio();// 设置基本信息subjectRadio.setOptionType(subjectAnswerBO.getOptionType());subjectRadio.setOptionContent(subjectAnswerBO.getOptionContent());subjectRadio.setIsCorrect(subjectAnswerBO.getIsCorrect());// 设置题目idsubjectRadio.setSubjectId(subjectInfoBO.getId());subjectRadioList.add(subjectRadio);});// 批量插入subjectRadioService.batchInsert(subjectRadioList);}
}
5.sun-club-infra
1.SubjectMappingDao.xml的批量插入如果逻辑删除字段为空就设置成0
2.SubjectRadioDao.xml 如果逻辑删除字段为空就设置成0

6.sun-club-application-controller
SubjectController.java
package com.sunxiansheng.subject.application.controller;import com.alibaba.fastjson.JSON;
import com.google.common.base.Preconditions;
import com.sunxiansheng.subject.application.convert.SubjectAnswerDTOConverter;
import com.sunxiansheng.subject.application.convert.SubjectInfoDTOConverter;
import com.sunxiansheng.subject.application.dto.SubjectInfoDTO;
import com.sunxiansheng.subject.common.eneity.Result;
import com.sunxiansheng.subject.domain.convert.SubjectInfoConverter;
import com.sunxiansheng.subject.domain.entity.SubjectAnswerBO;
import com.sunxiansheng.subject.domain.entity.SubjectInfoBO;
import com.sunxiansheng.subject.domain.service.SubjectInfoDomainService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;
import java.util.List;/*** Description: 刷题微服务控制器* @Author sun* @Create 2024/5/23 16:42* @Version 1.0*/
@RestController
@Slf4j
public class SubjectController {@Resourceprivate SubjectInfoDomainService subjectInfoDomainService;private final SubjectAnswerDTOConverter subjectAnswerDTOConverter;public SubjectController(SubjectAnswerDTOConverter subjectAnswerDTOConverter) {this.subjectAnswerDTOConverter = subjectAnswerDTOConverter;}/*** 新增题目* @param subjectInfoDTO* @return*/@PostMapping("/add")public Result<Boolean> add(@RequestBody SubjectInfoDTO subjectInfoDTO) {try {// 打印日志if (log.isInfoEnabled()) {log.info("SubjectController add SubjectInfoDTO, subjectInfoDTO:{}", JSON.toJSONString(subjectInfoDTO));}// 参数校验Preconditions.checkArgument(!StringUtils.isBlank(subjectInfoDTO.getSubjectName()), "题目名称不能为空");Preconditions.checkNotNull(subjectInfoDTO.getSubjectDifficult(), "题目难度不能为空");Preconditions.checkNotNull(subjectInfoDTO.getSubjectType(), "题目类型不能为空");Preconditions.checkNotNull(subjectInfoDTO.getSubjectScore(), "题目分数不能为空");Preconditions.checkArgument(!CollectionUtils.isEmpty(subjectInfoDTO.getCategoryIds()), "题目所属分类不能为空");Preconditions.checkArgument(!CollectionUtils.isEmpty(subjectInfoDTO.getLabelIds()), "题目所属标签不能为空");// 转换DTO为BOSubjectInfoBO subjectInfoBO = SubjectInfoDTOConverter.INSTANCE.convertDTO2BO(subjectInfoDTO);List<SubjectAnswerBO> subjectAnswerBOS = subjectAnswerDTOConverter.convertDTO2BO(subjectInfoDTO.getOptionList());subjectInfoBO.setOptionList(subjectAnswerBOS);// 新增题目subjectInfoDomainService.add(subjectInfoBO);return Result.ok(true);} catch (Exception e) {log.error("SubjectController add error, subjectInfoDTO:{}", JSON.toJSONString(subjectInfoDTO), e);return Result.fail("新增题目失败");}}
}
7.接口测试





相关文章:
新增题目接口开发
文章目录 1.基本设计2.生成CRUD代码1.生成五张表的代码1.subject_info2.subject_brief3.subject_judge4.subject_multiple5.subject_radio 2.将所有的dao放到mapper文件夹3.将所有实体类使用lombok简化4.删除所有mapper的Param("pageable") Pageable pageable5.删除所…...
国内怎样使用GPT4 turbo
GPT是当前最为熟知的大模型,它优越的性能一直遥遥领先于其它一众厂商,然而如此优秀的AI在中国境内却是无法正常使用的。本文将告诉你4种使用gpt4的方法,让你突破限制顺利使用。 官方售价是20美元/月,40次提问/3小时,需…...
【语义分割】1-标注数据集-【单张图片】labelme标注json文件转mask
声明:我学习了b站:标注自己的语义分割数据集_哔哩哔哩_bilibili 并且复现了,记录了所思所得。 主要是说了: 做语义分割,数据集怎么用labelme标注成json文件,以及,json文件怎么转成mask 流程…...
c++: 理解编译器在背后所做的工作-工具篇
理解C模板以及编译器的优化是深入掌握C编程的重要部分。有一些其他工具和技术可以帮助你更好地理解编译器在背后所做的工作,特别是优化方面。以下是一些有用的工具和技术: 1. Compiler Explorer (Godbolt) Compiler Explorer 是一个非常流行的在线工具…...
Verilog HDL语法入门系列(三):Verilog的语言操作符规则(上)
目录 1.操作符优先级2.Verilog中的大小(size)与符号3.算术操作符4.按位操作符5.逻辑操作符6.逻辑反与位反的对比 微信公众号获取更多FPGA相关源码: 1.操作符优先级 下表以优先级顺序列出了Verilog操作符。 2.Verilog中的大小(size)与符号 Verilog根据表达式中变…...
IT营大地老师是谁,怎么什么都会?
很多学员都很好奇大地老师到底是谁,怎么什么都会?每过一段时间就会出一门新课程,涉足深耕不同的领域。经反馈常有童鞋私聊IT营官网客服咨询这个问题,也有很多人在b站大地老师的免费课程里私信,有好奇也有崇拜ÿ…...
【python013】pyinstaller打包PDF提取脚本为exe工具
1.在日常工作和学习中,遇到类似问题处理场景,如pdf文件核心内容截取,这里将文件打包成exe可执行文件,实现功能简便使用。 2.欢迎点赞、关注、批评、指正,互三走起来,小手动起来! 3.欢迎点赞、关…...
VUE div的右上角的角标/标签
一、效果图 二、代码 <div class"comp-overview"><div class"overview-item" v-for"(item,index) in overviewInfoList" :key"index"><div class"angle_mark"><span>{{item.label}}</span>&…...
WPS复制后转置粘贴
1. WPS复制后转置粘贴 复制-》右键-》顶部第一行-》粘贴行列转置,如下图: 2. Excel office365 本地版 2. Excel office365 在线版...
Shell编程之正则表达式与文本处理器
一,正则表达式 1:正则表达式概述 1.正则表达式的定义 正则表达式(Regular Expression,RegEx)是一种高度灵活的文本处理工具,它结合了字符序列、特殊控制字符(称为元字符)、以及特定…...
linux文本粘贴格式错乱的问题
vi/vim :set paste然后再 insert, 粘贴...
第二节课 6月13日 ssh密钥登陆方式
centos和ubuntu openssh服务的初始安装 一、实验:ubuntu系统激活root用户 ubuntu系统如何激活root用户,允许root用户ssh登陆? 1、ubuntu默认root用户未设置密码,未激活 激活root用户,设置root密码 sudo passwd roo…...
图书馆借阅表
DDL 用户表 (Users) 图书表 (Books) 图书类别表 (BookCategories) 图书与类别关联表 (BookCategoryRelations) 借阅记录表 (BorrowRecords) 供应商表 (Suppliers) 采购记录表 (PurchaseRecords) CREATE TABLE Users (user_id INT PRIMARY KEY AUTO_INCREMENT,username …...
云动态摘要 2024-06-25
给您带来云厂商的最新动态,最新产品资讯和最新优惠更新。 最新产品更新 Web应用防火墙 - 验证码支持微信小程序接入 阿里云 2024-06-25 支持客户从微信小程序场景下接入,提供人机识别的安全防护。 工业数字模型驱动引擎 - iDME控制台换新升级 华为云…...
Docker编译nanopc-t4源码流程介绍
官方文档 Android系统编译 vnc加环境变量配置 https://github.com/friendlyarm/docker-cross-compiler-novnc 下载 git clone https://github.com/friendlyarm/docker-ubuntu-lxde-novnc cd docker-ubuntu-lxde-novnc docker build --no-cache -t docker-ubuntu-lxde-novnc …...
Redis八股文目录
Redis缓存穿透-CSDN博客 Redis缓存击穿-CSDN博客 Redis缓存雪崩(主从复制、哨兵模式(脑裂)、分片集群)-CSDN博客 Redis双写一致性-CSDN博客 Redis持久化-CSDN博客 Redis数据过期、淘汰策略-CSDN博客 分布式锁(Re…...
Ext JS+Spring Boot 使用Ajax方式上传文件
实现方式 使用 Ext JS 进行 AJAX 调用以传递文件通常涉及到创建一个 FormData 对象,将文件附加到这个对象中,然后通过 Ext JS 的 AJAX API 发送这个对象。 基本步骤 以下是使用 Ext JS 发送文件的基本步骤: 准备文件和数据: 首先需要获取到要传递的文件 创建 FormData 对…...
windows桌面运维----第九天
1、新的电脑需要安装哪些驱动: 显卡驱动、声卡驱动、主板驱动、网卡驱动、打印机驱动、外设驱动、 2、网络打印机如何开启打印机共享核客户端连接共享打印机: 一、打开控制面板并定位到设备和打印机: 首先,我们在电脑桌面上找…...
【Docker】安装和加速
目录 1.安装 2.了解 docker 信息 3.查询状态 4. 重新启动Docker 1.安装 yum install –y docker 2.了解 docker 信息 cat /etc/redhat-release 3.查询状态 systemctl status docker 4.支持 1.12 的 docker 镜像加速 sudo mkdir -p /etc/docker sudo tee /etc/docke…...
如何关闭win10音量调节时 左上角出现的黑框
目录 1.谷歌浏览器: 2.edge浏览器: 3.没得办法的办法: 4.官方回复: 1.谷歌浏览器: 把这行地址chrome://flags/#hardware-media-key-handling 输入到chrome的地址栏里,回车,把黄色里的Hardwa…...
k8s从入门到放弃之Ingress七层负载
k8s从入门到放弃之Ingress七层负载 在Kubernetes(简称K8s)中,Ingress是一个API对象,它允许你定义如何从集群外部访问集群内部的服务。Ingress可以提供负载均衡、SSL终结和基于名称的虚拟主机等功能。通过Ingress,你可…...
关于nvm与node.js
1 安装nvm 安装过程中手动修改 nvm的安装路径, 以及修改 通过nvm安装node后正在使用的node的存放目录【这句话可能难以理解,但接着往下看你就了然了】 2 修改nvm中settings.txt文件配置 nvm安装成功后,通常在该文件中会出现以下配置&…...
【ROS】Nav2源码之nav2_behavior_tree-行为树节点列表
1、行为树节点分类 在 Nav2(Navigation2)的行为树框架中,行为树节点插件按照功能分为 Action(动作节点)、Condition(条件节点)、Control(控制节点) 和 Decorator(装饰节点) 四类。 1.1 动作节点 Action 执行具体的机器人操作或任务,直接与硬件、传感器或外部系统…...
相机从app启动流程
一、流程框架图 二、具体流程分析 1、得到cameralist和对应的静态信息 目录如下: 重点代码分析: 启动相机前,先要通过getCameraIdList获取camera的个数以及id,然后可以通过getCameraCharacteristics获取对应id camera的capabilities(静态信息)进行一些openCamera前的…...
大模型多显卡多服务器并行计算方法与实践指南
一、分布式训练概述 大规模语言模型的训练通常需要分布式计算技术,以解决单机资源不足的问题。分布式训练主要分为两种模式: 数据并行:将数据分片到不同设备,每个设备拥有完整的模型副本 模型并行:将模型分割到不同设备,每个设备处理部分模型计算 现代大模型训练通常结合…...
[Java恶补day16] 238.除自身以外数组的乘积
给你一个整数数组 nums,返回 数组 answer ,其中 answer[i] 等于 nums 中除 nums[i] 之外其余各元素的乘积 。 题目数据 保证 数组 nums之中任意元素的全部前缀元素和后缀的乘积都在 32 位 整数范围内。 请 不要使用除法,且在 O(n) 时间复杂度…...
#Uniapp篇:chrome调试unapp适配
chrome调试设备----使用Android模拟机开发调试移动端页面 Chrome://inspect/#devices MuMu模拟器Edge浏览器:Android原生APP嵌入的H5页面元素定位 chrome://inspect/#devices uniapp单位适配 根路径下 postcss.config.js 需要装这些插件 “postcss”: “^8.5.…...
【7色560页】职场可视化逻辑图高级数据分析PPT模版
7种色调职场工作汇报PPT,橙蓝、黑红、红蓝、蓝橙灰、浅蓝、浅绿、深蓝七种色调模版 【7色560页】职场可视化逻辑图高级数据分析PPT模版:职场可视化逻辑图分析PPT模版https://pan.quark.cn/s/78aeabbd92d1...
纯 Java 项目(非 SpringBoot)集成 Mybatis-Plus 和 Mybatis-Plus-Join
纯 Java 项目(非 SpringBoot)集成 Mybatis-Plus 和 Mybatis-Plus-Join 1、依赖1.1、依赖版本1.2、pom.xml 2、代码2.1、SqlSession 构造器2.2、MybatisPlus代码生成器2.3、获取 config.yml 配置2.3.1、config.yml2.3.2、项目配置类 2.4、ftl 模板2.4.1、…...
【JVM】Java虚拟机(二)——垃圾回收
目录 一、如何判断对象可以回收 (一)引用计数法 (二)可达性分析算法 二、垃圾回收算法 (一)标记清除 (二)标记整理 (三)复制 (四ÿ…...
