SpringBootWeb案例_01

news2024/9/29 17:32:56

Web后端开发_04

SpringBootWeb案例_01

原型展示

image-20231126101510691

成品展示

image-20231126101610266

准备工作

需求&环境搭建

需求说明:

完成tlias智能学习辅助系统的部门管理,员工管理

image-20231126101755949

环境搭建
  • 准备数据库表(dept、emp)
  • 创建springboot工程,引入对应的起步依赖(web、mybatis、mysql驱动、lombok)
  • 配置文件application.properties中引入mybatis的配置信息,准备对应的实体类
  • 准备对应的Mapper、Service(接口、实现类)、Controller基础结构

image-20231126102329624

示例工程文件

image-20231126104315440

数据准备

-- 部门管理
create table dept
(
    id          int unsigned primary key auto_increment comment '主键ID',
    name        varchar(10) not null unique comment '部门名称',
    create_time datetime    not null comment '创建时间',
    update_time datetime    not null comment '修改时间'
) comment '部门表';

insert into dept (id, name, create_time, update_time)
values (1, '学工部', now(), now()),
       (2, '教研部', now(), now()),
       (3, '咨询部', now(), now()),
       (4, '就业部', now(), now()),
       (5, '人事部', now(), now());


-- 员工管理(带约束)
create table emp
(
    id          int unsigned primary key auto_increment comment 'ID',
    username    varchar(20)      not null unique comment '用户名',
    password    varchar(32) default '123456' comment '密码',
    name        varchar(10)      not null comment '姓名',
    gender      tinyint unsigned not null comment '性别, 说明: 1 男, 2 女',
    image       varchar(300) comment '图像',
    job         tinyint unsigned comment '职位, 说明: 1 班主任,2 讲师, 3 学工主管, 4 教研主管, 5 咨询师',
    entrydate   date comment '入职时间',
    dept_id     int unsigned comment '部门ID',
    create_time datetime         not null comment '创建时间',
    update_time datetime         not null comment '修改时间'
) comment '员工表';

INSERT INTO emp
(id, username, password, name, gender, image, job, entrydate, dept_id, create_time, update_time)
VALUES (1, 'jinyong', '123456', '金庸', 1, '1.jpg', 4, '2000-01-01', 2, now(), now()),
       (2, 'zhangwuji', '123456', '张无忌', 1, '2.jpg', 2, '2015-01-01', 2, now(), now()),
       (3, 'yangxiao', '123456', '杨逍', 1, '3.jpg', 2, '2008-05-01', 2, now(), now()),
       (4, 'weiyixiao', '123456', '韦一笑', 1, '4.jpg', 2, '2007-01-01', 2, now(), now()),
       (5, 'changyuchun', '123456', '常遇春', 1, '5.jpg', 2, '2012-12-05', 2, now(), now()),
       (6, 'xiaozhao', '123456', '小昭', 2, '6.jpg', 3, '2013-09-05', 1, now(), now()),
       (7, 'jixiaofu', '123456', '纪晓芙', 2, '7.jpg', 1, '2005-08-01', 1, now(), now()),
       (8, 'zhouzhiruo', '123456', '周芷若', 2, '8.jpg', 1, '2014-11-09', 1, now(), now()),
       (9, 'dingminjun', '123456', '丁敏君', 2, '9.jpg', 1, '2011-03-11', 1, now(), now()),
       (10, 'zhaomin', '123456', '赵敏', 2, '10.jpg', 1, '2013-09-05', 1, now(), now()),
       (11, 'luzhangke', '123456', '鹿杖客', 1, '11.jpg', 5, '2007-02-01', 3, now(), now()),
       (12, 'hebiweng', '123456', '鹤笔翁', 1, '12.jpg', 5, '2008-08-18', 3, now(), now()),
       (13, 'fangdongbai', '123456', '方东白', 1, '13.jpg', 5, '2012-11-01', 3, now(), now()),
       (14, 'zhangsanfeng', '123456', '张三丰', 1, '14.jpg', 2, '2002-08-01', 2, now(), now()),
       (15, 'yulianzhou', '123456', '俞莲舟', 1, '15.jpg', 2, '2011-05-01', 2, now(), now()),
       (16, 'songyuanqiao', '123456', '宋远桥', 1, '16.jpg', 2, '2007-01-01', 2, now(), now()),
       (17, 'chenyouliang', '123456', '陈友谅', 1, '17.jpg', NULL, '2015-03-21', NULL, now(), now());

创建工程

image-20231126111243772

添加依赖

image-20231126111348722

配置文件application.properties中引入mybatis的配置信息

#驱动类名称
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#数据库连接的url
spring.datasource.url=jdbc:mysql://localhost:3306/tlias
#连接数据库的用户名
spring.datasource.username=root
#连接数据库的密码
spring.datasource.password=123456
#配置mybatis的日志, 指定输出到控制台
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
#开启mybatis的驼峰命名自动映射开关 a_column ------> aCloumn
mybatis.configuration.map-underscore-to-camel-case=true

准备对应的Mapper、Service(接口、实现类)、Controller基础结构

image-20231126113932247

开发规范

案例基于当前最为主流的前后端分离模式进行开发

image-20231126114201493

开发规范-Restful

  • REST(REpresentational State Transfer),表述性状态转换,它是一种软件架构风格

image-20231126114802069

image-20231126114828145

注意事项

  • REST是风格,是约定方式,约定不是规矩,可以打破
  • 描述模块的功能通常使用复数,也就是加s的格式来描述,表示此类资源,而非单个资源。如:users、emps、books等
  • 前后端交互统一响应结果Result

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public class Result {
        private Integer code;//响应码,1 代表成功;0 代表失败
        private String msg;//响应信息 描述字符串
        private Object data;//返回的数据
    
        public static Result success() {//增删改 成功响应
            return new Result(1, "success", null);
        }
    
        public static Result success(Object data) {//增删改 成功响应
            return new Result(1, "success", data);
        }
    
        public static Result error(String msg) {//增删改 成功响应
            return new Result(0, msg, null);
        }
    
    }
    

开发流程

image-20231126121654739

部门管理

需求说明

部门管理页面 , 管理员可以对部门信息进行管理,包括新增、修改、删除部门信息等。

页面开发规则

  1. 部门查询

1.1 查询全部数据(由于部门数据比较少,不考虑分页)。

  1. 新增部门

1.1 点击新增部门,会打开新增部门的页面。

1.2 部门名称,必填,唯一,长度为2-10位。

  1. 删除部门

​ 弹出确认框 , 提示 “您确定要删除该部门的信息吗 ?” 如果选择确定 , 则删除该部门 , 删除成功后 , 重新刷新列表页面。 如果选择了 取消 , 则不执行任何操作。

查询部门

image-20231126123847051

思路

image-20231126122241806

DeptController.java

/**
 * @ClassName DeptController
 * @Description 部门管理的controller
 * @Author Bowen
 * @Date 2023/11/26 11:19
 * @Version 1.0
 **/
@Slf4j
@RestController
public class DeptController {
    @Autowired
    private DeptService deptService;
    @GetMapping("/depts")
    public Result list() {
        log.info("查询全部部门数据");
        //调用service查询部门数据
        List<Dept> deptList = deptService.list();
        return Result.success(deptList);
    }
}

注解

@Slf4j日志管理的注解

log.info("查询全部部门数据");调用该方法,控制台输出日志

@GetMapping("/depts")GET请求方法的注解

DeptService.java接口

/**
 * 部门管理
 */
public interface DeptService {
    /**
     * 查询全部数据
     * @return
     */
    List<Dept> list();
}

DeptServiceImpl.java部门接口实现类

/**
 * @ClassName DeptServiceImpl
 * @Description 部门 接口的实现类
 * @Author Bowen
 * @Date 2023/11/26 11:25
 * @Version 1.0
 **/
@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptMapper deptMapper;
    @Override
    public List<Dept> list() {
        return deptMapper.list();
    }
}

DeptMapper.java接口

/**
 * 部门管理
 */
@Mapper
public interface DeptMapper {
    /**
     * 查询全部部门
     * @return
     */
    @Select("select * from dept")
    List<Dept> list();
}

API测试

image-20231126140412602

前后端联调

  • 将资料中提供的“前端工程”文件夹中的压缩包,拷贝到一个没有中文不带空格的目录下,解压。
  • 启动nginx,访问测试:http://localhost:90

image-20231126140552983

若使用自己下载的nginx,需要修改nginx安装目录的conf文件夹下的nginx.conf文件的配置内容(在我的电脑上启动nginx.exe都会闪退,是否运行成功,需要在任务管理器中查看)

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       90;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        location ^~ /api/ {
			rewrite ^/api/(.*)$ /$1 break;
			proxy_pass http://localhost:8080;
        }
        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

}

然后再将前端项目打包后的文件(dist文件夹下的所有文件)拷贝到nginx安装目录的html文件夹下

联调成功

image-20231126154717422

删除部门

需求

image-20231126164009048

思路

image-20231126164440283

DeptController.java

/**
 * 删除部门数据
 * @return
 */
@DeleteMapping("/depts/{id}")
public Result delete(@PathVariable Integer id){
    log.info("根据id删除部门:{}",id);
    //调用service删除部门
    deptService.delete(id);
    return Result.success();
}

DeptService.java接口

/**
 * 删除部门
 * @param id
 */
void delete(Integer id);

DeptServiceImpl.java部门接口实现类

@Override
public void delete(Integer id) {
    deptMapper.deleteById(id);
}

DeptMapper.java接口

/**
 * 根据ID删除部门
 *
 * @param id
 */
@Delete("delete from dept where id = #{id}")
void deleteById(Integer id);

API测试

image-20231126171026504

新增部门

需求

image-20231126171138611

思路

image-20231126171553593

实现

image-20231127003632179

@RequestParam的属性defaultValue可以来设置参数的默认值

DeptController.java

/**
 * 新增部门
 */
@PostMapping("/depts")
public Result add(@RequestBody Dept dept) {
    log.info("新增一个部门:{}", dept);
    deptService.add(dept);
    return Result.success();
}

DeptService.java接口

/**
 * 新增部门
 * @param dept
 */
void add(Dept dept);

DeptServiceImpl.java部门接口实现类

@Override
public void add(Dept dept) {
    dept.setCreateTime(LocalDateTime.now());
    dept.setUpdateTime(LocalDateTime.now());
    deptMapper.insert(dept);
}

DeptMapper.java接口

/**
 * 插入一条部门信息
 * @param dept
 */
@Insert("insert into dept(name, create_time, update_time) values (#{name}, #{createTime}, #{updateTime})")
void insert(Dept dept);

API测试

image-20231126174239203

@RequestMapping

image-20231126174459084

注意事项

  • 一个完整的请求路径,应该是类上的@RequestMapping的value属性+方法上的@RequestMapping的value属性。

修改部门

1、实现数据回显

根据ID查询

请求路径:/depts/{id}
请求方式:GET
接口描述:该接口用于根据ID查询部门数据

请求参数

参数格式:路径参数

参数说明:

image-20231126194305745

响应数据

参数格式:application/json

参数说明:

image-20231126194412240

响应数据样例:

{
"code": 1,
"msg": "success",
"data": {
    "id": 1,
    "name": "学工部",
    "createTime": "2022-09-01T23:06:29",
    "updateTime": "2022-09-01T23:06:29"
}
}

DeptController.java

/**
 * 根据ID查询部门数据
 */
@GetMapping("/{id}")
public Result get(@PathVariable Integer id) {
    log.info("根据id查部门:{}", id);
    Dept dept = deptService.get(id);
    return Result.success(dept);
}

DeptService.java接口

/**
 * 查询id
 * @param id
 * @return
 */
Dept get(Integer id);

DeptServiceImpl.java部门接口实现类

@Override
public Dept get(Integer id) {
    Dept dept = deptMapper.getById(id);
    return dept;
}

DeptMapper.java接口

/**
 * 查找id
 * @param id
 * @return
 */
@Select("select * from dept where id = #{id}")
Dept getById(Integer id);

测试点击编辑出现部门名称

image-20231126194959456

2、修改部门

基本信息

请求路径:/depts
请求方式:PUT
接口描述:该接口用于修改部门数据

请求参数

格式:application/json

参数说明:

image-20231126195158426

请求参数样例:

{
"id": 1,
"name": "教研部"
}

响应数据

参数格式:application/json

参数说明:

image-20231126195333592

响应数据样例:

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

DeptController.java

/**
 * 更新部门
 */
@PutMapping
public Result update(@RequestBody Dept dept) {
    log.info("根据id修改部门:{}", dept.getId());
    deptService.update(dept);
    return Result.success();
}

DeptService.java接口

/**
 * 更新部门
 * @param dept
 */
void update(Dept dept);

DeptServiceImpl.java部门接口实现类

@Override
public void update(Dept dept) {
    dept.setUpdateTime(LocalDateTime.now());
    deptMapper.update(dept);
}

DeptMapper.java接口

/**
 * 更新部门信息
 * @param dept
 */
@Update("update dept set name = #{name}, update_time = #{updateTime} where id = #{id}")
void update(Dept dept);

测试-修改成功

image-20231126195701919

小结

部门管理

  • 查询部门 @GetMapping
  • 删除部门 @DeleteMapping
  • 新增部门 @PostMapping
  • 修改部门 @PostMapping-根据ID查询、PutMapping-修改部门

员工管理

分页查询

需求

image-20231126215439693

image-20231126215746489

思路

image-20231126220527203

pageBean.java分页查询结果封装类

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageBean {
    private Long total;//总记录数
    private List<Emp> rows;//数据列表
}

EmpController.java员工管理的controller

@Slf4j
@RestController
public class EmpController {
    @Autowired
    private EmpService empService;

    @GetMapping("/emps")
    public Result page(@RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer pageSize) {
        log.info("分页查询,参数:{},{}", page, pageSize);
        //掉用service分页查询
        PageBean pageBean = empService.page(page, pageSize);
        return Result.success(pageBean);
    }
}

EmpService.java员工管理service层

public interface EmpService {
    /**
     * 分页查询
     * @param page
     * @param pageSize
     * @return
     */
    PageBean page(Integer page, Integer pageSize);
}

EmpServiceImpl.java员工 接口实现类

@Service
public class EmpServiceImpl implements EmpService {
    @Autowired
    private EmpMapper empMapper;

    @Override
    public PageBean page(Integer page, Integer pageSize) {
        //1. 获取总记录数
        Long count = empMapper.count();
        //2. 获取分页查询结果列表
        Integer start = (page - 1) * pageSize;
        List<Emp> empList = empMapper.page(start, pageSize);
        //3. 封装PageBean对象
        PageBean pageBean = new PageBean(count, empList);
        return pageBean;
    }
}

EmpMapper.java员工管理mapper层,可能是mybatis版本不同,需要添加@Param("start")@Param("pageSize"),可参考MyBatis框架_01中的参数名说明(http://t.csdnimg.cn/1ovab)

@Mapper
public interface EmpMapper {
    //查询总记录数
    @Select("select count(*) from emp")
    public Long count();

    //分页查询获取列表数据的方法
    @Select("select * from emp limit #{start}, #{pageSize}")
    public List<Emp> page(@Param("start") Integer start, @Param("pageSize") Integer pageSize);
}

API测试(无参)localhost:8080/emps

image-20231127002823590

API测试(带参)localhost:8080/emps?page=3&pageSize=5

image-20231127003015694

前端进行联调

image-20231127003518462

小结

1、分页查询

  • 请求参数:页码、每页展示记录数
  • 响应结果:总记录数 、结果列表(PageBean)

2、注解

@RequestParam(defaultValue="1")//设置请求参数默认值
分页插件PageHelper

image-20231127112643682

image-20231127112732487

实现

pom.xml引入依赖

<!--PageHelper分页插件-->
<dependency>
    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper-spring-boot-starter</artifactId>
    <version>1.4.6</version>
</dependency>

EmpMapper.java 接口

@Select("select * from tlias.emp")
public List<Emp> list();

EmpServiceIml.java员工 接口的实现类

@Override
public PageBean page(Integer page, Integer pageSize) {
    //1. 设置分页参数
    PageHelper.startPage(page, pageSize);
    //2. 执行查询
    List<Emp> empList = empMapper.list();
    Page<Emp> p = (Page<Emp>) empList;
    //3. 封装PageBean对象
    PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
    return pageBean;
}

API测试

image-20231127115226597

查看控制台,SELECT count(0) FROM tlias.empselect * from tlias.emp LIMIT ?都是分页插件PageHelper生成的,

image-20231127115437376

进行前后端联调

image-20231127120035377

小结

PageHelper分页插件

  • 引入依赖:pagehelper-spring-boot-starter

  • 使用:

    PageHelper.startPage(pageNum, pageSize);
    List<Emp> List = empMapper.list();
    Page<Emp> p = (Page<Emp>) List;
    

分页查询(带条件)

需求

image-20231127133944120

思路

image-20231127140208911

请求参数

参数格式:queryString

参数说明:

image-20231127140438551

EmpController.java员工管理的controller层

@Slf4j
@RestController
public class EmpController {
    @Autowired
    private EmpService empService;

    @GetMapping("/emps")
    public Result page(@RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer pageSize,
                       String name, Short gender,
                       @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,
                       @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end) {
        log.info("分页查询,参数:{},{},{},{},{},{}", page, pageSize, name, gender, begin, end);
        //掉用service分页查询
        PageBean pageBean = empService.page(page, pageSize, name, gender, begin, end);
        return Result.success(pageBean);
    }
}

EmpService.java员工管理的service层

public interface EmpService {
	//分页查询
    PageBean page(Integer page, Integer pageSize, String name, Short gender, LocalDate begin, LocalDate end);
}

EmpServiceImpl.java员工 service接口的实现类

@Service
public class EmpServiceImpl implements EmpService {
    @Autowired
    private EmpMapper empMapper;

    @Override
    public 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(name, gender, begin, end);
        Page<Emp> p = (Page<Emp>) empList;
        //3. 封装PageBean对象
        PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
        return pageBean;
    }
}

EmpMapper.java员工Mapper层接口

@Mapper
public interface EmpMapper {
    //员工信息查询
    public List<Emp> list(@Param("name") String name, @Param("gender") Short gender,
                          @Param("begin") LocalDate begin, @Param("end") LocalDate end);
}

resource/com/bowen/mapper/EmpMapper.xml使用动态SQL-XML映射文件

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bowen.mapper.EmpMapper">
    <!--  条件查询  -->
    <select id="list" resultType="com.bowen.pojo.Emp">
        select *
        from tlias.emp
        <where>
            <if test="name != null and name != ''">
                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>

API测试,尽量测试的全面一些,以方便bug的修复

使用get请求

localhost:8080/emps?page=1&pageSize=5&name=张&gender=1&begin=2000-01-01&end=2010-01-01

localhost:8080/emps?page=1&pageSize=5&name=张&gender=1

localhost:8080/emps?page=1&pageSize=5&gender=1

localhost:8080/emps?name=张&gender=1

localhost:8080/emps?gender=1

image-20231127152129513

在前端进行联调

image-20231127152233670

删除员工

需求

image-20231127152524323

接口文档

基本信息

请求路径:/emps/{ids}

请求方式:DELETE

接口描述:该接口用于批量删除员工的数据信息

请求参数

参数格式:路径参数

参数说明:

image-20231127152749167

思路

image-20231127153253080

EmpController.java

@DeleteMapping("/{ids}")
public Result delete(@PathVariable List<Integer> ids) {
    log.info("批量删除操作,ids:{}", ids);
    empService.delete(ids);
    return Result.success();
}

EmpService.java员工service层接口

/**
 * 批量删除操作
 * @param ids
 */
void delete(List<Integer> ids);

EmpServiceImpl.java员工 接口的实现类

@Override
public void delete(List<Integer> ids) {
    empMapper.delete(ids);
}

EmpMapper.java员工Mapper层接口

/**
 * 批量删除
 * @param ids
 */
void delete(@Param("ids") List<Integer> ids);

resource/com/bowen/mapper/EmpMapper.xml使用动态SQL-XML映射文件

<!--批量删除(1, 2, 3)-->
<delete id="delete">
    delete
    from tlias.emp
    where id in
    <foreach collection="ids" item="id" separator="," open="(" close=")">
        #{id}
    </foreach>
</delete>

API测试

image-20231127155528180

IDEA控制台中的日志,说明id=1,2,3的员工删除成功

image-20231127155720654

前端联调,删除 张三丰、方东白

image-20231127155952371

日志

image-20231127160153068

a`

@DeleteMapping("/{ids}")
public Result delete(@PathVariable List<Integer> ids) {
    log.info("批量删除操作,ids:{}", ids);
    empService.delete(ids);
    return Result.success();
}

EmpService.java员工service层接口

/**
 * 批量删除操作
 * @param ids
 */
void delete(List<Integer> ids);

EmpServiceImpl.java员工 接口的实现类

@Override
public void delete(List<Integer> ids) {
    empMapper.delete(ids);
}

EmpMapper.java员工Mapper层接口

/**
 * 批量删除
 * @param ids
 */
void delete(@Param("ids") List<Integer> ids);

resource/com/bowen/mapper/EmpMapper.xml使用动态SQL-XML映射文件

<!--批量删除(1, 2, 3)-->
<delete id="delete">
    delete
    from tlias.emp
    where id in
    <foreach collection="ids" item="id" separator="," open="(" close=")">
        #{id}
    </foreach>
</delete>

API测试

在这里插入图片描述

IDEA控制台中的日志,说明id=15,16,17的员工删除成功

image-20231127155720654

前端联调,删除 张三丰、方东白

image-20231127155952371

日志

在这里插入图片描述

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

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

相关文章

神经网络核心组件和流程梳理

文章目录 神经网络核心组件和流程梳理组件流程 神经网络核心组件和流程梳理 组件 层&#xff1a;神经网络的基本结构&#xff0c;将输入张量转换为输出张量。模型&#xff1a;由层构成的网络。损失函数&#xff1a;参数学习的目标函数&#xff0c;通过最小化损失函数来学习各…

HCIP-十一、BGP反射器和联盟

十一、BGP反射器和联盟 实验拓扑实验需求及解法1.配置各设备的接口 IP 地址。2.BGPAS 规划3.BGP 反射器4.BGP 联盟5.ebgp 邻居6.bgp 路由汇总 实验拓扑 实验需求及解法 本实验模拟 BGP 综合网络拓扑&#xff0c;完成以下需求&#xff1a; 1.配置各设备的接口 IP 地址。 所有…

这些汽车托运套路你肯定不知道

这些汽车托运套路你肯定不知道 这些套路你肯定不知道.. 学会这三招 汽车托运不怕吃亏 1 看营业执照 首先确定选择的托运公司是否有保障 要求公司出示营业执照和道路运输经营许可证 如果都没有 那就很有可能是无牌照的小作坊!! 这种出问题就肯定没保障 2 保险跟合同 一车一合同 …

安卓系统修图软件(三)

在之前的推送里面&#xff0c;博主分享过两期关于安卓手机的优质修图软件&#xff0c;今天&#xff0c;博主将带来第三期的分享&#xff0c;这也将是该栏目的最后一期。 之前的8款软件&#xff0c;都是以美化、滤镜的风格为主&#xff0c;今天博主带来的这3款&#xff0c;则是以…

数据结构与算法的精髓是什么?复杂度分析【数据结构与算法】

代码跑一遍存在什么问题&#xff1f;什么是 O 复杂度表示法&#xff1f;如何分析时间复杂度&#xff1f;常见时间复杂度量级有哪些&#xff1f;O(1)O(logn)O(n)O(nlogn)O(mn)O(m*n)O(n^2)O(2^n)O(n!)不同时间复杂度差距有多大&#xff1f;时间复杂度分析总结 如何分析空间复杂度…

2021年06月 Scratch图形化(四级)真题解析#中国电子学会#全国青少年软件编程等级考试

Scratch等级考试(1~4级)全部真题・点这里 一、单选题(共10题,每题2分,共20分) 第1题 执行下列程序,输出的结果为? A:12 B:24 C:8 D:30 答案:B 第2题 执行下列程序,角色说出的内容是? A:2 B:3 C:4 D:5 答案:A 第3题 执行下列程序,输出结果为?

Spring Security 6.x 系列(5)—— Servlet 认证体系结构介绍

一、前言 本章主要学习Spring Security中基于Servlet 的认证体系结构&#xff0c;为后续认证执行流程源码分析打好基础。 二、身份认证机制 Spring Security提供个多种认证方式登录系统&#xff0c;包括&#xff1a; Username and Password&#xff1a;使用用户名/密码 方式…

接口测试:Jmeter和Postman测试方法对比

前阶段做了一个小调查&#xff0c;发现软件测试行业做功能测试和接口测试的人相对比较多。在测试工作中&#xff0c;有高手&#xff0c;自然也会有小白&#xff0c;但有一点我们无法否认&#xff0c;就是每一个高手都是从小白开始的&#xff0c;所以今天我们就来谈谈一大部分人…

Leetcode98 验证二叉搜索树

题意理解&#xff1a; 首先明确二叉树的定义&#xff0c;对于所有节点&#xff0c;根节点的值大于左子树所有节点的值&#xff0c;小于右子树所有节点的值。 注意一个误区&#xff1a; 根节点简单和左孩子&#xff0c;右孩子比大小是不够的&#xff0c;要和子树比&#xff0c;…

30.0/集合/ArrayList/LinkedList

目录 30.1什么是集合? 30.1.2为什么使用集合 30.1.3自己创建一个集合类 30.1.3 集合框架有哪些? 30.1.2使用ArrayList集合 30.2增加元素 30.3查询的方法 30.4删除 30.5 修改 30.6泛型 30.1什么是集合? 我们之前讲过数组&#xff0c;数组中它也可以存放多个元素。集合…

C++基础 -6-二维数组,数组指针

二维数组在内存中的存放方式和一维数组完全相同 下表把二维数组抽象成了行列形式方便理解 a[0]指向第一行首元素地址 a指向第一行的首地址 所以a地址和a[0]地址相同,因为起点相同 但a[0]1往右偏移 但a1往下方向偏移 方便理解 an控制行 a[0]n控制列(相当于*an) 数组指针指向二…

【EI会议投稿】第四届物联网与智慧城市国际学术会议(IoTSC 2024)

第四届物联网与智慧城市国际学术会议 2024 4th International Conference on Internet of Things and Smart City 继IoTSC前三届的成功举办&#xff0c;第四届物联网与智慧城市国际学术会议&#xff08;IoTSC 2024&#xff09;将于2024年3月22-24日在河南洛阳举办。 智慧城市的…

Redis常用操作及应用(二)

一、Hash结构 1、常用操作 HSET key field value //存储一个哈希表key的键值 HSETNX key field value //存储一个不存在的哈希表key的键值 HMSET key field value [field value ...] //在一个哈希表key中存储多个键值对 HGET key fie…

二叉树OJ题讲解之一

今天我们一起来做一道初级的二叉树OJ题&#xff0c;都是用递归思想解答 力扣965.单值二叉树 链接https://leetcode.cn/problems/univalued-binary-tree/description/ 所谓单值二叉树就是这棵二叉树的所有节点的值是相同的&#xff0c;那我们要做这道题&#xff0c;肯定要…

sql注入靶场

第一关&#xff1a; 输入&#xff1a;http://127.0.0.1/sqli-labs-master/Less-1/?id1 http://127.0.0.1/sqli-labs-master/Less-1/?id1%27 http://127.0.0.1/sqli-labs-master/Less-1/?id1%27-- 使用--来闭合单引号&#xff0c;证明此处存在字符型的SQL注入。 使用order …

mybatis collection 错误去重

一、需求背景 一条银行产品的需求&#xff0c;不同阶段&#xff0c;可能对应不同的银行(也有可能是同一个银行处理不同的阶段)去处理&#xff0c;如&#xff1a; 发布阶段: —> A银行处理立项阶段: —> B银行处理审核阶段: —> A银行处理出账阶段: —> C银行处理 …

第二十章——多线程

Windows操作系统是多任务操作系统&#xff0c;它以进程为单位。一个进程是一个包含有自身地址的程序&#xff0c;每个独立执行的程序都称为进程。也就是说每个正在执行的程序都是一个进程。系统可以分配给每一个进程有一段有限的使用CPU的时间&#xff08;也可以称为CPU时间片&…

YOLOv8独家原创改进: AKConv(可改变核卷积),即插即用的卷积,效果秒杀DSConv | 2023年11月最新发表

💡💡💡本文全网首发独家改进:可改变核卷积(AKConv),赋予卷积核任意数量的参数和任意采样形状,为网络开销和性能之间的权衡提供更丰富的选择,解决具有固定样本形状和正方形的卷积核不能很好地适应不断变化的目标的问题点,效果秒殺DSConv 1)AKConv替代标准卷积进行…

第二十章总结

继承Thread 类 Thread 类时 java.lang 包中的一个类&#xff0c;从类中实例化的对象代表线程&#xff0c;程序员启动一个新线程需要建立 Thread 实例。 Thread 对象需要一个任务来执行&#xff0c;任务是指线程在启动时执行的工作&#xff0c;start() 方法启动线程&…

什么是交流负载的特点和特性?

交流负载往往存在不平衡的特性&#xff0c;即三相电流和电压的幅值和相位存在差异。这是由于不同负载的性质和使用情况不同导致的&#xff0c;交流负载的功率因数是描述负载对电网的有功功率需求和无功功率需求之间关系的重要参数。功率因数可以分为正功率因数和负功率因数&…