OJ在线评测系统 后端基础部分开发 完善CRUD相关接口

news2024/11/23 11:53:01

完善相关接口

判斷编程语言是否合法

先从用户的请求拿到Language

package com.dduo.dduoj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dduo.dduoj.common.ErrorCode;
import com.dduo.dduoj.exception.BusinessException;
import com.dduo.dduoj.model.dto.questionsubmit.JudgeInfo;
import com.dduo.dduoj.model.dto.questionsubmit.QuestionSubmitAddRequest;
import com.dduo.dduoj.model.enums.QuestionSubmitLanguageEnum;
import com.dduo.dduoj.model.enums.QuestionSubmitStatusEnum;
import com.dduo.dduoj.service.mapper.QuestionSubmitMapper;
import com.dduo.dduoj.service.mapper.entity.Question;
import com.dduo.dduoj.service.mapper.entity.QuestionSubmit;
import com.dduo.dduoj.service.mapper.entity.User;
import com.dduo.dduoj.service.QuestionService;
import com.dduo.dduoj.service.QuestionSubmitService;
import javax.annotation.Resource;
import org.springframework.aop.framework.AopContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 提交题目服务实现
 *
 */
@Service
public class QuestionSubmitServiceImpl extends ServiceImpl<QuestionSubmitMapper, QuestionSubmit>
        implements QuestionSubmitService {

    @Resource
    private QuestionService questionService;

    /**
     * 提交题目
     *
     * @param questionSubmitAddRequest
     * @param loginUser
     * @return
     */
    @Override
    public long doQuestionSubmit(QuestionSubmitAddRequest questionSubmitAddRequest, User loginUser) {
        // 编程语言是否合法
        String language = questionSubmitAddRequest.getLanguage();
        QuestionSubmitLanguageEnum enumByValue = QuestionSubmitLanguageEnum.getEnumByValue(language);
        if (enumByValue==null){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"编程语言错误");
        }
        long questionId = questionSubmitAddRequest.getQuestionId();
        // 判断实体是否存在,根据类别获取实体
        Question question = questionService.getById(questionId);
        if (question == null) {
            throw new BusinessException(ErrorCode.NOT_FOUND_ERROR);
        }
        // 是否提交题目
        long userId = loginUser.getId();
        // 每个用户串行提交题目
        // 锁必须要包裹住事务方法
        QuestionSubmit questionSubmit = new QuestionSubmit();
        questionSubmit.setUserId(userId);
        questionSubmit.setQuestionId(questionId);
        questionSubmit.setCode(questionSubmitAddRequest.getCode());
        questionSubmit.setLanguage(language);
        //设置初始状态
        questionSubmit.setStatus(QuestionSubmitStatusEnum.WATING.getValue());
        questionSubmit.setJudgeInfo("{}");
        boolean save = this.save(questionSubmit);
        if(!save){
            throw new BusinessException(ErrorCode.SYSTEM_ERROR,"数据插入失败");
        }
        return questionSubmit.getId();
    }

}

写好了 idea启动

代码运行成功

我们

使用接口文档提交题目试一试

数据库中数据录入成功

为了防止用户根据id爬取题目

建议把id的生成规则改成ASSIGN_ID

非连续递增

而不是从1开始递增

数值传到数据库中进行一个转换

/**
 * 创建
 *
 * @param questionAddRequest
 * @param request
 * @return
 */
@PostMapping("/add")
public BaseResponse<Long> addQuestion(@RequestBody QuestionAddRequest questionAddRequest, HttpServletRequest request) {
    if (questionAddRequest == null) {
        throw new BusinessException(ErrorCode.PARAMS_ERROR);
    }
    Question question = new Question();
    BeanUtils.copyProperties(questionAddRequest, question);
    List<String> tags = questionAddRequest.getTags();
    if (tags != null) {
        question.setTags(GSON.toJson(tags));
    }
    List<JudgeCase> judgeCase = questionAddRequest.getJudgeCase();
    if (judgeCase != null) {
        question.setJudgeCase(GSON.toJson(judgeCase));
    }
    List<JudgeConfig> judgeConfig = questionAddRequest.getJudgeConfig();
    if (judgeConfig != null) {
        question.setJudgeConfig(GSON.toJson(judgeConfig));
    }
    questionService.validQuestion(question, true);
    User loginUser = userService.getLoginUser(request);
    question.setUserId(loginUser.getId());
    question.setFavourNum(0);
    question.setThumbNum(0);
    boolean result = questionService.save(question);
    ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
    long newQuestionId = question.getId();
    return ResultUtils.success(newQuestionId);
}

@PostMapping("/update")
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
public BaseResponse<Boolean> updateQuestion(@RequestBody QuestionUpdateRequest questionUpdateRequest) {
    if (questionUpdateRequest == null || questionUpdateRequest.getId() <= 0) {
        throw new BusinessException(ErrorCode.PARAMS_ERROR);
    }
    Question question = new Question();
    BeanUtils.copyProperties(questionUpdateRequest, question);
    List<String> tags = questionUpdateRequest.getTags();
    if (tags != null) {
        question.setTags(GSON.toJson(tags));
    }
    List<JudgeCase> judgeCase = questionUpdateRequest.getJudgeCase();
    if (judgeCase != null) {
        question.setJudgeCase(GSON.toJson(judgeCase));
    }
    List<JudgeConfig> judgeConfig = questionUpdateRequest.getJudgeConfig();
    if (judgeConfig != null) {
        question.setJudgeConfig(GSON.toJson(judgeConfig));
    }
    // 参数校验
    questionService.validQuestion(question, false);
    long id = questionUpdateRequest.getId();
    // 判断是否存在
    Question oldQuestion = questionService.getById(id);
    ThrowUtils.throwIf(oldQuestion == null, ErrorCode.NOT_FOUND_ERROR);
    boolean result = questionService.updateById(question);
    return ResultUtils.success(result);
}

@PostMapping("/edit")
public BaseResponse<Boolean> editQuestion(@RequestBody QuestionEditRequest questionEditRequest, HttpServletRequest request) {
    if (questionEditRequest == null || questionEditRequest.getId() <= 0) {
        throw new BusinessException(ErrorCode.PARAMS_ERROR);
    }
    Question question = new Question();
    BeanUtils.copyProperties(questionEditRequest, question);
    List<String> tags = questionEditRequest.getTags();
    if (tags != null) {
        question.setTags(GSON.toJson(tags));
    }
    List<JudgeCase> judgeCase = questionEditRequest.getJudgeCase();
    if (judgeCase != null) {
        question.setJudgeCase(GSON.toJson(judgeCase));
    }
    List<JudgeConfig> judgeConfig = questionEditRequest.getJudgeConfig();
    if (judgeConfig != null) {
        question.setJudgeConfig(GSON.toJson(judgeConfig));
    }
    // 参数校验
    questionService.validQuestion(question, false);
    User loginUser = userService.getLoginUser(request);
    long id = questionEditRequest.getId();
    // 判断是否存在
    Question oldQuestion = questionService.getById(id);
    ThrowUtils.throwIf(oldQuestion == null, ErrorCode.NOT_FOUND_ERROR);
    // 仅本人或管理员可编辑
    if (!oldQuestion.getUserId().equals(loginUser.getId()) && !userService.isAdmin(loginUser)) {
        throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
    }
    boolean result = questionService.updateById(question);
    return ResultUtils.success(result);
}

枯燥的测试

完善

查询提交信息

接口功能 能够根据用户id 题目id 编程语言 去查询提交记录

注意事项 仅本人和管理员能看见自己提交代码的答案 提交代码

实现方案 先查询

package com.dduo.dduoj.model.dto.questionsubmit;

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

import java.io.Serializable;

//查询请求
@Data
public class QuestionSubmitQueryRequest implements Serializable {
    /**
     * 编程语言
     */
    private String language;    

    /**
     * 提交状态
     */
    private Integer status;

    /**
     * 题目id
     */
    private Long questionId;

    /**
     * 用户id
     */
    private Long userId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}

QuestionSubmitVO

/**
 * 包装类转对象
 *
 * @param questionSubmitVO
 * @return
 */
public static QuestionSubmit voToObj(QuestionSubmitVO questionSubmitVO) {
    if (questionSubmitVO == null) {
        return null;
    }
    QuestionSubmit questionSubmit = new QuestionSubmit();
    BeanUtils.copyProperties(questionSubmitVO, questionSubmit);
    JudgeInfo judgeInfoObj = questionSubmitVO.getJudgeInfo();
    if (judgeInfoObj != null) {
        questionSubmit.setJudgeInfo(JSONUtil.toJsonStr(judgeInfoObj));
    }
    return questionSubmit;
}

/**
 * 对象转包装类
 *
 * @param questionSubmit
 * @return
 */
public static QuestionSubmitVO objToVo(QuestionSubmit questionSubmit) {
    if (questionSubmit == null) {
        return null;
    }
    QuestionSubmitVO questionSubmitVO = new QuestionSubmitVO();
    BeanUtils.copyProperties(questionSubmit, questionSubmitVO);
    String judgeInfoStr = questionSubmit.getJudgeInfo();
    questionSubmitVO.setJudgeInfo(JSONUtil.toBean(judgeInfoStr, JudgeInfo.class));
    return questionSubmitVO;
}

先查询再根据权限去脱敏

/**
 * 分页获取题目提交(除了管理员外 普通用户是能看见非答案 提交代码等非公开信息)
 *
 * @param questionSubmitQueryRequest
 * @return
 */
@PostMapping("/list/page")
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
public BaseResponse<Page<QuestionSubmitVO>> listQuestionSubmitByPage(@RequestBody QuestionSubmitQueryRequest questionSubmitQueryRequest,HttpServletRequest request) {
    long current = questionSubmitQueryRequest.getCurrent();
    long size = questionSubmitQueryRequest.getPageSize();
    //从数据库中获取信息
    Page<QuestionSubmit> questionSubmitPage = questionSubmitService.page(new Page<>(current, size),
            questionSubmitService.getQueryWrapper(questionSubmitQueryRequest));
    //返回脱敏方法
    return ResultUtils.success(questionSubmitService.getQuestionSubmitVOPage(questionSubmitPage,request));
}

脱敏处理

/*
* 单条数据
* */
@Override
public QuestionSubmitVO getQuestionSubmitVO(QuestionSubmit questionSubmit, User loginUser) {
    QuestionSubmitVO questionSubmitVO = QuestionSubmitVO.objToVo(questionSubmit);
    // 脱敏:仅本人和管理员能看见自己(提交 userId 和登录用户 id 不同)提交的代码
    long userId = loginUser.getId();
    // 处理脱敏
    if (userId != questionSubmit.getUserId() && !userService.isAdmin(loginUser)) {
        questionSubmitVO.setCode(null);
    }
    return questionSubmitVO;
}

/*
 * 多条数据
 * */
@Override
public Page<QuestionSubmitVO> getQuestionSubmitVOPage(Page<QuestionSubmit> questionSubmitPage, User loginUser) {
    List<QuestionSubmit> questionSubmitList = questionSubmitPage.getRecords();
    Page<QuestionSubmitVO> questionSubmitVOPage = new Page<>(questionSubmitPage.getCurrent(), questionSubmitPage.getSize(), questionSubmitPage.getTotal());
    if (CollectionUtils.isEmpty(questionSubmitList)) {
        return questionSubmitVOPage;
    }
    List<QuestionSubmitVO> questionSubmitVOList = questionSubmitList.stream()
            .map(questionSubmit -> getQuestionSubmitVO(questionSubmit, loginUser))
            .collect(Collectors.toList());
    questionSubmitVOPage.setRecords(questionSubmitVOList);
    return questionSubmitVOPage;
}

QuestionSubmitServiceImpl

package com.dduo.dduoj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dduo.dduoj.common.ErrorCode;
import com.dduo.dduoj.constant.CommonConstant;
import com.dduo.dduoj.exception.BusinessException;
import com.dduo.dduoj.judge.JudgeService;
import com.dduo.dduoj.model.dto.questionsubmit.QuestionSubmitAddRequest;
import com.dduo.dduoj.model.dto.questionsubmit.QuestionSubmitQueryRequest;
import com.dduo.dduoj.model.entity.Question;
import com.dduo.dduoj.model.entity.QuestionSubmit;
import com.dduo.dduoj.model.entity.User;
import com.dduo.dduoj.model.enums.QuestionSubmitLanguageEnum;
import com.dduo.dduoj.model.enums.QuestionSubmitStatusEnum;
import com.dduo.dduoj.mapper.QuestionSubmitMapper;
import com.dduo.dduoj.model.vo.QuestionSubmitVO;
import com.dduo.dduoj.service.QuestionService;
import com.dduo.dduoj.service.QuestionSubmitService;
import javax.annotation.Resource;

import com.dduo.dduoj.service.UserService;
import com.dduo.dduoj.utils.SqlUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;

/**
 * 提交题目服务实现
 *
 */
@Service
public class QuestionSubmitServiceImpl extends ServiceImpl<QuestionSubmitMapper, QuestionSubmit>
        implements QuestionSubmitService {

    @Resource
    private QuestionService questionService;

    @Resource
    private UserService userService;

    @Resource
    @Lazy
    private JudgeService judgeService;

    /**
     * 提交题目
     *
     * @param questionSubmitAddRequest
     * @param loginUser
     * @return
     */
    @Override
    public long doQuestionSubmit(QuestionSubmitAddRequest questionSubmitAddRequest, User loginUser) {
        // 校验编程语言是否合法
        String language = questionSubmitAddRequest.getLanguage();
        QuestionSubmitLanguageEnum languageEnum = QuestionSubmitLanguageEnum.getEnumByValue(language);
        if (languageEnum == null) {
            throw new BusinessException(ErrorCode.PARAMS_ERROR, "编程语言错误");
        }
        long questionId = questionSubmitAddRequest.getQuestionId();
        // 判断实体是否存在,根据类别获取实体
        Question question = questionService.getById(questionId);
        if (question == null) {
            throw new BusinessException(ErrorCode.NOT_FOUND_ERROR);
        }
        // 是否已提交题目
        long userId = loginUser.getId();
        // 每个用户串行提交题目
        QuestionSubmit questionSubmit = new QuestionSubmit();
        questionSubmit.setUserId(userId);
        questionSubmit.setQuestionId(questionId);
        questionSubmit.setCode(questionSubmitAddRequest.getCode());
        questionSubmit.setLanguage(language);
        // 设置初始状态
        questionSubmit.setStatus(QuestionSubmitStatusEnum.WAITING.getValue());
        questionSubmit.setJudgeInfo("{}");
        boolean save = this.save(questionSubmit);
        if (!save){
            throw new BusinessException(ErrorCode.SYSTEM_ERROR, "数据插入失败");
        }
        Long questionSubmitId = questionSubmit.getId();
        // 执行判题服务
        CompletableFuture.runAsync(() -> {
            judgeService.doJudge(questionSubmitId);
        });
        return questionSubmitId;
    }


    /**
     * 获取查询包装类(用户根据哪些字段查询,根据前端传来的请求对象,得到 mybatis 框架支持的查询 QueryWrapper 类)
     *
     * @param questionSubmitQueryRequest
     * @return
     */
    @Override
    public QueryWrapper<QuestionSubmit> getQueryWrapper(QuestionSubmitQueryRequest questionSubmitQueryRequest) {
        QueryWrapper<QuestionSubmit> queryWrapper = new QueryWrapper<>();
        if (questionSubmitQueryRequest == null) {
            return queryWrapper;
        }
        String language = questionSubmitQueryRequest.getLanguage();
        Integer status = questionSubmitQueryRequest.getStatus();
        Long questionId = questionSubmitQueryRequest.getQuestionId();
        Long userId = questionSubmitQueryRequest.getUserId();
        String sortField = questionSubmitQueryRequest.getSortField();
        String sortOrder = questionSubmitQueryRequest.getSortOrder();

        // 拼接查询条件
        queryWrapper.eq(StringUtils.isNotBlank(language), "language", language);
        queryWrapper.eq(ObjectUtils.isNotEmpty(userId), "userId", userId);
        queryWrapper.eq(ObjectUtils.isNotEmpty(questionId), "questionId", questionId);
        queryWrapper.eq(QuestionSubmitStatusEnum.getEnumByValue(status) != null, "status", status);
        queryWrapper.eq("isDelete", false);
        queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC),
                sortField);
        return queryWrapper;
    }

    /*
    * 单条数据
    * */
    @Override
    public QuestionSubmitVO getQuestionSubmitVO(QuestionSubmit questionSubmit, User loginUser) {
        QuestionSubmitVO questionSubmitVO = QuestionSubmitVO.objToVo(questionSubmit);
        // 脱敏:仅本人和管理员能看见自己(提交 userId 和登录用户 id 不同)提交的代码
        long userId = loginUser.getId();
        // 处理脱敏
        if (userId != questionSubmit.getUserId() && !userService.isAdmin(loginUser)) {
            questionSubmitVO.setCode(null);
        }
        return questionSubmitVO;
    }

    /*
     * 多条数据
     * */
    @Override
    public Page<QuestionSubmitVO> getQuestionSubmitVOPage(Page<QuestionSubmit> questionSubmitPage, User loginUser) {
        List<QuestionSubmit> questionSubmitList = questionSubmitPage.getRecords();
        Page<QuestionSubmitVO> questionSubmitVOPage = new Page<>(questionSubmitPage.getCurrent(), questionSubmitPage.getSize(), questionSubmitPage.getTotal());
        if (CollectionUtils.isEmpty(questionSubmitList)) {
            return questionSubmitVOPage;
        }
        List<QuestionSubmitVO> questionSubmitVOList = questionSubmitList.stream()
                .map(questionSubmit -> getQuestionSubmitVO(questionSubmit, loginUser))
                .collect(Collectors.toList());
        questionSubmitVOPage.setRecords(questionSubmitVOList);
        return questionSubmitVOPage;
    }

}

controller层代码

/**
 * 提交题目
 *
 * @param questionSubmitAddRequest
 * @param request
 * @return 提交记录的 id
 */
@PostMapping("/")
public BaseResponse<Long> doQuestionSubmit(@RequestBody QuestionSubmitAddRequest questionSubmitAddRequest,
                                           HttpServletRequest request) {
    if (questionSubmitAddRequest == null || questionSubmitAddRequest.getQuestionId() <= 0) {
        throw new BusinessException(ErrorCode.PARAMS_ERROR);
    }
    // 登录才能点赞
    final User loginUser = userService.getLoginUser(request);
    long questionSubmitId = questionSubmitService.doQuestionSubmit(questionSubmitAddRequest, loginUser);
    return ResultUtils.success(questionSubmitId);
}

listQuestionSubmitByPage

/**
 * 分页获取题目提交(除了管理员外 普通用户是能看见非答案 提交代码等非公开信息)
 *
 * @param questionSubmitQueryRequest
 * @return
 */
@PostMapping("/list/page")
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
public BaseResponse<Page<QuestionSubmitVO>> listQuestionSubmitByPage(@RequestBody QuestionSubmitQueryRequest questionSubmitQueryRequest, HttpServletRequest request) {
    long current = questionSubmitQueryRequest.getCurrent();
    long size = questionSubmitQueryRequest.getPageSize();
    //从数据库中获取信息
    Page<QuestionSubmit> questionSubmitPage = questionSubmitService.page(new Page<>(current, size),
            questionSubmitService.getQueryWrapper(questionSubmitQueryRequest));
    final User loginUser = userService.getLoginUser(request);
    //返回脱敏方法
    return ResultUtils.success(questionSubmitService.getQuestionSubmitVOPage(questionSubmitPage, loginUser));
}

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

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

相关文章

OpenHarmony(鸿蒙南向)——平台驱动开发【SDIO】

往期知识点记录&#xff1a; 鸿蒙&#xff08;HarmonyOS&#xff09;应用层开发&#xff08;北向&#xff09;知识点汇总 鸿蒙&#xff08;OpenHarmony&#xff09;南向开发保姆级知识点汇总~ 持续更新中…… 概述 功能简介 SDIO&#xff08;Secure Digital Input and Outpu…

【Faster-Rcnn】训练与测试

✨ Blog’s 主页: 白乐天_ξ( ✿&#xff1e;◡❛) &#x1f308; 个人Motto&#xff1a;他强任他强&#xff0c;清风拂山冈&#xff01; &#x1f4ab; 欢迎来到我的学习笔记&#xff01; 1.提前准备 1.1. mobaxterm&#xff08;远程连接服务器&#xff09; 链接&#xff1a…

达索系统SOLIDWORKS2025新版本即将来袭

达索系统SOLIDWORKS2025新版本即将来袭 北京众联亿诚是达索官方授权的SOLIDWORKS经销商&#xff0c;专业经销SOLIDWORKS正版软件并提供免费试用、培训认证、二次开发等增值服务。 在CAD软件领域&#xff0c;SOLIDWORKS作为达索系统旗下的旗舰产品&#xff0c;一直以其优越的三…

CTF学习路线(非常详细)零基础入门到精通,收藏这一篇就够了

**CTF概述&#xff1a;**CTF(夺旗赛)是一种网络安全竞赛&#xff0c;通过解决一系列安全问题来测试参赛者的技能和经验。对于网络安全爱好者和从业者来说&#xff0c;学习CTF是一个不错的选择。 下面是从零开始学习CTF的详细规划和路线&#xff1a; 1 基础知识 要开始学习C…

问题:机器字长为n位的二进制数可以用补码来表示()个不同的有符号定点整数。

一、概念 概念&#xff1a;无论原码、反码、补码&#xff0c;n位二进制数可以表示2^n个数值 二、从范围证明 有符号的情况下&#xff0c;表格如下&#xff1a; 其中&#xff0c;原码、反码含有-0、0 &#xff0c; 而补码不划分0 由此&#xff0c;可知&#xff1a; ① 原码…

Ubuntu 编译安装 ImageMagick 来处理图片

一&#xff1a;克隆 ImageMagick cd /tools git clone https://github.com/ImageMagick/ImageMagick.git cd ImageMagick 二&#xff1a;安装编译 ImageMagick 所需的软件包 sudo apt -y install build-essential libltdl-dev libjpeg-dev libpng-dev libtiff-dev libgif-dev…

Unity 外描边简单实现(Shader Graph)

1&#xff1a;原理 将物体的模型空间的位置&#xff08;也就是顶点数据&#xff09;放大&#xff0c;作为一个单独的渲染通道单独渲染&#xff0c;这时候模型是已经发大过的&#xff0c;要想看到外描边的效果&#xff0c;需要将正面显示的东西给去掉&#xff0c;显示背面渲染的…

HTTPS证书配置

NGINX、SSl配置 修改conf目录下NGINX中的crt和key文件 单点配置SSL 需要的文件和配置信息 证书和keytool.exe(使用jdk1.8的)工具要在同一个目录下 gxszy.qhxzhny.top.pfx&#xff08;证书&#xff09; keystorePass.txt&#xff08;密码&#xff09; 使用JDK自带的keyto…

【CSS】变量的声明与使用

原生变量root 伪类 原生变量 CSS中我们可以统一设置变量方便页面维护。变量声明的时候&#xff0c;自定义样式变量名之前加上两根连词线 " – " 即可&#xff0c;使用 var() 来引用。声明的变量是有作用域的 ( 比如是在html中声明的变量&#xff0c;那么该变量在html…

Leecode刷题之路从今天开始

前言 众所周知&#xff0c;数据结构算法程序。算法对程序的重要性不言而喻。我们后端研发在写业务代码的时候很容易忽略算法&#xff0c;因此为了加强算法功底&#xff0c;从今日起&#xff0c;决定每日记录Leecode刷题记录&#xff0c;每道题都有相关的demo代码和文档&#x…

Voxel mamba :基于Mamba的3D目标检测算法解析

目录 1 算法简介1.1 前提补充空间填充曲线(Space-filling Curve)点云分组2 模块介绍2.1 希尔伯特输入层(Hilbert Input Layer)2.2 双尺度 SSM 模块(Dual-scale SSM Block)2.3 隐式窗口分区 (Implicit Window Partition)2.4 Voxel Mamba Backbone2.5 有效感受野 Effecti…

安全使用微软Azure OpenAI:使用 Azure AI Studio 实现企业安全的 5 种方法

Azure 是一个受到数百万客户信赖的创新平台&#xff0c;目前有超过 60,000 名客户正在使用 Azure AI&#xff0c;通过 AI 将他们的雄心勃勃的想法变为现实。Azure AI Studio是一个值得信赖的企业级平台&#xff0c;可用于大规模构建、测试、部署和管理生成式 AI 应用程序。企业…

一键启动,停止,重启nginx

1.一键启动nginx 启动的时候只能启动当前目录的nginx.exe echo off echo 正在启动nginx cmd /c "start nginx.exe" timeout /t 1 /nobreak > NUL2.一键关闭nginx 关闭的时候只能关闭当前目录的nginx.exe echo off echo 正在关闭nginx cmd /c "nginx -s quit&…

kubernetes网络(三)之bird的路由反射器的使用

一、摘要 上一篇文章中我们用 bird 程序实现了三台服务器之间的BGP full mesh。本文我们将实验把full mesh方式改为RR 路由反射器方式 &#xff0c;让宿主的BIRD相互学习到对方的容器网段&#xff0c;从而达到容器网段能相互通信的目的。 二、bird 实验 bird简介 BIRD 实际…

awvs漏洞扫描工具使用教程

一、工具简介 AWVS&#xff08;Acunetix Web Vulnerability Scanner&#xff09;是一款常用的Web应用程序漏洞扫描工具&#xff0c;业界排名Top3&#xff0c;它可以自动扫描Web应用程序并发现其中可能存在的漏洞&#xff0c;包括SQL注入、跨站脚本、文件包含等安全漏洞。AWVS具…

Java语言程序设计基础篇_编程练习题**18.39(拖动树)

目录 题目&#xff1a;**18.39(拖动树) 代码示例 代码逻辑解析 类定义和变量初始化 main 方法 start 方法 drawRecursiveTree 方法 动画演示 题目&#xff1a;**18.39(拖动树) 修改编程练习题18.38, 将树移动到鼠标所拖动到的位置 Java语言程序设计基础篇_编程练习题…

elementUi / elementPlus自定义上传方法 Upload自定义文件上传

&#x1f680; 个人简介&#xff1a;某大型国企资深软件研发工程师&#xff0c;信息系统项目管理师、CSDN优质创作者、阿里云专家博主&#xff0c;华为云云享专家&#xff0c;分享前端后端相关技术与工作常见问题~ &#x1f49f; 作 者&#xff1a;码喽的自我修养&#x1f9…

二进制文件与文本文件的区别【字符集Charset】

计算机上存储的文件在比特位上都是以二进制数字0或1表示&#xff0c;因此在物理层面上&#xff0c;文本文件和二进制文件没有本质差异&#xff0c;都是由数字0或1组成的比特位集合。 文本文件和二进制文件&#xff0c;两者的差异体现在编码逻辑&#xff0c;需要根据文件头中标…

SpringSecurity-用户认证

1、用户认证 1.1 用户认证核心组件 我们系统中会有许多用户&#xff0c;确认当前是哪个用户正在使用我们系统就是登录认证的最终目的。这里我们就提取出了一个核心概念&#xff1a;当前登录用户/当前认证用户。整个系统安全都是围绕当前登录用户展开的&#xff0c;这个不难理…

百度在线翻译神器?这3款工具让你秒变语言达人!

在数字化的今天&#xff0c;我们早已离不开在线翻译工具了&#xff01;从日常的简单翻译到专业级的文献翻译&#xff0c;这些翻译工具就像是我们的“翻译官”&#xff0c;为我们的生活带来了便利&#xff1b;在这里&#xff0c;我给大家分享一下我的百度在线翻译使用感受&#…