新增题目接口开发
文章目录
- 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…...
7.4.分块查找
一.分块查找的算法思想: 1.实例: 以上述图片的顺序表为例, 该顺序表的数据元素从整体来看是乱序的,但如果把这些数据元素分成一块一块的小区间, 第一个区间[0,1]索引上的数据元素都是小于等于10的, 第二…...
label-studio的使用教程(导入本地路径)
文章目录 1. 准备环境2. 脚本启动2.1 Windows2.2 Linux 3. 安装label-studio机器学习后端3.1 pip安装(推荐)3.2 GitHub仓库安装 4. 后端配置4.1 yolo环境4.2 引入后端模型4.3 修改脚本4.4 启动后端 5. 标注工程5.1 创建工程5.2 配置图片路径5.3 配置工程类型标签5.4 配置模型5.…...
【快手拥抱开源】通过快手团队开源的 KwaiCoder-AutoThink-preview 解锁大语言模型的潜力
引言: 在人工智能快速发展的浪潮中,快手Kwaipilot团队推出的 KwaiCoder-AutoThink-preview 具有里程碑意义——这是首个公开的AutoThink大语言模型(LLM)。该模型代表着该领域的重大突破,通过独特方式融合思考与非思考…...
C++ Visual Studio 2017厂商给的源码没有.sln文件 易兆微芯片下载工具加开机动画下载。
1.先用Visual Studio 2017打开Yichip YC31xx loader.vcxproj,再用Visual Studio 2022打开。再保侟就有.sln文件了。 易兆微芯片下载工具加开机动画下载 ExtraDownloadFile1Info.\logo.bin|0|0|10D2000|0 MFC应用兼容CMD 在BOOL CYichipYC31xxloaderDlg::OnIni…...
【从零开始学习JVM | 第四篇】类加载器和双亲委派机制(高频面试题)
前言: 双亲委派机制对于面试这块来说非常重要,在实际开发中也是经常遇见需要打破双亲委派的需求,今天我们一起来探索一下什么是双亲委派机制,在此之前我们先介绍一下类的加载器。 目录 编辑 前言: 类加载器 1. …...
Python 训练营打卡 Day 47
注意力热力图可视化 在day 46代码的基础上,对比不同卷积层热力图可视化的结果 import torch import torch.nn as nn import torch.optim as optim from torchvision import datasets, transforms from torch.utils.data import DataLoader import matplotlib.pypl…...
Monorepo架构: Nx Cloud 扩展能力与缓存加速
借助 Nx Cloud 实现项目协同与加速构建 1 ) 缓存工作原理分析 在了解了本地缓存和远程缓存之后,我们来探究缓存是如何工作的。以计算文件的哈希串为例,若后续运行任务时文件哈希串未变,系统会直接使用对应的输出和制品文件。 2 …...
DAY 45 超大力王爱学Python
来自超大力王的友情提示:在用tensordoard的时候一定一定要用绝对位置,例如:tensorboard --logdir"D:\代码\archive (1)\runs\cifar10_mlp_experiment_2" 不然读取不了数据 知识点回顾: tensorboard的发展历史和原理tens…...
基于Python的气象数据分析及可视化研究
目录 一.🦁前言二.🦁开源代码与组件使用情况说明三.🦁核心功能1. ✅算法设计2. ✅PyEcharts库3. ✅Flask框架4. ✅爬虫5. ✅部署项目 四.🦁演示效果1. 管理员模块1.1 用户管理 2. 用户模块2.1 登录系统2.2 查看实时数据2.3 查看天…...
基于Java项目的Karate API测试
Karate 实现了可以只编写Feature 文件进行测试,但是对于熟悉Java语言的开发或是测试人员,可以通过编程方式集成 Karate 丰富的自动化和数据断言功能。 本篇快速介绍在Java Maven项目中编写和运行测试的示例。 创建Maven项目 最简单的创建项目的方式就是创建一个目录,里面…...
