04-SpringBootWeb案例(中)

3. 员工管理

完成了部门管理的功能开发之后,我们进入到下一环节员工管理功能的开发。
在这里插入图片描述
基于以上原型,我们可以把员工管理功能分为:

  1. 分页查询(今天完成)
  2. 带条件的分页查询(今天完成)
  3. 删除员工(今天完成)
  4. 新增员工(后续完成)
  5. 修改员工(后续完成)

那下面我们就先从分页查询功能开始学习。

3.1 分页查询

3.1.1 基础分页

3.1.1.1 需求分析

我们之前做的查询功能,是将数据库中所有的数据查询出来并展示到页面上,试想如果数据库中的数据有很多(假设有十几万条)的时候,将数据全部展示出来肯定不现实,那如何解决这个问题呢?

使用分页解决这个问题。每次只展示一页的数据,比如:一页展示10条数据,如果还想看其他的数据,可以通过点击页码进行查询。

在这里插入图片描述
要想从数据库中进行分页查询,我们要使用 LIMIT 关键字,格式为:limit 开始索引 每页显示的条数

查询第1页数据的SQL语句是:
select * from emp limit 0,10;
查询第2页数据的SQL语句是:
select * from emp limit 10,10;
查询第3页的数据的SQL语句是:
select * from emp limit 20,10;
观察以上SQL语句,发现: 开始索引一直在改变 , 每页显示条数是固定的
开始索引的计算公式: 开始索引 = (当前页码 - 1) * 每页显示条数

我们继续基于页面原型,继续分析,得出以下结论:

  1. 前端在请求服务端时,传递的参数
    • 当前页码 page
    • 每页显示条数 pageSize
  2. 后端需要响应什么数据给前端
    • 所查询到的数据列表(存储到List 集合中)
    • 总记录数

在这里插入图片描述

后台给前端返回的数据包含:List集合(数据列表)、total(总记录数) 而这两部分我们通常封装到PageBean对象中,并将该对象转换为json格式的数据响应回给浏览器。

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageBean {private Long total; //总记录数private List rows; //当前页数据列表
}
3.1.1.2 接口文档

员工列表查询

  • 基本信息

请求路径:/emps
请求方式:GET
接口描述:该接口用于员工列表数据的条件分页查询

  • 请求参数

参数格式:queryString
参数说明:

参数名是否必须示例备注
name姓名
gender1性别 , 1 男 , 2 女
begin2010-01-01范围匹配的开始时间(入职日期)
end2020-01-01范围匹配的结束时间(入职日期)
page1分页查询的页码,如果未指定,默认为1
pageSize10分页查询的每页记录数,如果未指定,默认为10

请求数据样例:

/emps?name=张&gender=1&begin=2007-09-01&end=2022-09-01&page=1&pageSize=10
  • 响应数据

参数格式:application/json
参数说明:

参数名类型是否必须默认值备注其他信息
codenumber必须响应码,1 代表成功,0 代表失败
msgstring非必须提示信息
dataobject[ ]非必须返回的数据
l- totalnumber必须总记录数
l- rowsobject[]必须iditem 类型:object
l- idnumber非必须id
l- usernamestring非必须用户名
l- namestring非必须姓名
l- passwordstring非必须密码
l- entrydatestring非必须入职日期
l- gendernumber非必须性别,1 男 2女
l- imagestring非必须职位, 说明: 1 班主任,2 讲师,3 学工主管, 4 教研主管, 5 咨询师
l- jobnumber非必须图像
l- deptIdnumber非必须部门id
l- createTimestring非必须创建时间
l- updateTimestring非必须更新时间

响应数据样例:

{"code": 1,"msg": "success","data": {"total": 2,"rows": [{"id": 1,"username": "jinyong","password": "123456","name": "金庸","gender": 1,"image": "https://web-framework.oss-cnhangzhou.aliyuncs.com/2022-09-02-00-27-53B.jpg","job": 2,"entrydate": "2015-01-01","deptId": 2,"createTime": "2022-09-01T23:06:30","updateTime": "2022-09-02T00:29:04"},{"id": 2,"username": "zhangwuji","password": "123456","name": "张无忌","gender": 1,"image": "https://web-framework.oss-cnhangzhou.aliyuncs.com/2022-09-02-00-27-53B.jpg","job": 2,"entrydate": "2015-01-01","deptId": 2,"createTime": "2022-09-01T23:06:30","updateTime": "2022-09-02T00:29:04"}]}
}
3.1.1.3 思路分析

在这里插入图片描述
分页查询需要的数据,封装在PageBean对象中:
在这里插入图片描述

3.1.1.4 功能开发

通过查看接口文档:员工列表查询

请求路径:/emps
请求方式:GET
请求参数:跟随在请求路径后的参数字符串。 例:/emps?page=1&pageSize=10
响应数据:json格式

EmpController

package com.itheima.controller;import com.itheima.pojo.PageBean;
import com.itheima.pojo.Result;
import com.itheima.service.EmpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;@RestController
@Slf4j
@CrossOrigin(origins = "*", maxAge = 3600)
public class EmpController {@Autowiredprivate EmpService empService;// 条件分页查询@GetMapping("/emps")public Result page(@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer pageSize) {// 记录日志log.info("分页查询,参数:{},{}", page, pageSize);// 调用业务层分页查询功能PageBean pageBean = empService.page(page, pageSize);// 响应return Result.success(pageBean);}
}

@RequestParam(defaultValue=“默认值”) //设置请求参数默认值

EmpService

package com.itheima.service;import com.itheima.pojo.PageBean;
import org.springframework.stereotype.Service;@Service
public interface EmpService {/*** 条件分页查询** @param page     页码* @param pageSize 每页展示记录数* @return*/PageBean page(Integer page, Integer pageSize);
}

EmpServiceImpl

package com.itheima.service.impl;import com.itheima.mapper.EmpMapper;
import com.itheima.pojo.Emp;
import com.itheima.pojo.PageBean;
import com.itheima.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;@Service
public class EmpServiceImpl implements EmpService {@Autowiredprivate EmpMapper empMapper;@Overridepublic PageBean page(Integer page, Integer pageSize) {// 1、获取总记录数long count = empMapper.count();// 2、获取分页查询结果列表Integer start = (page - 1) * pageSize;  // 计算起始索引 , 公式:(页码-1)*页大小List<Emp> empList = empMapper.page(start, pageSize);// 3、封装PageBean对象PageBean pageBean = new PageBean(count, empList);return pageBean;}
}

EmpMapper

package com.itheima.mapper;import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;import java.util.List;@Mapper
public interface EmpMapper {/*** 获取总记录数** @return*/@Select("select count(*) from emp")public long count();/*** 获取当前页的结果列表** @param start* @param pageSize* @return*/@Select("select * from emp limit #{start},#{pageSize}")public List<Emp> page(Integer start, Integer pageSize);
}
3.1.1.5 功能测试

功能开发完成后,重新启动项目,使用postman,发起POST请求:
在这里插入图片描述

3.1.1.6 前后端联调

打开浏览器,测试后端功能接口:
在这里插入图片描述

3.1.2 分页插件

3.1.2.1 介绍

前面我们已经完了基础的分页查询,大家会发现:分页查询功能编写起来比较繁琐。
在这里插入图片描述

在Mapper接口中定义两个方法执行两条不同的SQL语句:

  1. 查询总记录数
  2. 指定页码的数据列表

在Service当中,调用Mapper接口的两个方法,分别获取:总记录数、查询结果列表,然后在将 获?>取的数据结果封装到PageBean对象中。 大家思考下:在未来开发其他项目,只要涉及到分页查询 >功能(例:订单、用户、支付、商品),
都必须按照以上操作完成功能开发

结论:原始方式的分页查询,存在着"步骤固定"、"代码频繁"的问题
解决方案:可以使用一些现成的分页插件完成。对于Mybatis来讲现在最主流的就是PageHelper。

PageHelper是Mybatis的一款功能强大、方便易用的分页插件,支持任何形式的单标、多表的
分页查询。
官网:https://pagehelper.github.io/

在这里插入图片描述

在执行empMapper.list()方法时,就是执行:select * from emp 语句,怎么能够实现分页操作呢?
分页插件帮我们完成了以下操作:

  1. 先获取到要执行的SQL语句:select * from emp
  2. 把SQL语句中的字段列表,变为:count(*)
  3. 执行SQL语句:select count(*) from emp //获取到总记录数
  4. 再对要执行的SQL语句:select * from emp 进行改造,在末尾添加 limit ? ,?
  5. 执行改造后的SQL语句:select * from emp limit ? , ?
3.1.2.2 代码实现

当使用了PageHelper分页插件进行分页,就无需再Mapper中进行手动分页了。 在Mapper中我们只
需要进行正常的列表查询即可。在Service层中,调用Mapper的方法之前设置分页参数,在调用
Mapper方法执行查询之后,解析分页结果,并将结果封装到PageBean对象中返回。
1、在pom.xml引入依赖

<dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper-spring-boot-starter</artifactId><version>1.4.2</version>
</dependency>

2、EmpMapper

@Mapper
public interface EmpMapper {//获取当前页的结果列表@Select("select * from emp")public List<Emp> page(Integer start, Integer pageSize);
}

3、EmpServiceImpl

@Override
public PageBean page(Integer page, Integer pageSize) {// 设置分页参数PageHelper.startPage(page, pageSize);// 执行分页查询List<Emp> empList = empMapper.list(name,gender,begin,end);// 获取分页结果Page<Emp> p = (Page<Emp>) empList;//封装PageBeanPageBean pageBean = new PageBean(p.getTotal(), p.getResult());return pageBean;
}
3.1.2.3 测试

功能开发完成后,我们重启项目工程,打开postman,发起GET请求,访问 :http://localhost:8080/emps?page=1&pageSize=5
在这里插入图片描述

后端程序SQL输出:
在这里插入图片描述

3.1.2.4 小结

在这里插入图片描述

3.2 分页查询(带条件)

完了分页查询后,下面我们需要在分页查询的基础上,添加条件。

3.2.1 需求

在这里插入图片描述
通过员工管理的页面原型我们可以看到,员工列表页面的查询,不仅仅需要考虑分页,还需要考虑查询条件。 分页查询我们已经实现了,接下来,我们需要考虑在分页查询的基础上,再加上查询条件。
我们看到页面原型及需求中描述,搜索栏的搜索条件有三个,分别是:

  • 姓名:模糊匹配
  • 性别:精确匹配
  • 入职日期:范围匹配
select *
from emp
wherename like concat('%','张','%') -- 条件1:根据姓名模糊匹配and gender = 1 -- 条件2:根据性别精确匹配and entrydate = between '2000-01-01' and '2010-01-01' -- 条件3:根据入职日期范围匹配
order by update_time desc;

而且上述的三个条件,都是可以传递,也可以不传递的,也就是动态的。 我们需要使用前面学习的
Mybatis中的动态SQL 。

3.2.2 思路分析

在这里插入图片描述

3.2.3 功能开发

通过查看接口文档:员工列表查询

请求路径:/emps
请求方式:GET
请求参数:

参数名是否必须示例备注
name姓名
gender1性别 , 1 男 , 2 女
begin2010-01-01范围匹配的开始时间(入职日期)
end2020-01-01范围匹配的结束时间(入职日期)
page1分页查询的页码,如果未指定,默认为1
pageSize10分页查询的每页记录数,如果未指定,默认为10

在原有分页查询的代码基础上进行改造:
EmpController

package com.itheima.controller;import com.itheima.pojo.PageBean;
import com.itheima.pojo.Result;
import com.itheima.service.EmpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;import java.time.LocalDate;@RestController
@Slf4j
// @CrossOrigin(origins = "*", maxAge = 3600)
public class EmpController {@Autowiredprivate EmpService empService;// 条件分页查询@GetMapping("/emps")public Result page(@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer pageSize,String name, Short gender, LocalDate begin, LocalDate end) {// 记录日志log.info("查询员工数据,参数{},{},{},{},{},{}", page, pageSize, name, gender, begin, end);// 调用业务层分页查询功能PageBean pageBean = empService.page(page, pageSize, name, gender, begin, end);// 响应return Result.success(pageBean);}
}

EmpService

package com.itheima.service;import com.itheima.pojo.PageBean;
import org.springframework.stereotype.Service;import java.time.LocalDate;@Service
public interface EmpService {/*** 条件分页查询** @param page     页码* @param pageSize 每页展示记录数* @param name     姓名* @param gender   性别* @param begin    开始时间* @param end      结束时间* @return*/PageBean page(Integer page, Integer pageSize, String name, Short gender, LocalDate begin, LocalDate end);
}

EmpServiceImpl

package com.itheima.service.impl;import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.EmpMapper;
import com.itheima.pojo.Emp;
import com.itheima.pojo.PageBean;
import com.itheima.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.time.LocalDate;
import java.util.List;@Service
public class EmpServiceImpl implements EmpService {@Autowiredprivate EmpMapper empMapper;//    @Override
//    public PageBean page(Integer page, Integer pageSize) {
//        // 获取总条数
//        long count = empMapper.count();
//        // 获取员工数据
//        Integer start = (page - 1) * pageSize;
//        List<Emp> empList = empMapper.page(start, pageSize);
//        // 封装 pageBean对象
//        PageBean pageBean = new PageBean(count, empList);
//        return pageBean;
//    }@Overridepublic PageBean page(Integer page, Integer pageSize, String name, Short gender, LocalDate begin, LocalDate end) {// 1、设置分页参数PageHelper.startPage(page, pageSize);// 2、执行条件分页查询List<Emp> empList = empMapper.list(page, pageSize, name, gender, begin, end);// 3、获取查询结果Page<Emp> p = (Page<Emp>) empList;// 4、封装 pageBean对象PageBean pageBean = new PageBean(p.getTotal(), p.getResult());return pageBean;}
}

EmpMapper

package com.itheima.mapper;import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.Mapper;import java.time.LocalDate;
import java.util.List;@Mapper
public interface EmpMapper {
//    @Select("select count(*) from emp")
//    long count();
//
//
//    @Select("select * from emp limit #{start},#{pageSize}")
//    List<Emp> page(Integer start, Integer pageSize);// @Select("select * from emp")// 获取当前页的结果列表public List<Emp> list(Integer page, Integer pageSize, String name, Short gender, LocalDate begin, LocalDate end);
}

EmpMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.itheima.mapper.EmpMapper"><!-- 条件分页查询 --><select id="list" resultType="com.itheima.pojo.Emp">select * from emp<where><if test="name!=null">name like concat('%',#{name},'%')</if><if test="gender!=null">and gender = #{gender}</if><if test="begin!=null and end!=null">and entrydate between #{begin} and #{end}</if></where>order by update_time desc</select>
</mapper>

3.2.4 功能测试

功能开发完成后,重启项目工程,打开postman,发起GET请求:
在这里插入图片描述

控制台SQL语句:
在这里插入图片描述

3.2.5 前后端联调

打开浏览器,测试后端功能接口:3.2.5 前后端联调
打开浏览器,测试后端功能接口:
在这里插入图片描述

3.3 删除员工

查询员完成之后,我们继续开发新的功能:删除员工。

3.3.1 需求

在这里插入图片描述
当我们勾选列表前面的复选框,然后点击 “批量删除” 按钮,就可以将这一批次的员工信息删除掉了。
也可以只勾选一个复选框,仅删除一个员工信息。

问题:我们需要开发两个功能接口吗?一个删除单个员工,一个删除多个员工
答案:不需要。 只需要开发一个功能接口即可(删除多个员工包含只删除一个员工)

3.3.2 接口文档

删除员工

  • 基本信息

请求路径:/emps/{ids}
请求方式:DELETE
接口描述:该接口用于批量删除员工的数据信息

  • 请求参数

参数格式:路径参数
参数说明:

参数名类型示例是否必须备注
ids数组 array1,2,3必须员工的id数组

请求参数样例:

/emps/1,2,3
  • 响应数据

参数格式:application/json
参数说明:

参数名类型是否必须备注
code数组 array必须响应码,1 代表成功,0 代表失败
msgstring非必须提示信息
dataobject非必须返回的数据

响应数据样例:

{"code":1,"msg":"success","data":null
}

3.3.3 思路分析

在这里插入图片描述
接口文档规定:

  • 前端请求路径:/emps/{ids}
  • 前端请求方式:DELETE

问题1:怎么在controller中接收请求路径中的路径参数?
@PathVariable
问题2:如何限定请求方式是delete?
@DeleteMapping
问题3:在Mapper接口中,执行delete操作的SQL语句时,条件中的id值是不确定的是动态的,
怎么实现呢?
Mybatis中的动态SQL:foreach

3.3.4 功能开发

通过查看接口文档:删除员工

请求路径:/emps/{ids}
请求方式:DELETE
请求参数:路径参数 {ids}
响应数据:json格式

EmpController

@RestController
@Slf4j
@RequestMapping("/emps")
// @CrossOrigin(origins = "*", maxAge = 3600)
public class EmpController {@Autowiredprivate EmpService empService;// 条件分页查询@GetMappingpublic Result page(@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer pageSize,String name, Short gender, LocalDate begin, LocalDate end) {// 记录日志log.info("查询员工数据,参数{},{},{},{},{},{}", page, pageSize, name, gender, begin, end);// 调用业务层分页查询功能PageBean pageBean = empService.page(page, pageSize, name, gender, begin, end);// 响应return Result.success(pageBean);}// 批量删除@DeleteMapping("/{ids}")public Result delete(@PathVariable List<Integer> ids) {// 记录日志log.info("批量删除员工,ids:{}", ids);// 调用业务层批量删除功能empService.delete(ids);// 响应return Result.success();}
}

EmpService

@Service
public interface EmpService {/*** 批量删除员工** @param ids*/void delete(List<Integer> ids);
}

EmpServiceImpl

@Service
public class EmpServiceImpl implements EmpService {@Autowiredprivate EmpMapper empMapper;/*** 批量删除员工** @param ids*/@Overridepublic void delete(List<Integer> ids) {empMapper.delete(ids);}
}

EmpMapper

@Mapper
public interface EmpMapper {// 批量删除员工void delete(List<Integer> ids);
}

EmpMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.itheima.mapper.EmpMapper"><!--批量删除员工--><delete id="delete">delete from emp where id in<foreach collection="ids" item="id" open="(" separator="," close=")">#{id}</foreach></delete>
</mapper>

3.3.5 功能测试

功能开发完成后,重启项目工程,打开postman,发起DELETE请求:
在这里插入图片描述

控制台SQL语句:
在这里插入图片描述

3.3.6 前后端联调

打开浏览器,测试后端功能接口:
在这里插入图片描述
在这里插入图片描述

SpringBootWeb案例(下)

链接:SpringBootWeb案例(下)

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

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

相关文章

服务器conda环境安装rpy2

参考博客 https://stackoverflow.com/questions/68936589/how-to-select-r-installation-when-using-rpy2-on-conda 现在我遇到这样一个问题&#xff0c;服务器系统环境没有R(没有权限安装&#xff09;&#xff0c;我只能在minconda的conda环境中使用R, 使用方法如下 我现在…

芝法酱学习笔记(0.6)——nexus与maven私库

一、私库的需求 在一个公司中&#xff0c;后端程序员通常几十上百个。在没有镜像私库的情况下&#xff0c;每当引入新库时&#xff0c;大家都会从maven中央仓库下载一遍这个库。这样无疑十分浪费。再加之国家的防火墙政策&#xff0c;许多人下载lib包可能还会十分缓慢。不同程…

Python水循环标准化对比算法实现

&#x1f3af;要点 算法区分不同水循环数据类型&#xff1a;地下水、河水、降水、气温和其他&#xff0c;并使用相应标准化降水指数、标准化地下水指数、标准化河流水位指数和标准化降水蒸散指数。绘制和计算特定的时间序列比较统计学相关性。使用相关矩阵可视化集水区和显示空…

推荐:五种限流(Rate Limiting)算法

推荐&#xff1a;五种限流(Rate Limiting)算法&#xff0c;发现一个不错的讲这个算法的UP,地址是&#xff1a;05~五种限流(Rate Limiting)算法_哔哩哔哩_bilibili https://www.bilibili.com/video/BV11k4SerE74/ 全部用动画展示&#xff0c;十分生动&#xff0c;比如漏桶算法&…

短剧小程序短剧APP在线追剧APP网剧推广分销微短剧小剧场小程序集师知识付费集师短剧小程序集师小剧场小程序集师在线追剧小程序源码

一、产品简介功能介绍 集师专属搭建您的独有短剧/追剧/小剧场小程序或APP平台 二、短剧软件私域运营解决方案 针对短剧类小程序的运营&#xff0c;以下提出10条具体的方案&#xff1a; 明确定位与目标用户&#xff1a; 对短剧类小程序进行明确定位&#xff0c;了解目标用户群体…

【AI知识点】置信区间(Confidence Interval)

置信区间&#xff08;Confidence Interval, CI&#xff09; 是统计学中用于估计总体参数的范围。它给出了一个区间&#xff0c;并且这个区间包含总体参数的概率等于某个指定的置信水平&#xff08;通常是 90%、95% 或 99%&#xff09;。与点估计不同&#xff0c;置信区间通过区…

开源的云平台有哪些?

开源云平台为用户提供了构建、管理和运行云基础设施及应用的能力&#xff0c;同时允许社区参与开发和改进。以下是一些知名的开源云平台&#xff1a; 1. OpenStack 简介&#xff1a;OpenStack&#xff1a;一个广泛使用的开源云平台&#xff0c;它由多个组件组成&#xff0c;提…

深度学习中的结构化概率模型 - 结构化概率模型的深度学习方法篇

序言 在深度学习的广阔领域中&#xff0c;结构化概率模型&#xff08; Structured Probabilistic Model \text{Structured Probabilistic Model} Structured Probabilistic Model&#xff09;扮演着至关重要的角色。这类模型利用图论中的图结构来表示概率分布中随机变量之间的…

精品WordPress主题/响应式个人博客主题Kratos

Kratos 是一款专注于用户阅读体验的响应式 WordPress 主题&#xff0c;整体布局简洁大方&#xff0c;针对资源加载进行了优化。 Kratos主题基于Bootstrap和Font Awesome的WordPress一个干净&#xff0c;简单且响应迅速的博客主题&#xff0c;Vtrois创建和维护&#xff0c; 主…

Markdown实用语法汇总

说明&#xff1a; 本来只展示本人常用的、markdown特有优势的一些语法。表格输入markdown的弱项&#xff0c;不作介绍&#xff0c;借助软件创建即可。引用图片、音频、视频等&#xff0c;虽然很方便&#xff0c;但是内容集成度不高&#xff0c;需要上传发布的时候很不方便&…

学习C语言(23)

整理今天的学习内容 1.文件的概念 使用文件是为了将数据永久化地保存 按照文件功能&#xff0c;在程序设计中一般把文件分成两类&#xff1a; 每个文件都有一个唯一的文字标识&#xff0c;文字标识常被称为文件名&#xff0c;文件名包含文件路径&#xff0c;文件名主干和文件…

Apollo9.0 Planning2.0决策规划算法代码详细解析 (4): PlanningComponent::Proc()

&#x1f31f; 面向自动驾驶规划算法工程师的专属指南 &#x1f31f; 欢迎来到《Apollo9.0 Planning2.0决策规划算法代码详细解析》专栏&#xff01;本专栏专为自动驾驶规划算法工程师量身打造&#xff0c;旨在通过深入剖析Apollo9.0开源自动驾驶软件栈中的Planning2.0模块&am…

vAPI靶场

前言 自行去搭建vAPI靶场&#xff0c;配合postman使用 vapi1 创建用户 第一个用户 {"username": "shi","name": "shi1","course": "nihao","id": 10 } 第二个用户 {"username": "hui…

论文理解【LLM-CV】—— 【MAE】Masked Autoencoders Are Scalable Vision Learners

文章链接&#xff1a;Masked Autoencoders Are Scalable Vision Learners代码&#xff1a;GitHub - facebookresearch/mae发表&#xff1a;CVPR 2022领域&#xff1a;LLM CV一句话总结&#xff1a;本文提出的 MAE 是一种将 Transformer 模型用作 CV backbone 的方法&#xff0c…

制作一个流水灯,控制发光二极管由上至下再由下至上反复循环点亮显示,每次点亮一个发光二级管(Proteus 与Keil uVision联合仿真)

一、代码编写 &#xff08;1&#xff09;编写程序来控制发光二极管由上至下的反复循环流水点亮&#xff0c;每次点亮一个发光二极管。 #define uchar unsigned char // 定义uchar为unsigned char类型uchar tab[] {0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f, 0x7f, 0x…

一个不错的 SQL 编码风格的指南

前言 SQL语句的编写对于我们后端开发者而言是一个必备的技巧&#xff0c;在日常工作中&#xff0c;SQL语言编写的质量不仅仅会影响到团队的合作效率与项目的可维护性&#xff0c;还直接关系到数据库的性能优化与数据安全。今天大姚给大家分享一个不错的 SQL 编码风格的指南&am…

【Qt】控件概述(4)—— 输出类控件

输出类控件 1. QLineEdit——单行输入框2. QTextEdit——多行输入框3. QComboBox——下拉框4. QSpinBox——微调框5. QDateEdit && QTimeEdit && QDateTimeEdit6 QDial——旋钮7. QSlider——滑动条 1. QLineEdit——单行输入框 QLineEdit是一个单行的输入框&…

定时器实验(Proteus 与Keil uVision联合仿真)

一、 &#xff08;1&#xff09;设置TMOD寄存器 T0工作在方式1&#xff0c;应使TMOD寄存器的M1、M001&#xff1b;应设置C/T*0&#xff0c;为定时器模式&#xff1b;对T0的运行控制仅由TR0来控制&#xff0c;应使相应的GATE位为0。定时器T1不使用&#xff0c;各相关位均设为…

执行路径带空格的服务漏洞

原理 当系统管理员配置Windows服务时&#xff0c;必须指定要执行的命令&#xff0c;或者运行可执行文件的路径。 当Windows服务运行时&#xff0c;会发生以下两种情况之一。 1、如果给出了可执行文件&#xff0c;并且引用了完整路径&#xff0c;则系统会按字面解释它并执行 …

Listen1 0.8.2| 免费无广告,整合多平台音乐,界面简洁,操作便捷。

Listen 1 是一款开源且免费的跨平台音乐播放器&#xff0c;它能够整合多个主流音乐平台的资源&#xff0c;让你在一个应用中就能听到来自不同平台的歌曲。无论你是网易云音乐、QQ音乐还是虾米音乐的用户&#xff0c;你都可以通过 Listen 1 来享受无缝的音乐体验。它支持网易云音…