国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

【企業(yè)級(jí)SpringBoot單體項(xiàng)目模板 】——Mybatis-plus自動(dòng)代碼生成

這篇具有很好參考價(jià)值的文章主要介紹了【企業(yè)級(jí)SpringBoot單體項(xiàng)目模板 】——Mybatis-plus自動(dòng)代碼生成。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

  • ?? ? ??????? :是江迪呀
  • ??本文關(guān)鍵詞SpringBoot項(xiàng)目模版、企業(yè)級(jí)、模版
  • ??每日?? 一言我們之所以這樣認(rèn)為,是因?yàn)樗麄冞@樣說。他們之所以那樣說,是因?yàn)樗麄兿胱屛覀兡菢诱J(rèn)為。所以實(shí)踐才是檢驗(yàn)真理的唯一準(zhǔn)則。

上回我們說了一些開發(fā)規(guī)范,其實(shí)現(xiàn)在你就可以開始寫代碼了。但是呢效率會(huì)很慢,實(shí)體類、mapper、service等等這些你都要手動(dòng)創(chuàng)建,這樣效率太低了,遇到一個(gè)表中有幾十個(gè)字段的情況,你可以一上午都在寫實(shí)體類,而且還不能保證準(zhǔn)確性,所以我們需要一個(gè)工具替我們生成。

一、使用Velocity模版自動(dòng)生成代碼

我們以生成t_user表為例,表結(jié)構(gòu)如下:

【企業(yè)級(jí)SpringBoot單體項(xiàng)目模板 】——Mybatis-plus自動(dòng)代碼生成,項(xiàng)目搭建,mybatis,spring boot,java

Generator代碼:

package com.shijiangdiya.common;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.io.ClassPathResource;

import java.util.*;

public class Generator {
    /**
     * 生成的代碼的頂層包名
     */
    private static final String SERVICE_NAME = "code";
    /**
     * 最終包路徑
     */
    private static final StringBuilder FINAL_PATH = new StringBuilder();

    /**
     * 表名前綴
     */
    private static String tablePrefix = "t_";


    /**
     * <p>
     * 讀取控制臺(tái)內(nèi)容
     * </p>
     */
    public static String scanner(String tip) {
        Scanner scanner = new Scanner(System.in);
        StringBuilder help = new StringBuilder();
        help.append("請(qǐng)輸入" + tip + ":");
        System.out.println(help);
        if (scanner.hasNext()) {
            String ipt = scanner.next();
            if (StringUtils.isNotEmpty(ipt)) {
                return ipt;
            }
        }
        throw new MybatisPlusException("請(qǐng)輸入正確的" + tip + "!");
    }

    /**
     * 代碼生成器
     */
    public static void main(String[] args) {
        // 目標(biāo)數(shù)據(jù)表名
        String[] tableName = scanner("表名,多個(gè)英文逗號(hào)分割").split(",");
        generateByTables(tableName);
    }

    private static void generateByTables(String... tableNames) {
        AutoGenerator mpg = new AutoGenerator();
        mpg.setTemplateEngine(new VelocityTemplateEngine());
        // 全局配置
        GlobalConfig gc = globalGenerate();
        // 包配置
        PackageConfig pc = packageGenerate();
        // 數(shù)據(jù)庫(kù)配置
        DataSourceConfig dsc = dataSourceGenerate();
        // 自定義模板
        TemplateConfig tc = templateGenerate();
        // 策略配置
        StrategyConfig strategy = strategyGenerate(tableNames);
        mpg.setGlobalConfig(gc);
        mpg.setDataSource(dsc);
        mpg.setPackageInfo(pc);
        mpg.setTemplate(tc);
        mpg.setStrategy(strategy);
        mpg.execute();
    }

    /**
     * 數(shù)據(jù)庫(kù)配置
     *
     * @return 數(shù)據(jù)源
     */
    private static DataSourceConfig dataSourceGenerate() {
        YamlPropertiesFactoryBean yamlMapFactoryBean = new YamlPropertiesFactoryBean();
        yamlMapFactoryBean.setResources(new ClassPathResource("application.yml"));
        //獲取yml里的參數(shù)
        Properties properties = yamlMapFactoryBean.getObject();
        String url = properties.getProperty("spring.datasource.url");
        String driver = properties.getProperty("spring.datasource.driver-class-name");
        String username = properties.getProperty("spring.datasource.username");
        String password = properties.getProperty("spring.datasource.password");
        // 數(shù)據(jù)庫(kù)配置
        DataSourceConfig dsc = new DataSourceConfig();
        //數(shù)據(jù)類型
        dsc.setDbType(DbType.MYSQL);
        dsc.setUrl(url);
        dsc.setDriverName(driver);
        dsc.setUsername(username);
        dsc.setPassword(password);
        return dsc;
    }

    /**
     * 全局配置
     *
     * @return 全局配置
     */
    private static GlobalConfig globalGenerate() {
        // 全局配置
        GlobalConfig gc = new GlobalConfig();
        //是否覆蓋文件
        gc.setFileOverride(true);
        // 獲取頂層目錄
        String projectPath = System.getProperty("user.dir");
        // 獲取子項(xiàng)目目錄
        String path = Generator.class.getClassLoader().getResource("").getPath();
        String levelPath = path.substring(0, path.indexOf("target") - 1);
        if (!projectPath.equals(levelPath)) {
            FINAL_PATH.append(levelPath);
        } else {
            FINAL_PATH.append(projectPath);
        }
        //輸出路徑
        gc.setOutputDir(FINAL_PATH + "/src/main/java");
        //作者名稱
        gc.setAuthor("shijiangdiya");
        //生成后是否自動(dòng)打開文件
        gc.setOpen(true);
        // XML 二級(jí)緩存
        gc.setEnableCache(false);
        //是否使用swagger2
        gc.setSwagger2(true);
        // 自定義文件命名,注意 %s 會(huì)自動(dòng)填充表實(shí)體屬性!
        gc.setControllerName("%sController");
        gc.setServiceName("%sService");
        gc.setServiceImplName("%sServiceImpl");
        gc.setMapperName("%sMapper");
        gc.setXmlName("%sMapper");
        //mapper.xml中生成基礎(chǔ)resultMap
        gc.setBaseResultMap(true);
        //mapper.xml中生成基礎(chǔ)columnList
        gc.setBaseColumnList(true);
        // 主鍵類型
        gc.setIdType(IdType.ID_WORKER);
        return gc;
    }

    /**
     * 策略配置
     * 主要的表字段映射
     *
     * @param tableName 表名
     * @return 策略配置
     */
    private static StrategyConfig strategyGenerate(String[] tableName) {
        // 策略配置
        StrategyConfig strategy = new StrategyConfig();
        //表名映射到實(shí)體策略,帶下劃線的轉(zhuǎn)成 駝峰
        strategy.setNaming(NamingStrategy.underline_to_camel);
        //列名映射到類型屬性策略,帶下劃線的轉(zhuǎn)成駝峰
        strategy.setColumnNaming(NamingStrategy.underline_to_camel);
        // 表名和字段名是否大小寫
        strategy.setCapitalMode(false);
        //實(shí)體類使用lombok
        strategy.setEntityLombokModel(true);
        //controller使用rest接口模式
        strategy.setRestControllerStyle(true);
        // 繼承頂層controller 這里是
        strategy.setSuperControllerClass("com.shijiangdiya.config.AbstractController");
        //設(shè)置表名
        strategy.setInclude(tableName);
        //去掉前綴
        strategy.setTablePrefix(tablePrefix);
        strategy.setEntityBooleanColumnRemoveIsPrefix(true);
        // 駝峰轉(zhuǎn)連字符
        strategy.setControllerMappingHyphenStyle(true);
        strategy.setEntityBuilderModel(true);
        return strategy;
    }

    /**
     * 自定義模板
     *
     * @return 模板
     */
    private static TemplateConfig templateGenerate() {
        // 設(shè)置自定義的模板
        TemplateConfig tc = new TemplateConfig();
        tc.setController("templates/MyController.java.vm")
                .setEntity("templates/MyEntity.java.vm")
                .setService("templates/MyService.java.vm")
                .setServiceImpl("templates/MyServiceImpl.java.vm")
                .setMapper("templates/MyMapper.java.vm")
                .setXml("/templates/MyMapper.xml.vm");
                // 不要源碼包內(nèi)的mapper
        return tc;
    }

    /**
     * 包配置
     *
     * @return 包配置
     */
    private static PackageConfig packageGenerate() {
        // 包配置
        PackageConfig pc = new PackageConfig();
        pc.setModuleName(SERVICE_NAME);
        pc.setParent("com.shijiangdiya");
        pc.setEntity("entity");
        pc.setService("service");
        pc.setServiceImpl("service.impl");
        pc.setMapper("mapper");
        pc.setXml("mapper.xml");
        return pc;
    }
}

二、自定義vm模版

使用自定義模板你可以生成更加符合你業(yè)務(wù)場(chǎng)景的代碼。

2.1 MyController.java.vm

在控制層中,提供了CRUD的方法,你可以自定義一些通用的東西,比如傳入查詢的QO、返回的DTO等。

package ${package.Controller};

import ${package.Entity}.${entity};
import ${package.Service}.${table.serviceName};
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import com.shijiangdiya.config.Response;


#if(${superControllerClassPackage})
import $!{superControllerClassPackage};
#end


/**
 * <p>
 * $!{table.comment} 前端控制器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
#set($entityName = ${entity.substring(0,1).toLowerCase()}+${entity.substring(1)})
@RestController
@RequestMapping(value = {"#if(${controllerMappingHyphenStyle})/api/${controllerMappingHyphen}#else /api/${table.entityPath}#end"},
		produces = MediaType.APPLICATION_JSON_VALUE)
@Api(value = "${table.controllerName}", description = "$!{table.comment}", produces = MediaType.APPLICATION_JSON_VALUE)
public class ${table.controllerName} extends ${superControllerClass} {
    @Autowired
    private ${table.serviceName} ${entityName}Service;

    @ResponseBody
    @ApiOperation(value = "", notes = "")
    @GetMapping(value = "/")
    public Response select(){
        ${entityName}Service.select();
        return returnSuccess();
    }

    @ResponseBody
    @ApiOperation(value = "", notes = "")
    @PostMapping(value = "")
    public Response add(){
        ${entityName}Service.add();
        return returnSuccess();
    }

    @ResponseBody
    @ApiOperation(value = "", notes = "")
    @PutMapping(value = "/{id}")
    public Response update(@PathVariable Long id){
        ${entityName}Service.modifyById();
        return returnSuccess();
    }

    @ApiOperation(value = "$!{table.comment}-刪除", notes = "$!{table.comment}-刪除")
    @DeleteMapping(value = "/{id}")
    public Response delete(@PathVariable Long id){
        ${entityName}Service.deleteById(id);
        return returnSuccess();
    }

}

2.2 MyEntity.java.vm 實(shí)體類

package ${package.Controller};

import ${package.Entity}.${entity};
import ${package.Service}.${table.serviceName};
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import com.shijiangdiya.config.Response;


#if(${superControllerClassPackage})
import $!{superControllerClassPackage};
#end


/**
 * <p>
 * $!{table.comment} 前端控制器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
#set($entityName = ${entity.substring(0,1).toLowerCase()}+${entity.substring(1)})
@RestController
@RequestMapping(value = {"#if(${controllerMappingHyphenStyle})/api/${controllerMappingHyphen}#else /api/${table.entityPath}#end"},
		produces = MediaType.APPLICATION_JSON_VALUE)
@Api(value = "${table.controllerName}", description = "$!{table.comment}", produces = MediaType.APPLICATION_JSON_VALUE)
public class ${table.controllerName} extends ${superControllerClass} {
    @Autowired
    private ${table.serviceName} ${entityName}Service;

    @ResponseBody
    @ApiOperation(value = "", notes = "")
    @GetMapping(value = "/")
    public Response select(){
        ${entityName}Service.select();
        return returnSuccess();
    }

    @ResponseBody
    @ApiOperation(value = "", notes = "")
    @PostMapping(value = "")
    public Response add(){
        ${entityName}Service.add();
        return returnSuccess();
    }

    @ResponseBody
    @ApiOperation(value = "", notes = "")
    @PutMapping(value = "/{id}")
    public Response update(@PathVariable Long id){
        ${entityName}Service.modifyById();
        return returnSuccess();
    }

    @ApiOperation(value = "$!{table.comment}-刪除", notes = "$!{table.comment}-刪除")
    @DeleteMapping(value = "/{id}")
    public Response delete(@PathVariable Long id){
        ${entityName}Service.deleteById(id);
        return returnSuccess();
    }

}

2.3 MyMapper.java.vm mapper接口

package ${package.Mapper};

import ${package.Entity}.${entity};
import ${superMapperClassPackage};
import org.apache.ibatis.annotations.Mapper;

/**
 * <p>
 * $!{table.comment} Mapper 接口
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Mapper
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {

}

2.4 MyMapper.xml.vm mapper.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="${package.Mapper}.${table.mapperName}">
</mapper>

2.5 MyService.java.vm 服務(wù)層

package ${package.Service};

import ${package.Entity}.${entity};
import ${superServiceClassPackage};
import java.util.List;
/**
 * <p>
 * $!{table.comment} 服務(wù)類
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
#set($entityName = ${entity.substring(0,1).toLowerCase()}+${entity.substring(1)})
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {

    /**
        * 查詢
        */
       List select();

       /**
        * 修改
        */
       void add();

       /**
        * 刪除
        * @param id
        */
       void deleteById(Long id);

       /**
        * 修改
        */
       void modifyById();
}

2.6 MyServiceImpl.java.vm 服務(wù)實(shí)現(xiàn)類

package ${package.ServiceImpl};

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * <p>
 * $!{table.comment} 服務(wù)實(shí)現(xiàn)類
 * </p>
 *
 * @author ${author}
 * @since ${date}
 * @version ${cfg.version}
 */
#set($entityName = ${entity.substring(0,1).toLowerCase()}+${entity.substring(1)})
@Service
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {

     @Override
       public List select() {
           return null;
       }

       @Override
       public void add() {

       }

       @Override
       public void deleteById(Long id) {

       }

       @Override
       public void modifyById() {

       }
}

三、測(cè)試

【企業(yè)級(jí)SpringBoot單體項(xiàng)目模板 】——Mybatis-plus自動(dòng)代碼生成,項(xiàng)目搭建,mybatis,spring boot,java
【企業(yè)級(jí)SpringBoot單體項(xiàng)目模板 】——Mybatis-plus自動(dòng)代碼生成,項(xiàng)目搭建,mybatis,spring boot,java文章來源地址http://www.zghlxwxcb.cn/news/detail-731792.html

到了這里,關(guān)于【企業(yè)級(jí)SpringBoot單體項(xiàng)目模板 】——Mybatis-plus自動(dòng)代碼生成的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • vue2企業(yè)級(jí)項(xiàng)目(八)

    4、 searchForm 創(chuàng)建 components/searchForm/index.js 使用案例 5、 searchTable 創(chuàng)建 components/searchTable/index.js 創(chuàng)建 components/searchTable/index.vue 使用案例 6、 dialogForm 創(chuàng)建 components/dialogForm/index.js 創(chuàng)建 components/dialogForm/index.vue 使用案例

    2024年02月14日
    瀏覽(25)
  • vue2企業(yè)級(jí)項(xiàng)目(四)

    路由設(shè)計(jì),過場(chǎng)動(dòng)畫設(shè)計(jì) 項(xiàng)目下載依賴 src 目錄下創(chuàng)建 router/index.js 創(chuàng)建 router/modules 文件,并使用 require.context 技術(shù)進(jìn)行動(dòng)態(tài)引入。 創(chuàng)建 router/hook.js 文件,編寫路由攔截等操作 使用 router.addRoutes 方法,動(dòng)態(tài)設(shè)置后端傳入的路由。(不建議) 前端開發(fā)需要路由來找具體的頁(yè)面

    2024年02月15日
    瀏覽(25)
  • vue2企業(yè)級(jí)項(xiàng)目(三)

    引入mockjs,i18n 項(xiàng)目下載依賴 根目錄創(chuàng)建 mock 文件夾,并創(chuàng)建 mock/index.js 創(chuàng)建 mock/mockPort.js 創(chuàng)建 mock/modules/test.js 示例 src 目錄下創(chuàng)建 api/mock.js 示例 main.js 添加一下內(nèi)容 根目錄創(chuàng)建 vue.config.js 項(xiàng)目下載依賴 src 目錄下創(chuàng)建 i18n/index.js 文件 main.js 引入使用 i18n ,和 vuex 生成的 s

    2024年02月14日
    瀏覽(21)
  • 低代碼企業(yè)級(jí)PMO項(xiàng)目管理系統(tǒng),360度全景透視企業(yè)管理視角

    低代碼企業(yè)級(jí)PMO項(xiàng)目管理系統(tǒng),360度全景透視企業(yè)管理視角

    在一個(gè)崇高的目標(biāo)支持下,不停地工作,即使慢,也一定會(huì)獲得成功。 ? 愛因斯坦 企業(yè)級(jí)PMO項(xiàng)目管理業(yè)務(wù)是行業(yè)里相對(duì)成熟和規(guī)范的業(yè)務(wù),擁有眾多商業(yè)套件和標(biāo)準(zhǔn)產(chǎn)品。 然而隨著企業(yè)數(shù)字化建設(shè)進(jìn)入深水區(qū),站在甲方角度進(jìn)行項(xiàng)目管理的業(yè)務(wù)視角、精細(xì)化管控、標(biāo)準(zhǔn)化管

    2024年02月03日
    瀏覽(23)
  • 企業(yè)級(jí)微服務(wù)架構(gòu)實(shí)戰(zhàn)項(xiàng)目--xx優(yōu)選-用戶登錄

    企業(yè)級(jí)微服務(wù)架構(gòu)實(shí)戰(zhàn)項(xiàng)目--xx優(yōu)選-用戶登錄

    1.登錄常量 ?2.登錄地址 ?3.配置域名 4.啟動(dòng)程序 ? ? 觸發(fā)連接小程序后端的登錄接口 ? ?小程序controller的登錄方法 ?

    2024年02月11日
    瀏覽(21)
  • 企業(yè)級(jí)高負(fù)載web服務(wù)器-Tomcat小項(xiàng)目

    企業(yè)級(jí)高負(fù)載web服務(wù)器-Tomcat小項(xiàng)目

    靜態(tài)頁(yè)面: 在網(wǎng)站設(shè)計(jì)中,純粹HTML格式的網(wǎng)頁(yè)(可以包含圖片、視頻JS (前端功能實(shí)現(xiàn))、CSS (樣式)等)通常 被稱為\\\"靜態(tài)網(wǎng)頁(yè)\\\" 特點(diǎn): 處理文件類型:如.html、jpg、.gif、.mp4、.swf、.avi、.wmv、.flv等2. 地址中不含有問號(hào)\\\"?\\\"或等特殊符號(hào)。 保存在網(wǎng)站服務(wù)器文件系統(tǒng)上的,是

    2024年02月14日
    瀏覽(30)
  • Vue3.0 項(xiàng)目啟動(dòng)(打造企業(yè)級(jí)音樂App)

    Vue3.0 項(xiàng)目啟動(dòng)(打造企業(yè)級(jí)音樂App)

    內(nèi)容 參考鏈接 Vue3.0 項(xiàng)目啟動(dòng) Vue3.0 項(xiàng)目啟動(dòng)(打造企業(yè)級(jí)音樂App) Vue3.0項(xiàng)目——打造企業(yè)級(jí)音樂App(一) Tab欄、輪播圖、歌單列表、滾動(dòng)組件 Vue3.0項(xiàng)目——打造企業(yè)級(jí)音樂App(二) 圖片懶加載、v-loading指令的開發(fā)和優(yōu)化 2020年09月18日,vue3.0 版本正式發(fā)布。這意味著在未來

    2023年04月08日
    瀏覽(15)
  • Redis:原理速成+項(xiàng)目實(shí)戰(zhàn)——Redis企業(yè)級(jí)項(xiàng)目實(shí)戰(zhàn)終結(jié)篇(HyperLogLog實(shí)現(xiàn)UV統(tǒng)計(jì))

    Redis:原理速成+項(xiàng)目實(shí)戰(zhàn)——Redis企業(yè)級(jí)項(xiàng)目實(shí)戰(zhàn)終結(jié)篇(HyperLogLog實(shí)現(xiàn)UV統(tǒng)計(jì))

    ?????作者簡(jiǎn)介:一位大四、研0學(xué)生,正在努力準(zhǔn)備大四暑假的實(shí)習(xí) ??上期文章:Redis:原理速成+項(xiàng)目實(shí)戰(zhàn)——Redis實(shí)戰(zhàn)14(BitMap實(shí)現(xiàn)用戶簽到功能) ??訂閱專欄:Redis:原理速成+項(xiàng)目實(shí)戰(zhàn) 希望文章對(duì)你們有所幫助 這篇是實(shí)戰(zhàn)部分的終結(jié)篇,其實(shí)Redis的核心操作,主要是

    2024年01月17日
    瀏覽(25)
  • Vue3 + Vite2 + TypeScript4搭建企業(yè)級(jí)項(xiàng)目框架

    1. 創(chuàng)建項(xiàng)目 使用命令行工具進(jìn)入到你想要?jiǎng)?chuàng)建項(xiàng)目的目錄,然后執(zhí)行以下命令: 這將會(huì)創(chuàng)建一個(gè)新的項(xiàng)目文件夾和一個(gè) package.json 文件。 2. 安裝依賴 接下來你需要在項(xiàng)目中安裝 Vue、Vite、TypeScript 和其他需要的依賴。執(zhí)行以下命令: 以上命令會(huì)安裝最新的 Vue、Vite 和 TypeSc

    2024年02月08日
    瀏覽(93)
  • 企業(yè)級(jí)開發(fā)項(xiàng)目實(shí)戰(zhàn)——基于RabbitMQ實(shí)現(xiàn)數(shù)據(jù)庫(kù)、elasticsearch的數(shù)據(jù)同步

    企業(yè)級(jí)開發(fā)項(xiàng)目實(shí)戰(zhàn)——基于RabbitMQ實(shí)現(xiàn)數(shù)據(jù)庫(kù)、elasticsearch的數(shù)據(jù)同步

    1、商品上架時(shí):search-service新增商品到elasticsearch 2、商品下架時(shí):search-service刪除elasticsearch中的商品 數(shù)據(jù)同步是希望,當(dāng)我們商品修改了數(shù)據(jù)庫(kù)中的商品信息,索引庫(kù)中的信息也會(huì)跟著改。在微服務(wù)中數(shù)據(jù)庫(kù)和索引庫(kù)是在兩個(gè)不同的服務(wù)中。如果,商品的服務(wù),向es的服務(wù)中

    2024年02月12日
    瀏覽(86)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包