從0開始實現一個博客系統 (SSM 實現)

相關技術

Spring + Spring Boot + Spring MVC + MyBatis
Html + Css + JS

實現功能

  1. 用戶注冊 - 密碼加鹽加密 (md5 加密)
  2. 前后端用戶信息存儲 - 令牌技術
  3. 用戶登錄 - (使用 攔截器 做登錄校驗)
  4. 博客的增刪改查
  5. 后端數據返回前端, 采用 SpringBoot 做統一功能處理和統一異常處理

數據庫設計

  1. 用戶表
  2. 博客表

在這里插入圖片描述

前端頁面

博客登錄頁 (blog_login.html)

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><me_ta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>博客登陸頁</title><link rel="stylesheet" href="css/common.css"><link rel="stylesheet" href="css/login.css"></head><body><div class="nav"><img src="pic/logo2.jpg" alt=""><span class="blog-title">我的博客系統</span><div class="space"></div><a class="nav-span" href="blog_list.html">主頁</a><a class="nav-span" href="blog_edit.html">寫博客</a></div><div class="container-login"><div class="login-dialog"><h3>登陸</h3><div class="row"><span>用戶名</span><input type="text" name="username" id="username"></div><div class="row"><span>密碼</span><input type="password" name="password" id="password"></div><div class="row"><button id="submit" onclick="login()">提交</button></div></div></div><script src="js/jquery.min.js"></script><script>function login() {// 發送 ajax 請求, 獲取 token$.ajax({type: "post",url: "/user/login",data: {"userName": $("#username").val(),"password": $("#password").val()},success: function(result) {if(result.code == 200 && result.data != null) {// 存儲 token 到本地localStorage.setItem("user_token", result.data);location.href = "blog_list.html";}else{alert("用戶名或密碼錯誤");}}});}</script>
</body></html>

用戶登錄成功之后, 會將用戶信息, 生成令牌, 存儲到 request 中, 前后端都能從中獲取當前登錄用戶的信息

博客列表頁 (blog_list.html)

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>博客列表頁</title><link rel="stylesheet" href="css/common.css"><link rel="stylesheet" href="css/list.css"></head>
<body><div class="nav"><img src="pic/logo2.jpg" alt=""><span class="blog-title">我的博客系統</span><div class="space"></div><a class="nav-span" href="blog_list.html">主頁</a><a class="nav-span" href="blog_edit.html">寫博客</a><a class="nav-span" href="#" onclick="logout()">注銷</a></div><div class="container"><div class="left"><div class="card"><img src="pic/doge.jpg" alt=""><h3></h3><a href="#"></a><div class="row"><span>文章</span><span>分類</span></div><div class="row"><span>2</span><span>1</span></div></div></div><div class="right"></div></div><script src="js/jquery.min.js"></script><script src="js/common.js"></script><script>//顯示用戶信息var userUrl = "/user/getUserInfo";getUserInfo(userUrl);// 獲取所有的博客信息$.ajax({type: "get",url: "/blog/getList",success: function(result) {console.log("result:" + result);if(result.code == 200 && result.data != null) {var finalHtml = "";for(var blog of result.data) {finalHtml += '<div class="blog">';finalHtml += '<div class="title">'+blog.title+'</div>';finalHtml += '<div class="date">'+blog.createTime+'</div>';finalHtml += '<div class="desc">'+blog.content+'</div>';finalHtml += '<a class="detail" href="blog_detail.html?blogId='+blog.id+'">查看全文&gt;&gt;</a>';finalHtml += '</div>';}$(".right").html(finalHtml);}},error: function(error) {console.log("error:" + error);location.href = "blog_login.html";if(error != null && error.state == 401) {location.href = "blog_login.html";}}});</script>
</body>
</html>

當前頁面會自動調用一個 ajax 請求, 用以獲取數據庫中 所有未刪除博客 的信息進行展示 (博客正文會裁取前100字進行顯示)

博客詳情頁 (blog_detail.html)

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>博客詳情頁</title><link rel="stylesheet" href="css/common.css"><link rel="stylesheet" href="css/detail.css"></head><body><div class="nav"><img src="pic/logo2.jpg" alt=""><span class="blog-title">我的博客系統</span><div class="space"></div><a class="nav-span" href="blog_list.html">主頁</a><a class="nav-span" href="blog_edit.html">寫博客</a><a class="nav-span" href="#" onclick="logout()">注銷</a></div><div class="container"><div class="left"><div class="card"><img src="pic/doge.jpg" alt=""><h3></h3><a href="#"></a><div class="row"><span>文章</span><span>分類</span></div><div class="row"><span>2</span><span>1</span></div></div></div><div class="right"><div class="content"><div class="title"></div><div class="date"></div><div class="detail" id="detail" style="background-color: transparent;"></div><!-- <div class="operating"><button onclick="window.location.href='blog_update.html'">編輯</button><button onclick="deleteBlog()">刪除</button></div> --></div></div></div><!-- 引入 editor.md 的依賴 --><link rel="stylesheet" href="blog-editormd/css/editormd.css" /><script src="js/jquery.min.js"></script><script src="blog-editormd/lib/marked.min.js"></script><script src="blog-editormd/lib/prettify.min.js"></script><script src="blog-editormd/editormd.js"></script><script src="js/common.js"></script><script>// 獲取博客詳情$.ajax({type: "get",url: "/blog/getBlogDetail"+location.search,success: function(result) {console.log(result);if(result.code == 200 && result.data != null) {console.log("abc" + result);var blog = result.data;$(".right .content .title").text(blog.title);$(".right .content .date").text(blog.createTime);// $(".right .content .detail").text(blog.content);editormd.markdownToHTML("detail", {markdown: blog.content,});// 是否顯示 編輯/刪除 按鈕if(blog.isLoginUser == true) {var html = "";html += '<div class="operating">';html += '<button onclick="window.location.href=\'blog_update.html'+location.search+'\'">編輯</button>';html += '<button onclick="deleteBlog()">刪除</button>';html += '</div>';$(".content").append(html);}}},error: function(error) {if(error != null && error.status == 401) {location.href = "blog_list.html";}}});//顯示博客作者信息var userUrl = "/user/getAuthorInfo" + location.search;getUserInfo(userUrl);function deleteBlog() {$.ajax({type: "post",url: "/blog/delete" + location.search,success: function(result) {if(result.code == 200 && result.data != null && result.data == true) {location.href = "blog_list.html";}}});}</script>
</body></html>

對于每篇博客, 會顯示博客信息 (標題, 最后一次的修改時間, 博客正文), 和博客作者的信息 (用戶名) (TODO: 作者頭像, 作者的總文章數量, 博客的分類所屬)
頁面會自動校驗登錄用戶是否為當前博客的作者, 如果是, 那么可以對當前博客進行編輯和刪除, 如果不是, 這兩個按鈕不會顯示

博客編輯頁 (blog_edit.html)

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>博客編輯頁</title><link rel="stylesheet" href="css/common.css"><link rel="stylesheet" href="css/edit.css"><link rel="stylesheet" href="blog-editormd/css/editormd.css" /></head><body><div class="nav"><img src="pic/logo2.jpg" alt=""><span class="blog-title">我的博客系統</span><div class="space"></div><a class="nav-span" href="blog_list.html">主頁</a><a class="nav-span" href="blog_edit.html">寫博客</a><a class="nav-span" href="#" onclick="logout()">注銷</a></div><div class="content-edit"><div class="push"><input type="text" name="" id="title"><input type="button" value="發布文章" id="submit" onclick="submit()"></div><!-- markdown 插件 html代碼 --><div id="editor"><textarea style="display:none;" id="content" name="content">##在這里寫下一篇博客</textarea></div></div><script src="js/jquery.min.js"></script><script src="blog-editormd/editormd.min.js"></script><script src="js/common.js"></script><script type="text/javascript">$(function () {var editor = editormd("editor", {width: "100%",height: "550px",path: "blog-editormd/lib/"});});function submit() {$.ajax({type: "post",url: "/blog/add",data: {title: $("#title").val(),content: $("#content").val()},success: function(result) {if(result.code == 200 && result.data != null && result.data == true) {location.href = "blog_list.html";}else {alert("博客發布失敗!");}}});}</script>
</body></html>

博客編輯頁使用了 gittee 上的一個開源 markdown 組件
對于未有博客的 “寫博客” , 調用的是 “插入操作”
對于已有博客的 “編輯博客” , 調用的是 “更新操作”
“刪除博客” 操作是邏輯刪除, 即修改數據庫的某一字段, 所以調用的也是 “更新操作”

前端頁面共同的 js (common.js)

$(document).ajaxSend(function(e, xhr, opt) {// 獲取本地存儲中的 tokenvar user_token = localStorage.getItem("user_token");// 將 token 設置到每個 ajax 請求的 header 中xhr.setRequestHeader("user_token_header", user_token);
});// 獲取用戶信息
function getUserInfo(url) {$.ajax({type: "post",url: url,success: function(result) {if(result.code == 200 && result.data != null) {$(".left .card h3").text(result.data.userName);$(".left .card a").attr("href", result.data.githubUrl);}}});
}// 用戶退出
function logout() {localStorage.removeItem("user_token");location.href = "blog_login.html";
}

主要就是獲取當前登錄用戶的信息, 以及退出登錄的邏輯

后端代碼

項目的基本框架

在這里插入圖片描述

實體類

BlogInfo
@Data
public class BlogInfo {private Integer id;private String title;private String content;private Integer userId;private Integer deleteFlag;private Date createTime;private Date updateTime;private Boolean isLoginUser = false;// 返回 String 類型的數據 (BlogInfo 里面存儲的是 Date 類型數據)public String getCreateTime() {return DateUtils.formateDate(createTime);}public String getUpdateTime() {return DateUtils.formateDate(updateTime);}
}

對應數據的 blog 表

UserInfo
@Data
public class UserInfo {private Integer id;private String userName;private String password;private String githubUrl;private Integer deleteFlag;private Date createTime;private Date updateTime;
}

對應數據的 user 表

Result
@Data
public class Result {private int code;  //200成功  -1失敗  -2未登錄private String errMsg;private Object data;public static Result success(Object data) {Result result = new Result();result.setCode(Constant.SUCCESS_CODE);result.setErrMsg("");result.setData(data);return result;}public static Result fail(String errMsg) {Result result = new Result();result.setCode(Constant.FAIL_CODE);result.setErrMsg(errMsg);result.setData(null);return result;}public static Result fail(String errMsg, Object data) {Result result = new Result();result.setCode(Constant.FAIL_CODE);result.setErrMsg(errMsg);result.setData(data);return result;}public static Result unlogin() {Result result = new Result();result.setCode(Constant.FAIL_CODE);result.setErrMsg("用戶未登錄");result.setData(null);return result;}public static Result unlogin(String errMsg) {Result result = new Result();result.setCode(Constant.UNLOGIN_CODE);result.setErrMsg("用戶未登錄");result.setData(null);return result;}
}

用于統一數據格式返回 (不知道可以看一下我的另一篇博客 Spring Boot統一功能處理(攔截器, 統一數據返回格式, 統一異常處理) )

Constant 類 (常量值存儲)

public class Constant {public final static Integer SUCCESS_CODE = 200;public final static Integer FAIL_CODE = -1;public final static Integer UNLOGIN_CODE = -2;public final static String USER_TOKEN_HEADER = "user_token_header";public final static String USER_CLAIM_ID = "id";public final static String USER_CLAIM_NAME = "name";
}

Mapper 類

通過 MyBatis 操作數據庫

BlogMapper
@Mapper
public interface BlogMapper {// 查詢博客列表@Select("select * from blog where delete_flag = 0 order by create_time desc")List<BlogInfo> selectAllBlog();// 根據博客 ID, 查詢博客信息@Select("select * from blog where delete_flag = 0 and id = #{blogId}")BlogInfo selectById(@Param("blogId") Integer blogId);// 根據博客 ID, 修改/刪除 博客信息Integer updateBlog(BlogInfo blogInfo);// 插入博客@Insert("insert into blog(title, content, user_id) values(#{blogInfo.title}, #{blogInfo.content}, #{blogInfo.userId})")Integer insertBlog(@Param("blogInfo") BlogInfo blogInfo);
}

數據庫操作 blog 表

UserMapper
@Mapper
public interface UserMapper {// 根據用戶名, 查詢用戶信息@Select("select * from user where user_name = #{userName} and delete_flag = 0")UserInfo selectByName(@Param("userName") String userName);// 根據用戶 ID, 查詢用戶信息@Select("select * from user where id = #{userId} and delete_flag = 0")UserInfo selectById(@Param("userId") Integer userId);}

數據庫操作 user 表

用戶登錄頁

登錄功能

登錄頁面點擊登錄按鈕后, 觸發 controller 層的 login 接口

	@Autowiredprivate UserService userService;// 登錄接口@RequestMapping("/login")public Result login(String userName, String password) {// 1.對參數進行校驗// 2.對密碼進行校驗// 3.如果校驗成功, 生成 tokenif(!StringUtils.hasLength(userName) || !StringUtils.hasLength(password)) {
//            throw new UnsupportedOperationException("用戶名或密碼不能為空");return Result.fail("用戶名或密碼不能為空");}// 獲取用戶信息UserInfo userInfo = userService.queryUserByName(userName);if(userInfo == null || userInfo.getId() <= 0) {return Result.fail("用戶不存在");}// 密碼校驗if(!SecurityUtils.verify(password, userInfo.getPassword())) {return Result.fail("密碼錯誤");}// 用戶信息正確, 生成 tokenMap<String, Object> claim = new HashMap<>();claim.put(Constant.USER_CLAIM_ID, userInfo.getId());claim.put(Constant.USER_CLAIM_NAME, userInfo.getUserName());return Result.success(JWTUtils.getToken(claim));}

login 接口先對前端數據進行判空校驗, 然后根據用戶名 查詢數據庫中是否有對應的信息, 將獲取信息與輸入信息進行比對, 返回登錄判定信息 (登錄成功生成 token 令牌)

獲取用戶信息:
在這里插入圖片描述
密碼校驗:

在這里插入圖片描述
生成 token 令牌:
在這里插入圖片描述

用戶注銷

用戶注銷是個前端功能
在 common.js 里面

function logout() {localStorage.removeItem("user_token");location.href = "blog_login.html";
}

博客列表頁

博客列表頁獲取所有未刪除博客的信息進行展示

調用接口 getList

@Autowired
private BlogService blogService;@RequestMapping("/getList")
public List<BlogInfo> queryBlogList() {return blogService.queryBlogList();
}

在這里插入圖片描述

博客列表頁左側登錄用戶信息欄, 獲取當前登錄用戶的信息進行展示

調用接口 getUserInfo

@RestController
@RequestMapping("/user")
public class UserController {@Autowiredprivate UserService userService;// 獲取當前登錄用戶的信息@RequestMapping("/getUserInfo")public UserInfo getUserInfo(HttpServletRequest request) {// 1. 獲取 token, 從 token 中獲取 IDString user_token = request.getHeader(Constant.USER_TOKEN_HEADER);Integer userId = JWTUtils.getUserIdFromToken(user_token);// 2. 根據 ID, 獲取用戶信息if(userId == null || userId <= 0) {return null;}UserInfo userInfo =userService.queryUserByID(userId);userInfo.setPassword("");return userInfo;}
}

在這里插入圖片描述

博客詳情頁

博客詳情頁右側獲取博客詳情信息

調用接口 getBlogDetail

@Slf4j
@RestController
@RequestMapping("/blog")
public class BlogController {@Autowiredprivate BlogService blogService;// 根據博客id獲取博客信息@RequestMapping("/getBlogDetail")public BlogInfo getBlogDetail(Integer blogId, HttpServletRequest request) {BlogInfo blogInfo = blogService.getBlogDetail(blogId);// 獲取登錄用戶信息String user_token = request.getHeader(Constant.USER_TOKEN_HEADER);Integer userId = JWTUtils.getUserIdFromToken(user_token);// 判斷登錄用戶是否為作者if(userId != null && userId == blogInfo.getUserId()) {blogInfo.setIsLoginUser(true);}else {blogInfo.setIsLoginUser(false);}return blogInfo;}
}

在這里插入圖片描述

博客詳情頁左側獲取博客作者信息

調用接口 getAuthorInfo

@RestController
@RequestMapping("/user")
public class UserController {@Autowiredprivate UserService userService;// 根據博客 ID, 獲取作者信息@RequestMapping("/getAuthorInfo")public UserInfo getAuthorInfo(Integer blogId) {// 校驗博客 ID 是否正確if(blogId == null || blogId <= 0) {return null;}UserInfo userInfo = userService.queryAuthorInfoByBlogId(blogId);userInfo.setPassword("");return userInfo;}
}

在這里插入圖片描述

博客詳情頁中, 編輯和刪除功能

調用接口 update & delete

@Slf4j
@RestController
@RequestMapping("/blog")
public class BlogController {@Autowiredprivate BlogService blogService;// 編輯博客@RequestMapping("/update")public Boolean update(Integer blogId, String title, String content) {log.error("blogId:{}, title:{}, content:{}", blogId, title, content);if(blogId == null || !StringUtils.hasLength(title) || !StringUtils.hasLength(content)) {log.error("update, 參數非法");return false;}BlogInfo blogInfo = new BlogInfo();blogInfo.setId(blogId);blogInfo.setTitle(title);blogInfo.setContent(content);log.error("blogInfo:{}", blogInfo);Integer result = blogService.updateBlog(blogInfo);if(result < 1) return false;return true;}// 刪除博客(邏輯刪除)@RequestMapping("/delete")public Boolean delete(Integer blogId) {BlogInfo blogInfo = new BlogInfo();blogInfo.setId(blogId);blogInfo.setDeleteFlag(1);log.error("blogInfo:{}", blogInfo);Integer result = blogService.updateBlog(blogInfo);if(result < 1) return false;return true;}
}

在這里插入圖片描述

博客編輯頁

博客撰寫后存入數據庫

調用接口 add

@Slf4j
@RestController
@RequestMapping("/blog")
public class BlogController {@Autowiredprivate BlogService blogService;// 添加博客@RequestMapping("/add")public Boolean publishBlog(String title, String content, HttpServletRequest request) {// 1.參數校驗if(!StringUtils.hasLength(title) || !StringUtils.hasLength(content)) {return false;}// 2.獲取當前用戶String user_token = request.getHeader(Constant.USER_TOKEN_HEADER);Integer userId = JWTUtils.getUserIdFromToken(user_token);if(userId == null || userId <= 0) {return false;}// 3.博客發布BlogInfo blogInfo = new BlogInfo();blogInfo.setUserId( userId);blogInfo.setContent(content);blogInfo.setTitle(title);Integer result = blogService.publishBlog(blogInfo);return result<=0 ? false:true;}
}

在這里插入圖片描述

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/bicheng/15290.shtml
繁體地址,請注明出處:http://hk.pswp.cn/bicheng/15290.shtml
英文地址,請注明出處:http://en.pswp.cn/bicheng/15290.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

軟考-程序員 知識點與部分真題梳理

軟考-程序員 知識點與部分真題梳理 參照《程序員教程》第五版劃分類別&#xff1b; 持續更新中… 計算機系統基礎知識 如何理解和處理浮點數的加減法運算 在計算機科學中&#xff0c;處理浮點數的表示和運算是基礎且關鍵的&#xff0c;尤其是在進行科學計算、圖形處理和數據分…

V2I(車與基礎設施)介紹

V2I&#xff08;車與基礎設施&#xff09;介紹 一、V2I技術概述 V2I&#xff08;Vehicle-to-Infrastructure&#xff09;技術&#xff0c;全稱汽車與基礎設施通訊&#xff0c;也被稱為信號燈系統。它通過無線通信技術&#xff0c;為車載智能交通運輸系統設立了專門的通信頻段…

【網絡】為什么udp協議報頭有長度字段,而tcp沒有

引言&#xff1a; 在網絡通信中&#xff0c;UDP&#xff08;用戶數據報協議&#xff09;和TCP&#xff08;傳輸控制協議&#xff09;是兩種常用的傳輸層協議。它們在設計和功能上有一些不同之處&#xff0c;其中之一就是報頭中的長度字段。本文將深入探討UDP和TCP協議中長度字…

SpringCloud Alibaba詳解:打造高可用的分布式系統

SpringCloud Alibaba是一個基于Spring Cloud的微服務開發框架&#xff0c;它集成了阿里巴巴的一系列中間件和工具&#xff0c;能夠快速構建高可用的分布式系統。在本文中&#xff0c;將詳細介紹如何使用SpringCloud Alibaba來打造高可用的分布式系統&#xff0c;并通過代碼案例…

第十一課,end關鍵字、簡單while循環嵌套、初識for循環

一&#xff0c;end關鍵字 end關鍵字用于在print輸出的內容后面聲明結束的字符&#xff0c;我們之前學過并且十分了解print是默認輸出內容之后跟著換行的&#xff0c;如果我們不希望換行而希望使用其它字符來代替換行&#xff0c;就可以用end關鍵字來實現 特殊的&#xff0c;en…

k8s筆記 | 高度調度

CronJob計劃任務 簡介&#xff1a;在k8s中周期性運行計劃任務&#xff0c;與linux中的crontab相同&#xff1b;注意點 CornJob執行的時間是controller-manager的時間&#xff0c;所以一定要確保controller-manager的時間是準確的&#xff0c;另外cornjob cron表達式 文章參…

xjoi題庫一級三段題解(c語言版)

浮點數 時間&#xff1a;0.2 空間&#xff1a;32M 題目描述&#xff1a; 小鸚鵡正在學習浮點數&#xff0c;你跟他說一個浮點數&#xff0c;他立刻就能學會。 輸入一個浮點數&#xff0c;輸出這個浮點數。 輸入格式&#xff1a; 輸入一個浮點數 輸出格式&#xff1a; 輸出一個…

2024.5.25AcWing刷題記錄-排序篇

一、786. 第k個數 - AcWing題庫 三路快速排序 import random def func(nums, start, end):if start > end:return idx random.randint(start, end)base nums[idx]i, j, m start, start, end 1while j < m:if nums[j] < base:nums[i], nums[j] nums[j], nums[i]…

Redis機制-Redis緩存穿透,擊穿,雪崩理解等問題的理解和學習

目錄 一 緩存穿透問題 二 緩存擊穿問題 三 緩存雪崩問題&#xff1a; 圖1 正常的Redis緩存流程 一 緩存穿透問題 我們都知道Redis是一個存儲鍵值對的非關系型數據庫&#xff0c;那么當用戶進行查詢的時候&#xff0c;勢必會從前端發起請求&#xff0c;從而數據從Redis緩存…

內網穿透--Frp-簡易型(速成)-上線

免責聲明:本文僅做技術交流與學習... 目錄 frp項目介紹: 一圖通解: ?編輯 1-下載frp 2-服務端(server)開啟frp口 3-kali客戶端(client)連接frp服務器 4-kali生成馬子 5-kali監聽 6-馬子執行-->成功上線 frp項目介紹: GitHub - fatedier/frp: A fast reverse proxy…

論文精讀-SwinIR Image Restoration Using Swin Transformer

論文精讀-SwinIR: Image Restoration Using Swin Transformer SwinIR:使用 Swin Transformer進行圖像恢復 參數量&#xff1a;SR 11.8M、JPEG壓縮偽影 11.5M、去噪 12.0M 優點&#xff1a;1、提出了新的網絡結構。它采用分塊設計。包括淺層特征提取&#xff1a;cnn提取&#…

Verilog實戰學習到RiscV - 1 : Yosys 綜合

Yosys 綜合 實例 一般 FPGA IDE 的第一步都是RTL 綜合&#xff08;Synthesis&#xff09;。之后就能看到數字電路圖了。然后可以做RTL 級的仿真模擬。 直接上代碼&#xff0c;這里我們看一個簡單的加法器來學習。 module adder(input [7:0] a,input [7:0] b, input …

Java延時隊列取消未支付的訂單 之 重啟服務任務丟失

一、定義延遲任務類 package com.activity.domain;import java.util.concurrent.Delayed; import java.util.concurrent.TimeUnit;/*** 延遲任務類*/ public class DelayedCancellation implements Delayed {private String order;private final long delayTime; // 延遲時間p…

鏈表類型的無界阻塞隊列-LinkedBlockingQueue

一:LinkedBlockingQueue介紹 1:LinkedBlockingQueue是一個基于鏈表實現的阻塞隊列,默認情況下,該阻塞隊列的大小為Integer.MAX_VALUE,由于這個數值特別大,所以 LinkedBlockingQueue 也被稱作無界隊列,代表它幾乎沒有界限,隊列可以隨著元素的添加而動態增長,但是如果沒…

智能體之斯坦福AI小鎮(Generative Agents: Interactive Simulacra of Human Behavior)

相關代碼地址見文末 論文地址&#xff1a;Generative Agents: Interactive Simulacra of Human Behavior | Proceedings of the 36th Annual ACM Symposium on User Interface Software and Technology 1.概述 論文提出了一種多個智能體進行協同&#xff0c;進而模擬可信的人…

Python燃氣輪機汽車鋼棒整流電路控制圖統計模型過程潛力分析

&#x1f3af;要點 &#x1f3af;活塞模擬器&#xff1a;&#x1f58a;控制圖過程能力分析&#xff1a;Cp 對過程提供在規格上限和下限內的輸出的潛力度量&#xff0c;Cpk中心過程能力指數&#xff0c;Cpl估計僅包含規格下限過程能力&#xff0c;Cpu估計僅包含規格上限過程能力…

Linux系統下Mysql忘記密碼怎么解決

一、對Mysql配置文件進行設置 1、找到/etc/mysql/my.cnf路徑下&#xff0c;用Vi命令編輯my.cnf配置文件&#xff0c;命令如下&#xff1a; # 以管理員身份登錄 sudo su # 輸入管理員密碼 # 登錄成功后&#xff0c;找到Mysql的配置文件-->Mysql配置文件默認在此 cd /etc/my…

善用KEGG數據庫挖掘目的基因

有關KEGG的分析在很多已發表的論文中都十分常見&#xff0c;涉及到的方向也很廣泛&#xff0c;比如&#xff1a;代謝組、表觀組、轉錄組等等。通常得到相關的基因集或者代謝物后&#xff0c;我們都希望能夠快速了解它們的蛋白功能和涉及的調控機制&#xff0c;從而進一步鎖定接…

NetSuite Intercompany COGS科目設置問題

在22年底的NetSuite多公司功能串講中&#xff0c;有一個題目是Intercompany COGS科目的設置問題。近期在項目上這個問題被密集討論。為了方便分享&#xff0c;所以在此摘出來獨立成文。有興趣的同學也可以翻看之前的視頻。 NetSuite知識會 第8談 多公司功能串講 NetSuite Inter…

圖論(從數據結構的三要素出發)

文章目錄 邏輯結構物理結構鄰接矩陣定義性能分析性質存在的問題 鄰接表定義性能分析存在的問題 十字鏈表(有向圖)定義性能分析 鄰接多重表(無向圖)定義性能分析 數據的操作圖的基本操作圖的遍歷廣度優先遍歷&#xff08;BFS&#xff09;算法思想和實現性能分析深度優先最小生成…