当前位置: 首页 > news >正文

案例01-tlias智能学习辅助系统01-增删改查+参数传递

目录

1、需求说明:实现对部门表和员工表的增删改查 

2、环境搭建

3、部门管理

3.1 查询部门

3.2 前后端联调

3.3 删除部门

3.4 新增部门

3.5 根据ID查询数据

3.5 修改部门

 总结(Controller层参数接收):

4、员工管理

4.1 分页查询

4.2 分页查询插件-PageHelper

4.3 分页查询(带条件)

4.4 删除员工

4.5 新增员工


该项目是在看完黑马2023年JavaWeb视频,跟着做的一个简单的SpringBoot项目

基于前后端分离模式进行开发,会遵循接口文档的开发规范

开发流程:

1、需求说明:实现对部门表和员工表的增删改查 

2、环境搭建

1 准备数据库表(dept、emp)

在本地创建tlias数据库,并复制资料中的两张表

2 创建SpringBoot工程

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>tlias</artifactId><version>1.0-SNAPSHOT</version><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.2.7.RELEASE</version></parent><dependencies><!--        mybatis的起步依赖--><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.2.2</version></dependency><!--        mysql 驱动包--><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><scope>runtime</scope></dependency><!--        springboot单元测试--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-test</artifactId></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency></dependencies></project>

 启动类tliasquickstartapplication:

package pearl;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication//具有包扫描作用,默认扫描当前包及其子包,即demo01
public class tliasquickstartapplication {public static void main(String[] args) {SpringApplication.run(tliasquickstartapplication.class,args);}}

测试类tliasquickstartapplicationTest: 

package pearl;import org.springframework.boot.test.context.SpringBootTest;@SpringBootTest //springboot整合单元测试的注解
public class tliasquickstartapplicationTest {}

application.properties配置文件

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

创建实体类Emp、Dept

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

3、部门管理

3.1 查询部门

EmpController: 首先返回一个空的数据测试端口号

@Slf4j //定义一个日志记录对象  等价于下面对log对象的定义1.
@RestController
public class DeptController {
//    1.定义一个日志记录对象
//    1.private static Logger log = LoggerFactory.getLogger(DeptController.class);//    @RequestMapping(value = "/depts",method = RequestMethod.GET)//指定请求方式为get@GetMapping("/depts")// 指定`/depts`路由的请求方式为get 与上一行代码等价public Result list(){log.info("查询全部部门数据");return Result.success();}
}

 然后运行启动类,在postman中测试:

没毛病,然后定义一个Service层对象,调用Service层方法查询数据

package pearl.controller;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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import pearl.pojo.Dept;
import pearl.pojo.Result;
import pearl.service.DeptService;import java.util.List;@Slf4j //定义一个日志记录对象  等价于下面对log对象的定义1.
@RestController
public class DeptController {
//    1.定义一个日志记录对象
//    1.private static Logger log = LoggerFactory.getLogger(DeptController.class);@Autowired//定义一个Service层对象private DeptService deptService;//    @RequestMapping(value = "/depts",method = RequestMethod.GET)//指定请求方式为get@GetMapping("/depts")// 指定`/depts`路由的请求方式为get 与上一行代码等价public Result list(){log.info("查询全部部门数据");//      调用service查询部门数据List<Dept> deptList = deptService.list();//此时service层中还没定义该方法,需要返回Service层中定义该方法return Result.success(deptList);}
}

 此时DeptService中还没有查询全部数据的list()方法,所以现在去DeptService中定义list()接口

      /** 查询全部部门数据* */List<Dept> list();

然后去 DeptService中定义list()的实现方法

即定义一个mapper层对象,调用mapper层方法查询数据

package pearl.service.impl;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pearl.mapper.DeptMapper;
import pearl.pojo.Dept;import java.util.List;@Service
public class DeptService implements pearl.service.DeptService {//    定义一个Mapper层对象@Autowiredprivate DeptMapper deptMapper;@Overridepublic List<Dept> list() {List<Dept> deptList = deptMapper.list();//此时service层中还没定义该方法,需要返回Service层中定义该方法return deptList;}
}

此时mapper层中没有list()方法,需要我们现在去DeptMapper中定义list()接口

   /** 查询全部部门数据* */@Select("select * from dept")List<Dept> list();

由于该SQL语句较简单,所以直接使用注解方式配置

现在需要按mapper-->service--->controller的路径去查看返回数据是否正确

然后运行启动类,查看查询结果

 完成!

3.2 前后端联调

前后端联调:将前端工程、后端工程都启动起来,然后访问前端工程,通过前端工程访问服务程序,进而进行调试

        1.将资料中提供的“前端工程”文件中的压缩包,拷贝到一个没有中文不带空格的目录下,解压

        2.启动nginx,访问测试:http://localhost:90  --ngix占用的是90端口

点击文件中的nginx.exe

 然后通过任务管理器的详细信息查看nginx是否启动完成

然后在浏览器访问http://localhost:90:进入前端页面

3.3 删除部门

EmpController:编写删除函数,调用Service删除接口

//    删除@DeleteMapping("/depts/{id}")public Result delete(@PathVariable Integer id){ //@PathVariable 表示绑定路径中的参数idlog.info("删除id为"+id+"的数据");deptService.delete(id);return Result.success();}

@PathVariable

可以将 URL 中占位符参数绑定到控制器处理方法的入参中:

URL 中的 {xxx} 占位符可以通过@PathVariable(“xxx“) 绑定到操作方法的入参中 

 EmpService接口:

    /** 根据ID删除数据* */void delete(Integer id);

 EmpService实现类:编写删除函数,调用mapper 层删除接口

    @Overridepublic void delete(Integer id){deptMapper.delete(id);return ;}

EmpMapper: 编写删除接口,与SQL语句

    @Delete("delete from dept where id = #{id}")void delete(Integer id);

启动测试类,在postman中测试接口: 

 完成!

3.4 新增部门

新增部门逻辑与前面相似

注意:新增部门时,使用@RequestBody 将请求参数封装到实体类中,再在service层的实现方法类中补全实体类的属性值,在执行插入到数据库的操作

EmpController:

//    新增部门@PostMapping("/depts")public Result insert(@RequestBody Dept dept){//@RequestBody 将获取到的请求参数封装到实体类dept中log.info("新增部门"+dept);deptService.insert(dept);return Result.success();}

EmpService接口:

    /** 新增数据* */void insert(Dept dept);

 EmpService实现类:

    @Overridepublic void insert(Dept dept) {dept.setCreateTime(LocalDateTime.now());//补全dept中的属性dept.setUpdateTime(LocalDateTime.now());deptMapper.insert(dept);}

EmpMapper:

    @Insert("insert into dept (name,create_time,update_time) values(#{name},#{createTime},#{updateTime})")void insert(Dept dept);

运行完成!

3.5 根据ID查询数据

EmpController:

    /** 根据ID查询* */@GetMapping("/depts/{id}")public Result selectById(@PathVariable Integer id){log.info("获取id为"+id+"的数据");Dept dept = deptService.selectById(id);return Result.success(dept);}

注意:这里路径中携带参数,一定要使用@PathVariable注解,绑定 路径中的参数

EmpService接口:

    /** 根据ID查询数据* */Dept selectById(Integer id);

 EmpService实现类:

    @Overridepublic Dept selectById(Integer id){Dept dept = deptMapper.selectById(id);return dept;}

EmpMapper :

    @Select("select * from dept where id = #{id}")Dept selectById(Integer id);

3.5 修改部门

EmpController:

    /** 修改部门* */@PutMapping("/depts")public Result update(@RequestBody Dept dept){log.info("修改部门"+dept);deptService.update(dept);return Result.success();}

EmpService接口:

    /** 修改部门* */void update(Dept dept);

EmpService实现类:

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

EmpMapper:

    @Update("update dept set name = #{name}, update_time = #{updateTime} where id = #{id}")void update(Dept dept);

完成! 

编辑之前:

 点击编辑:

 这里会自动回显,利用的是通过ID查询数据功能

编辑完成后:

 此时部门管理的操作已经完成了,返回来看我们DeptController文件中还可以优化;

优化前:

package pearl.controller;import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Insert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pearl.pojo.Dept;
import pearl.pojo.Result;
import pearl.service.DeptService;import java.util.List;@Slf4j //定义一个日志记录对象  等价于下面对log对象的定义1.
@RestController
public class DeptController {
//    1.定义一个日志记录对象
//    1.private static Logger log = LoggerFactory.getLogger(DeptController.class);@Autowired//定义一个Service层对象private DeptService deptService;/** 查询* */
//    @RequestMapping(value = "/depts",method = RequestMethod.GET)//指定请求方式为get@GetMapping("/depts")// 指定`/depts`路由的请求方式为get 与上一行代码等价public Result list(){log.info("查询全部部门数据");//      调用service查询部门数据List<Dept> deptList = deptService.list();//此时service层中还没定义该方法,需要返回Service层中定义该方法return Result.success(deptList);}/** 根据ID查询* */@GetMapping("/depts/{id}")public Result selectById(@PathVariable Integer id){log.info("获取id为"+id+"的数据");Dept dept = deptService.selectById(id);return Result.success(dept);}/** 删除* */@DeleteMapping("/depts/{id}")public Result delete(@PathVariable Integer id){ //@PathVariable 表示绑定路径中的参数idlog.info("删除id为"+id+"的数据");deptService.delete(id);return Result.success();}/** 新增部门* */@PostMapping("/depts")public Result insert(@RequestBody Dept dept){//@RequestBody 将获取到的请求参数封装到实体类dept中log.info("新增部门"+dept);deptService.insert(dept);return Result.success();}/** 修改部门* */@PutMapping("/depts")public Result update(@RequestBody Dept dept){log.info("修改部门"+dept);deptService.update(dept);return Result.success();}}

由于该文件下的路径都是在`/depts`路径下,所以就把这部分抽出类,简化代码

完整的请求路径为:类上@RequestMappering的路径+方法前的路径

简化后的代码如下 

 优化后:

package pearl.controller;import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Insert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pearl.pojo.Dept;
import pearl.pojo.Result;
import pearl.service.DeptService;import java.util.List;@Slf4j
@RequestMapping("/depts")
@RestController
public class DeptController {@Autowired//定义一个Service层对象private DeptService deptService;/** 查询* */@GetMapping// 指定`/depts`路由的请求方式为get 与上一行代码等价public Result list(){log.info("查询全部部门数据");//      调用service查询部门数据List<Dept> deptList = deptService.list();//此时service层中还没定义该方法,需要返回Service层中定义该方法return Result.success(deptList);}/** 删除* */@DeleteMapping("/{id}")public Result delete(@PathVariable Integer id){ //@PathVariable 表示绑定路径中的参数idlog.info("删除id为"+id+"的数据");deptService.delete(id);return Result.success();}/** 新增部门* */@PostMappingpublic Result insert(@RequestBody Dept dept){//@RequestBody 将获取到的请求参数封装到实体类dept中log.info("新增部门"+dept);deptService.insert(dept);return Result.success();}}

 总结(Controller层参数接收):

参数格式:路径参数

使用 @PathVariable 表示绑定路径中的参数id
eg1: @DeleteMapping("/{id}")public Result delete(@PathVariable Integer id)

参数格式:application/json

使用:@RequestBody 将获取到的请求参数封装到实体类中
eg: 请求参数是Dept类的部分属性值@PostMappingpublic Result insert(@RequestBody Dept dept)

参数格式:queryString

@RequestParam(defaultValue = "1")  设置默认值
下面的参数名称和类型一定要和文档中的保持一致,否则传输不了数据
eg: public Result selectByPage(@RequestParam(defaultValue = "1") Integer page,  @RequestParam(defaultValue = "5") Integer pageSize)

4、员工管理

4.1 分页查询

分页查询语法:

-- 参数1 b: 起始索引  = (页码-1)* l

-- 参数2 l: 查询返回记录数 = 每页展示的记录数

select * from emp limit b,l;

 首先查看接口文档,发现需要返回的数据类型是Json文件,包含总记录数和数据列表,

我们最好的选择就是把记录数和数据列表封装成一个实体类,然后再返回给前端

PageBean:

package pearl.pojo;import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;import java.util.List;@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageBean {private Long total;//总记录数private List rows;//数据列表
}

EmpController: //接收前端的请求参数,并返回Result型数据

package pearl.controller;import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pearl.pojo.PageBean;
import pearl.pojo.Result;
import pearl.service.EmpService;@RestController
@Slf4j
public class EmpController {@Autowiredprivate EmpService empService;/** 分页查询* */@GetMapping("/emps")       //@RequestParam(defaultValue = "1") 设置默认值public Result selectByPage(@RequestParam(defaultValue = "1") Integer page,  //注意这里的参数名称一定要和文档中的保持一致,否则肯传输不了数据@RequestParam(defaultValue = "5") Integer pageSize){log.info("查询数据:第{}页,{}条数据",page,pageSize);PageBean pageBean = empService.selectByPage(page,pageSize);return Result.success(pageBean);}
}

 EmpService接口:

     /** 分页查询* */PageBean selectByPage(Integer page, Integer pageSize);

EmpService实现类:

    @Autowiredprivate EmpMapper empMapper;/** 分页查询* */@Overridepublic PageBean selectByPage(Integer page, Integer pageSize) {List<Emp> rows = empMapper.selectByPage((page-1)*pageSize,pageSize);Long total = empMapper.count();final PageBean pageBean = new PageBean(total,rows);return pageBean;}

EmpMapper:

    /** 分页查询,获取列表数据* */@Select("select * from emp limit #{page},#{pageSize}")List<Emp> selectByPage(Integer page, Integer pageSize);/** 查询记录数* */@Select("select count(*) from emp")Long count();

 完成!

4.2 分页查询插件-PageHelper

使用PageHelper插件实现分页查询功能

pom文件中导入依赖

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

 EmpController 与EmpService接口代码不变

EmpService实现类:

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

EmpMapper:

    /** 分页查询-使用PageHelper插件* */@Select("select * from emp")public List<Emp> list();

 完成!

4.3 分页查询(带条件)

 条件如上所示:我们需要更改EmpController中的参数

EmpController:

    @GetMapping("/emps")       //@RequestParam(defaultValue = "1") 设置默认值public Result selectByPage(@RequestParam(defaultValue = "1") Integer page,  //注意这里的参数名称一定要和文档中的保持一致,否则肯传输不了数据@RequestParam(defaultValue = "5") Integer pageSize,String name, Short gender,@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,//@DateTimeFormat指定日期格式@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end){log.info("查询数据:第{}页,{}条数据,{},{},{},{}",page,pageSize,name,gender,begin,end);PageBean pageBean = empService.selectByPage(page,pageSize,name,gender,begin,end);return Result.success(pageBean);}

EmpService接口:也需要增加参数

    /** 分页查询-带条件* */PageBean selectByPage(Integer page, Integer pageSize, String name, Short gender,LocalDate begin, LocalDate end);

EmpService实现类:参数

    @Overridepublic PageBean selectByPage(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. 封装成bean对象PageBean pageBean = new PageBean(p.getTotal(),p.getResult());return pageBean;}

EmpMapper接口:

    public List<Emp> list(String name, Short gender,LocalDate begin, LocalDate end);

由于条件参数非必须传递,所以使用动态SQL,配置在XML文件中

EmpMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pearl.mapper.EmpMapper"><select id="list" resultType="pearl.pojo.Emp">select * from 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></select>
</mapper>

 完成!

4.4 删除员工

具体代码如下,不做过多描述 

4.5 新增员工

具体代码如下,不做过多描述 

相关文章:

案例01-tlias智能学习辅助系统01-增删改查+参数传递

目录 1、需求说明&#xff1a;实现对部门表和员工表的增删改查 2、环境搭建 3、部门管理 3.1 查询部门 3.2 前后端联调 3.3 删除部门 3.4 新增部门 3.5 根据ID查询数据 3.5 修改部门 总结&#xff08;Controller层参数接收&#xff09;&#xff1a; 4、员工管理 4.…...

Spring之Bean的配置与实例

Spring之Bean的配置与实例 一、Bean的基础配置1. Bean基础配置【重点】配置说明代码演示运行结果 2. Bean别名配置配置说明代码演示打印结果 3. Bean作用范围配置【重点】配置说明代码演示打印结果 二、Bean的实例化1. Bean是如何创建的2. 实例化Bean的三种方式2.1 构造方法方式…...

“不保留活动”打开,导致app返回前台崩溃问题解决

问题描述 不保留活动开关打开&#xff0c;把app切入后台&#xff0c;会导致当前展示的Activity被回收&#xff0c;切到前台后重建。 我们有个业务场景是&#xff0c;Activity里面有个ViewPager2&#xff0c;VP里面放Fragment&#xff0c;Fragment的展示需要在Activity中做一些…...

解读vue3源码(3)——watch

Vue3的watch底层源码主要是通过使用Proxy对象来实现的。在Vue3中&#xff0c;每个组件实例都会有一个watcher实例&#xff0c;用于监听组件数据的变化。当组件数据发生变化时&#xff0c;watcher实例会触发回调函数&#xff0c;从而更新组件的视图。 Vue3的watch底层源码主要涉…...

优秀简历的HR视角:怎样打造一份称心如意的简历?

简历的排版应该简洁工整&#xff0c;注重细节。需要注意对齐和标点符号的使用&#xff0c;因为在排版上的细节需要下很大功夫。除此之外&#xff0c;下面重点讲述几点简历内容需要注意的地方。 要点1&#xff1a;不相关的不要写。 尤其是与应聘岗位毫不相关的实习经历&#x…...

系统集成项目管理工程师——考试重点(三)项目管理一般知识

1.项目定义&#xff1a; 为达到特定的目的&#xff0c;使用一定资源&#xff0c;在确定的期间内&#xff0c;为特定发起人提供独特的产品、服务或成果而进行的一系列相互关联的活动的集合。 2.项目目标&#xff1a; 成果性目标&#xff1a;项目产品本身 约束性目标&…...

为什么医疗保健需要MFT来帮助保护EHR文件传输

毫无疑问&#xff0c;医疗保健行业需要EHR技术来处理患者&#xff0c;设施&#xff0c;提供者等之间的敏感患者信息。但是&#xff0c;如果没有安全的MFT解决方案&#xff0c;您将无法安全地传输患者文件&#xff0c;从而使您的运营面临遭受数据泄露&#xff0c;尴尬&#xff0…...

对项目总体把控不足,项目经理应该怎么办?

公司现状&#xff1a;项目人员紧缺&#xff0c;只有两人了解此项目技术细节&#xff0c;其中一个不常驻现场&#xff0c;另一个是执行项目经理李伟。 项目经理王博是公司元老&#xff0c;同时负责多个项目&#xff0c;工作比较忙&#xff0c;不常驻现场&#xff0c;没有参加过…...

【学习笔记】CF603E Pastoral Oddities

先不考虑数据结构部分&#xff0c;尝试猜一下结论。 结论&#xff1a;一个连通块有解当且仅当连通块的度数为偶数。 然后这题要你最大边权最小。最无脑的方法就是直接上 lct \text{lct} lct。真省事啊 我第一眼想到的还是整体二分。这玩意非常好写。 但是为什么也可以用线段…...

如何使用ESP32-CAM构建一个人脸识别系统

有许多人识别系统使用签名、指纹、语音、手部几何、人脸识别等来识别人&#xff0c;但除了人脸识别系统。 人脸识别系统不仅可以用于安全目的来识别公共场所的人员&#xff0c;还可以用于办公室和学校的考勤目的。 在这个项目中&#xff0c;我们将使用 ESP32-CAM 构建一个人脸识…...

JavaWeb分页条件查询参数特殊字符处理

问题背景 在项目开发过程中&#xff0c;基本都会有列表条件查询&#xff0c;例如用户管理会有通过用户姓名模糊查询用户&#xff0c;课程管理会有课程名称模糊查询课程等等。 而查询过程中如果用户在界面上输入一些特殊字符&#xff0c;例如&#xff1a;%_等等&#xff0c;这…...

ubuntu18服务安装

一、JDK安装 将jdk解压缩到该目录 /opt/ sudo tar -zxvf jdk-8u261-linux-x64.tar.gz -C /opt/ #重命名 cd /opt sudo mv jdk-8u261-linux-x64 jdk_8 修改环境变量 sudo vi ~/.bashrc #在文件最后追加以下文本 #进入编辑器后输入以下指令&#xff1a; #1. G //将光标移到最后一…...

这些使用工具大推荐,现在知道不晚

1.Snip Snip是一款截图软件&#xff0c;它突出的优点就是可以制作滚动截图。 例如&#xff1a;对整个网页进行截图&#xff0c;使用Snip即可轻松获取&#xff0c;无需处理水印。 2.Sleep Cycle 快节奏、高压力的生活导致我们越来越晚睡觉&#xff0c;睡眠质量越来越差。 想提…...

【Java|golang】1048. 最长字符串链

给出一个单词数组 words &#xff0c;其中每个单词都由小写英文字母组成。 如果我们可以 不改变其他字符的顺序 &#xff0c;在 wordA 的任何地方添加 恰好一个 字母使其变成 wordB &#xff0c;那么我们认为 wordA 是 wordB 的 前身 。 例如&#xff0c;“abc” 是 “abac”…...

Hive基础和使用详解

文章目录 一、启动hive1. hive启动的前置条件2. 启动方式一: hive命令3. 方式二:使用jdbc连接hive 二、Hive常用交互命令1. hive -help 命令2. hive -e 命令3. hive -f 命令4. 退出hive窗口5. 在hive窗口中执行dfs -ls /&#xff1b; 三、Hive语法1.DDL语句1.1 创建数据库1.2 两…...

c/c++:栈帧,传值,传址,实参传值给形参,传地址指针给形参

c/c&#xff1a;栈帧&#xff0c;传值&#xff0c;传址&#xff0c;实参传值给形参&#xff0c;传地址指针给形参 2022找工作是学历、能力和运气的超强结合体&#xff0c;遇到寒冬&#xff0c;大厂不招人&#xff0c;此时学会c的话&#xff0c; 我所知道的周边的会c的同学&…...

玩元宇宙血亏后 蓝色光标梭哈AI也挺悬

蓝色光标2022年年度报告出炉&#xff0c;巨亏21.75 亿元&#xff0c;其中20.38亿亏损因商誉、无形资产及其他资产减值造成&#xff0c;而在实际亏损业务中&#xff0c;元宇宙占比不小。 蓝色光标在元宇宙领域的布局&#xff0c;主要通过三家子公司实施&#xff0c;分别为蓝色宇…...

生物---英文

标题 前言必学场景词汇及用法鸟类昆虫类哺乳类爬行类情境常用单词鸟类虫类哺乳类两栖类与爬行类分类与动物相关的习语前言 加油 必学场景词汇及用法 鸟类 1bird [b[插图]d] n.鸟bird’s-eye-view[ˈb[插图]dzaɪˌvju]adj.鸟瞰图的a bird’s-eye view鸟瞰a flock of bird…...

ENVI 国产高分2号(GF-2)卫星数据辐射定标 大气校正 影像融合

1.数据 高分2号卫星数据&#xff0c;包含&#xff1a; MSS-1\2多光谱数据&#xff0c;4m分辨率&#xff1b; Pan-1\2全色波段数据&#xff0c;0.8m分辨率。 2.处理软件 ENVI5.3 国产插件下载地址&#xff1a;ENVI App Store (geoscene.cn) 首先下载插件文件&#xff1b; …...

操作系统考试复习——第二章 进程控制 同步与互斥

进程控制一般是由OS中的原语来实现的。 大多数OS内核都包含了两大方面的功能&#xff1a; 1.支撑功能&#xff1a;1)中断处理 2)时钟管理 3)原语操作(原语操作就是原子操作。所谓原子操作就是一个操作中所有动作要不全做要不全不做) 2.资源管理功能&#xff1a;1)进程管理…...

CVPR 2025 MIMO: 支持视觉指代和像素grounding 的医学视觉语言模型

CVPR 2025 | MIMO&#xff1a;支持视觉指代和像素对齐的医学视觉语言模型 论文信息 标题&#xff1a;MIMO: A medical vision language model with visual referring multimodal input and pixel grounding multimodal output作者&#xff1a;Yanyuan Chen, Dexuan Xu, Yu Hu…...

MySQL 隔离级别:脏读、幻读及不可重复读的原理与示例

一、MySQL 隔离级别 MySQL 提供了四种隔离级别,用于控制事务之间的并发访问以及数据的可见性,不同隔离级别对脏读、幻读、不可重复读这几种并发数据问题有着不同的处理方式,具体如下: 隔离级别脏读不可重复读幻读性能特点及锁机制读未提交(READ UNCOMMITTED)允许出现允许…...

pam_env.so模块配置解析

在PAM&#xff08;Pluggable Authentication Modules&#xff09;配置中&#xff0c; /etc/pam.d/su 文件相关配置含义如下&#xff1a; 配置解析 auth required pam_env.so1. 字段分解 字段值说明模块类型auth认证类模块&#xff0c;负责验证用户身份&am…...

(二)原型模式

原型的功能是将一个已经存在的对象作为源目标,其余对象都是通过这个源目标创建。发挥复制的作用就是原型模式的核心思想。 一、源型模式的定义 原型模式是指第二次创建对象可以通过复制已经存在的原型对象来实现,忽略对象创建过程中的其它细节。 📌 核心特点: 避免重复初…...

【Zephyr 系列 10】实战项目:打造一个蓝牙传感器终端 + 网关系统(完整架构与全栈实现)

🧠关键词:Zephyr、BLE、终端、网关、广播、连接、传感器、数据采集、低功耗、系统集成 📌目标读者:希望基于 Zephyr 构建 BLE 系统架构、实现终端与网关协作、具备产品交付能力的开发者 📊篇幅字数:约 5200 字 ✨ 项目总览 在物联网实际项目中,**“终端 + 网关”**是…...

大模型多显卡多服务器并行计算方法与实践指南

一、分布式训练概述 大规模语言模型的训练通常需要分布式计算技术,以解决单机资源不足的问题。分布式训练主要分为两种模式: 数据并行:将数据分片到不同设备,每个设备拥有完整的模型副本 模型并行:将模型分割到不同设备,每个设备处理部分模型计算 现代大模型训练通常结合…...

【数据分析】R版IntelliGenes用于生物标志物发现的可解释机器学习

禁止商业或二改转载&#xff0c;仅供自学使用&#xff0c;侵权必究&#xff0c;如需截取部分内容请后台联系作者! 文章目录 介绍流程步骤1. 输入数据2. 特征选择3. 模型训练4. I-Genes 评分计算5. 输出结果 IntelliGenesR 安装包1. 特征选择2. 模型训练和评估3. I-Genes 评分计…...

Yolov8 目标检测蒸馏学习记录

yolov8系列模型蒸馏基本流程&#xff0c;代码下载&#xff1a;这里本人提交了一个demo:djdll/Yolov8_Distillation: Yolov8轻量化_蒸馏代码实现 在轻量化模型设计中&#xff0c;**知识蒸馏&#xff08;Knowledge Distillation&#xff09;**被广泛应用&#xff0c;作为提升模型…...

基于 TAPD 进行项目管理

起因 自己写了个小工具&#xff0c;仓库用的Github。之前在用markdown进行需求管理&#xff0c;现在随着功能的增加&#xff0c;感觉有点难以管理了&#xff0c;所以用TAPD这个工具进行需求、Bug管理。 操作流程 注册 TAPD&#xff0c;需要提供一个企业名新建一个项目&#…...

【MATLAB代码】基于最大相关熵准则(MCC)的三维鲁棒卡尔曼滤波算法(MCC-KF),附源代码|订阅专栏后可直接查看

文章所述的代码实现了基于最大相关熵准则(MCC)的三维鲁棒卡尔曼滤波算法(MCC-KF),针对传感器观测数据中存在的脉冲型异常噪声问题,通过非线性加权机制提升滤波器的抗干扰能力。代码通过对比传统KF与MCC-KF在含异常值场景下的表现,验证了后者在状态估计鲁棒性方面的显著优…...