主頁 > 軟體設計 > 2021年了還有做某某管理系統的?springboot整合mysql快速搭建XX管理系統

2021年了還有做某某管理系統的?springboot整合mysql快速搭建XX管理系統

2021-01-09 11:35:25 軟體設計

XX管理系統

    • 摘要
    • 1 技術選型
      • 1.1 Mysql8
    • 1.2 springboot2
    • 1.3 模板引擎thymeleaf
    • 2 專案構建
      • 2.1 創建專案
      • 2.2 建表
    • 3 專案實作
      • 3.1 專案效果
      • 3.2 專案結構
    • 4 代碼實作
      • 4.1 前臺頁面
      • 4.2 后臺業務實作
        • 4.2.1 物體類Employee
        • 4.2.2 資料庫操作層repo
        • 4.2.3 業務代碼service
        • 4.2.4 Web介面
      • 4.3 組態檔
    • 5 總結

摘要

對企業來說,人、物資、能源、資金、資訊是5大重要資源,人、物資、能源、資金這些都是可見的有形資源,而資訊是一種無形的資源,以前人們比較看重有形的資源,進入資訊社會和知識經濟時代以后,資訊資源就顯得日益重要,因為資訊資源決定了如何更有效地利用物資資源,資訊資源是人類與自然的斗爭中得出的知識結晶,掌握了資訊資源,就可以更好地利用有形資源,使有形資源發揮更好的效益, 1

由此可見,諸如各類管理系統還是很有價值的,筆者經歷的公司內部都有自己實作的管理系統,可能有些非互聯網的公司是依靠其他公司提供的資訊管理服務,ERP系統至今還發揮著重要作用,筆者下班后連忙帶趕,經歷數個小時的鏖戰,終于做完了此xx管理系統,在此與諸位分享,

1 技術選型

1.1 Mysql8

為什么是mysql8,不是5版本的,沒錯就是喜新厭舊啦!!!
mysql8有何特別之處呢!
1.性能就是好,沒錯它就是強,所以當然上Mysql8,快點上8,
就是強呀
2.Mysql8還支持各種牛逼的功能:SQL視窗函式,GIS,JSON擴展語法等等,總之這些功能聽著就挺牛,由于筆者自己還沒弄明白,就不贅述了,

1.2 springboot2

當前主流的web開發框架,不二之選,沒有比這更方便的了,為什么選這個,它就是無敵,沒有競爭對手啊,自動裝配,父級依賴,嵌入tomcat等等,就是無敵呀,
無敵的我 又回來了

1.3 模板引擎thymeleaf

用模板引擎也實屬無奈,筆者不會前端呀,畢竟人的精力是有限的,不過這個東西還是挺好用的,趕腳用著和幾年前學寫jsp也差不多,

2 專案構建

2.1 創建專案

spring initializer
在這里插入圖片描述
取個心愛的專案名字
在這里插入圖片描述
勾選需要的依賴,mysql,thymeleaf,jpa
在這里插入圖片描述

2.2 建表

好吧,筆者為了偷懶,沒有建表ddl,直接上jpa,先建一個需要的庫,create database,做完這些,專案開始的準備作業就已經完了,馬上又帶了激動人心的擼代碼環節了,

3 專案實作

3.1 專案效果

主頁面
在這里插入圖片描述
就是這樣滴,如此就已然發揮了筆者百分之兩百的前端功力了,各種查閱資料,復制copy加代碼修改,修修改改終于有了上邊的模樣,應該不算太丑吧!好吧,我承認了,

3.2 專案結構

和主流web開發專案的結構基本大同小異:
對應資料庫物體的entity包,對應資料庫操作的repo目錄,對應業務代碼的service目錄,對應restful api的controller目錄,
專案結構

4 代碼實作

4.1 前臺頁面

首頁面,就是上邊看到的那個帥氣的首頁!

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <meta charset="UTF-8">
    <title>xx-manager</title>
</head>
<body>
<header th:replace="xx-header.html"></header>
<div class="container my-2">
    <a th:href="@{/newEmployee}" class="btn btn-primary btn-sm mb-3"> 新增 </a>
    <table border="1" class = "table table-striped table-responsive-md">
        <thead>
        <tr>
            <th>姓名</th>
            <th>郵箱</th>
            <th>電話</th>
            <th>地址</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="employee : ${employees}">
            <td th:text="${employee.name}"></td>
            <td th:text="${employee.email}"></td>
            <td th:text="${employee.mobile}"></td>
            <td th:text="${employee.location}"></td>
            <td><a th:href="@{/updateEmployee/{id}(id=${employee.id})}" class="btn btn-primary">修改</a>
                <a th:href="@{/deleteEmployee/{id}(id=${employee.id})}" class="btn btn-danger">洗掉</a></td>
        </tr>
        </tbody>
    </table>

    <div th:if="${totalPages > 1}">
        <div class="row col-sm-10">
            <div class="col-sm-2">
                總人數: [[${items}]]
            </div>
            <div class="col-sm-1">
                    <span th:each="i: ${#numbers.sequence(1, totalPages)}">
      <a th:if="${currentPage != i}" th:href="@{'/page/' + ${i}}">[[${i}]]</a>
      <span th:unless="${currentPage != i}">[[${i}]]</span> &nbsp; &nbsp;
                    </span>
            </div>
            <div class="col-sm-1">
                <a th:if="${currentPage < totalPages}" th:href="@{'/page/' + ${currentPage + 1}}">下一頁</a>
                <span th:unless="${currentPage < totalPages}">下一頁</span>
            </div>

            <div class="col-sm-1">
                <a th:if="${currentPage < totalPages}" th:href="@{'/page/' + ${totalPages}}">尾頁</a>
                <span th:unless="${currentPage < totalPages}">尾頁</span>
            </div>
        </div>
    </div>
</div>
<footer th:replace="footer.html"></footer>
</body>
</html>

新增功能頁面

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <meta charset="UTF-8">
    <title>xx-manager</title>
</head>
<body>
<header th:replace="xx-header.html"></header>
<div class="container">
    <h1>xx-manager</h1>
    <hr>
    <h2>保存</h2>

    <form action="#" th:action="@{/saveEmployee}" th:object="${employee}" method="POST">
        <input type="text" th:field="*{name}" placeholder="姓名" class="form-control mb-4 col-4">

        <input type="text" th:field="*{email}" placeholder="郵箱" class="form-control mb-4 col-4">

        <input type="text" th:field="*{mobile}" placeholder="電話" class="form-control mb-4 col-4">

        <input type="text" th:field="*{location}" placeholder="住址" class="form-control mb-4 col-4">

        <button type="submit" class="btn btn-info col-2">保存</button>
    </form>

    <hr>

    <a th:href="@{/}">回退</a>
</div>
<footer th:replace="footer.html"></footer>
</body>
</html>

修改功能頁面

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <meta charset="UTF-8">
    <title>xx-manager</title>
</head>
<body>
<header th:replace="xx-header.html"></header>
<div class="container">
    <h1>xx-manager</h1>
    <hr>
    <h2>更新</h2>

    <form action="#" th:action="@{/saveEmployee}" th:object="${employee}" method="POST">

        <input type="hidden" th:field="*{id}" />

        <input type="text" th:field="*{name}" class="form-control mb-4 col-4">

        <input type="text" th:field="*{email}" class="form-control mb-4 col-4">

        <input type="text" th:field="*{mobile}" class="form-control mb-4 col-4">

        <input type="text" th:field="*{location}" class="form-control mb-4 col-4">

        <button type="submit" class="btn btn-info col-2">修改</button>

    </form>

    <hr>

    <a th:href="@{/}">回退</a>
</div>
<footer th:replace="footer.html"></footer>
</body>
</html>

4.2 后臺業務實作

4.2.1 物體類Employee

對應資料庫中的表

package com.lbh.xxmanager.entity;

import javax.persistence.*;

/**
 * Copyright(c)lbhbinhao@163.com
 * @author liubinhao
 * @date 2021/1/7
 * ++++ ______                           ______             ______
 * +++/     /|                         /     /|           /     /|
 * +/_____/  |                       /_____/  |         /_____/  |
 * |     |   |                      |     |   |        |     |   |
 * |     |   |                      |     |   |________|     |   |
 * |     |   |                      |     |  /         |     |   |
 * |     |   |                      |     |/___________|     |   |
 * |     |   |___________________   |     |____________|     |   |
 * |     |  /                  / |  |     |   |        |     |   |
 * |     |/ _________________/  /   |     |  /         |     |  /
 * |_________________________|/b    |_____|/           |_____|/
 */
@Entity
@Table(name = "xx_employee")
public class Employee {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
    @Column(name = "name")
    private String name;
    @Column(name = "email")
    private String email;
    @Column(name = "mobile")
    private String mobile;
    @Column(name = "location")
    private String location;
    @Column(name="status")
    private int status;


    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
}

4.2.2 資料庫操作層repo

package com.lbh.xxmanager.repo;

import com.lbh.xxmanager.entity.Employee;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Copyright(c)lbhbinhao@163.com
 * @author liubinhao
 * @date 2021/1/7
 * ++++ ______                           ______             ______
 * +++/     /|                         /     /|           /     /|
 * +/_____/  |                       /_____/  |         /_____/  |
 * |     |   |                      |     |   |        |     |   |
 * |     |   |                      |     |   |________|     |   |
 * |     |   |                      |     |  /         |     |   |
 * |     |   |                      |     |/___________|     |   |
 * |     |   |___________________   |     |____________|     |   |
 * |     |  /                  / |  |     |   |        |     |   |
 * |     |/ _________________/  /   |     |  /         |     |  /
 * |_________________________|/b    |_____|/           |_____|/
 */
@Repository
public interface EmployeeRepository extends JpaRepository<Employee,Long> {

    List<Employee> findAllByStatus(int status);

    Page<Employee> findAllByStatus(int status, Pageable pageable);

    Page<Employee> findAllByStatusAndLocationLikeOrNameLikeOrEmailLike(int status,String locaion,String name,String email, Pageable pageable);

}

4.2.3 業務代碼service

介面:

package com.lbh.xxmanager.service;

import com.lbh.xxmanager.entity.Employee;
import org.springframework.data.domain.Page;

import java.util.List;

/**
 * Copyright(c)lbhbinhao@163.com
 * @author liubinhao
 * @date 2021/1/7
 * ++++ ______                           ______             ______
 * +++/     /|                         /     /|           /     /|
 * +/_____/  |                       /_____/  |         /_____/  |
 * |     |   |                      |     |   |        |     |   |
 * |     |   |                      |     |   |________|     |   |
 * |     |   |                      |     |  /         |     |   |
 * |     |   |                      |     |/___________|     |   |
 * |     |   |___________________   |     |____________|     |   |
 * |     |  /                  / |  |     |   |        |     |   |
 * |     |/ _________________/  /   |     |  /         |     |  /
 * |_________________________|/b    |_____|/           |_____|/
 */
public interface EmployeeService {

    List<Employee> findAllEmployees();

    void saveEmployee(Employee employee);

    Employee getEmployeeById(long id);

    void deleteEmployeeById(long id);

    Page<Employee> findPaging(int no,int size);

    Page<Employee> findPaging(int no,int size,String searchKey);
}

業務實作類:

package com.lbh.xxmanager.service;

import com.lbh.xxmanager.entity.Employee;
import com.lbh.xxmanager.repo.EmployeeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * Copyright(c)lbhbinhao@163.com
 *
 * @author liubinhao
 * @date 2021/1/7
 * ++++ ______                           ______             ______
 * +++/     /|                         /     /|           /     /|
 * +/_____/  |                       /_____/  |         /_____/  |
 * |     |   |                      |     |   |        |     |   |
 * |     |   |                      |     |   |________|     |   |
 * |     |   |                      |     |  /         |     |   |
 * |     |   |                      |     |/___________|     |   |
 * |     |   |___________________   |     |____________|     |   |
 * |     |  /                  / |  |     |   |        |     |   |
 * |     |/ _________________/  /   |     |  /         |     |  /
 * |_________________________|/b    |_____|/           |_____|/
 */
@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeRepository employeeRepository;

    @Override
    public List<Employee> findAllEmployees() {
        return employeeRepository.findAllByStatus(0);
    }

    @Override
    public void saveEmployee(Employee employee) {
        employee.setStatus(0);
        employeeRepository.save(employee);
    }

    @Override
    public Employee getEmployeeById(long id) {
        Optional<Employee> byId = employeeRepository.findById(id);
        Employee employee = null;
        if (byId.isPresent()){
            employee = byId.get();
        }else {
            throw new RuntimeException("該id員工不存在!");
        }
        return employee;
    }

    @Override
    public void deleteEmployeeById(long id) {
        Employee employeeById = getEmployeeById(id);
        employeeById.setStatus(1);
        employeeRepository.save(employeeById);
    }

    @Override
    public Page<Employee> findPaging(int no, int size) {
        Pageable pageable = PageRequest.of(no - 1,size);
        return employeeRepository.findAllByStatus(0,pageable);
    }

    @Override
    public Page<Employee> findPaging(int no, int size, String searchKey) {
        String key = "%"+searchKey+"%";
        Pageable pageable = PageRequest.of(no - 1,size);
        return employeeRepository.findAllByStatusAndLocationLikeOrNameLikeOrEmailLike(0,key,key,key,pageable);
    }
}

4.2.4 Web介面

package com.lbh.xxmanager.controller;

import com.lbh.xxmanager.entity.Employee;
import com.lbh.xxmanager.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.thymeleaf.util.StringUtils;

import java.util.List;

/**
 * Copyright(c)lbhbinhao@163.com
 * @author liubinhao
 * @date 2021/1/7
 * ++++ ______                           ______             ______
 * +++/     /|                         /     /|           /     /|
 * +/_____/  |                       /_____/  |         /_____/  |
 * |     |   |                      |     |   |        |     |   |
 * |     |   |                      |     |   |________|     |   |
 * |     |   |                      |     |  /         |     |   |
 * |     |   |                      |     |/___________|     |   |
 * |     |   |___________________   |     |____________|     |   |
 * |     |  /                  / |  |     |   |        |     |   |
 * |     |/ _________________/  /   |     |  /         |     |  /
 * |_________________________|/b    |_____|/           |_____|/
 */
@Controller
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    @GetMapping("/")
    public String index(Model model){
        model.addAttribute("employees",employeeService.findAllEmployees());
        return "redirect:/page/1";
    }

    @GetMapping("/newEmployee")
    public String newEmployee(Model model){
        Employee employee = new Employee();
        model.addAttribute("employee",employee);
        return "new_employee";
    }

    @PostMapping("/saveEmployee")
    public String saveEmployee(@ModelAttribute Employee employee){
        employeeService.saveEmployee(employee);
        return "redirect:/";
    }

    @GetMapping("/updateEmployee/{id}")
    public String updateEmployee(@PathVariable Long id,Model model){
        Employee employeeById = employeeService.getEmployeeById(id);
        model.addAttribute("employee",employeeById);
        return "update_employee";
    }

    @GetMapping("/deleteEmployee/{id}")
    public String deleteEmployee(@PathVariable Long id){
        employeeService.deleteEmployeeById(id);
        return "redirect:/";
    }

    @GetMapping("/page/{pageNo}")
    public String findPaging(@PathVariable int pageNo, @RequestParam(required = false) String key, Model model){
        Page<Employee> paging = null;
        if (StringUtils.isEmpty(key)) {
            paging = employeeService.findPaging(pageNo, 5);
        }
        else{
            paging = employeeService.findPaging(pageNo, 5,key);
        }
        List<Employee> content = paging.getContent();
        model.addAttribute("currentPage",pageNo);
        model.addAttribute("totalPages",paging.getTotalPages());
        model.addAttribute("items",paging.getTotalElements());
        model.addAttribute("employees",content);
        return "index";
    }
}

4.3 組態檔

springboot的組態檔

server.port=9001
spring.datasource.username=root
spring.datasource.password=你的資料庫密碼
spring.datasource.url=jdbc:mysql://localhost:3303/xx-manager?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=CONVERT_TO_NULL&autoReconnect=true&useSSL=false&failOverReadOnly=false

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
# update 這樣寫可以自動建表,更新表
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto=update

logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type=TRACE

5 總結

寫一個這樣簡單的后臺資訊管理還是不難,看來筆者還是寶刀未老,下班回家開始做,在這里插入圖片描述
不過寫博客是真滴難,都過了12點還沒有寫完,寫博客和我寫代碼的時間也相差無幾了,哎,我這可憐的頭發啊,


  1. 百度百科詞條.資訊管理系統 ??

轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/246595.html

標籤:其他

上一篇:Serverless+云資料庫輕松打造后端(一)---使用騰訊云SCF做一個介面(查詢資料庫)

下一篇:資料結構期末考試重點2020年

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 面試突擊第一季,第二季,第三季

    第一季必考 https://www.bilibili.com/video/BV1FE411y79Y?from=search&seid=15921726601957489746 第二季分布式 https://www.bilibili.com/video/BV13f4y127ee/?spm_id_fro ......

    uj5u.com 2020-09-10 05:35:24 more
  • 第三單元作業總結

    1.前言 這應該是本學期最后一次寫作業總結了吧。總體來說,對作業的節奏也差不多掌握了,作業做起來的效率也更高了。雖然和之前的作業一樣,作業中都要用到新的知識,但是相比之前,更加懂得了如何利用工具以及資料。雖然之間卡過殼,但總體而言,這幾次作業還算完成的比較好。 2.作業程序總結 相比前兩個單元,此單 ......

    uj5u.com 2020-09-10 05:35:41 more
  • 北航OO(2020)第四單元博客作業暨課程總結博客

    北航OO(2020)第四單元博客作業暨課程總結博客 本單元作業的架構設計 在本單元中,由于UML圖具有比較清晰的樹形結構,因此我對其中需要進行查詢操作的元素進行了包裝,在樹的父節點中存盤所有孩子的參考。考慮到性能問題,我采用了快取機制,一次查詢后盡可能快取已經遍歷過的資訊,以減少遍歷次數。 本單元我 ......

    uj5u.com 2020-09-10 05:35:48 more
  • BUAA_OO_第四單元

    一、UML決議器設計 ? 先看下題目:第四單元實作一個基于JDK 8帶有效性檢查的UML(Unified Modeling Language)類圖,順序圖,狀態圖分析器 MyUmlInteraction,實際上我們要建立一個有向圖模型,UML中的物件(元素)可能與同級元素連接,也可與低級元素相連形成 ......

    uj5u.com 2020-09-10 05:35:54 more
  • 6.1邏輯運算子

    邏輯運算子 1. && 短路與 運算式1 && 運算式2 01.運算式1為true并且運算式2也為true 整體回傳為true 02.運算式1為false,將不會執行運算式2 整體回傳為false 03.只要有一個運算式為false 整體回傳為false 2. || 短路或 運算式1 || 運算式2 ......

    uj5u.com 2020-09-10 05:35:56 more
  • BUAAOO 第四單元 & 課程總結

    1. 第四單元:StarUml檔案決議 本單元采用了圖模型決議UML。 UML檔案可以抽象為圖、子圖、邊的邏輯結構。 在實作中,圖的節點包括類、介面、屬性,子圖包括狀態圖、順序圖等。 采用了三次遍歷UML元素的方法建圖,第一遍遍歷建點,第二、三次遍歷設定屬性、連邊,實作圖物件的初始化。這里借鑒了一些 ......

    uj5u.com 2020-09-10 05:36:06 more
  • 談談我對C# 多型的理解

    面向物件三要素:封裝、繼承、多型。 封裝和繼承,這兩個比較好理解,但要理解多型的話,可就稍微有點難度了。今天,我們就來講講多型的理解。 我們應該經常會看到面試題目:請談談對多型的理解。 其實呢,多型非常簡單,就一句話:呼叫同一種方法產生了不同的結果。 具體實作方式有三種。 一、多載 多載很簡單。 p ......

    uj5u.com 2020-09-10 05:36:09 more
  • Python 資料驅動工具:DDT

    背景 python 的unittest 沒有自帶資料驅動功能。 所以如果使用unittest,同時又想使用資料驅動,那么就可以使用DDT來完成。 DDT是 “Data-Driven Tests”的縮寫。 資料:http://ddt.readthedocs.io/en/latest/ 使用方法 dd. ......

    uj5u.com 2020-09-10 05:36:13 more
  • Python里面的xlrd模塊詳解

    那我就一下面積個問題對xlrd模塊進行學習一下: 1.什么是xlrd模塊? 2.為什么使用xlrd模塊? 3.怎樣使用xlrd模塊? 1.什么是xlrd模塊? ?python操作excel主要用到xlrd和xlwt這兩個庫,即xlrd是讀excel,xlwt是寫excel的庫。 今天就先來說一下xl ......

    uj5u.com 2020-09-10 05:36:28 more
  • 當我們創建HashMap時,底層到底做了什么?

    jdk1.7中的底層實作程序(底層基于陣列+鏈表) 在我們new HashMap()時,底層創建了默認長度為16的一維陣列Entry[ ] table。當我們呼叫map.put(key1,value1)方法向HashMap里添加資料的時候: 首先,呼叫key1所在類的hashCode()計算key1 ......

    uj5u.com 2020-09-10 05:36:38 more
最新发布
  • 【中介者設計模式詳解】C/Java/JS/Go/Python/TS不同語言實作

    * 中介者模式是一種行為型設計模式,它可以用來減少類之間的直接依賴關系,
    * 將物件之間的通信封裝到一個中介者物件中,從而使得各個物件之間的關系更加松散。
    * 在中介者模式中,物件之間不再直接相互互動,而是通過中介者來中轉訊息。 ......

    uj5u.com 2023-04-20 08:20:47 more
  • 露天煤礦現場調研和交流案例分享

    他們集團的資訊化公司及研究院在一個礦區正在做智能礦山的統一平臺的 試點,專案投資大概1億,包括了礦山的各方面的內容,顯示得我們這次交流有點多余。他們2年前開始做智能礦山的規劃,有很多煤礦行業專家的加持,他們的描述是非常完美,但是去年底應該上線的平臺,現在還沒有看到影子。他們確實有很多場景需求,但是被... ......

    uj5u.com 2023-04-20 08:20:25 more
  • 《社區人員管理》實戰案例設計&個人案例分享

    設計是一個讓人夢想成真程序,開始編碼、測驗、除錯之前進行需求分析和架構設計,才能保證關鍵方面都做正確 ......

    uj5u.com 2023-04-20 08:20:17 more
  • 軟體架構生態化-多角色交付的探索實踐

    作為一個技術架構師,不僅僅要緊跟行業技術趨勢,還要結合研發團隊現狀及痛點,探索新的交付方案。在日常中,你是否遇到如下問題 “ 業務需求排期長研發是瓶頸;非研發角色感受不到研發技改提效的變化;引入ISV 團隊又擔心質量和安全,培訓周期長“等等,基于此我們探索了一種新的技術體系及交付方案來解決如上問題。 ......

    uj5u.com 2023-04-20 08:20:10 more
  • 【中介者設計模式詳解】C/Java/JS/Go/Python/TS不同語言實作

    * 中介者模式是一種行為型設計模式,它可以用來減少類之間的直接依賴關系,
    * 將物件之間的通信封裝到一個中介者物件中,從而使得各個物件之間的關系更加松散。
    * 在中介者模式中,物件之間不再直接相互互動,而是通過中介者來中轉訊息。 ......

    uj5u.com 2023-04-20 08:19:44 more
  • 露天煤礦現場調研和交流案例分享

    他們集團的資訊化公司及研究院在一個礦區正在做智能礦山的統一平臺的 試點,專案投資大概1億,包括了礦山的各方面的內容,顯示得我們這次交流有點多余。他們2年前開始做智能礦山的規劃,有很多煤礦行業專家的加持,他們的描述是非常完美,但是去年底應該上線的平臺,現在還沒有看到影子。他們確實有很多場景需求,但是被... ......

    uj5u.com 2023-04-20 08:19:07 more
  • 《社區人員管理》實戰案例設計&個人案例分享

    設計是一個讓人夢想成真程序,開始編碼、測驗、除錯之前進行需求分析和架構設計,才能保證關鍵方面都做正確 ......

    uj5u.com 2023-04-20 08:18:57 more
  • 軟體架構生態化-多角色交付的探索實踐

    作為一個技術架構師,不僅僅要緊跟行業技術趨勢,還要結合研發團隊現狀及痛點,探索新的交付方案。在日常中,你是否遇到如下問題 “ 業務需求排期長研發是瓶頸;非研發角色感受不到研發技改提效的變化;引入ISV 團隊又擔心質量和安全,培訓周期長“等等,基于此我們探索了一種新的技術體系及交付方案來解決如上問題。 ......

    uj5u.com 2023-04-20 08:18:49 more
  • 05單件模式

    #經典的單件模式 public class Singleton { private static Singleton uniqueInstance; //一個靜態變數持有Singleton類的唯一實體。 // 其他有用的實體變數寫在這里 //構造器宣告為私有,只有Singleton可以實體化這個類! ......

    uj5u.com 2023-04-19 08:42:51 more
  • 【架構與設計】常見微服務分層架構的區別和落地實踐

    軟體工程的方方面面都遵循一個最基本的道理:沒有銀彈,架構分層模型更是如此,每一種都有各自優缺點,所以請根據不同的業務場景,并遵循簡單、可演進這兩個重要的架構原則選擇合適的架構分層模型即可。 ......

    uj5u.com 2023-04-19 08:42:41 more