动力节点王鹤SpringBoot3笔记——第八章 文章管理模块

news2024/12/24 20:12:06

目录

第八章  文章管理模块

8.1  配置文件 

8.2 视图文件

8.3 Java代码


第八章  文章管理模块

创建新的Spring Boot项目,综合运用视频中的知识点,做一个文章管理的后台应用。 新的Spring Boot项目Lession20-BlogAdmin。Maven构建工具,包名称com.bjpowernode.blog JDK19,依赖:

  • Spring Web
  • Lombok
  • Thymeleaf
  • MyBatis Framework
  • MySQL Driver

依赖还需要Bean Validation 需求:文章管理工作,发布新文章,编辑文章,查看文章内容等 

8.1  配置文件 

组织配置文件 

 app-base.yml

article:
  #最低文章阅读数量
  low-read: 10
  #首页显示最多的文章数量
  top-read: 20

db.yml

spring:
  datasource:
    type: com.zaxxer.hikari.HikariDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/blog?serverTimezone=Asia/Shanghai
    username: root
    password: 123456
    hikari:
      auto-commit: true
      maximum-pool-size: 10
      minimum-idle: 10
      #获取连接时,检测语句
      connection-test-query: select 1
      connection-timeout: 20000
      #其他属性
      data-source-properties:
        cachePrepStmts: true
        dataSource.cachePrepStmtst: true
        dataSource.prepStmtCacheSize: 250
        dataSource.prepStmtCacheSqlLimit: 2048
        dataSource.useServerPrepStmts: true

8.2 视图文件

logo文件
favicon.ico放在static/ 根目录下

创建模板页面 

 articleList.html

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>文章列表</title>
  <link rel="icon" href="../favicon.ico" type="image/x-icon"/>
  <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
  <div style="margin-left: 200px">
    <h3>阅读最多的前10篇文章</h3>
    <table  border="1px"  cellspacing="0px" cellpadding="2px">
      <thead>
        <th>选择</th>
        <th>序号</th>
        <th>标题</th>
        <th>副标题</th>
        <th>已读数量</th>
        <th>发布时间</th>
        <th>最后修改时间</th>
        <th>编辑</th>
      </thead>
      <tbody>
        <tr th:each="article,loopStats : ${articleList}">
          <td><input type="checkbox" th:value="${article.id}"></td>
          <td th:text="${loopStats.index+1}"></td>
          <td th:text="${article.title}"></td>
          <td th:text="${article.summary}"></td>
          <td th:text="${article.readCount}"></td>
          <td th:text="${article.createTime}"></td>
          <td th:text="${article.updateTime}"></td>
          <td>
            <a th:href="@{/article/get(id=${article.id})}">编辑</a>
          </td>
        </tr>
        <tr>
          <td colspan="8">
            <table width="100%">
              <tr>
                <td><button id="add" onclick="addArticle()">发布新文章</button></td>
                <td><button id="delete" onclick="deleteArticle()">删除文章</button></td>
                <td><button id="read" onclick="readOverview()">文章概览</button></td>
              </tr>
            </table>
          </td>
        </tr>
      </tbody>
    </table>
    <form id="frm" th:action="@{/view/addArticle}" method="get">
    </form>

    <form id="delfrm" th:action="@{/article/removeArticle}" method="post">
      <input type="hidden" id="idsDom" name="ids" value="" >
    </form>
  </div>
  <script type="text/javascript">

    function addArticle(){
      $("#frm").submit();
    }

    function deleteArticle(){
      var ids = [];
      $("input[type='checkbox']:checked").each( (index,item)=>{
        ids.push( item.value );
      })
      $("#idsDom").val(ids);
      $("#delfrm").submit();
    }

    function readOverview(){

      var ids = [];
      $("input[type='checkbox']:checked").each( (index,item)=>{
        ids.push( item.value );
      })

      if( ids.length != 1){
        alert("选择一个文章查看");
        return;
      }
      $.get("../article/detail/overview", { id:ids[0] }, (data,status)=>{
        alert(data)
      } )
    }
  </script>
</body>
</html>

bind.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
  <div style="margin-left: 200px">
    <div th:each="field:${errors}">
      <div th:text="${field.field}"></div>
      <div th:text="${field.defaultMessage}"></div>
    </div>
  </div>
</body>
</html>

error.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
  <div style="margin-left: 200px">
    <div th:text="${error}"></div>
  </div>
</body>
</html>

8.3 Java代码

 java代码 

model包: 

 ArticleVO.java

@Data
public class ArticleVO {
  private Integer id;
  private Integer userId;
  private String title;
  private String summary;
  private String content;
  private Integer readCount;
  private LocalDateTime createTime;
  private LocalDateTime updateTime;
}

ArticleParam.java

package com.bjpowernode.blog.model.param;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.awt.PageAttributes.MediaType;
import lombok.Data;
import lombok.NonNull;
import org.hibernate.validator.constraints.Range;

@Datapublic class ArticleParam {
  public static interface AddArticle {};
  public static interface EditArticle {};

  @NotNull(message = "修改时必须有id",groups = EditArticle.class)
  @Min(value = 1,message = "id必须从{value}开始",groups = EditArticle.class)
  private Integer id;

  @NotBlank(message = "请输入文章标题",groups ={ AddArticle.class, EditArticle.class })
  @Size(min = 2,max = 20,message = "文章标题{min}-{max}",groups ={ AddArticle.class, EditArticle.class })
  private String title;

  @NotBlank(message = "请输入文章副标题",groups ={ AddArticle.class, EditArticle.class })
  @Size(min = 10,max = 30,message = "文章副标题{min}-{max}",groups ={ AddArticle.class, EditArticle.class })
  private String summary;

  @NotBlank(message = "请输入文章副标题",groups ={ AddArticle.class, EditArticle.class })
  @Size(min = 50,max = 8000,message = "文章至少五十个字,文章至多八千字",groups ={ AddArticle.class, EditArticle.class })
  private String content;
}

ArticleDTO.java

@Data
public class ArticleDTO {
  private Integer id;
  private Integer userId;
  private String title;
  private String summary;
  private Integer readCount;
  private String content;
  private LocalDateTime createTime;
  private LocalDateTime updateTime;
}

po包

 ArticlePO.java

@Data
public class ArticlePO {
  private Integer id;
  private Integer userId;
  private String title;
  private String summary;
  private Integer readCount;
  private LocalDateTime createTime;
  private LocalDateTime updateTime;
}

ArticleDetailPO.java

@Data
public class ArticleDetailPO {
  private Integer id;
  private Integer articleId;
  private String content;
}

mapper包

 ArticleMapper.java

package com.bjpowernode.blog.mapper;

public interface ArticleMapper {


  @Select("""
        select id,user_id,title,summary,read_count,create_time,update_time
        from article
        where read_count >=#{lowRead}

        order by read_count desc
        limit #{topRead}
      """)
  @Results(id = "ArticleBaseMap", value = {
      @Result(id = true, column = "id", property = "id"),
      @Result(column = "user_id", property = "userId"),
      @Result(column = "title", property = "title"),
      @Result(column = "summary", property = "summary"),
      @Result(column = "read_count", property = "readCount"),
      @Result(column = "create_time", property = "createTime"),
      @Result(column = "update_time", property = "updateTime"),
  })
  List<ArticlePO> topSortByReadCount(Integer lowRead, Integer topRead);

  @Insert("""
      insert into article(user_id,title,summary,read_count,create_time,update_time) \
      values(#{userId},#{title},#{summary},#{readCount},#{createTime},#{updateTime})
      """)
  @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
  int insertArticle(ArticlePO articlePO);


  @Insert("""
      insert into article_detail(article_id, content) 
      values (#{articleId},#{content}) 
     """)
  int insertArticleDetail(ArticleDetailPO articleDetailPO);


  @Select("""
      select m.id as articleId,title,summary,content 
      from article m left join article_detail ad 
      on m.id = ad.article_id
      where m.id=#{id}
      """)
  @Results({
      @Result(id = true, column = "articleId", property = "id"),
      @Result(column = "title", property = "title"),
      @Result(column = "summary", property = "summary"),
      @Result(column = "content", property = "content", jdbcType = JdbcType.LONGVARCHAR, javaType = String.class)
  })
  ArticleDTO selectArticleAndDetail(Integer id);


  //更新文章title,summary
  @Update("""
      update article set title=#{title},summary=#{summary} where id=#{id}
      """)
  int updateArticle(ArticlePO articlePO);


  @Update("""
      update article_detail set content=#{content} where article_id=#{articleId}
      """)
  int updateArticleDetail(ArticleDetailPO articleDetailPO);

  //<script>动态sql</script>
  @Delete("""
      <script>
      delete from article where id in
      <foreach item="id" collection="list" open="(" separator="," close=")">
           #{id}
      </foreach>
      </script>
      """)
  int deleteArticle(List<Integer> ids);


  @Delete("""
      <script>
      delete from article_detail where id in
      <foreach item="id" collection="list" open="(" separator="," close=")">
           #{id}
      </foreach>
      </script>
      """)
  int deleteArticleDetail(List<Integer> ids);

  @Select("""
      select id,article_id,content from article_detail
      where article_id= #{id}
      """)
  ArticleDetailPO selectDetailByArticleId(Integer id);
}

 ArticleService.java

public interface ArticleService {

  List<ArticlePO> queryTopAritcle();

  boolean addArticle(ArticleDTO article);

  boolean modifyArticle(ArticleParam param);

  int removeArticle(List<Integer> ids);

  ArticleDTO queryByArticleId(Integer id);
  
  String queryTop20Detail(Integer id);
}

ArticleServiceImpl.java

@RequiredArgsConstructor
@Service
public class ArticleServiceImpl implements ArticleService {

  private final ArticleMapper articleMapper;
  private final ArticleSettings articleSettings;

  @Override
  public List<ArticlePO> queryTopAritcle() {
    Integer lowRead = articleSettings.getLowRead();
    Integer topRead = articleSettings.getTopRead();
    return articleMapper.topSortByReadCount(lowRead, topRead);
  }

  @Transactional(rollbackFor = Exception.class)
  @Override
  public boolean addArticle(ArticleDTO article) {
    ArticlePO articlePO = new ArticlePO();
    articlePO.setTitle(article.getTitle());
    articlePO.setSummary(article.getSummary());
    //从登陆信息中获取,现在给个默认
    articlePO.setUserId(new Random().nextInt(1000));
    articlePO.setReadCount(new Random().nextInt(50));
    articlePO.setCreateTime(LocalDateTime.now());
    articlePO.setUpdateTime(LocalDateTime.now());
    articleMapper.insertArticle(articlePO);

    ArticleDetailPO articleDetailPO = new ArticleDetailPO();
    articleDetailPO.setArticleId(articlePO.getId());
    articleDetailPO.setContent(article.getContent());
    articleMapper.insertArticleDetail(articleDetailPO);

    return true;
  }

  @Transactional(rollbackFor = Exception.class)
  public boolean modifyArticle(ArticleParam param){

    ArticlePO  articlePO = new ArticlePO();
    articlePO.setId(param.getId());
    articlePO.setTitle(param.getTitle());
    articlePO.setSummary(param.getSummary());
    int editArticle = articleMapper.updateArticle(articlePO);

    ArticleDetailPO detailPO = new ArticleDetailPO();
    detailPO.setArticleId(param.getId());
    detailPO.setContent(param.getContent());

    int editDetail = articleMapper.updateArticleDetail(detailPO);

    if( editArticle > 0 && editDetail > 0 ){
      return true;
    }
    return false;
  }

  @Transactional(rollbackFor = Exception.class)
  @Override
  public int removeArticle(List<Integer> ids) {
    int master = articleMapper.deleteArticle(ids);
    int detail = articleMapper.deleteArticleDetail(ids);
    return master;
  }

  @Override
  public ArticleDTO queryByArticleId(Integer id) {
    return articleMapper.selectArticleAndDetail(id);
  }

  @Override
  public String queryTop20Detail(Integer id) {
    ArticleDetailPO articleDetailPO = articleMapper.selectDetailByArticleId(id);
    String content = articleDetailPO.getContent();
    if(StringUtils.hasText(content)){
      content = content.substring(0, content.length() >=20 ? 20 : content.length());

    }
    return content;
  }
}

 ArticleController.java

@RequiredArgsConstructor
@Controller
public class ArticleController {

  private final ArticleService articleService;

  @GetMapping( value = {"/", "/article/hot"})
  public String showHotArticle(Model model){
    List<ArticlePO> articlePOList = articleService.queryTopAritcle();
    //转为VO
    List<ArticleVO> articleVOList = BeanUtil.copyToList(articlePOList, ArticleVO.class);
    //存储数据
    model.addAttribute("articleList", articleVOList);
    //视图
    return "/blog/articleList";
  }

  //添加文章
  @PostMapping("/article/add")
  public String addArticle(@Validated(ArticleParam.AddArticle.class) ArticleParam param){

    ArticleDTO article = new ArticleDTO();
    article.setTitle(param.getTitle());
    article.setSummary(param.getSummary());
    article.setContent(param.getContent());
    boolean add = articleService.addArticle(article);
    return "redirect:/article/hot";

  }

  //查询文章
  @GetMapping("/article/get")
  public String queryById(Integer id, Model model){
    ArticleDTO articleDTO = articleService.queryByArticleId(id);
    ArticleVO articleVO = BeanUtil.copyProperties(articleDTO, ArticleVO.class);
    model.addAttribute("article",articleVO);
    return "/blog/editArticle";
  }

  //修改文章
  @PostMapping("/article/edit")
  public String modifyArticle(@Validated(ArticleParam.EditArticle.class) ArticleParam param){
    boolean edit = articleService.modifyArticle(param);
    return "redirect:/article/hot";
  }


  //删除文章
  @PostMapping("/article/removeArticle")
  public String removeArticle(@RequestParam("ids") IdType idType){
    System.out.println("ids="+idType);
    if(idType.getIdList() == null){
      throw new IdNullException("Id为null");
    }
    articleService.removeArticle(idType.getIdList());
    return "redirect:/article/hot";
  }

  //查询文章开始的20个字
  @GetMapping("/article/detail/overview")
  @ResponseBody
  public String queryDetail(Integer id){
    String top20Content = articleService.queryTop20Detail(id);
    return  top20Content;
  }
}

 IdNullException.java

public class IdNullException extends BlogRootException{

  public IdNullException() {
    super();
  }

  public IdNullException(String message) {
    super(message);
  }
}

BlogRootException.java

public class BlogRootException extends RuntimeException{

  public BlogRootException() {
    super();
  }

  public BlogRootException(String message) {
    super(message);
  }
}

GlobalHandleException.java

@ControllerAdvice
public class GlobalHandleException {

  @ExceptionHandler( BindException.class)
  public String handlerBindException(BindException bindException, Model model){
    BindingResult result = bindException.getBindingResult();
    if( result.hasErrors()){
     model.addAttribute("errors",result.getFieldErrors());
      System.out.println("result.getFieldErrors()="+result.getFieldErrors().size());
    }
    return "/blog/error/bind";
  }

  @ExceptionHandler( Exception.class)
  public String handlerDefaultException(Exception exception, Model model){

    model.addAttribute("msg","请稍后重试!!!");

    return "/blog/error/error";
  }
}

 IdType.java

@Data
public class IdType {
  private List<Integer> idList;
}

IdTypeFormatter.java

public class IdTypeFormatter implements Formatter<IdType> {

  @Override
  public IdType parse(String text, Locale locale) throws ParseException {

    IdType idType = new IdType();
    if(StringUtils.hasText(text)){

      List<Integer>  ids = new ArrayList<>();
      for (String id : text.split(",")) {
        ids.add(Integer.parseInt(id));
      }
      idType.setIdList(ids);

    }
    return idType;
  }

  @Override
  public String print(IdType object, Locale locale) {
    return null;
  }
}

 ArticleSettings.java

@Data
@ConfigurationProperties(prefix = "article")
public class ArticleSettings {
  private Integer lowRead;
  private Integer topRead;
}

WebMvcSettings.java

@Configuration
public class WebMvcSettings implements WebMvcConfigurer {

  @Override
  public void addFormatters(FormatterRegistry registry) {
    registry.addFormatter(new IdTypeFormatter());
  }

  @Override
  public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController("/view/addArticle").setViewName("/blog/addArticle");
  }
}

启动类:
Lession19AdminApplication.java

@MapperScan(basePackages = { "com.bjpowernode.blog.mapper" })
@EnableConfigurationProperties( {ArticleSettings.class} )
@SpringBootApplicationpublic class Lession19AdminApplication {

  public static void main(String[] args) {
    SpringApplication.run(Lession19AdminApplication.class, args);
  }

}

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

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

相关文章

VxLAN数据中心L2互连(hand-off方式)

用Arista的veos做了个DCI&#xff08;hand-off&#xff09;实验。模拟了VxLAN数据中心hand-off方式做L2互通。 在此分享。 实现思路 分别在DC1、DC2内配置BGP EVPN协议创建VXLAN隧道&#xff0c;实现各数据中心内部VM之间的通信&#xff0c;DC1-BL和DC2-BL通过二层接口方式接…

spring事务(注解 @Transactional )失效场景

目录标题1. 代理不生效1.1 将注解标注在接口方法上1.2 被final、static关键字修饰的类或方法1.3 类方法内部调用示例解决方案&#xff1a;新加一个Service方法1.4 (类本身) 未被spring管理2. 框架或底层不支持的功能2.1 非public修饰的方法2.2 多线程调用举例1举例22.3 数据库本…

C. Uncle Bogdan and Country Happiness(dfs + 回溯)

Problem - C - Codeforces 波格丹叔叔在弗林特船长的团队里待了很长一段时间&#xff0c;有时会怀念他的家乡。今天他告诉你他的国家是如何引入幸福指数的。有n个城市和n -1条连接城市的无方向道路。任何城市的公民都可以通过这些道路到达任何其他城市。城市编号从1到n&#xf…

【软考:软件设计师】 4 计算机组成与体系结构(三)计算机安全 | 加密技术

欢迎来到爱书不爱输的程序猿的博客, 本博客致力于知识分享&#xff0c;与更多的人进行学习交流 本文收录于软考中级&#xff1a;软件设计师系列专栏,本专栏服务于软考中级的软件设计师考试,包括不限于知识点讲解与真题讲解两大部分,并且提供电子教材与电子版真题,关注私聊即可 …

服务(第二篇)LAMP

一、编译安装apache ①关闭防火墙&#xff0c;将安装Apache所需软件包传到/opt目录下 systemctl stop firewalld.service setenforce 0 [rootxxx opt]# ls apr-1.6.2.tar.gz apr-util-1.6.0.tar.gz httpd-2.4.29.tar.bz2 ②安装环境依赖包 yum -y install gcc gcc-c mak…

专业排名全美top6|建筑学硕士学历CSC获批顺利赴美

E老师人文社科背景&#xff0c;二本院校任教&#xff0c;硕士毕业&#xff0c;没有英文文章&#xff0c;且申请周期只有一个月。据此我们提出&#xff0c;以赶上CSC申报为前提&#xff0c;尽量申请美国综合或者专业排名靠前的学校。最终我们助E老师获得美国专业排名TOP6的弗吉尼…

六个阶段形成CRM销售漏斗,优点有哪些

CRM销售漏斗是反映机会状态以及销售效率的重要的销售管理模型。对企业来说&#xff0c;CRM销售漏斗是一个必不可少的工具。通过销售漏斗&#xff0c;企业可以跟踪和分析客户旅程的每个阶段&#xff0c;并制定相应的销售战略。下面来说说&#xff0c;什么是CRM销售漏斗&#xff…

高频PCB电路设计常见的66个问题

随着电子技术快速发展&#xff0c;以及无线通信技术在各领域的广泛应用&#xff0c;高频、高速、高密度已逐步成为现代电子产品的显著发展趋势之一。信号传输高频化和高速数字化&#xff0c;迫使PCB走向微小孔与埋/盲孔化、导线精细化、介质层均匀薄型化&#xff0c;高频高速高…

Redis消息队列实现异步秒杀

Redis秒杀优化 改进秒杀业务&#xff0c;提高并发性能 需求&#xff1a; 1.新增秒杀优惠券的同时&#xff0c;将优惠券的信息保存到redis中 2.基于Lua脚本&#xff0c;判断秒杀库存&#xff0c;一人一单&#xff0c;决定用户是否抢购成功 3.如果抢购成功&#xff0c;将优惠…

Android系统启动流程--init进程的启动流程

这可能是个系列文章&#xff0c;用来总结和梳理Android系统的启动过程&#xff0c;以加深对Android系统相对全面的感知和理解&#xff08;基于Android11&#xff09;。 1.启动电源&#xff0c;设备上电 引导芯片代码从预定义的地方&#xff08;固化在ROM&#xff0c;全称Read …

hive 入门 一般用于正式环境 修改元数据(二)

安装配置可参考 https://blog.csdn.net/weixin_43205308/article/details/130020674 1、如果启动过derby&#xff0c;最小初始化过 在安装路径下删除 derby.log metastore_db rm -rf derby.log metastore_db此处省略安装mysql数据库 2、配置MySQL 登录mysql mysql -uroot …

EightCap易汇:外汇投资入门需要了解哪些必要知识?

外汇市场是国际投资市场&#xff0c;日内交易量巨大&#xff0c;盈利机会极多。外汇是一种含有杠杆的投资产品&#xff0c;杠杆带来了高收益&#xff0c;也会带来高风险&#xff0c;对于外汇新手来说存在一定难度。新手投资者要如何交易&#xff0c;才能抓住外汇市场的盈利机会…

C++标准库 -- 关联容器 (Primer C++ 第五版 · 阅读笔记)

C标准库 -- 关联容器(Primer C 第五版 阅读笔记&#xff09;第11章 关联容器------(持续更新)11.1、使用关联容器11.2、关联容器概述11.3、关联容器操作11.4、无序容器第11章 关联容器------(持续更新) 关联容器和顺序容器有着根本的不同:关联容器中的元素是按关键字来保存和…

助力AI语音开发者的社区-语音之家

语音之家简介 语音之家成立于2021年4月&#xff0c;是一家助力AI语音开发者的社区&#xff0c;我们希望通过知识传播、在线学习、资源分享、各类活动等方式提供全生命周期的服务&#xff0c;帮助全球的AI语音开发者获得成长&#xff0c;洞见AI语音技术领域的发展。目前&#x…

TiDB实战篇-TiDB Lightning 导入数据

简介 使用TiDB Lightning 导入数据。 原理 TiKV进入导入模式 它是使用物理导入的模式&#xff0c;将SQL文件直接导入到TiKV中&#xff0c;它是一种初始化的导入&#xff0c;也就是说目标的数据库和表都是不能够存在的&#xff08;注意事项&#xff0c;在这种方式导入的时候T…

论文笔记 U-Net: Convolutional Networks for Biomedical Image Segmentation

摘要&#xff1a;人们普遍认为&#xff0c;深度网络的成功训练需要数千个带注释的训练样本。在本文中&#xff0c;我们提出了一种网络和训练策略&#xff0c;该策略依赖于大量使用数据增强来更有效地使用可用的注释样本。该体系结构包括用于捕获上下文的收缩路径和用于实现精确…

计算机组件介绍

1. CPU 1.1 主频 1.2 CPU缓存 注&#xff1a;越高越好 2. Memory 注&#xff1a;只有内存是主存&#xff08;因为CPU只能和内存打交道&#xff09;&#xff0c;硬盘这种就是外存&#xff08;因为硬盘太慢了&#xff0c;跟不上cpu的运行速度&#xff09; 3. I/O 注&#xff1a;输…

Segment Anything论文翻译,SAM模型,SAM论文,SAM论文翻译;一个用于图像分割的新任务、模型和数据集;SA-1B数据集

【论文翻译】- Segment Anything / Model / SAM论文 论文链接&#xff1a; https://arxiv.org/pdf/2304.02643.pdfhttps://ai.facebook.com/research/publications/segment-anything/ 代码连接&#xff1a;https://github.com/facebookresearch/segment-anything 论文翻译&…

微软 AI 作图上线完全免费,“奖励自己”可提升速度

ChatGPT 的横空出世应该已经让大家意识到了 AI 的恐怖。 称不上啥都能干&#xff0c;但给东西它真学&#xff0c;学得还比你快。 最近一段时间 AI 在作图领域又一次人气暴涨。 什么小姐姐写真、突破时间线的历史古图、甚至是抽象的表情包都可能源于 AI 之手。 看着手痒想玩玩…

滴滴滴,请看MYSQL事务的四大特征(ACID)的实现原理:晓其原理而通其实现。

一.什么是事务的四特征 原子性&#xff08;Atomicity&#xff0c;或称不可分割性&#xff09;一致性&#xff08;Consistency&#xff09;隔离性&#xff08;Isolation&#xff09;持久性&#xff08;Durability&#xff09; 接下来&#xff0c;我们将对四大特性的具体概念以及…