JasonsGong.github.io/posts/45726.html
2024-03-28 11:28:52 +08:00

1288 lines
1.1 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="zh-CN" data-theme="light"><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,viewport-fit=cover"><title>项目实战-谷粒商城 | The Blog</title><meta name="author" content="Jason"><meta name="copyright" content="Jason"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="一.项目简介1.项目背景电商模式 谷粒商城使用的B2C模式销售自营的商品给客户 市面上5种常见的电商模式B2B、B2C、C2B、C2C、O2O 1、B2B模式business to business是指商家与商家建立的商业关系。如阿里巴巴。 2、B2C模式business to consumer商对客模式。即通常说的商业零售供应商直接把商品卖给用户。如苏宁易购、京东、天猫、小米商城。">
<meta property="og:type" content="article">
<meta property="og:title" content="项目实战-谷粒商城">
<meta property="og:url" content="https://jasonsgong.gitee.io/posts/45726.html">
<meta property="og:site_name" content="The Blog">
<meta property="og:description" content="一.项目简介1.项目背景电商模式 谷粒商城使用的B2C模式销售自营的商品给客户 市面上5种常见的电商模式B2B、B2C、C2B、C2C、O2O 1、B2B模式business to business是指商家与商家建立的商业关系。如阿里巴巴。 2、B2C模式business to consumer商对客模式。即通常说的商业零售供应商直接把商品卖给用户。如苏宁易购、京东、天猫、小米商城。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://jasonsgong.gitee.io/img/5.png">
<meta property="article:published_time" content="2023-05-17T16:06:28.000Z">
<meta property="article:modified_time" content="2023-09-11T23:36:48.000Z">
<meta property="article:author" content="Jason">
<meta property="article:tag" content="项目实战">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://jasonsgong.gitee.io/img/5.png"><link rel="shortcut icon" href="/img/%E5%9B%BE%E6%A0%87.png"><link rel="canonical" href="https://jasonsgong.gitee.io/posts/45726.html"><link rel="preconnect" href="//fastly.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="/cdn/icon/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="/cdn/css/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="/cdn/css/fancybox.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?aad83e413776c1cd5d11ed7eeedd98f7";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script><script>const GLOBAL_CONFIG = {
root: '/',
algolia: undefined,
localSearch: {"path":"/search.xml","preload":true,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"找不到您查询的内容:${query}","hits_stats":"共找到 ${hits} 篇文章"}},
translate: undefined,
noticeOutdate: undefined,
highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":400},
copy: {
success: '复制成功',
error: '复制错误',
noSupport: '浏览器不支持'
},
relativeDate: {
homepage: true,
post: true
},
runtime: '天',
dateSuffix: {
just: '刚刚',
min: '分钟前',
hour: '小时前',
day: '天前',
month: '个月前'
},
copyright: undefined,
lightbox: 'mediumZoom',
Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#006650","bgDark":"#006650","position":"top-center"},
source: {
justifiedGallery: {
js: 'https://fastly.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
css: 'https://fastly.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
}
},
isPhotoFigcaption: false,
islazyload: false,
isAnchor: true,
percent: {
toc: true,
rightside: false,
},
autoDarkmode: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: '项目实战-谷粒商城',
isPost: true,
isHome: false,
isHighlightShrink: false,
isToc: true,
postUpdate: '2023-09-12 07:36:48'
}</script><noscript><style type="text/css">
#nav {
opacity: 1
}
.justified-gallery img {
opacity: 1
}
#recent-posts time,
#post-meta time {
display: inline !important
}
</style></noscript><script>(win=>{
win.saveToLocal = {
set: function setWithExpiry(key, value, ttl) {
if (ttl === 0) return
const now = new Date()
const expiryDay = ttl * 86400000
const item = {
value: value,
expiry: now.getTime() + expiryDay,
}
localStorage.setItem(key, JSON.stringify(item))
},
get: function getWithExpiry(key) {
const itemStr = localStorage.getItem(key)
if (!itemStr) {
return undefined
}
const item = JSON.parse(itemStr)
const now = new Date()
if (now.getTime() > item.expiry) {
localStorage.removeItem(key)
return undefined
}
return item.value
}
}
win.getScript = url => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
script.onerror = reject
script.onload = script.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
script.onload = script.onreadystatechange = null
resolve()
}
document.head.appendChild(script)
})
win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = url
if (id) link.id = id
link.onerror = reject
link.onload = link.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
link.onload = link.onreadystatechange = null
resolve()
}
document.head.appendChild(link)
})
win.activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
}
}
win.activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
}
}
const t = saveToLocal.get('theme')
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
if (t === undefined) {
if (isLightMode) activateLightMode()
else if (isDarkMode) activateDarkMode()
else if (isNotSpecified || hasNoSupport) {
const now = new Date()
const hour = now.getHours()
const isNight = hour <= 8 || hour >= 22
isNight ? activateDarkMode() : activateLightMode()
}
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
if (saveToLocal.get('theme') === undefined) {
e.matches ? activateDarkMode() : activateLightMode()
}
})
} else if (t === 'light') activateLightMode()
else activateDarkMode()
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
if (asideStatus === 'hide') {
document.documentElement.classList.add('hide-aside')
} else {
document.documentElement.classList.remove('hide-aside')
}
}
const detectApple = () => {
if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
document.documentElement.classList.add('apple')
}
}
detectApple()
})(window)</script><script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script><script type="text/javascript" src ="/js/welcome.js" ></script><script src="/js/sweetalert.js"></script><link rel="stylesheet" href="/css/sweetalert.css"><!-- hexo injector head_end start --><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiperstyle.css" media="print" onload="this.media='all'"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/img/avatar.jpg" onerror="onerror=null;src='/img/loading.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">77</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">47</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div><br/><div class="menus_items"><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://gitee.com/JasonsGong/jasonsgong/pages"><i class="fa-fw fas fa-sync-alt"></i><span> 更新</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://www.tutorialspoint.com/compile_java8_online.php"><i class="fa-fw fas fa-code"></i><span> 代码</span></a></div><div class="menus_item"><a class="site-page" href="/notice/"><i class="fa-fw fas fa-stream"></i><span> 公告</span></a></div><div class="menus_item"><a class="site-page" href="/website/"><i class="fa-fw fas fa-list"></i><span> 网址</span></a></div><div class="menus_item"><a class="site-page" href="/record/"><i class="fa-fw fas fa-bars"></i><span> 记录</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://tongji.baidu.com/main/overview/10000573913/overview/index?siteId=20315864"><i class="fa-fw fas fa-chart-line"></i><span> 统计</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://jasonsgong.github.io"><i class="fa-fw fas fa-wave-square"></i><span> 镜像</span></a></div><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="not-top-img" id="page-header"><nav id="nav"><span id="blog-info"><a href="/" title="The Blog"><img class="site-icon" src="/img/logo.png"/><span class="site-name">The Blog</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://gitee.com/JasonsGong/jasonsgong/pages"><i class="fa-fw fas fa-sync-alt"></i><span> 更新</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://www.tutorialspoint.com/compile_java8_online.php"><i class="fa-fw fas fa-code"></i><span> 代码</span></a></div><div class="menus_item"><a class="site-page" href="/notice/"><i class="fa-fw fas fa-stream"></i><span> 公告</span></a></div><div class="menus_item"><a class="site-page" href="/website/"><i class="fa-fw fas fa-list"></i><span> 网址</span></a></div><div class="menus_item"><a class="site-page" href="/record/"><i class="fa-fw fas fa-bars"></i><span> 记录</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://tongji.baidu.com/main/overview/10000573913/overview/index?siteId=20315864"><i class="fa-fw fas fa-chart-line"></i><span> 统计</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://jasonsgong.github.io"><i class="fa-fw fas fa-wave-square"></i><span> 镜像</span></a></div><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav></header><main class="layout" id="content-inner"><div id="post"><div id="post-info"><h1 class="post-title">项目实战-谷粒商城</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-05-17T16:06:28.000Z" title="发表于 2023-05-18 00:06:28">2023-05-18</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-09-11T23:36:48.000Z" title="更新于 2023-09-12 07:36:48">2023-09-12</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E5%90%8E%E7%AB%AF/">后端</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">42.4k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>207分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="项目实战-谷粒商城"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div><article class="post-content" id="article-container"><h1 id="一-项目简介"><a href="#一-项目简介" class="headerlink" title="一.项目简介"></a>一.项目简介</h1><h2 id="1-项目背景"><a href="#1-项目背景" class="headerlink" title="1.项目背景"></a>1.项目背景</h2><p><strong>电商模式</strong> 谷粒商城使用的B2C模式销售自营的商品给客户</p>
<p>市面上5种常见的电商模式B2B、B2C、C2B、C2C、O2O</p>
<p><strong>1、B2B模式</strong><br>business to business是指商家与商家建立的商业关系。如阿里巴巴。</p>
<p><strong>2、B2C模式</strong><br>business to consumer商对客模式。即通常说的商业零售供应商直接把商品卖给用户。如苏宁易购、京东、天猫、小米商城。</p>
<p><strong>3、C2B模式</strong><br>customer to business即消费者对企业。先有消费者需求而后有企业生产。例如众筹类的商城。</p>
<p><strong>4、C2C模式</strong><br>customer to consumer客户之间直接把东西放上网上去卖。如淘宝、闲鱼。</p>
<p><strong>5、O2O模式</strong><br>online to offline线上线下。线上快速支付线下优质服务。如饿了么、美团、京东到家。</p>
<h2 id="2-项目架构图"><a href="#2-项目架构图" class="headerlink" title="2.项目架构图"></a>2.项目架构图</h2><p><strong>项目的架构图</strong></p>
<p><img src="/pictures/image-20230518000727005.png"></p>
<p> <strong>微服务划分图</strong></p>
<p><img src="/pictures/image-20230518015831413.png" alt="image-20230518015831413"></p>
<h2 id="3-项目技术和特色"><a href="#3-项目技术和特色" class="headerlink" title="3.项目技术和特色"></a>3.项目技术和特色</h2><ul>
<li><strong>前后端分离开发开发基于VUE的后台管理系统</strong></li>
<li><strong>SpringCloud全新解决方案</strong></li>
<li><strong>应用监控、限流、网关、熔断降级等分布式方案 全方位涉及</strong></li>
<li><strong>包含分布式事务、分布式锁等技术难点</strong></li>
<li><strong>分析高并发场景的编码方式、线程池、异步编排等使用</strong></li>
<li><strong>压力测试与性能优化</strong></li>
<li><strong>各种集群技术的区别已经使用</strong></li>
<li><strong>CI&#x2F;CD的使用</strong></li>
</ul>
<h2 id="4-项目的前置要求"><a href="#4-项目的前置要求" class="headerlink" title="4.项目的前置要求"></a>4.项目的前置要求</h2><ul>
<li><strong>熟悉SpringBoot以及常见的整合方案</strong></li>
<li><strong>了解SpringCloud</strong></li>
<li><strong>熟悉Maven git</strong></li>
<li><strong>熟悉linux、redis、docker基本操作</strong></li>
<li><strong>了解html、css、js、vue</strong></li>
<li><strong>熟练使用idea开发项目</strong></li>
</ul>
<h1 id="二-分布式基础概念"><a href="#二-分布式基础概念" class="headerlink" title="二.分布式基础概念"></a>二.分布式基础概念</h1><h2 id="1-微服务"><a href="#1-微服务" class="headerlink" title="1.微服务"></a>1.微服务</h2><p>微服务架构风格,就像是一个<strong>单独的应用程序</strong>开发为<strong>一套小服务</strong>每个服务运行在自己的进程中并使用轻量级机制通信通常是HTTP API。这些服务围绕业务能力来构建并通过完全自动化部署机制来独立部署。这些服务使用不同的编程语言编写以及不同的数据存储技术并保持最低限度的集中式管理。</p>
<p><strong>简而言之:拒绝大型单体应用,基于业务边界进行服务微化拆分,各个应用独立部署运行。</strong></p>
<h2 id="2-集群-分布式-节点"><a href="#2-集群-分布式-节点" class="headerlink" title="2.集群|分布式|节点"></a>2.集群|分布式|节点</h2><p><strong>集群是一个物理形态 ,分布式是个工作方式</strong></p>
<p><strong>分布式:</strong> 将不同的业务分布在不同的地方</p>
<p><strong>集群:</strong> 集群指的是将几台服务器集中在一起,实现同一业务</p>
<p><strong>分布式中的每一个节点,都可以做集群。而集群不一定是分布式的。</strong></p>
<p><strong>节点:</strong> 集群中的一个服务器</p>
<h2 id="3-远程调用"><a href="#3-远程调用" class="headerlink" title="3.远程调用"></a>3.远程调用</h2><p><strong>在分布式系统中,各个服务可能处于不同主机,但是服务之间不可避免的需要相互调用,我们称之为远程调用。</strong></p>
<p>SpringCloud中使用HTTP+JSON的方式完成远程调用</p>
<p><img src="/pictures/image-20230518010847966.png" alt="image-20230518010847966"></p>
<h2 id="4-负载均衡"><a href="#4-负载均衡" class="headerlink" title="4.负载均衡"></a>4.负载均衡</h2><img src="/pictures/image-20230518011030343.png" alt="image-20230518011030343" style="zoom:150%;" />
<pre><code>分布式系统中A服务需要调用B服务B服务在多台机器上都存在A调用任意一个服务均可完成功能。为了使每一个服务器都不要太忙或者太闲我们可以使用负载均衡的调用每一个服务器提升网站的健壮性。
</code></pre>
<p><strong>常见的负载均衡算法:</strong></p>
<p><strong>轮询:</strong> 为第一个请求选择健康池中的第一台后端服务器,然后按顺序往后依次选择,直到最后一个,然后循环。</p>
<p><strong>最小连接:</strong> 有限选择连接数量少,也就是压力最小的后端服务器,在会话较长的情况下可以考虑采取这种方式。</p>
<p><strong>随机法:</strong>通过系统的随机算法,根据后端服务器的列表大小值来随机选取其中的一台服务器进行访问。由概率统计理论可以得知,随着客户端调用服务端的次数增多,其实际效果越来越接近于平均分配调用量到后端的每一台服务器,也就是轮询的结果。</p>
<p><strong>源地址哈希法:</strong>源地址哈希的思想是根据获取客户端的IP地址通过哈希函数计算得到的一个数值用该数值对服务器列表的大小进行取模运算得到的结果便是客服端要访问服务器的序号。采用源地址哈希法进行负载均衡同一IP地址的客户端当后端服务器列表不变时它每次都会映射到同一台后端服务器进行访问。</p>
<p><strong>加权轮询法:</strong>不同的后端服务器可能机器的配置和当前系统的负载并不相同,因此它们的抗压能力也不相同。给配置高、负载低的机器配置更高的权重,让其处理更多的请;而配置低、负载高的机器,给其分配较低的权重,降低其系统负载,加权轮询能很好地处理这一问题,并将请求顺序且按照权重分配到后端。</p>
<p><strong>加权随机法:</strong>与加权轮询法一样,加权随机法也根据后端机器的配置,系统的负载分配不同的权重。不同的是,它是按照权重随机请求后端服务器,而非顺序。</p>
<h2 id="5-服务注册-发现-注册中心"><a href="#5-服务注册-发现-注册中心" class="headerlink" title="5.服务注册|发现|注册中心"></a>5.服务注册|发现|注册中心</h2><p><img src="/pictures/image-20230518012211042.png" alt="image-20230518012211042"></p>
<h2 id="6-配置中心"><a href="#6-配置中心" class="headerlink" title="6.配置中心"></a>6.配置中心</h2><pre><code>每一个服务最终会有大量的配置,并且每个服务都可能部署在多台机器上。我们经常需要变更配置,我们可以让每个服务在配置中心获取自己的配置。
</code></pre>
<p><img src="/pictures/image-20230518012538349.png" alt="image-20230518012538349"></p>
<h2 id="7-服务熔断和服务降级"><a href="#7-服务熔断和服务降级" class="headerlink" title="7.服务熔断和服务降级"></a>7.服务熔断和服务降级</h2><pre><code>在微服务的架构中,微服务之间通过网络进行通信,存在相互依赖,当其中的一个服务不可用时,有可能会造成雪崩效应。要防止这样的情况,必须要有容错机制来保护服务。
</code></pre>
<p><strong>服务熔断:</strong> 设置服务的超时,当被调用的服务经常失败到达某个阈值,我们可以开启短路保护机制,后来的请求不再去调用这个服务。本地直接返回默认的数据。</p>
<p><strong>服务降级:</strong> 在运维期间,当系统处于高峰期,系统资源紧张,我们可以让非核心的业务降级运行。降级:某些业务不处理,或者简单处理[抛异常、返回NULL、调用mock数据、调用Fallback处理逻辑]。</p>
<p><img src="/pictures/image-20230518013254404.png" alt="image-20230518013254404"></p>
<p><img src="/pictures/image-20230518013624395.png" alt="image-20230518013624395"></p>
<h2 id="8-API网关"><a href="#8-API网关" class="headerlink" title="8.API网关"></a>8.API网关</h2><pre><code>在微服务的架构中API Gateway作为整体架构的重要组件他抽象了微服务中都需要的公共功能同时提供了客户端的负载均衡服务自动熔断灰度发布、统一认证、限流流控、日志统计等丰富功能帮助我们解决很多API管理难题。
</code></pre>
<img src="/pictures/image-20230518014732955.png" alt="image-20230518014732955" style="zoom:150%;" />
<h1 id="三-环境搭建"><a href="#三-环境搭建" class="headerlink" title="三.环境搭建"></a>三.环境搭建</h1><h2 id="1-安装虚拟机"><a href="#1-安装虚拟机" class="headerlink" title="1.安装虚拟机"></a>1.<strong>安装虚拟机</strong></h2><p>需要使用虚拟机安装相关的软件和部署集群</p>
<p><strong><a href="https://jasonsgong.gitee.io/posts/47407.html">VMWare虚拟机安装Linux教程 | The Blog (gitee.io)</a></strong></p>
<p>将Linxu的IP地址固定下来</p>
<p><strong><a href="https://jasonsgong.gitee.io/posts/21883.html">Linux设置静态IP | The Blog (gitee.io)</a></strong></p>
<h2 id="2-Docker安装与配置"><a href="#2-Docker安装与配置" class="headerlink" title="2.Docker安装与配置"></a>2.Docker安装与配置</h2><p>包含docker安装、开启开机自启动、配置镜像加速服务</p>
<p><strong><a href="https://jasonsgong.gitee.io/posts/19306.html">Docker容器化技术 | The Blog (gitee.io)</a></strong><img src="/pictures/image-20230518141429712.png" alt="image-20230518141429712"></p>
<p><img src="/pictures/image-20230518145456236.png" alt="image-20230518145456236"></p>
<h2 id="3-Docker安装mysql"><a href="#3-Docker安装mysql" class="headerlink" title="3.Docker安装mysql"></a>3.Docker安装mysql</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">下载mysql的镜像文件 这里以下载mysql5.7为例</span></span><br><span class="line">docker pull mysql:5.7</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看是否下载成功</span></span><br><span class="line">docker images</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">使用MySQL的镜像启动一个容器</span></span><br><span class="line"> docker run -p 3306:3306 --name mysql \</span><br><span class="line">-v /mydata/mysql/log:/var/log/mysql \</span><br><span class="line">-v /mydata/mysql/data:/var/lib/mysql \</span><br><span class="line">-v /mydata/mysql/conf:/etc/mysql \</span><br><span class="line">-e MYSQL_ROOT_PASSWORD=root \</span><br><span class="line">-d mysql:5.7</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">参数说明</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">-p 3306:3306将容器的 3306 端口映射到主机的 3306 端口</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">-v /mydata/mysql/conf:/etc/mysql将配置文件夹挂载到主机</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">-v /mydata/mysql/log:/var/log/mysql将日志文件夹挂载到主机</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">-v /mydata/mysql/data:/var/lib/mysql/:将配置文件夹挂载到主机</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">-e MYSQL_ROOT_PASSWORD=root初始化 root 用户的密码</span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看是否运行成功 这时使用Navicat就可以连接上了 连接不上 关闭防火墙</span></span><br><span class="line">docker ps #查看正在运行的容器</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">进入容器的内部</span></span><br><span class="line">docker exec -it mysql /bin/bash</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看容器内部的目录结构 我们可以看到容器的内部是一个小小的linux系统</span></span><br><span class="line">ls / #注意中间有一个空格</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看与mysql相关的目录</span></span><br><span class="line">whereis mysql</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">退出容器</span></span><br><span class="line">exit;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">在容器外部查看mysql挂载在本地的三个文件</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">容器内部文件的变化会同步在这三个文件中 conf data <span class="built_in">log</span></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">外部修改 也会同步到内部</span></span><br><span class="line">cd /mydata/mysql</span><br><span class="line">ls</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">创建一个mysql的配置文件设置字符编码 将下面的内容粘贴到配置文件中</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">1.创建配置文件</span></span><br><span class="line">vi /mydata/mysql/conf/my.cnf</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">2.将以下的内容粘贴到配置文件配置文件内容</span></span><br><span class="line">[client]</span><br><span class="line">default-character-set=utf8</span><br><span class="line">[mysql]</span><br><span class="line">default-character-set=utf8</span><br><span class="line">[mysqld]</span><br><span class="line">init_connect=&#x27;SET collation_connection = utf8_unicode_ci&#x27;</span><br><span class="line">init_connect=&#x27;SET NAMES utf8&#x27;</span><br><span class="line">character-set-server=utf8</span><br><span class="line">collation-server=utf8_unicode_ci</span><br><span class="line">skip-character-set-client-handshake</span><br><span class="line">skip-name-resolve</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">3.重启MySQl的服务 让配置文件生效 这个配置文件也会同步到容器内部</span></span><br><span class="line">docker restart mysql</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">设置开机自启动</span></span><br><span class="line">docker update mysql --restart=always</span><br></pre></td></tr></table></figure>
<h2 id="4-Docker安装redis"><a href="#4-Docker安装redis" class="headerlink" title="4.Docker安装redis"></a>4.Docker安装redis</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">下载redis的镜像文件 直接下载最新的</span></span><br><span class="line">docker pull redis</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">创建redis挂载在宿主机的配置文件和目录</span></span><br><span class="line">mkdir -p /mydata/redis/conf #创建目录</span><br><span class="line">touch /mydata/redis/conf/redis.conf #创建配置文件</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">创建并启动容器 这是以配置文件的方式启动 \前面有一个空格</span></span><br><span class="line">docker run -p 6379:6379 --name redis \</span><br><span class="line">-v /mydata/redis/data:/data \</span><br><span class="line">-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf \</span><br><span class="line">-d redis redis-server /etc/redis/redis.conf</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">检查容器的运行情况</span></span><br><span class="line">docker ps</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">测试客户端的使用</span></span><br><span class="line">docker exec -it redis redis-cli</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">可以在redis客户端中使用如下命令</span></span><br><span class="line">127.0.0.1:6379&gt; set name tom #存值</span><br><span class="line">OK</span><br><span class="line">127.0.0.1:6379&gt; get name #取值</span><br><span class="line">&quot;tom&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">redis中的数据不能持久化 关机重启之后数据会丢失</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">通过以下的配置 实现redis的持久化操作 AOF的持久化</span></span><br><span class="line">vi /mydata/redis/conf/redis.conf #修改之前创建的配置文件</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">添加如下配置</span></span><br><span class="line">appendonly yes</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">重启redis 让配置生效</span></span><br><span class="line">docker restart redis</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">设置开机自启动</span></span><br><span class="line">docker update redis --restart=always</span><br></pre></td></tr></table></figure>
<h2 id="5-统一开发环境"><a href="#5-统一开发环境" class="headerlink" title="5.统一开发环境"></a>5.统一开发环境</h2><p><strong>其中Java使用的是java8及以上</strong></p>
<p><strong>Maven 配置阿里云的镜像 profiles</strong></p>
<p><strong><a href="https://jasonsgong.gitee.io/posts/63333.html">开发环境的搭建 | The Blog (gitee.io)</a></strong></p>
<p><strong>IDEA中修改使用自己安装的Maven</strong></p>
<p><strong>IDEA插件:Lombok|MybatisX</strong></p>
<p><strong>VSCode插件:</strong></p>
<p><img src="/pictures/image-20230518160444927.png" alt="image-20230518160444927"></p>
<p><img src="/pictures/image-20230518155308167.png" alt="image-20230518155308167"></p>
<h2 id="6-配置Git"><a href="#6-配置Git" class="headerlink" title="6.配置Git"></a>6.配置Git</h2><p><strong>官网下载:<a target="_blank" rel="noopener" href="https://git-scm.com/downloads">https://git-scm.com/downloads</a></strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">以下的操作在下载安装完毕之后进行</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">1.鼠标在桌面右键 选择Git Bash Here 打开控制台</span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">2.配置用户名和邮箱</span></span><br><span class="line">git config --global user.name &quot;用户名&quot; #随意</span><br><span class="line">git config --global user.email &quot;邮箱&quot; #自己的邮箱</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">3.配置SSH免密连接</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">生成密钥</span></span><br><span class="line">ssh-keygen -t rsa -C &quot;在码云上注册的邮箱地址&quot; #连续三次回车</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看密钥并复制公钥的内容</span></span><br><span class="line">cat ~/.ssh/id_rsa.pub</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">4.将密钥的复制到码云的SSH公钥中</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">4.1添加公钥 公钥名随意 公钥内容就是上面复制的内容</span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">5.测试</span></span><br><span class="line">ssh -T git@gitee.com</span><br></pre></td></tr></table></figure>
<p><strong>常用命令</strong></p>
<img src="/pictures/image-20230518161145808.png" alt="image-20230518161145808" style="zoom: 200%;" />
<h2 id="7-从Gitee上初始化一个项目"><a href="#7-从Gitee上初始化一个项目" class="headerlink" title="7.从Gitee上初始化一个项目"></a>7.从Gitee上初始化一个项目</h2><p>我们是先从码云上初始化一个项目 然后拉取到本地</p>
<p><strong>创建一个仓库</strong></p>
<p><img src="/pictures/image-20230518163703370.png" alt="image-20230518163703370"></p>
<p><strong>复制刚才创建仓库的地址</strong></p>
<p><img src="/pictures/image-20230518163838162.png" alt="image-20230518163838162"></p>
<p><strong>将工程导入到IDEA中</strong></p>
<p><img src="/pictures/image-20230518164005690.png" alt="image-20230518164005690"></p>
<p><strong>导入成功</strong></p>
<p><img src="/pictures/image-20230518164217773.png" alt="image-20230518164217773"></p>
<h2 id="8-创建微服务模块"><a href="#8-创建微服务模块" class="headerlink" title="8.创建微服务模块"></a>8.创建微服务模块</h2><img src="/pictures/image-20230518171355588.png" alt="image-20230518171355588" style="zoom:150%;" />
<h2 id="9-数据库设计"><a href="#9-数据库设计" class="headerlink" title="9.数据库设计"></a>9.数据库设计</h2><p><img src="/pictures/image-20230518171546236.png" alt="image-20230518171546236"></p>
<img src="/pictures/image-20230518173203605.png" alt="image-20230518173203605" style="zoom:200%;" />
<h2 id="10-后台管理系统的搭建"><a href="#10-后台管理系统的搭建" class="headerlink" title="10.后台管理系统的搭建"></a>10.后台管理系统的搭建</h2><h3 id="10-1-后端的搭建"><a href="#10-1-后端的搭建" class="headerlink" title="10.1.后端的搭建"></a>10.1.后端的搭建</h3><p><strong>后台管理系统使用的是人人开源提供的一个脚手架:</strong></p>
<p><strong>仓库的地址信息:</strong></p>
<p><strong>仓库主页:<a target="_blank" rel="noopener" href="https://gitee.com/renrenio">https://gitee.com/renrenio</a></strong></p>
<p><strong>后端renren-fast<a target="_blank" rel="noopener" href="https://gitee.com/renrenio/renren-fast.git">https://gitee.com/renrenio/renren-fast.git</a></strong></p>
<p><strong>前端renren-fast-vue<a target="_blank" rel="noopener" href="https://gitee.com/renrenio/renren-fast-vue.git">https://gitee.com/renrenio/renren-fast-vue.git</a></strong></p>
<p>将其作为一个模块集成到gulimall中</p>
<p><img src="/pictures/image-20230518221222845.png" alt="image-20230518221222845"></p>
<p>同时创建好这个脚手架需要的数据库</p>
<p><img src="/pictures/image-20230518221433314.png" alt="image-20230518221433314"></p>
<p><strong>修改配置文件中数据库账号密码ip的设置启动项目看有没有报错</strong></p>
<h3 id="10-2-前端的搭建"><a href="#10-2-前端的搭建" class="headerlink" title="10.2 前端的搭建"></a>10.2 前端的搭建</h3><p><strong>安装node.js 和 npm包管理工具 (node.js自带npm包管理工具)</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">检查是否安装成功</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">出现版本号就是安装成功了</span></span><br><span class="line">node -v</span><br><span class="line">npm -v</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">npm配置淘宝的镜像 下载依赖的速度更快</span></span><br><span class="line">npm config set registry https://registry.npmmirror.com</span><br></pre></td></tr></table></figure>
<p><strong>将项目导入到vscode中并安装依赖</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">安装依赖的命令</span></span><br><span class="line">npm install</span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230518223021928.png" alt="image-20230518223021928"></p>
<p><strong>下载完成之后,运行前端的项目</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">运行命令</span></span><br><span class="line">npm run dev</span><br></pre></td></tr></table></figure>
<p><strong>运行成功过之后访问 <a target="_blank" rel="noopener" href="http://localhost:8001/">http://localhost:8001</a></strong></p>
<p><strong>成功的页面显示如下</strong></p>
<p><img src="/pictures/image-20230518223525151.png" alt="image-20230518223525151"></p>
<p>**使用账号:admin密码:admin 登录 **</p>
<p><strong>可以登录成功并显示以下的页面说明前后端的联调通过</strong></p>
<p><img src="/pictures/image-20230518223921179.png" alt="image-20230518223921179"></p>
<h2 id="11-快速开发-逆向工程的搭建"><a href="#11-快速开发-逆向工程的搭建" class="headerlink" title="11.快速开发-逆向工程的搭建"></a>11.快速开发-逆向工程的搭建</h2><h3 id="1-代码生成器快速使用案例"><a href="#1-代码生成器快速使用案例" class="headerlink" title="1.代码生成器快速使用案例"></a>1.代码生成器快速使用案例</h3><p><strong>人人开源代码生成器的地址:<a target="_blank" rel="noopener" href="https://gitee.com/renrenio/renren-generator.git">https://gitee.com/renrenio/renren-generator.git</a></strong></p>
<p><strong>集成代码生成器</strong></p>
<p><img src="/pictures/image-20230518230016421.png" alt="image-20230518230016421"></p>
<p><strong>修改代码生成器的配置文件</strong></p>
<p><strong>1.修改yml配置文件中数据库的连接信息</strong></p>
<p><strong>2.修改properties中与代码生成相关的配置信息</strong></p>
<p>配置举例 根据不同的模块 不同的数据库 配置不同</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#代码生成器配置信息</span></span><br><span class="line"></span><br><span class="line"><span class="attr">mainPath</span>=<span class="string">com.atguigu</span></span><br><span class="line"><span class="comment">#包名</span></span><br><span class="line"><span class="attr">package</span>=<span class="string">com.atguigu.gulimall</span></span><br><span class="line"><span class="attr">moduleName</span>=<span class="string">product</span></span><br><span class="line"><span class="comment">#作者</span></span><br><span class="line"><span class="attr">author</span>=<span class="string">JasonGong</span></span><br><span class="line"><span class="comment">#Email</span></span><br><span class="line"><span class="attr">email</span>=<span class="string">JasonGong@gmail.com</span></span><br><span class="line"><span class="comment">#表前缀(类名不会包含表前缀)</span></span><br><span class="line"><span class="attr">tablePrefix</span>=<span class="string">pms_</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">#以下的配置信息一般不动</span></span><br><span class="line"><span class="comment">#类型转换配置信息</span></span><br><span class="line"><span class="attr">tinyint</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">smallint</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">mediumint</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">int</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">integer</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">bigint</span>=<span class="string">Long</span></span><br><span class="line"><span class="attr">float</span>=<span class="string">Float</span></span><br><span class="line"><span class="attr">double</span>=<span class="string">Double</span></span><br><span class="line"><span class="attr">decimal</span>=<span class="string">BigDecimal</span></span><br><span class="line"><span class="attr">bit</span>=<span class="string">Boolean</span></span><br><span class="line"></span><br><span class="line"><span class="attr">char</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">varchar</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">tinytext</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">text</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">mediumtext</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">longtext</span>=<span class="string">String</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="attr">date</span>=<span class="string">Date</span></span><br><span class="line"><span class="attr">datetime</span>=<span class="string">Date</span></span><br><span class="line"><span class="attr">timestamp</span>=<span class="string">Date</span></span><br><span class="line"></span><br><span class="line"><span class="attr">NUMBER</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">INT</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">INTEGER</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">BINARY_INTEGER</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">LONG</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">FLOAT</span>=<span class="string">Float</span></span><br><span class="line"><span class="attr">BINARY_FLOAT</span>=<span class="string">Float</span></span><br><span class="line"><span class="attr">DOUBLE</span>=<span class="string">Double</span></span><br><span class="line"><span class="attr">BINARY_DOUBLE</span>=<span class="string">Double</span></span><br><span class="line"><span class="attr">DECIMAL</span>=<span class="string">BigDecimal</span></span><br><span class="line"><span class="attr">CHAR</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">VARCHAR</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">VARCHAR2</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">NVARCHAR</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">NVARCHAR2</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">CLOB</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">BLOB</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">DATE</span>=<span class="string">Date</span></span><br><span class="line"><span class="attr">DATETIME</span>=<span class="string">Date</span></span><br><span class="line"><span class="attr">TIMESTAMP</span>=<span class="string">Date</span></span><br><span class="line"><span class="attr">TIMESTAMP(6)</span>=<span class="string">Date</span></span><br><span class="line"></span><br><span class="line"><span class="attr">int8</span>=<span class="string">Long</span></span><br><span class="line"><span class="attr">int4</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">int2</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">numeric</span>=<span class="string">BigDecimal</span></span><br><span class="line"></span><br><span class="line"><span class="attr">nvarchar</span>=<span class="string">String</span></span><br></pre></td></tr></table></figure>
<p><strong>3.运行项目</strong></p>
<p><strong>通过<a target="_blank" rel="noopener" href="http://localhost:81/">http://localhost:81</a> 访问</strong></p>
<p><img src="/pictures/image-20230518234030568.png" alt="image-20230518234030568"></p>
<p><strong>4.使用生成代码的功能生成代码</strong></p>
<p><img src="/pictures/image-20230518234311272.png" alt="image-20230518234311272"></p>
<p>解压之后的文件如下</p>
<p><img src="/pictures/image-20230518234941961.png" alt="image-20230518234941961"></p>
<p>压缩包中的文件如下所示</p>
<p><img src="/pictures/image-20230518234922087.png" alt="image-20230518234922087"></p>
<p><strong>由于项目中没有使用shiro安全框架我们注释掉安全框架的注解生成模板</strong></p>
<p><img src="/pictures/image-20230519002146272.png" alt="image-20230519002146272"></p>
<p><strong>配置每个模块的配置文件</strong></p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">server:</span></span><br><span class="line"> <span class="attr">port:</span> <span class="number">8080</span></span><br><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">datasource:</span></span><br><span class="line"> <span class="attr">url:</span> <span class="string">jdbc:mysql://192.168.111.100:3306/gulimall_pms?useUnicode=true&amp;characterEncoding=UTF-8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai</span></span><br><span class="line"> <span class="attr">username:</span> <span class="string">root</span></span><br><span class="line"> <span class="attr">password:</span> <span class="string">root</span></span><br><span class="line"> <span class="attr">driver-class-name:</span> <span class="string">com.mysql.cj.jdbc.Driver</span></span><br><span class="line"><span class="attr">mybatis-plus:</span></span><br><span class="line"> <span class="attr">mapper-locations:</span> <span class="string">classpath*:/mapper/**/*.xml</span> <span class="comment">#定义mapper.xml文件的位置</span></span><br><span class="line"> <span class="attr">global-config:</span></span><br><span class="line"> <span class="attr">db-config:</span></span><br><span class="line"> <span class="attr">id-type:</span> <span class="string">auto</span> <span class="comment">#主键的生成规则</span></span><br></pre></td></tr></table></figure>
<p><strong>测试生成的代码</strong></p>
<p><img src="/pictures/image-20230519005131468.png" alt="image-20230519005131468"></p>
<h3 id="2-代码生成器的使用步骤"><a href="#2-代码生成器的使用步骤" class="headerlink" title="2.代码生成器的使用步骤"></a>2.代码生成器的使用步骤</h3><p><strong>1.修改代码生成器的配置文件generator.properties</strong></p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#代码生成器配置信息</span></span><br><span class="line"></span><br><span class="line"><span class="attr">mainPath</span>=<span class="string">com.atguigu</span></span><br><span class="line"><span class="comment">#包名</span></span><br><span class="line"><span class="attr">package</span>=<span class="string">com.atguigu.gulimall</span></span><br><span class="line"><span class="attr">moduleName</span>=<span class="string">ware #1.修改模块名 </span></span><br><span class="line"><span class="comment">#作者</span></span><br><span class="line"><span class="attr">author</span>=<span class="string">JasonGong</span></span><br><span class="line"><span class="comment">#Email</span></span><br><span class="line"><span class="attr">email</span>=<span class="string">JasonGong@gmail.com</span></span><br><span class="line"><span class="comment">#表前缀(类名不会包含表前缀)</span></span><br><span class="line"><span class="attr">tablePrefix</span>=<span class="string">wms_ #2.数据库表的前缀</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">#以下的配置信息一般不动</span></span><br><span class="line"><span class="comment">#类型转换配置信息</span></span><br><span class="line"><span class="attr">tinyint</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">smallint</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">mediumint</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">int</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">integer</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">bigint</span>=<span class="string">Long</span></span><br><span class="line"><span class="attr">float</span>=<span class="string">Float</span></span><br><span class="line"><span class="attr">double</span>=<span class="string">Double</span></span><br><span class="line"><span class="attr">decimal</span>=<span class="string">BigDecimal</span></span><br><span class="line"><span class="attr">bit</span>=<span class="string">Boolean</span></span><br><span class="line"></span><br><span class="line"><span class="attr">char</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">varchar</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">tinytext</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">text</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">mediumtext</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">longtext</span>=<span class="string">String</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="attr">date</span>=<span class="string">Date</span></span><br><span class="line"><span class="attr">datetime</span>=<span class="string">Date</span></span><br><span class="line"><span class="attr">timestamp</span>=<span class="string">Date</span></span><br><span class="line"></span><br><span class="line"><span class="attr">NUMBER</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">INT</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">INTEGER</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">BINARY_INTEGER</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">LONG</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">FLOAT</span>=<span class="string">Float</span></span><br><span class="line"><span class="attr">BINARY_FLOAT</span>=<span class="string">Float</span></span><br><span class="line"><span class="attr">DOUBLE</span>=<span class="string">Double</span></span><br><span class="line"><span class="attr">BINARY_DOUBLE</span>=<span class="string">Double</span></span><br><span class="line"><span class="attr">DECIMAL</span>=<span class="string">BigDecimal</span></span><br><span class="line"><span class="attr">CHAR</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">VARCHAR</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">VARCHAR2</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">NVARCHAR</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">NVARCHAR2</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">CLOB</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">BLOB</span>=<span class="string">String</span></span><br><span class="line"><span class="attr">DATE</span>=<span class="string">Date</span></span><br><span class="line"><span class="attr">DATETIME</span>=<span class="string">Date</span></span><br><span class="line"><span class="attr">TIMESTAMP</span>=<span class="string">Date</span></span><br><span class="line"><span class="attr">TIMESTAMP(6)</span>=<span class="string">Date</span></span><br><span class="line"></span><br><span class="line"><span class="attr">int8</span>=<span class="string">Long</span></span><br><span class="line"><span class="attr">int4</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">int2</span>=<span class="string">Integer</span></span><br><span class="line"><span class="attr">numeric</span>=<span class="string">BigDecimal</span></span><br><span class="line"></span><br><span class="line"><span class="attr">nvarchar</span>=<span class="string">String</span></span><br></pre></td></tr></table></figure>
<p><strong>2修改要生成增删改查代码的数据库的连接配置application.yml</strong></p>
<p>只用配置数据库的连接信息即可</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">server:</span></span><br><span class="line"> <span class="attr">port:</span> <span class="number">81</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># mysql</span></span><br><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">main:</span></span><br><span class="line"> <span class="attr">allow-circular-references:</span> <span class="literal">true</span></span><br><span class="line"> <span class="attr">datasource:</span></span><br><span class="line"> <span class="attr">type:</span> <span class="string">com.alibaba.druid.pool.DruidDataSource</span></span><br><span class="line"> <span class="comment">#MySQL配置</span></span><br><span class="line"> <span class="attr">driverClassName:</span> <span class="string">com.mysql.cj.jdbc.Driver</span></span><br><span class="line"> <span class="attr">url:</span> <span class="string">jdbc:mysql://192.168.111.100:3306/gulimall_wms?useUnicode=true&amp;characterEncoding=UTF-8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai</span></span><br><span class="line"> <span class="attr">username:</span> <span class="string">root</span></span><br><span class="line"> <span class="attr">password:</span> <span class="string">root</span></span><br><span class="line"> <span class="comment">#oracle配置</span></span><br><span class="line"> <span class="comment"># driverClassName: oracle.jdbc.OracleDriver</span></span><br><span class="line"> <span class="comment"># url: jdbc:oracle:thin:@47.100.206.162:1521:xe</span></span><br><span class="line"> <span class="comment"># username: renren</span></span><br><span class="line"> <span class="comment"># password: 123456</span></span><br><span class="line"> <span class="comment">#SQLServer配置</span></span><br><span class="line"> <span class="comment"># driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver</span></span><br><span class="line"> <span class="comment"># url: jdbc:sqlserver://192.168.10.10:1433;DatabaseName=renren_fast</span></span><br><span class="line"> <span class="comment"># username: sa</span></span><br><span class="line"> <span class="comment"># password: 123456</span></span><br><span class="line"> <span class="comment">#PostgreSQL配置</span></span><br><span class="line"> <span class="comment"># driverClassName: org.postgresql.Driver</span></span><br><span class="line"> <span class="comment"># url: jdbc:postgresql://192.168.10.10:5432/renren_fast</span></span><br><span class="line"> <span class="comment"># username: postgres</span></span><br><span class="line"> <span class="comment"># password: 123456</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="attr">jackson:</span></span><br><span class="line"> <span class="attr">time-zone:</span> <span class="string">GMT+8</span></span><br><span class="line"> <span class="attr">date-format:</span> <span class="string">yyyy-MM-dd</span> <span class="string">HH:mm:ss</span></span><br><span class="line"> <span class="attr">web:</span></span><br><span class="line"> <span class="attr">resources:</span></span><br><span class="line"> <span class="attr">static-locations:</span> <span class="string">classpath:/static/,classpath:/views/</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#mongodb:</span></span><br><span class="line"><span class="comment"># host: localhost</span></span><br><span class="line"><span class="comment"># port: 27017</span></span><br><span class="line"><span class="comment"># auth: false #是否使用密码验证</span></span><br><span class="line"><span class="comment"># username: tincery</span></span><br><span class="line"><span class="comment"># password: renren</span></span><br><span class="line"><span class="comment"># source: 123456</span></span><br><span class="line"><span class="comment"># database: test</span></span><br><span class="line"></span><br><span class="line"><span class="attr">mybatis-plus:</span></span><br><span class="line"> <span class="attr">mapperLocations:</span> <span class="string">classpath:mapper/**/*.xml</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="attr">pagehelper:</span></span><br><span class="line"> <span class="attr">reasonable:</span> <span class="literal">true</span></span><br><span class="line"> <span class="attr">supportMethodsArguments:</span> <span class="literal">true</span></span><br><span class="line"> <span class="attr">params:</span> <span class="string">count=countSql</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">#指定数据库可选值有【mysql、oracle、sqlserver、postgresql、mongodb】</span></span><br><span class="line"><span class="attr">renren:</span></span><br><span class="line"> <span class="attr">database:</span> <span class="string">mysql</span></span><br></pre></td></tr></table></figure>
<p><strong>3.启动服务生成代码,将生成的代码解压并粘贴到对应的模块中去</strong></p>
<p>将main这个目录替换原来模块中的main目录即可sql文件暂时不用管</p>
<p><strong>4.创建模块的配置文件</strong></p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">server:</span></span><br><span class="line"> <span class="attr">port:</span> <span class="number">8080</span></span><br><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">datasource:</span></span><br><span class="line"> <span class="attr">url:</span> <span class="string">jdbc:mysql://192.168.111.100:3306/gulimall_pms?useUnicode=true&amp;characterEncoding=UTF-8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai</span></span><br><span class="line"> <span class="attr">username:</span> <span class="string">root</span></span><br><span class="line"> <span class="attr">password:</span> <span class="string">root</span></span><br><span class="line"> <span class="attr">driver-class-name:</span> <span class="string">com.mysql.cj.jdbc.Driver</span></span><br><span class="line"><span class="attr">mybatis-plus:</span></span><br><span class="line"> <span class="attr">mapper-locations:</span> <span class="string">classpath*:/mapper/**/*.xml</span> <span class="comment">#定义mapper.xml文件的位置</span></span><br><span class="line"> <span class="attr">global-config:</span></span><br><span class="line"> <span class="attr">db-config:</span></span><br><span class="line"> <span class="attr">id-type:</span> <span class="string">auto</span> <span class="comment">#主键的生成规则</span></span><br></pre></td></tr></table></figure>
<p><strong>5.启动测试生成的代码</strong></p>
<pre><code>在启动的时候,我们要处理好代码依赖的包,这些包都存在与生成代码的模块中,我们在生成代码的模块中复制过来即可,然后手动的引入相应的包,处理好报错信息。
</code></pre>
<h3 id="3-后台搭建完成之后的项目树"><a href="#3-后台搭建完成之后的项目树" class="headerlink" title="3.后台搭建完成之后的项目树"></a>3.后台搭建完成之后的项目树</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br><span class="line">335</span><br><span class="line">336</span><br><span class="line">337</span><br><span class="line">338</span><br><span class="line">339</span><br><span class="line">340</span><br><span class="line">341</span><br><span class="line">342</span><br><span class="line">343</span><br><span class="line">344</span><br><span class="line">345</span><br><span class="line">346</span><br><span class="line">347</span><br><span class="line">348</span><br><span class="line">349</span><br><span class="line">350</span><br><span class="line">351</span><br><span class="line">352</span><br><span class="line">353</span><br><span class="line">354</span><br><span class="line">355</span><br><span class="line">356</span><br><span class="line">357</span><br><span class="line">358</span><br><span class="line">359</span><br><span class="line">360</span><br><span class="line">361</span><br><span class="line">362</span><br><span class="line">363</span><br><span class="line">364</span><br><span class="line">365</span><br><span class="line">366</span><br><span class="line">367</span><br><span class="line">368</span><br><span class="line">369</span><br><span class="line">370</span><br><span class="line">371</span><br><span class="line">372</span><br><span class="line">373</span><br><span class="line">374</span><br><span class="line">375</span><br><span class="line">376</span><br><span class="line">377</span><br><span class="line">378</span><br><span class="line">379</span><br><span class="line">380</span><br><span class="line">381</span><br><span class="line">382</span><br><span class="line">383</span><br><span class="line">384</span><br><span class="line">385</span><br><span class="line">386</span><br><span class="line">387</span><br><span class="line">388</span><br><span class="line">389</span><br><span class="line">390</span><br><span class="line">391</span><br><span class="line">392</span><br><span class="line">393</span><br><span class="line">394</span><br><span class="line">395</span><br><span class="line">396</span><br><span class="line">397</span><br><span class="line">398</span><br><span class="line">399</span><br><span class="line">400</span><br><span class="line">401</span><br><span class="line">402</span><br><span class="line">403</span><br><span class="line">404</span><br><span class="line">405</span><br><span class="line">406</span><br><span class="line">407</span><br><span class="line">408</span><br><span class="line">409</span><br><span class="line">410</span><br><span class="line">411</span><br><span class="line">412</span><br><span class="line">413</span><br><span class="line">414</span><br><span class="line">415</span><br><span class="line">416</span><br><span class="line">417</span><br><span class="line">418</span><br><span class="line">419</span><br><span class="line">420</span><br><span class="line">421</span><br><span class="line">422</span><br><span class="line">423</span><br><span class="line">424</span><br><span class="line">425</span><br><span class="line">426</span><br><span class="line">427</span><br><span class="line">428</span><br><span class="line">429</span><br><span class="line">430</span><br><span class="line">431</span><br><span class="line">432</span><br><span class="line">433</span><br><span class="line">434</span><br><span class="line">435</span><br><span class="line">436</span><br><span class="line">437</span><br><span class="line">438</span><br><span class="line">439</span><br><span class="line">440</span><br><span class="line">441</span><br><span class="line">442</span><br><span class="line">443</span><br><span class="line">444</span><br><span class="line">445</span><br><span class="line">446</span><br><span class="line">447</span><br><span class="line">448</span><br><span class="line">449</span><br><span class="line">450</span><br><span class="line">451</span><br><span class="line">452</span><br><span class="line">453</span><br><span class="line">454</span><br><span class="line">455</span><br><span class="line">456</span><br><span class="line">457</span><br><span class="line">458</span><br><span class="line">459</span><br><span class="line">460</span><br><span class="line">461</span><br><span class="line">462</span><br><span class="line">463</span><br><span class="line">464</span><br><span class="line">465</span><br><span class="line">466</span><br><span class="line">467</span><br><span class="line">468</span><br><span class="line">469</span><br><span class="line">470</span><br><span class="line">471</span><br><span class="line">472</span><br><span class="line">473</span><br><span class="line">474</span><br><span class="line">475</span><br><span class="line">476</span><br><span class="line">477</span><br><span class="line">478</span><br><span class="line">479</span><br><span class="line">480</span><br><span class="line">481</span><br><span class="line">482</span><br><span class="line">483</span><br><span class="line">484</span><br><span class="line">485</span><br><span class="line">486</span><br><span class="line">487</span><br><span class="line">488</span><br><span class="line">489</span><br><span class="line">490</span><br><span class="line">491</span><br><span class="line">492</span><br><span class="line">493</span><br><span class="line">494</span><br><span class="line">495</span><br><span class="line">496</span><br><span class="line">497</span><br><span class="line">498</span><br><span class="line">499</span><br><span class="line">500</span><br><span class="line">501</span><br><span class="line">502</span><br><span class="line">503</span><br><span class="line">504</span><br><span class="line">505</span><br><span class="line">506</span><br><span class="line">507</span><br><span class="line">508</span><br><span class="line">509</span><br><span class="line">510</span><br><span class="line">511</span><br><span class="line">512</span><br><span class="line">513</span><br><span class="line">514</span><br><span class="line">515</span><br><span class="line">516</span><br><span class="line">517</span><br><span class="line">518</span><br><span class="line">519</span><br><span class="line">520</span><br><span class="line">521</span><br><span class="line">522</span><br><span class="line">523</span><br><span class="line">524</span><br><span class="line">525</span><br><span class="line">526</span><br><span class="line">527</span><br><span class="line">528</span><br><span class="line">529</span><br><span class="line">530</span><br><span class="line">531</span><br><span class="line">532</span><br><span class="line">533</span><br><span class="line">534</span><br><span class="line">535</span><br><span class="line">536</span><br><span class="line">537</span><br><span class="line">538</span><br><span class="line">539</span><br><span class="line">540</span><br><span class="line">541</span><br><span class="line">542</span><br><span class="line">543</span><br><span class="line">544</span><br><span class="line">545</span><br><span class="line">546</span><br><span class="line">547</span><br><span class="line">548</span><br><span class="line">549</span><br><span class="line">550</span><br><span class="line">551</span><br><span class="line">552</span><br><span class="line">553</span><br><span class="line">554</span><br><span class="line">555</span><br><span class="line">556</span><br><span class="line">557</span><br><span class="line">558</span><br><span class="line">559</span><br><span class="line">560</span><br><span class="line">561</span><br><span class="line">562</span><br><span class="line">563</span><br><span class="line">564</span><br><span class="line">565</span><br><span class="line">566</span><br><span class="line">567</span><br><span class="line">568</span><br><span class="line">569</span><br><span class="line">570</span><br><span class="line">571</span><br><span class="line">572</span><br><span class="line">573</span><br><span class="line">574</span><br><span class="line">575</span><br><span class="line">576</span><br><span class="line">577</span><br><span class="line">578</span><br><span class="line">579</span><br><span class="line">580</span><br><span class="line">581</span><br><span class="line">582</span><br><span class="line">583</span><br><span class="line">584</span><br><span class="line">585</span><br><span class="line">586</span><br><span class="line">587</span><br><span class="line">588</span><br><span class="line">589</span><br><span class="line">590</span><br><span class="line">591</span><br><span class="line">592</span><br><span class="line">593</span><br><span class="line">594</span><br><span class="line">595</span><br><span class="line">596</span><br><span class="line">597</span><br><span class="line">598</span><br><span class="line">599</span><br><span class="line">600</span><br><span class="line">601</span><br><span class="line">602</span><br><span class="line">603</span><br><span class="line">604</span><br><span class="line">605</span><br><span class="line">606</span><br><span class="line">607</span><br><span class="line">608</span><br><span class="line">609</span><br><span class="line">610</span><br><span class="line">611</span><br><span class="line">612</span><br><span class="line">613</span><br><span class="line">614</span><br><span class="line">615</span><br><span class="line">616</span><br><span class="line">617</span><br><span class="line">618</span><br><span class="line">619</span><br><span class="line">620</span><br><span class="line">621</span><br><span class="line">622</span><br><span class="line">623</span><br><span class="line">624</span><br><span class="line">625</span><br><span class="line">626</span><br><span class="line">627</span><br><span class="line">628</span><br><span class="line">629</span><br><span class="line">630</span><br><span class="line">631</span><br><span class="line">632</span><br><span class="line">633</span><br><span class="line">634</span><br><span class="line">635</span><br><span class="line">636</span><br><span class="line">637</span><br><span class="line">638</span><br><span class="line">639</span><br><span class="line">640</span><br><span class="line">641</span><br><span class="line">642</span><br><span class="line">643</span><br><span class="line">644</span><br><span class="line">645</span><br><span class="line">646</span><br><span class="line">647</span><br><span class="line">648</span><br><span class="line">649</span><br><span class="line">650</span><br><span class="line">651</span><br><span class="line">652</span><br><span class="line">653</span><br><span class="line">654</span><br><span class="line">655</span><br><span class="line">656</span><br><span class="line">657</span><br><span class="line">658</span><br><span class="line">659</span><br><span class="line">660</span><br><span class="line">661</span><br><span class="line">662</span><br><span class="line">663</span><br><span class="line">664</span><br><span class="line">665</span><br><span class="line">666</span><br><span class="line">667</span><br><span class="line">668</span><br><span class="line">669</span><br><span class="line">670</span><br><span class="line">671</span><br><span class="line">672</span><br><span class="line">673</span><br><span class="line">674</span><br><span class="line">675</span><br><span class="line">676</span><br><span class="line">677</span><br><span class="line">678</span><br><span class="line">679</span><br><span class="line">680</span><br><span class="line">681</span><br><span class="line">682</span><br><span class="line">683</span><br><span class="line">684</span><br><span class="line">685</span><br><span class="line">686</span><br><span class="line">687</span><br><span class="line">688</span><br><span class="line">689</span><br><span class="line">690</span><br><span class="line">691</span><br><span class="line">692</span><br><span class="line">693</span><br><span class="line">694</span><br><span class="line">695</span><br><span class="line">696</span><br><span class="line">697</span><br><span class="line">698</span><br><span class="line">699</span><br><span class="line">700</span><br><span class="line">701</span><br><span class="line">702</span><br><span class="line">703</span><br><span class="line">704</span><br><span class="line">705</span><br><span class="line">706</span><br><span class="line">707</span><br><span class="line">708</span><br><span class="line">709</span><br><span class="line">710</span><br><span class="line">711</span><br><span class="line">712</span><br><span class="line">713</span><br><span class="line">714</span><br><span class="line">715</span><br><span class="line">716</span><br><span class="line">717</span><br><span class="line">718</span><br><span class="line">719</span><br><span class="line">720</span><br><span class="line">721</span><br><span class="line">722</span><br><span class="line">723</span><br><span class="line">724</span><br><span class="line">725</span><br><span class="line">726</span><br><span class="line">727</span><br><span class="line">728</span><br><span class="line">729</span><br><span class="line">730</span><br><span class="line">731</span><br><span class="line">732</span><br><span class="line">733</span><br><span class="line">734</span><br><span class="line">735</span><br><span class="line">736</span><br><span class="line">737</span><br><span class="line">738</span><br><span class="line">739</span><br><span class="line">740</span><br><span class="line">741</span><br><span class="line">742</span><br><span class="line">743</span><br><span class="line">744</span><br><span class="line">745</span><br><span class="line">746</span><br><span class="line">747</span><br><span class="line">748</span><br><span class="line">749</span><br><span class="line">750</span><br><span class="line">751</span><br><span class="line">752</span><br><span class="line">753</span><br><span class="line">754</span><br><span class="line">755</span><br><span class="line">756</span><br><span class="line">757</span><br><span class="line">758</span><br><span class="line">759</span><br><span class="line">760</span><br><span class="line">761</span><br><span class="line">762</span><br><span class="line">763</span><br><span class="line">764</span><br><span class="line">765</span><br><span class="line">766</span><br><span class="line">767</span><br><span class="line">768</span><br><span class="line">769</span><br><span class="line">770</span><br><span class="line">771</span><br><span class="line">772</span><br><span class="line">773</span><br><span class="line">774</span><br><span class="line">775</span><br><span class="line">776</span><br><span class="line">777</span><br><span class="line">778</span><br><span class="line">779</span><br><span class="line">780</span><br><span class="line">781</span><br><span class="line">782</span><br><span class="line">783</span><br><span class="line">784</span><br><span class="line">785</span><br><span class="line">786</span><br><span class="line">787</span><br><span class="line">788</span><br><span class="line">789</span><br><span class="line">790</span><br><span class="line">791</span><br><span class="line">792</span><br><span class="line">793</span><br><span class="line">794</span><br><span class="line">795</span><br><span class="line">796</span><br><span class="line">797</span><br><span class="line">798</span><br><span class="line">799</span><br><span class="line">800</span><br><span class="line">801</span><br><span class="line">802</span><br><span class="line">803</span><br><span class="line">804</span><br><span class="line">805</span><br><span class="line">806</span><br><span class="line">807</span><br><span class="line">808</span><br><span class="line">809</span><br><span class="line">810</span><br><span class="line">811</span><br><span class="line">812</span><br><span class="line">813</span><br><span class="line">814</span><br><span class="line">815</span><br><span class="line">816</span><br><span class="line">817</span><br><span class="line">818</span><br><span class="line">819</span><br><span class="line">820</span><br><span class="line">821</span><br><span class="line">822</span><br><span class="line">823</span><br><span class="line">824</span><br><span class="line">825</span><br><span class="line">826</span><br><span class="line">827</span><br><span class="line">828</span><br><span class="line">829</span><br><span class="line">830</span><br><span class="line">831</span><br><span class="line">832</span><br><span class="line">833</span><br><span class="line">834</span><br><span class="line">835</span><br><span class="line">836</span><br><span class="line">837</span><br><span class="line">838</span><br><span class="line">839</span><br><span class="line">840</span><br><span class="line">841</span><br><span class="line">842</span><br><span class="line">843</span><br><span class="line">844</span><br><span class="line">845</span><br><span class="line">846</span><br><span class="line">847</span><br><span class="line">848</span><br><span class="line">849</span><br><span class="line">850</span><br><span class="line">851</span><br><span class="line">852</span><br><span class="line">853</span><br><span class="line">854</span><br><span class="line">855</span><br><span class="line">856</span><br><span class="line">857</span><br><span class="line">858</span><br><span class="line">859</span><br><span class="line">860</span><br><span class="line">861</span><br><span class="line">862</span><br><span class="line">863</span><br><span class="line">864</span><br><span class="line">865</span><br><span class="line">866</span><br><span class="line">867</span><br><span class="line">868</span><br><span class="line">869</span><br><span class="line">870</span><br><span class="line">871</span><br><span class="line">872</span><br><span class="line">873</span><br><span class="line">874</span><br><span class="line">875</span><br><span class="line">876</span><br><span class="line">877</span><br><span class="line">878</span><br><span class="line">879</span><br><span class="line">880</span><br><span class="line">881</span><br><span class="line">882</span><br><span class="line">883</span><br><span class="line">884</span><br><span class="line">885</span><br><span class="line">886</span><br><span class="line">887</span><br><span class="line">888</span><br><span class="line">889</span><br><span class="line">890</span><br><span class="line">891</span><br><span class="line">892</span><br><span class="line">893</span><br><span class="line">894</span><br><span class="line">895</span><br><span class="line">896</span><br><span class="line">897</span><br><span class="line">898</span><br><span class="line">899</span><br><span class="line">900</span><br><span class="line">901</span><br><span class="line">902</span><br><span class="line">903</span><br><span class="line">904</span><br><span class="line">905</span><br><span class="line">906</span><br><span class="line">907</span><br><span class="line">908</span><br><span class="line">909</span><br><span class="line">910</span><br><span class="line">911</span><br><span class="line">912</span><br><span class="line">913</span><br><span class="line">914</span><br><span class="line">915</span><br><span class="line">916</span><br><span class="line">917</span><br><span class="line">918</span><br><span class="line">919</span><br><span class="line">920</span><br><span class="line">921</span><br><span class="line">922</span><br><span class="line">923</span><br><span class="line">924</span><br><span class="line">925</span><br><span class="line">926</span><br><span class="line">927</span><br><span class="line">928</span><br><span class="line">929</span><br><span class="line">930</span><br><span class="line">931</span><br><span class="line">932</span><br><span class="line">933</span><br><span class="line">934</span><br><span class="line">935</span><br><span class="line">936</span><br><span class="line">937</span><br><span class="line">938</span><br><span class="line">939</span><br><span class="line">940</span><br><span class="line">941</span><br><span class="line">942</span><br><span class="line">943</span><br><span class="line">944</span><br><span class="line">945</span><br><span class="line">946</span><br><span class="line">947</span><br><span class="line">948</span><br><span class="line">949</span><br><span class="line">950</span><br><span class="line">951</span><br><span class="line">952</span><br><span class="line">953</span><br><span class="line">954</span><br><span class="line">955</span><br><span class="line">956</span><br><span class="line">957</span><br><span class="line">958</span><br><span class="line">959</span><br><span class="line">960</span><br><span class="line">961</span><br><span class="line">962</span><br><span class="line">963</span><br><span class="line">964</span><br><span class="line">965</span><br><span class="line">966</span><br><span class="line">967</span><br><span class="line">968</span><br><span class="line">969</span><br><span class="line">970</span><br><span class="line">971</span><br><span class="line">972</span><br><span class="line">973</span><br><span class="line">974</span><br><span class="line">975</span><br><span class="line">976</span><br><span class="line">977</span><br><span class="line">978</span><br><span class="line">979</span><br><span class="line">980</span><br><span class="line">981</span><br><span class="line">982</span><br><span class="line">983</span><br><span class="line">984</span><br><span class="line">985</span><br><span class="line">986</span><br><span class="line">987</span><br><span class="line">988</span><br><span class="line">989</span><br><span class="line">990</span><br><span class="line">991</span><br><span class="line">992</span><br><span class="line">993</span><br><span class="line">994</span><br><span class="line">995</span><br><span class="line">996</span><br><span class="line">997</span><br><span class="line">998</span><br><span class="line">999</span><br><span class="line">1000</span><br><span class="line">1001</span><br><span class="line">1002</span><br><span class="line">1003</span><br><span class="line">1004</span><br><span class="line">1005</span><br><span class="line">1006</span><br><span class="line">1007</span><br><span class="line">1008</span><br><span class="line">1009</span><br><span class="line">1010</span><br><span class="line">1011</span><br><span class="line">1012</span><br><span class="line">1013</span><br><span class="line">1014</span><br><span class="line">1015</span><br><span class="line">1016</span><br><span class="line">1017</span><br><span class="line">1018</span><br><span class="line">1019</span><br><span class="line">1020</span><br><span class="line">1021</span><br><span class="line">1022</span><br><span class="line">1023</span><br><span class="line">1024</span><br><span class="line">1025</span><br><span class="line">1026</span><br><span class="line">1027</span><br><span class="line">1028</span><br><span class="line">1029</span><br><span class="line">1030</span><br><span class="line">1031</span><br><span class="line">1032</span><br><span class="line">1033</span><br><span class="line">1034</span><br><span class="line">1035</span><br><span class="line">1036</span><br><span class="line">1037</span><br><span class="line">1038</span><br><span class="line">1039</span><br><span class="line">1040</span><br><span class="line">1041</span><br><span class="line">1042</span><br><span class="line">1043</span><br><span class="line">1044</span><br><span class="line">1045</span><br><span class="line">1046</span><br><span class="line">1047</span><br><span class="line">1048</span><br><span class="line">1049</span><br><span class="line">1050</span><br><span class="line">1051</span><br><span class="line">1052</span><br><span class="line">1053</span><br><span class="line">1054</span><br><span class="line">1055</span><br><span class="line">1056</span><br><span class="line">1057</span><br><span class="line">1058</span><br><span class="line">1059</span><br><span class="line">1060</span><br><span class="line">1061</span><br><span class="line">1062</span><br><span class="line">1063</span><br><span class="line">1064</span><br><span class="line">1065</span><br><span class="line">1066</span><br><span class="line">1067</span><br><span class="line">1068</span><br><span class="line">1069</span><br><span class="line">1070</span><br><span class="line">1071</span><br><span class="line">1072</span><br><span class="line">1073</span><br><span class="line">1074</span><br><span class="line">1075</span><br><span class="line">1076</span><br><span class="line">1077</span><br><span class="line">1078</span><br><span class="line">1079</span><br><span class="line">1080</span><br><span class="line">1081</span><br><span class="line">1082</span><br><span class="line">1083</span><br><span class="line">1084</span><br><span class="line">1085</span><br><span class="line">1086</span><br><span class="line">1087</span><br><span class="line">1088</span><br><span class="line">1089</span><br><span class="line">1090</span><br><span class="line">1091</span><br><span class="line">1092</span><br><span class="line">1093</span><br><span class="line">1094</span><br><span class="line">1095</span><br><span class="line">1096</span><br><span class="line">1097</span><br><span class="line">1098</span><br><span class="line">1099</span><br><span class="line">1100</span><br><span class="line">1101</span><br><span class="line">1102</span><br><span class="line">1103</span><br><span class="line">1104</span><br><span class="line">1105</span><br><span class="line">1106</span><br><span class="line">1107</span><br><span class="line">1108</span><br><span class="line">1109</span><br><span class="line">1110</span><br><span class="line">1111</span><br><span class="line">1112</span><br><span class="line">1113</span><br><span class="line">1114</span><br><span class="line">1115</span><br><span class="line">1116</span><br><span class="line">1117</span><br><span class="line">1118</span><br><span class="line">1119</span><br><span class="line">1120</span><br><span class="line">1121</span><br><span class="line">1122</span><br><span class="line">1123</span><br><span class="line">1124</span><br><span class="line">1125</span><br><span class="line">1126</span><br><span class="line">1127</span><br><span class="line">1128</span><br><span class="line">1129</span><br><span class="line">1130</span><br><span class="line">1131</span><br><span class="line">1132</span><br><span class="line">1133</span><br><span class="line">1134</span><br><span class="line">1135</span><br><span class="line">1136</span><br><span class="line">1137</span><br><span class="line">1138</span><br><span class="line">1139</span><br><span class="line">1140</span><br><span class="line">1141</span><br><span class="line">1142</span><br><span class="line">1143</span><br><span class="line">1144</span><br><span class="line">1145</span><br><span class="line">1146</span><br><span class="line">1147</span><br><span class="line">1148</span><br><span class="line">1149</span><br><span class="line">1150</span><br><span class="line">1151</span><br><span class="line">1152</span><br><span class="line">1153</span><br><span class="line">1154</span><br><span class="line">1155</span><br><span class="line">1156</span><br><span class="line">1157</span><br><span class="line">1158</span><br><span class="line">1159</span><br><span class="line">1160</span><br><span class="line">1161</span><br><span class="line">1162</span><br><span class="line">1163</span><br><span class="line">1164</span><br><span class="line">1165</span><br><span class="line">1166</span><br><span class="line">1167</span><br><span class="line">1168</span><br><span class="line">1169</span><br><span class="line">1170</span><br><span class="line">1171</span><br><span class="line">1172</span><br><span class="line">1173</span><br><span class="line">1174</span><br><span class="line">1175</span><br><span class="line">1176</span><br><span class="line">1177</span><br><span class="line">1178</span><br><span class="line">1179</span><br><span class="line">1180</span><br><span class="line">1181</span><br><span class="line">1182</span><br><span class="line">1183</span><br><span class="line">1184</span><br><span class="line">1185</span><br><span class="line">1186</span><br><span class="line">1187</span><br><span class="line">1188</span><br><span class="line">1189</span><br><span class="line">1190</span><br><span class="line">1191</span><br><span class="line">1192</span><br><span class="line">1193</span><br><span class="line">1194</span><br><span class="line">1195</span><br><span class="line">1196</span><br><span class="line">1197</span><br><span class="line">1198</span><br><span class="line">1199</span><br><span class="line">1200</span><br><span class="line">1201</span><br><span class="line">1202</span><br><span class="line">1203</span><br><span class="line">1204</span><br><span class="line">1205</span><br><span class="line">1206</span><br><span class="line">1207</span><br><span class="line">1208</span><br><span class="line">1209</span><br><span class="line">1210</span><br><span class="line">1211</span><br><span class="line">1212</span><br><span class="line">1213</span><br><span class="line">1214</span><br><span class="line">1215</span><br><span class="line">1216</span><br><span class="line">1217</span><br><span class="line">1218</span><br><span class="line">1219</span><br><span class="line">1220</span><br><span class="line">1221</span><br><span class="line">1222</span><br><span class="line">1223</span><br><span class="line">1224</span><br><span class="line">1225</span><br><span class="line">1226</span><br><span class="line">1227</span><br><span class="line">1228</span><br><span class="line">1229</span><br><span class="line">1230</span><br><span class="line">1231</span><br><span class="line">1232</span><br><span class="line">1233</span><br><span class="line">1234</span><br><span class="line">1235</span><br><span class="line">1236</span><br><span class="line">1237</span><br><span class="line">1238</span><br><span class="line">1239</span><br><span class="line">1240</span><br><span class="line">1241</span><br><span class="line">1242</span><br><span class="line">1243</span><br><span class="line">1244</span><br><span class="line">1245</span><br><span class="line">1246</span><br><span class="line">1247</span><br><span class="line">1248</span><br><span class="line">1249</span><br><span class="line">1250</span><br><span class="line">1251</span><br><span class="line">1252</span><br><span class="line">1253</span><br><span class="line">1254</span><br><span class="line">1255</span><br><span class="line">1256</span><br><span class="line">1257</span><br><span class="line">1258</span><br><span class="line">1259</span><br><span class="line">1260</span><br><span class="line">1261</span><br><span class="line">1262</span><br><span class="line">1263</span><br><span class="line">1264</span><br><span class="line">1265</span><br><span class="line">1266</span><br><span class="line">1267</span><br><span class="line">1268</span><br><span class="line">1269</span><br><span class="line">1270</span><br><span class="line">1271</span><br><span class="line">1272</span><br><span class="line">1273</span><br><span class="line">1274</span><br><span class="line">1275</span><br><span class="line">1276</span><br><span class="line">1277</span><br><span class="line">1278</span><br><span class="line">1279</span><br><span class="line">1280</span><br><span class="line">1281</span><br><span class="line">1282</span><br><span class="line">1283</span><br><span class="line">1284</span><br><span class="line">1285</span><br><span class="line">1286</span><br><span class="line">1287</span><br><span class="line">1288</span><br><span class="line">1289</span><br><span class="line">1290</span><br><span class="line">1291</span><br><span class="line">1292</span><br><span class="line">1293</span><br><span class="line">1294</span><br><span class="line">1295</span><br><span class="line">1296</span><br><span class="line">1297</span><br><span class="line">1298</span><br><span class="line">1299</span><br><span class="line">1300</span><br><span class="line">1301</span><br><span class="line">1302</span><br><span class="line">1303</span><br><span class="line">1304</span><br><span class="line">1305</span><br><span class="line">1306</span><br><span class="line">1307</span><br><span class="line">1308</span><br><span class="line">1309</span><br><span class="line">1310</span><br><span class="line">1311</span><br><span class="line">1312</span><br><span class="line">1313</span><br><span class="line">1314</span><br><span class="line">1315</span><br><span class="line">1316</span><br><span class="line">1317</span><br><span class="line">1318</span><br><span class="line">1319</span><br><span class="line">1320</span><br><span class="line">1321</span><br><span class="line">1322</span><br><span class="line">1323</span><br><span class="line">1324</span><br><span class="line">1325</span><br><span class="line">1326</span><br><span class="line">1327</span><br><span class="line">1328</span><br><span class="line">1329</span><br><span class="line">1330</span><br><span class="line">1331</span><br><span class="line">1332</span><br><span class="line">1333</span><br><span class="line">1334</span><br><span class="line">1335</span><br><span class="line">1336</span><br><span class="line">1337</span><br><span class="line">1338</span><br><span class="line">1339</span><br><span class="line">1340</span><br><span class="line">1341</span><br><span class="line">1342</span><br><span class="line">1343</span><br><span class="line">1344</span><br><span class="line">1345</span><br><span class="line">1346</span><br><span class="line">1347</span><br><span class="line">1348</span><br><span class="line">1349</span><br><span class="line">1350</span><br><span class="line">1351</span><br><span class="line">1352</span><br><span class="line">1353</span><br><span class="line">1354</span><br><span class="line">1355</span><br><span class="line">1356</span><br><span class="line">1357</span><br><span class="line">1358</span><br><span class="line">1359</span><br><span class="line">1360</span><br><span class="line">1361</span><br><span class="line">1362</span><br><span class="line">1363</span><br><span class="line">1364</span><br><span class="line">1365</span><br><span class="line">1366</span><br><span class="line">1367</span><br><span class="line">1368</span><br><span class="line">1369</span><br><span class="line">1370</span><br><span class="line">1371</span><br><span class="line">1372</span><br><span class="line">1373</span><br><span class="line">1374</span><br><span class="line">1375</span><br><span class="line">1376</span><br><span class="line">1377</span><br><span class="line">1378</span><br><span class="line">1379</span><br><span class="line">1380</span><br><span class="line">1381</span><br><span class="line">1382</span><br><span class="line">1383</span><br><span class="line">1384</span><br><span class="line">1385</span><br><span class="line">1386</span><br><span class="line">1387</span><br><span class="line">1388</span><br><span class="line">1389</span><br><span class="line">1390</span><br><span class="line">1391</span><br><span class="line">1392</span><br><span class="line">1393</span><br><span class="line">1394</span><br><span class="line">1395</span><br><span class="line">1396</span><br><span class="line">1397</span><br><span class="line">1398</span><br><span class="line">1399</span><br><span class="line">1400</span><br><span class="line">1401</span><br><span class="line">1402</span><br><span class="line">1403</span><br><span class="line">1404</span><br><span class="line">1405</span><br><span class="line">1406</span><br><span class="line">1407</span><br><span class="line">1408</span><br><span class="line">1409</span><br><span class="line">1410</span><br><span class="line">1411</span><br><span class="line">1412</span><br><span class="line">1413</span><br><span class="line">1414</span><br><span class="line">1415</span><br><span class="line">1416</span><br><span class="line">1417</span><br><span class="line">1418</span><br><span class="line">1419</span><br><span class="line">1420</span><br><span class="line">1421</span><br><span class="line">1422</span><br><span class="line">1423</span><br><span class="line">1424</span><br><span class="line">1425</span><br><span class="line">1426</span><br><span class="line">1427</span><br><span class="line">1428</span><br><span class="line">1429</span><br><span class="line">1430</span><br><span class="line">1431</span><br><span class="line">1432</span><br><span class="line">1433</span><br><span class="line">1434</span><br><span class="line">1435</span><br><span class="line">1436</span><br><span class="line">1437</span><br><span class="line">1438</span><br><span class="line">1439</span><br><span class="line">1440</span><br><span class="line">1441</span><br><span class="line">1442</span><br><span class="line">1443</span><br><span class="line">1444</span><br><span class="line">1445</span><br><span class="line">1446</span><br><span class="line">1447</span><br><span class="line">1448</span><br><span class="line">1449</span><br><span class="line">1450</span><br><span class="line">1451</span><br><span class="line">1452</span><br><span class="line">1453</span><br><span class="line">1454</span><br><span class="line">1455</span><br><span class="line">1456</span><br><span class="line">1457</span><br><span class="line">1458</span><br><span class="line">1459</span><br><span class="line">1460</span><br><span class="line">1461</span><br><span class="line">1462</span><br><span class="line">1463</span><br><span class="line">1464</span><br><span class="line">1465</span><br><span class="line">1466</span><br><span class="line">1467</span><br><span class="line">1468</span><br><span class="line">1469</span><br><span class="line">1470</span><br><span class="line">1471</span><br><span class="line">1472</span><br><span class="line">1473</span><br><span class="line">1474</span><br><span class="line">1475</span><br><span class="line">1476</span><br><span class="line">1477</span><br><span class="line">1478</span><br><span class="line">1479</span><br><span class="line">1480</span><br><span class="line">1481</span><br><span class="line">1482</span><br><span class="line">1483</span><br><span class="line">1484</span><br><span class="line">1485</span><br><span class="line">1486</span><br><span class="line">1487</span><br><span class="line">1488</span><br><span class="line">1489</span><br><span class="line">1490</span><br><span class="line">1491</span><br><span class="line">1492</span><br><span class="line">1493</span><br><span class="line">1494</span><br><span class="line">1495</span><br><span class="line">1496</span><br><span class="line">1497</span><br><span class="line">1498</span><br><span class="line">1499</span><br><span class="line">1500</span><br><span class="line">1501</span><br><span class="line">1502</span><br><span class="line">1503</span><br><span class="line">1504</span><br><span class="line">1505</span><br><span class="line">1506</span><br><span class="line">1507</span><br><span class="line">1508</span><br><span class="line">1509</span><br><span class="line">1510</span><br><span class="line">1511</span><br><span class="line">1512</span><br><span class="line">1513</span><br><span class="line">1514</span><br><span class="line">1515</span><br><span class="line">1516</span><br><span class="line">1517</span><br><span class="line">1518</span><br><span class="line">1519</span><br><span class="line">1520</span><br><span class="line">1521</span><br><span class="line">1522</span><br><span class="line">1523</span><br><span class="line">1524</span><br><span class="line">1525</span><br><span class="line">1526</span><br><span class="line">1527</span><br><span class="line">1528</span><br><span class="line">1529</span><br><span class="line">1530</span><br><span class="line">1531</span><br><span class="line">1532</span><br><span class="line">1533</span><br><span class="line">1534</span><br><span class="line">1535</span><br><span class="line">1536</span><br><span class="line">1537</span><br><span class="line">1538</span><br><span class="line">1539</span><br><span class="line">1540</span><br><span class="line">1541</span><br><span class="line">1542</span><br><span class="line">1543</span><br><span class="line">1544</span><br><span class="line">1545</span><br><span class="line">1546</span><br><span class="line">1547</span><br><span class="line">1548</span><br><span class="line">1549</span><br><span class="line">1550</span><br><span class="line">1551</span><br><span class="line">1552</span><br><span class="line">1553</span><br><span class="line">1554</span><br><span class="line">1555</span><br><span class="line">1556</span><br><span class="line">1557</span><br><span class="line">1558</span><br><span class="line">1559</span><br><span class="line">1560</span><br><span class="line">1561</span><br><span class="line">1562</span><br><span class="line">1563</span><br><span class="line">1564</span><br><span class="line">1565</span><br><span class="line">1566</span><br><span class="line">1567</span><br><span class="line">1568</span><br><span class="line">1569</span><br><span class="line">1570</span><br><span class="line">1571</span><br><span class="line">1572</span><br><span class="line">1573</span><br><span class="line">1574</span><br><span class="line">1575</span><br><span class="line">1576</span><br><span class="line">1577</span><br><span class="line">1578</span><br><span class="line">1579</span><br><span class="line">1580</span><br><span class="line">1581</span><br><span class="line">1582</span><br><span class="line">1583</span><br><span class="line">1584</span><br><span class="line">1585</span><br><span class="line">1586</span><br><span class="line">1587</span><br><span class="line">1588</span><br><span class="line">1589</span><br><span class="line">1590</span><br><span class="line">1591</span><br><span class="line">1592</span><br><span class="line">1593</span><br><span class="line">1594</span><br><span class="line">1595</span><br><span class="line">1596</span><br><span class="line">1597</span><br><span class="line">1598</span><br><span class="line">1599</span><br><span class="line">1600</span><br><span class="line">1601</span><br><span class="line">1602</span><br><span class="line">1603</span><br><span class="line">1604</span><br><span class="line">1605</span><br><span class="line">1606</span><br><span class="line">1607</span><br><span class="line">1608</span><br><span class="line">1609</span><br><span class="line">1610</span><br><span class="line">1611</span><br><span class="line">1612</span><br><span class="line">1613</span><br><span class="line">1614</span><br><span class="line">1615</span><br><span class="line">1616</span><br><span class="line">1617</span><br><span class="line">1618</span><br><span class="line">1619</span><br><span class="line">1620</span><br><span class="line">1621</span><br><span class="line">1622</span><br><span class="line">1623</span><br><span class="line">1624</span><br><span class="line">1625</span><br><span class="line">1626</span><br><span class="line">1627</span><br><span class="line">1628</span><br><span class="line">1629</span><br><span class="line">1630</span><br><span class="line">1631</span><br><span class="line">1632</span><br><span class="line">1633</span><br><span class="line">1634</span><br><span class="line">1635</span><br><span class="line">1636</span><br><span class="line">1637</span><br><span class="line">1638</span><br><span class="line">1639</span><br><span class="line">1640</span><br><span class="line">1641</span><br><span class="line">1642</span><br><span class="line">1643</span><br><span class="line">1644</span><br><span class="line">1645</span><br><span class="line">1646</span><br><span class="line">1647</span><br><span class="line">1648</span><br><span class="line">1649</span><br><span class="line">1650</span><br><span class="line">1651</span><br><span class="line">1652</span><br><span class="line">1653</span><br><span class="line">1654</span><br><span class="line">1655</span><br><span class="line">1656</span><br><span class="line">1657</span><br><span class="line">1658</span><br><span class="line">1659</span><br><span class="line">1660</span><br><span class="line">1661</span><br><span class="line">1662</span><br><span class="line">1663</span><br><span class="line">1664</span><br><span class="line">1665</span><br><span class="line">1666</span><br><span class="line">1667</span><br><span class="line">1668</span><br><span class="line">1669</span><br><span class="line">1670</span><br><span class="line">1671</span><br><span class="line">1672</span><br><span class="line">1673</span><br><span class="line">1674</span><br><span class="line">1675</span><br><span class="line">1676</span><br><span class="line">1677</span><br><span class="line">1678</span><br><span class="line">1679</span><br><span class="line">1680</span><br><span class="line">1681</span><br><span class="line">1682</span><br><span class="line">1683</span><br><span class="line">1684</span><br><span class="line">1685</span><br><span class="line">1686</span><br><span class="line">1687</span><br><span class="line">1688</span><br><span class="line">1689</span><br><span class="line">1690</span><br><span class="line">1691</span><br><span class="line">1692</span><br><span class="line">1693</span><br><span class="line">1694</span><br><span class="line">1695</span><br><span class="line">1696</span><br><span class="line">1697</span><br><span class="line">1698</span><br><span class="line">1699</span><br><span class="line">1700</span><br><span class="line">1701</span><br><span class="line">1702</span><br><span class="line">1703</span><br><span class="line">1704</span><br><span class="line">1705</span><br><span class="line">1706</span><br><span class="line">1707</span><br><span class="line">1708</span><br><span class="line">1709</span><br><span class="line">1710</span><br><span class="line">1711</span><br><span class="line">1712</span><br><span class="line">1713</span><br><span class="line">1714</span><br><span class="line">1715</span><br><span class="line">1716</span><br><span class="line">1717</span><br><span class="line">1718</span><br><span class="line">1719</span><br><span class="line">1720</span><br><span class="line">1721</span><br><span class="line">1722</span><br><span class="line">1723</span><br><span class="line">1724</span><br><span class="line">1725</span><br><span class="line">1726</span><br><span class="line">1727</span><br><span class="line">1728</span><br><span class="line">1729</span><br><span class="line">1730</span><br><span class="line">1731</span><br><span class="line">1732</span><br><span class="line">1733</span><br><span class="line">1734</span><br><span class="line">1735</span><br><span class="line">1736</span><br><span class="line">1737</span><br><span class="line">1738</span><br><span class="line">1739</span><br><span class="line">1740</span><br><span class="line">1741</span><br><span class="line">1742</span><br><span class="line">1743</span><br><span class="line">1744</span><br><span class="line">1745</span><br><span class="line">1746</span><br><span class="line">1747</span><br><span class="line">1748</span><br><span class="line">1749</span><br><span class="line">1750</span><br><span class="line">1751</span><br><span class="line">1752</span><br><span class="line">1753</span><br><span class="line">1754</span><br><span class="line">1755</span><br><span class="line">1756</span><br><span class="line">1757</span><br><span class="line">1758</span><br><span class="line">1759</span><br><span class="line">1760</span><br><span class="line">1761</span><br><span class="line">1762</span><br><span class="line">1763</span><br><span class="line">1764</span><br><span class="line">1765</span><br><span class="line">1766</span><br><span class="line">1767</span><br><span class="line">1768</span><br><span class="line">1769</span><br><span class="line">1770</span><br><span class="line">1771</span><br><span class="line">1772</span><br><span class="line">1773</span><br><span class="line">1774</span><br><span class="line">1775</span><br><span class="line">1776</span><br><span class="line">1777</span><br><span class="line">1778</span><br><span class="line">1779</span><br><span class="line">1780</span><br><span class="line">1781</span><br><span class="line">1782</span><br><span class="line">1783</span><br><span class="line">1784</span><br><span class="line">1785</span><br><span class="line">1786</span><br><span class="line">1787</span><br><span class="line">1788</span><br><span class="line">1789</span><br><span class="line">1790</span><br><span class="line">1791</span><br><span class="line">1792</span><br><span class="line">1793</span><br><span class="line">1794</span><br><span class="line">1795</span><br><span class="line">1796</span><br><span class="line">1797</span><br><span class="line">1798</span><br><span class="line">1799</span><br><span class="line">1800</span><br><span class="line">1801</span><br><span class="line">1802</span><br><span class="line">1803</span><br><span class="line">1804</span><br><span class="line">1805</span><br><span class="line">1806</span><br><span class="line">1807</span><br><span class="line">1808</span><br><span class="line">1809</span><br><span class="line">1810</span><br><span class="line">1811</span><br><span class="line">1812</span><br><span class="line">1813</span><br><span class="line">1814</span><br><span class="line">1815</span><br><span class="line">1816</span><br><span class="line">1817</span><br><span class="line">1818</span><br><span class="line">1819</span><br><span class="line">1820</span><br><span class="line">1821</span><br><span class="line">1822</span><br><span class="line">1823</span><br><span class="line">1824</span><br><span class="line">1825</span><br><span class="line">1826</span><br><span class="line">1827</span><br><span class="line">1828</span><br><span class="line">1829</span><br><span class="line">1830</span><br><span class="line">1831</span><br><span class="line">1832</span><br><span class="line">1833</span><br><span class="line">1834</span><br><span class="line">1835</span><br><span class="line">1836</span><br><span class="line">1837</span><br><span class="line">1838</span><br><span class="line">1839</span><br><span class="line">1840</span><br><span class="line">1841</span><br><span class="line">1842</span><br><span class="line">1843</span><br><span class="line">1844</span><br><span class="line">1845</span><br><span class="line">1846</span><br><span class="line">1847</span><br><span class="line">1848</span><br><span class="line">1849</span><br><span class="line">1850</span><br><span class="line">1851</span><br><span class="line">1852</span><br><span class="line">1853</span><br><span class="line">1854</span><br><span class="line">1855</span><br><span class="line">1856</span><br><span class="line">1857</span><br><span class="line">1858</span><br><span class="line">1859</span><br><span class="line">1860</span><br><span class="line">1861</span><br><span class="line">1862</span><br><span class="line">1863</span><br><span class="line">1864</span><br><span class="line">1865</span><br><span class="line">1866</span><br><span class="line">1867</span><br><span class="line">1868</span><br><span class="line">1869</span><br><span class="line">1870</span><br><span class="line">1871</span><br><span class="line">1872</span><br><span class="line">1873</span><br><span class="line">1874</span><br><span class="line">1875</span><br><span class="line">1876</span><br><span class="line">1877</span><br><span class="line">1878</span><br><span class="line">1879</span><br><span class="line">1880</span><br><span class="line">1881</span><br><span class="line">1882</span><br><span class="line">1883</span><br><span class="line">1884</span><br><span class="line">1885</span><br><span class="line">1886</span><br><span class="line">1887</span><br><span class="line">1888</span><br><span class="line">1889</span><br><span class="line">1890</span><br><span class="line">1891</span><br><span class="line">1892</span><br><span class="line">1893</span><br><span class="line">1894</span><br><span class="line">1895</span><br><span class="line">1896</span><br><span class="line">1897</span><br><span class="line">1898</span><br><span class="line">1899</span><br><span class="line">1900</span><br><span class="line">1901</span><br><span class="line">1902</span><br><span class="line">1903</span><br><span class="line">1904</span><br><span class="line">1905</span><br><span class="line">1906</span><br><span class="line">1907</span><br><span class="line">1908</span><br><span class="line">1909</span><br><span class="line">1910</span><br><span class="line">1911</span><br><span class="line">1912</span><br><span class="line">1913</span><br><span class="line">1914</span><br><span class="line">1915</span><br><span class="line">1916</span><br><span class="line">1917</span><br><span class="line">1918</span><br><span class="line">1919</span><br><span class="line">1920</span><br><span class="line">1921</span><br><span class="line">1922</span><br><span class="line">1923</span><br><span class="line">1924</span><br><span class="line">1925</span><br><span class="line">1926</span><br><span class="line">1927</span><br><span class="line">1928</span><br><span class="line">1929</span><br><span class="line">1930</span><br><span class="line">1931</span><br><span class="line">1932</span><br><span class="line">1933</span><br><span class="line">1934</span><br><span class="line">1935</span><br><span class="line">1936</span><br><span class="line">1937</span><br><span class="line">1938</span><br><span class="line">1939</span><br><span class="line">1940</span><br><span class="line">1941</span><br><span class="line">1942</span><br><span class="line">1943</span><br><span class="line">1944</span><br><span class="line">1945</span><br><span class="line">1946</span><br><span class="line">1947</span><br><span class="line">1948</span><br><span class="line">1949</span><br><span class="line">1950</span><br><span class="line">1951</span><br><span class="line">1952</span><br><span class="line">1953</span><br><span class="line">1954</span><br><span class="line">1955</span><br><span class="line">1956</span><br><span class="line">1957</span><br><span class="line">1958</span><br><span class="line">1959</span><br><span class="line">1960</span><br><span class="line">1961</span><br><span class="line">1962</span><br><span class="line">1963</span><br><span class="line">1964</span><br><span class="line">1965</span><br><span class="line">1966</span><br><span class="line">1967</span><br><span class="line">1968</span><br><span class="line">1969</span><br><span class="line">1970</span><br><span class="line">1971</span><br><span class="line">1972</span><br><span class="line">1973</span><br><span class="line">1974</span><br><span class="line">1975</span><br><span class="line">1976</span><br><span class="line">1977</span><br><span class="line">1978</span><br><span class="line">1979</span><br><span class="line">1980</span><br><span class="line">1981</span><br><span class="line">1982</span><br><span class="line">1983</span><br><span class="line">1984</span><br><span class="line">1985</span><br><span class="line">1986</span><br><span class="line">1987</span><br><span class="line">1988</span><br><span class="line">1989</span><br><span class="line">1990</span><br><span class="line">1991</span><br><span class="line">1992</span><br><span class="line">1993</span><br><span class="line">1994</span><br><span class="line">1995</span><br><span class="line">1996</span><br><span class="line">1997</span><br><span class="line">1998</span><br><span class="line">1999</span><br><span class="line">2000</span><br><span class="line">2001</span><br><span class="line">2002</span><br><span class="line">2003</span><br><span class="line">2004</span><br><span class="line">2005</span><br><span class="line">2006</span><br><span class="line">2007</span><br><span class="line">2008</span><br><span class="line">2009</span><br><span class="line">2010</span><br><span class="line">2011</span><br><span class="line">2012</span><br><span class="line">2013</span><br><span class="line">2014</span><br><span class="line">2015</span><br><span class="line">2016</span><br><span class="line">2017</span><br><span class="line">2018</span><br><span class="line">2019</span><br><span class="line">2020</span><br><span class="line">2021</span><br><span class="line">2022</span><br><span class="line">2023</span><br><span class="line">2024</span><br><span class="line">2025</span><br><span class="line">2026</span><br><span class="line">2027</span><br><span class="line">2028</span><br><span class="line">2029</span><br><span class="line">2030</span><br><span class="line">2031</span><br><span class="line">2032</span><br><span class="line">2033</span><br><span class="line">2034</span><br><span class="line">2035</span><br><span class="line">2036</span><br><span class="line">2037</span><br><span class="line">2038</span><br><span class="line">2039</span><br><span class="line">2040</span><br><span class="line">2041</span><br><span class="line">2042</span><br><span class="line">2043</span><br><span class="line">2044</span><br><span class="line">2045</span><br><span class="line">2046</span><br><span class="line">2047</span><br><span class="line">2048</span><br><span class="line">2049</span><br><span class="line">2050</span><br><span class="line">2051</span><br><span class="line">2052</span><br><span class="line">2053</span><br><span class="line">2054</span><br><span class="line">2055</span><br><span class="line">2056</span><br><span class="line">2057</span><br><span class="line">2058</span><br><span class="line">2059</span><br><span class="line">2060</span><br><span class="line">2061</span><br><span class="line">2062</span><br><span class="line">2063</span><br><span class="line">2064</span><br><span class="line">2065</span><br><span class="line">2066</span><br><span class="line">2067</span><br><span class="line">2068</span><br><span class="line">2069</span><br><span class="line">2070</span><br><span class="line">2071</span><br><span class="line">2072</span><br><span class="line">2073</span><br><span class="line">2074</span><br><span class="line">2075</span><br><span class="line">2076</span><br><span class="line">2077</span><br><span class="line">2078</span><br><span class="line">2079</span><br><span class="line">2080</span><br><span class="line">2081</span><br><span class="line">2082</span><br><span class="line">2083</span><br><span class="line">2084</span><br><span class="line">2085</span><br><span class="line">2086</span><br><span class="line">2087</span><br><span class="line">2088</span><br><span class="line">2089</span><br><span class="line">2090</span><br><span class="line">2091</span><br><span class="line">2092</span><br><span class="line">2093</span><br><span class="line">2094</span><br><span class="line">2095</span><br><span class="line">2096</span><br><span class="line">2097</span><br><span class="line">2098</span><br><span class="line">2099</span><br><span class="line">2100</span><br><span class="line">2101</span><br><span class="line">2102</span><br><span class="line">2103</span><br><span class="line">2104</span><br><span class="line">2105</span><br><span class="line">2106</span><br><span class="line">2107</span><br><span class="line">2108</span><br><span class="line">2109</span><br><span class="line">2110</span><br><span class="line">2111</span><br><span class="line">2112</span><br><span class="line">2113</span><br><span class="line">2114</span><br><span class="line">2115</span><br><span class="line">2116</span><br><span class="line">2117</span><br><span class="line">2118</span><br><span class="line">2119</span><br><span class="line">2120</span><br><span class="line">2121</span><br><span class="line">2122</span><br><span class="line">2123</span><br><span class="line">2124</span><br><span class="line">2125</span><br><span class="line">2126</span><br><span class="line">2127</span><br><span class="line">2128</span><br><span class="line">2129</span><br><span class="line">2130</span><br><span class="line">2131</span><br><span class="line">2132</span><br><span class="line">2133</span><br><span class="line">2134</span><br><span class="line">2135</span><br><span class="line">2136</span><br><span class="line">2137</span><br><span class="line">2138</span><br><span class="line">2139</span><br><span class="line">2140</span><br><span class="line">2141</span><br><span class="line">2142</span><br><span class="line">2143</span><br><span class="line">2144</span><br><span class="line">2145</span><br><span class="line">2146</span><br><span class="line">2147</span><br><span class="line">2148</span><br><span class="line">2149</span><br><span class="line">2150</span><br><span class="line">2151</span><br><span class="line">2152</span><br><span class="line">2153</span><br><span class="line">2154</span><br><span class="line">2155</span><br><span class="line">2156</span><br><span class="line">2157</span><br><span class="line">2158</span><br><span class="line">2159</span><br><span class="line">2160</span><br><span class="line">2161</span><br><span class="line">2162</span><br><span class="line">2163</span><br><span class="line">2164</span><br><span class="line">2165</span><br><span class="line">2166</span><br><span class="line">2167</span><br><span class="line">2168</span><br><span class="line">2169</span><br><span class="line">2170</span><br><span class="line">2171</span><br><span class="line">2172</span><br><span class="line">2173</span><br><span class="line">2174</span><br><span class="line">2175</span><br><span class="line">2176</span><br><span class="line">2177</span><br><span class="line">2178</span><br><span class="line">2179</span><br><span class="line">2180</span><br><span class="line">2181</span><br><span class="line">2182</span><br><span class="line">2183</span><br><span class="line">2184</span><br><span class="line">2185</span><br><span class="line">2186</span><br><span class="line">2187</span><br><span class="line">2188</span><br><span class="line">2189</span><br><span class="line">2190</span><br><span class="line">2191</span><br><span class="line">2192</span><br><span class="line">2193</span><br><span class="line">2194</span><br><span class="line">2195</span><br><span class="line">2196</span><br><span class="line">2197</span><br><span class="line">2198</span><br><span class="line">2199</span><br><span class="line">2200</span><br><span class="line">2201</span><br><span class="line">2202</span><br><span class="line">2203</span><br><span class="line">2204</span><br><span class="line">2205</span><br><span class="line">2206</span><br><span class="line">2207</span><br><span class="line">2208</span><br><span class="line">2209</span><br><span class="line">2210</span><br><span class="line">2211</span><br><span class="line">2212</span><br><span class="line">2213</span><br><span class="line">2214</span><br><span class="line">2215</span><br><span class="line">2216</span><br><span class="line">2217</span><br><span class="line">2218</span><br><span class="line">2219</span><br><span class="line">2220</span><br><span class="line">2221</span><br><span class="line">2222</span><br><span class="line">2223</span><br><span class="line">2224</span><br><span class="line">2225</span><br><span class="line">2226</span><br><span class="line">2227</span><br><span class="line">2228</span><br><span class="line">2229</span><br><span class="line">2230</span><br><span class="line">2231</span><br><span class="line">2232</span><br><span class="line">2233</span><br><span class="line">2234</span><br><span class="line">2235</span><br><span class="line">2236</span><br><span class="line">2237</span><br><span class="line">2238</span><br><span class="line">2239</span><br><span class="line">2240</span><br><span class="line">2241</span><br><span class="line">2242</span><br><span class="line">2243</span><br><span class="line">2244</span><br><span class="line">2245</span><br><span class="line">2246</span><br><span class="line">2247</span><br><span class="line">2248</span><br><span class="line">2249</span><br><span class="line">2250</span><br><span class="line">2251</span><br><span class="line">2252</span><br><span class="line">2253</span><br><span class="line">2254</span><br><span class="line">2255</span><br><span class="line">2256</span><br><span class="line">2257</span><br><span class="line">2258</span><br><span class="line">2259</span><br><span class="line">2260</span><br><span class="line">2261</span><br><span class="line">2262</span><br><span class="line">2263</span><br><span class="line">2264</span><br><span class="line">2265</span><br><span class="line">2266</span><br><span class="line">2267</span><br><span class="line">2268</span><br><span class="line">2269</span><br><span class="line">2270</span><br><span class="line">2271</span><br><span class="line">2272</span><br><span class="line">2273</span><br><span class="line">2274</span><br><span class="line">2275</span><br><span class="line">2276</span><br><span class="line">2277</span><br><span class="line">2278</span><br><span class="line">2279</span><br><span class="line">2280</span><br><span class="line">2281</span><br><span class="line">2282</span><br><span class="line">2283</span><br><span class="line">2284</span><br><span class="line">2285</span><br><span class="line">2286</span><br><span class="line">2287</span><br><span class="line">2288</span><br><span class="line">2289</span><br><span class="line">2290</span><br><span class="line">2291</span><br><span class="line">2292</span><br><span class="line">2293</span><br><span class="line">2294</span><br><span class="line">2295</span><br><span class="line">2296</span><br><span class="line">2297</span><br><span class="line">2298</span><br><span class="line">2299</span><br><span class="line">2300</span><br><span class="line">2301</span><br><span class="line">2302</span><br><span class="line">2303</span><br><span class="line">2304</span><br><span class="line">2305</span><br><span class="line">2306</span><br><span class="line">2307</span><br><span class="line">2308</span><br><span class="line">2309</span><br><span class="line">2310</span><br><span class="line">2311</span><br><span class="line">2312</span><br><span class="line">2313</span><br><span class="line">2314</span><br><span class="line">2315</span><br><span class="line">2316</span><br><span class="line">2317</span><br><span class="line">2318</span><br><span class="line">2319</span><br><span class="line">2320</span><br><span class="line">2321</span><br><span class="line">2322</span><br><span class="line">2323</span><br><span class="line">2324</span><br><span class="line">2325</span><br><span class="line">2326</span><br><span class="line">2327</span><br><span class="line">2328</span><br><span class="line">2329</span><br><span class="line">2330</span><br><span class="line">2331</span><br><span class="line">2332</span><br><span class="line">2333</span><br><span class="line">2334</span><br><span class="line">2335</span><br><span class="line">2336</span><br><span class="line">2337</span><br><span class="line">2338</span><br><span class="line">2339</span><br><span class="line">2340</span><br><span class="line">2341</span><br><span class="line">2342</span><br><span class="line">2343</span><br><span class="line">2344</span><br><span class="line">2345</span><br><span class="line">2346</span><br><span class="line">2347</span><br><span class="line">2348</span><br><span class="line">2349</span><br><span class="line">2350</span><br><span class="line">2351</span><br><span class="line">2352</span><br><span class="line">2353</span><br><span class="line">2354</span><br><span class="line">2355</span><br><span class="line">2356</span><br><span class="line">2357</span><br><span class="line">2358</span><br><span class="line">2359</span><br><span class="line">2360</span><br><span class="line">2361</span><br><span class="line">2362</span><br><span class="line">2363</span><br><span class="line">2364</span><br><span class="line">2365</span><br><span class="line">2366</span><br><span class="line">2367</span><br><span class="line">2368</span><br><span class="line">2369</span><br><span class="line">2370</span><br><span class="line">2371</span><br><span class="line">2372</span><br><span class="line">2373</span><br><span class="line">2374</span><br><span class="line">2375</span><br><span class="line">2376</span><br><span class="line">2377</span><br><span class="line">2378</span><br><span class="line">2379</span><br><span class="line">2380</span><br><span class="line">2381</span><br><span class="line">2382</span><br><span class="line">2383</span><br><span class="line">2384</span><br><span class="line">2385</span><br><span class="line">2386</span><br></pre></td><td class="code"><pre><span class="line">C:.</span><br><span class="line">│ .gitignore</span><br><span class="line">│ LICENSE</span><br><span class="line">│ pom.xml</span><br><span class="line">│</span><br><span class="line">├─.idea</span><br><span class="line">│ │ .gitignore</span><br><span class="line">│ │ compiler.xml</span><br><span class="line">│ │ encodings.xml</span><br><span class="line">│ │ jarRepositories.xml</span><br><span class="line">│ │ misc.xml</span><br><span class="line">│ │ uiDesigner.xml</span><br><span class="line">│ │ vcs.xml</span><br><span class="line">│ │ workspace.xml</span><br><span class="line">│ │</span><br><span class="line">│ └─codeStyles</span><br><span class="line">│ codeStyleConfig.xml</span><br><span class="line">│ Project.xml</span><br><span class="line">│</span><br><span class="line">├─gulimall-common</span><br><span class="line">│ │ pom.xml</span><br><span class="line">│ │</span><br><span class="line">│ ├─src</span><br><span class="line">│ │ ├─main</span><br><span class="line">│ │ │ ├─java</span><br><span class="line">│ │ │ │ └─com</span><br><span class="line">│ │ │ │ └─atguigu</span><br><span class="line">│ │ │ │ └─common</span><br><span class="line">│ │ │ │ ├─exception</span><br><span class="line">│ │ │ │ │ RRException.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─utils</span><br><span class="line">│ │ │ │ │ Constant.java</span><br><span class="line">│ │ │ │ │ PageUtils.java</span><br><span class="line">│ │ │ │ │ Query.java</span><br><span class="line">│ │ │ │ │ R.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─xss</span><br><span class="line">│ │ │ │ HTMLFilter.java</span><br><span class="line">│ │ │ │ SQLFilter.java</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─resources</span><br><span class="line">│ │ └─test</span><br><span class="line">│ │ └─java</span><br><span class="line">│ └─target</span><br><span class="line">│ ├─classes</span><br><span class="line">│ │ └─com</span><br><span class="line">│ │ └─atguigu</span><br><span class="line">│ │ └─common</span><br><span class="line">│ │ ├─exception</span><br><span class="line">│ │ │ RRException.class</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─utils</span><br><span class="line">│ │ │ Constant$MenuType.class</span><br><span class="line">│ │ │ Constant$ScheduleStatus.class</span><br><span class="line">│ │ │ Constant.class</span><br><span class="line">│ │ │ PageUtils.class</span><br><span class="line">│ │ │ Query.class</span><br><span class="line">│ │ │ R.class</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─xss</span><br><span class="line">│ │ HTMLFilter.class</span><br><span class="line">│ │ SQLFilter.class</span><br><span class="line">│ │</span><br><span class="line">│ └─generated-sources</span><br><span class="line">│ └─annotations</span><br><span class="line">├─gulimall-coupon</span><br><span class="line">│ │ .gitignore</span><br><span class="line">│ │ gulimall-coupon.iml</span><br><span class="line">│ │ HELP.md</span><br><span class="line">│ │ mvnw</span><br><span class="line">│ │ mvnw.cmd</span><br><span class="line">│ │ pom.xml</span><br><span class="line">│ │</span><br><span class="line">│ ├─.mvn</span><br><span class="line">│ │ └─wrapper</span><br><span class="line">│ │ maven-wrapper.jar</span><br><span class="line">│ │ maven-wrapper.properties</span><br><span class="line">│ │</span><br><span class="line">│ ├─src</span><br><span class="line">│ │ ├─main</span><br><span class="line">│ │ │ ├─java</span><br><span class="line">│ │ │ │ └─com</span><br><span class="line">│ │ │ │ └─atguigu</span><br><span class="line">│ │ │ │ └─gulimall</span><br><span class="line">│ │ │ │ └─coupon</span><br><span class="line">│ │ │ │ │ GulimallCouponApplication.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ CouponController.java</span><br><span class="line">│ │ │ │ │ CouponHistoryController.java</span><br><span class="line">│ │ │ │ │ CouponSpuCategoryRelationController.java</span><br><span class="line">│ │ │ │ │ CouponSpuRelationController.java</span><br><span class="line">│ │ │ │ │ HomeAdvController.java</span><br><span class="line">│ │ │ │ │ HomeSubjectController.java</span><br><span class="line">│ │ │ │ │ HomeSubjectSpuController.java</span><br><span class="line">│ │ │ │ │ MemberPriceController.java</span><br><span class="line">│ │ │ │ │ SeckillPromotionController.java</span><br><span class="line">│ │ │ │ │ SeckillSessionController.java</span><br><span class="line">│ │ │ │ │ SeckillSkuNoticeController.java</span><br><span class="line">│ │ │ │ │ SeckillSkuRelationController.java</span><br><span class="line">│ │ │ │ │ SkuFullReductionController.java</span><br><span class="line">│ │ │ │ │ SkuLadderController.java</span><br><span class="line">│ │ │ │ │ SpuBoundsController.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ CouponDao.java</span><br><span class="line">│ │ │ │ │ CouponHistoryDao.java</span><br><span class="line">│ │ │ │ │ CouponSpuCategoryRelationDao.java</span><br><span class="line">│ │ │ │ │ CouponSpuRelationDao.java</span><br><span class="line">│ │ │ │ │ HomeAdvDao.java</span><br><span class="line">│ │ │ │ │ HomeSubjectDao.java</span><br><span class="line">│ │ │ │ │ HomeSubjectSpuDao.java</span><br><span class="line">│ │ │ │ │ MemberPriceDao.java</span><br><span class="line">│ │ │ │ │ SeckillPromotionDao.java</span><br><span class="line">│ │ │ │ │ SeckillSessionDao.java</span><br><span class="line">│ │ │ │ │ SeckillSkuNoticeDao.java</span><br><span class="line">│ │ │ │ │ SeckillSkuRelationDao.java</span><br><span class="line">│ │ │ │ │ SkuFullReductionDao.java</span><br><span class="line">│ │ │ │ │ SkuLadderDao.java</span><br><span class="line">│ │ │ │ │ SpuBoundsDao.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ CouponEntity.java</span><br><span class="line">│ │ │ │ │ CouponHistoryEntity.java</span><br><span class="line">│ │ │ │ │ CouponSpuCategoryRelationEntity.java</span><br><span class="line">│ │ │ │ │ CouponSpuRelationEntity.java</span><br><span class="line">│ │ │ │ │ HomeAdvEntity.java</span><br><span class="line">│ │ │ │ │ HomeSubjectEntity.java</span><br><span class="line">│ │ │ │ │ HomeSubjectSpuEntity.java</span><br><span class="line">│ │ │ │ │ MemberPriceEntity.java</span><br><span class="line">│ │ │ │ │ SeckillPromotionEntity.java</span><br><span class="line">│ │ │ │ │ SeckillSessionEntity.java</span><br><span class="line">│ │ │ │ │ SeckillSkuNoticeEntity.java</span><br><span class="line">│ │ │ │ │ SeckillSkuRelationEntity.java</span><br><span class="line">│ │ │ │ │ SkuFullReductionEntity.java</span><br><span class="line">│ │ │ │ │ SkuLadderEntity.java</span><br><span class="line">│ │ │ │ │ SpuBoundsEntity.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─service</span><br><span class="line">│ │ │ │ │ CouponHistoryService.java</span><br><span class="line">│ │ │ │ │ CouponService.java</span><br><span class="line">│ │ │ │ │ CouponSpuCategoryRelationService.java</span><br><span class="line">│ │ │ │ │ CouponSpuRelationService.java</span><br><span class="line">│ │ │ │ │ HomeAdvService.java</span><br><span class="line">│ │ │ │ │ HomeSubjectService.java</span><br><span class="line">│ │ │ │ │ HomeSubjectSpuService.java</span><br><span class="line">│ │ │ │ │ MemberPriceService.java</span><br><span class="line">│ │ │ │ │ SeckillPromotionService.java</span><br><span class="line">│ │ │ │ │ SeckillSessionService.java</span><br><span class="line">│ │ │ │ │ SeckillSkuNoticeService.java</span><br><span class="line">│ │ │ │ │ SeckillSkuRelationService.java</span><br><span class="line">│ │ │ │ │ SkuFullReductionService.java</span><br><span class="line">│ │ │ │ │ SkuLadderService.java</span><br><span class="line">│ │ │ │ │ SpuBoundsService.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─impl</span><br><span class="line">│ │ │ │ CouponHistoryServiceImpl.java</span><br><span class="line">│ │ │ │ CouponServiceImpl.java</span><br><span class="line">│ │ │ │ CouponSpuCategoryRelationServiceImpl.java</span><br><span class="line">│ │ │ │ CouponSpuRelationServiceImpl.java</span><br><span class="line">│ │ │ │ HomeAdvServiceImpl.java</span><br><span class="line">│ │ │ │ HomeSubjectServiceImpl.java</span><br><span class="line">│ │ │ │ HomeSubjectSpuServiceImpl.java</span><br><span class="line">│ │ │ │ MemberPriceServiceImpl.java</span><br><span class="line">│ │ │ │ SeckillPromotionServiceImpl.java</span><br><span class="line">│ │ │ │ SeckillSessionServiceImpl.java</span><br><span class="line">│ │ │ │ SeckillSkuNoticeServiceImpl.java</span><br><span class="line">│ │ │ │ SeckillSkuRelationServiceImpl.java</span><br><span class="line">│ │ │ │ SkuFullReductionServiceImpl.java</span><br><span class="line">│ │ │ │ SkuLadderServiceImpl.java</span><br><span class="line">│ │ │ │ SpuBoundsServiceImpl.java</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─resources</span><br><span class="line">│ │ │ │ application.properties</span><br><span class="line">│ │ │ │ application.yml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─mapper</span><br><span class="line">│ │ │ │ └─coupon</span><br><span class="line">│ │ │ │ CouponDao.xml</span><br><span class="line">│ │ │ │ CouponHistoryDao.xml</span><br><span class="line">│ │ │ │ CouponSpuCategoryRelationDao.xml</span><br><span class="line">│ │ │ │ CouponSpuRelationDao.xml</span><br><span class="line">│ │ │ │ HomeAdvDao.xml</span><br><span class="line">│ │ │ │ HomeSubjectDao.xml</span><br><span class="line">│ │ │ │ HomeSubjectSpuDao.xml</span><br><span class="line">│ │ │ │ MemberPriceDao.xml</span><br><span class="line">│ │ │ │ SeckillPromotionDao.xml</span><br><span class="line">│ │ │ │ SeckillSessionDao.xml</span><br><span class="line">│ │ │ │ SeckillSkuNoticeDao.xml</span><br><span class="line">│ │ │ │ SeckillSkuRelationDao.xml</span><br><span class="line">│ │ │ │ SkuFullReductionDao.xml</span><br><span class="line">│ │ │ │ SkuLadderDao.xml</span><br><span class="line">│ │ │ │ SpuBoundsDao.xml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─src</span><br><span class="line">│ │ │ │ └─views</span><br><span class="line">│ │ │ │ └─modules</span><br><span class="line">│ │ │ │ └─coupon</span><br><span class="line">│ │ │ │ coupon-add-or-update.vue</span><br><span class="line">│ │ │ │ coupon.vue</span><br><span class="line">│ │ │ │ couponhistory-add-or-update.vue</span><br><span class="line">│ │ │ │ couponhistory.vue</span><br><span class="line">│ │ │ │ couponspucategoryrelation-add-or-update.vue</span><br><span class="line">│ │ │ │ couponspucategoryrelation.vue</span><br><span class="line">│ │ │ │ couponspurelation-add-or-update.vue</span><br><span class="line">│ │ │ │ couponspurelation.vue</span><br><span class="line">│ │ │ │ homeadv-add-or-update.vue</span><br><span class="line">│ │ │ │ homeadv.vue</span><br><span class="line">│ │ │ │ homesubject-add-or-update.vue</span><br><span class="line">│ │ │ │ homesubject.vue</span><br><span class="line">│ │ │ │ homesubjectspu-add-or-update.vue</span><br><span class="line">│ │ │ │ homesubjectspu.vue</span><br><span class="line">│ │ │ │ memberprice-add-or-update.vue</span><br><span class="line">│ │ │ │ memberprice.vue</span><br><span class="line">│ │ │ │ seckillpromotion-add-or-update.vue</span><br><span class="line">│ │ │ │ seckillpromotion.vue</span><br><span class="line">│ │ │ │ seckillsession-add-or-update.vue</span><br><span class="line">│ │ │ │ seckillsession.vue</span><br><span class="line">│ │ │ │ seckillskunotice-add-or-update.vue</span><br><span class="line">│ │ │ │ seckillskunotice.vue</span><br><span class="line">│ │ │ │ seckillskurelation-add-or-update.vue</span><br><span class="line">│ │ │ │ seckillskurelation.vue</span><br><span class="line">│ │ │ │ skufullreduction-add-or-update.vue</span><br><span class="line">│ │ │ │ skufullreduction.vue</span><br><span class="line">│ │ │ │ skuladder-add-or-update.vue</span><br><span class="line">│ │ │ │ skuladder.vue</span><br><span class="line">│ │ │ │ spubounds-add-or-update.vue</span><br><span class="line">│ │ │ │ spubounds.vue</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─static</span><br><span class="line">│ │ │ └─templates</span><br><span class="line">│ │ └─test</span><br><span class="line">│ │ └─java</span><br><span class="line">│ │ └─com</span><br><span class="line">│ │ └─atguigu</span><br><span class="line">│ │ └─gulimall</span><br><span class="line">│ │ └─coupon</span><br><span class="line">│ │ GulimallCouponApplicationTests.java</span><br><span class="line">│ │</span><br><span class="line">│ └─target</span><br><span class="line">│ ├─classes</span><br><span class="line">│ │ │ application.properties</span><br><span class="line">│ │ │ application.yml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─com</span><br><span class="line">│ │ │ └─atguigu</span><br><span class="line">│ │ │ └─gulimall</span><br><span class="line">│ │ │ └─coupon</span><br><span class="line">│ │ │ │ GulimallCouponApplication.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─controller</span><br><span class="line">│ │ │ │ CouponController.class</span><br><span class="line">│ │ │ │ CouponHistoryController.class</span><br><span class="line">│ │ │ │ CouponSpuCategoryRelationController.class</span><br><span class="line">│ │ │ │ CouponSpuRelationController.class</span><br><span class="line">│ │ │ │ HomeAdvController.class</span><br><span class="line">│ │ │ │ HomeSubjectController.class</span><br><span class="line">│ │ │ │ HomeSubjectSpuController.class</span><br><span class="line">│ │ │ │ MemberPriceController.class</span><br><span class="line">│ │ │ │ SeckillPromotionController.class</span><br><span class="line">│ │ │ │ SeckillSessionController.class</span><br><span class="line">│ │ │ │ SeckillSkuNoticeController.class</span><br><span class="line">│ │ │ │ SeckillSkuRelationController.class</span><br><span class="line">│ │ │ │ SkuFullReductionController.class</span><br><span class="line">│ │ │ │ SkuLadderController.class</span><br><span class="line">│ │ │ │ SpuBoundsController.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─dao</span><br><span class="line">│ │ │ │ CouponDao.class</span><br><span class="line">│ │ │ │ CouponHistoryDao.class</span><br><span class="line">│ │ │ │ CouponSpuCategoryRelationDao.class</span><br><span class="line">│ │ │ │ CouponSpuRelationDao.class</span><br><span class="line">│ │ │ │ HomeAdvDao.class</span><br><span class="line">│ │ │ │ HomeSubjectDao.class</span><br><span class="line">│ │ │ │ HomeSubjectSpuDao.class</span><br><span class="line">│ │ │ │ MemberPriceDao.class</span><br><span class="line">│ │ │ │ SeckillPromotionDao.class</span><br><span class="line">│ │ │ │ SeckillSessionDao.class</span><br><span class="line">│ │ │ │ SeckillSkuNoticeDao.class</span><br><span class="line">│ │ │ │ SeckillSkuRelationDao.class</span><br><span class="line">│ │ │ │ SkuFullReductionDao.class</span><br><span class="line">│ │ │ │ SkuLadderDao.class</span><br><span class="line">│ │ │ │ SpuBoundsDao.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─entity</span><br><span class="line">│ │ │ │ CouponEntity.class</span><br><span class="line">│ │ │ │ CouponHistoryEntity.class</span><br><span class="line">│ │ │ │ CouponSpuCategoryRelationEntity.class</span><br><span class="line">│ │ │ │ CouponSpuRelationEntity.class</span><br><span class="line">│ │ │ │ HomeAdvEntity.class</span><br><span class="line">│ │ │ │ HomeSubjectEntity.class</span><br><span class="line">│ │ │ │ HomeSubjectSpuEntity.class</span><br><span class="line">│ │ │ │ MemberPriceEntity.class</span><br><span class="line">│ │ │ │ SeckillPromotionEntity.class</span><br><span class="line">│ │ │ │ SeckillSessionEntity.class</span><br><span class="line">│ │ │ │ SeckillSkuNoticeEntity.class</span><br><span class="line">│ │ │ │ SeckillSkuRelationEntity.class</span><br><span class="line">│ │ │ │ SkuFullReductionEntity.class</span><br><span class="line">│ │ │ │ SkuLadderEntity.class</span><br><span class="line">│ │ │ │ SpuBoundsEntity.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─service</span><br><span class="line">│ │ │ │ CouponHistoryService.class</span><br><span class="line">│ │ │ │ CouponService.class</span><br><span class="line">│ │ │ │ CouponSpuCategoryRelationService.class</span><br><span class="line">│ │ │ │ CouponSpuRelationService.class</span><br><span class="line">│ │ │ │ HomeAdvService.class</span><br><span class="line">│ │ │ │ HomeSubjectService.class</span><br><span class="line">│ │ │ │ HomeSubjectSpuService.class</span><br><span class="line">│ │ │ │ MemberPriceService.class</span><br><span class="line">│ │ │ │ SeckillPromotionService.class</span><br><span class="line">│ │ │ │ SeckillSessionService.class</span><br><span class="line">│ │ │ │ SeckillSkuNoticeService.class</span><br><span class="line">│ │ │ │ SeckillSkuRelationService.class</span><br><span class="line">│ │ │ │ SkuFullReductionService.class</span><br><span class="line">│ │ │ │ SkuLadderService.class</span><br><span class="line">│ │ │ │ SpuBoundsService.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─impl</span><br><span class="line">│ │ │ CouponHistoryServiceImpl.class</span><br><span class="line">│ │ │ CouponServiceImpl.class</span><br><span class="line">│ │ │ CouponSpuCategoryRelationServiceImpl.class</span><br><span class="line">│ │ │ CouponSpuRelationServiceImpl.class</span><br><span class="line">│ │ │ HomeAdvServiceImpl.class</span><br><span class="line">│ │ │ HomeSubjectServiceImpl.class</span><br><span class="line">│ │ │ HomeSubjectSpuServiceImpl.class</span><br><span class="line">│ │ │ MemberPriceServiceImpl.class</span><br><span class="line">│ │ │ SeckillPromotionServiceImpl.class</span><br><span class="line">│ │ │ SeckillSessionServiceImpl.class</span><br><span class="line">│ │ │ SeckillSkuNoticeServiceImpl.class</span><br><span class="line">│ │ │ SeckillSkuRelationServiceImpl.class</span><br><span class="line">│ │ │ SkuFullReductionServiceImpl.class</span><br><span class="line">│ │ │ SkuLadderServiceImpl.class</span><br><span class="line">│ │ │ SpuBoundsServiceImpl.class</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─mapper</span><br><span class="line">│ │ │ └─coupon</span><br><span class="line">│ │ │ CouponDao.xml</span><br><span class="line">│ │ │ CouponHistoryDao.xml</span><br><span class="line">│ │ │ CouponSpuCategoryRelationDao.xml</span><br><span class="line">│ │ │ CouponSpuRelationDao.xml</span><br><span class="line">│ │ │ HomeAdvDao.xml</span><br><span class="line">│ │ │ HomeSubjectDao.xml</span><br><span class="line">│ │ │ HomeSubjectSpuDao.xml</span><br><span class="line">│ │ │ MemberPriceDao.xml</span><br><span class="line">│ │ │ SeckillPromotionDao.xml</span><br><span class="line">│ │ │ SeckillSessionDao.xml</span><br><span class="line">│ │ │ SeckillSkuNoticeDao.xml</span><br><span class="line">│ │ │ SeckillSkuRelationDao.xml</span><br><span class="line">│ │ │ SkuFullReductionDao.xml</span><br><span class="line">│ │ │ SkuLadderDao.xml</span><br><span class="line">│ │ │ SpuBoundsDao.xml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─src</span><br><span class="line">│ │ └─views</span><br><span class="line">│ │ └─modules</span><br><span class="line">│ │ └─coupon</span><br><span class="line">│ │ coupon-add-or-update.vue</span><br><span class="line">│ │ coupon.vue</span><br><span class="line">│ │ couponhistory-add-or-update.vue</span><br><span class="line">│ │ couponhistory.vue</span><br><span class="line">│ │ couponspucategoryrelation-add-or-update.vue</span><br><span class="line">│ │ couponspucategoryrelation.vue</span><br><span class="line">│ │ couponspurelation-add-or-update.vue</span><br><span class="line">│ │ couponspurelation.vue</span><br><span class="line">│ │ homeadv-add-or-update.vue</span><br><span class="line">│ │ homeadv.vue</span><br><span class="line">│ │ homesubject-add-or-update.vue</span><br><span class="line">│ │ homesubject.vue</span><br><span class="line">│ │ homesubjectspu-add-or-update.vue</span><br><span class="line">│ │ homesubjectspu.vue</span><br><span class="line">│ │ memberprice-add-or-update.vue</span><br><span class="line">│ │ memberprice.vue</span><br><span class="line">│ │ seckillpromotion-add-or-update.vue</span><br><span class="line">│ │ seckillpromotion.vue</span><br><span class="line">│ │ seckillsession-add-or-update.vue</span><br><span class="line">│ │ seckillsession.vue</span><br><span class="line">│ │ seckillskunotice-add-or-update.vue</span><br><span class="line">│ │ seckillskunotice.vue</span><br><span class="line">│ │ seckillskurelation-add-or-update.vue</span><br><span class="line">│ │ seckillskurelation.vue</span><br><span class="line">│ │ skufullreduction-add-or-update.vue</span><br><span class="line">│ │ skufullreduction.vue</span><br><span class="line">│ │ skuladder-add-or-update.vue</span><br><span class="line">│ │ skuladder.vue</span><br><span class="line">│ │ spubounds-add-or-update.vue</span><br><span class="line">│ │ spubounds.vue</span><br><span class="line">│ │</span><br><span class="line">│ ├─generated-sources</span><br><span class="line">│ │ └─annotations</span><br><span class="line">│ └─maven-status</span><br><span class="line">│ └─maven-compiler-plugin</span><br><span class="line">│ └─compile</span><br><span class="line">│ └─default-compile</span><br><span class="line">│ createdFiles.lst</span><br><span class="line">│ inputFiles.lst</span><br><span class="line">│</span><br><span class="line">├─gulimall-member</span><br><span class="line">│ │ .gitignore</span><br><span class="line">│ │ gulimall-member.iml</span><br><span class="line">│ │ HELP.md</span><br><span class="line">│ │ mvnw</span><br><span class="line">│ │ mvnw.cmd</span><br><span class="line">│ │ pom.xml</span><br><span class="line">│ │</span><br><span class="line">│ ├─.mvn</span><br><span class="line">│ │ └─wrapper</span><br><span class="line">│ │ maven-wrapper.jar</span><br><span class="line">│ │ maven-wrapper.properties</span><br><span class="line">│ │</span><br><span class="line">│ ├─src</span><br><span class="line">│ │ ├─main</span><br><span class="line">│ │ │ ├─java</span><br><span class="line">│ │ │ │ └─com</span><br><span class="line">│ │ │ │ └─atguigu</span><br><span class="line">│ │ │ │ └─gulimall</span><br><span class="line">│ │ │ │ └─member</span><br><span class="line">│ │ │ │ │ GulimallMemberApplication.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ GrowthChangeHistoryController.java</span><br><span class="line">│ │ │ │ │ IntegrationChangeHistoryController.java</span><br><span class="line">│ │ │ │ │ MemberCollectSpuController.java</span><br><span class="line">│ │ │ │ │ MemberCollectSubjectController.java</span><br><span class="line">│ │ │ │ │ MemberController.java</span><br><span class="line">│ │ │ │ │ MemberLevelController.java</span><br><span class="line">│ │ │ │ │ MemberLoginLogController.java</span><br><span class="line">│ │ │ │ │ MemberReceiveAddressController.java</span><br><span class="line">│ │ │ │ │ MemberStatisticsInfoController.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ GrowthChangeHistoryDao.java</span><br><span class="line">│ │ │ │ │ IntegrationChangeHistoryDao.java</span><br><span class="line">│ │ │ │ │ MemberCollectSpuDao.java</span><br><span class="line">│ │ │ │ │ MemberCollectSubjectDao.java</span><br><span class="line">│ │ │ │ │ MemberDao.java</span><br><span class="line">│ │ │ │ │ MemberLevelDao.java</span><br><span class="line">│ │ │ │ │ MemberLoginLogDao.java</span><br><span class="line">│ │ │ │ │ MemberReceiveAddressDao.java</span><br><span class="line">│ │ │ │ │ MemberStatisticsInfoDao.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ GrowthChangeHistoryEntity.java</span><br><span class="line">│ │ │ │ │ IntegrationChangeHistoryEntity.java</span><br><span class="line">│ │ │ │ │ MemberCollectSpuEntity.java</span><br><span class="line">│ │ │ │ │ MemberCollectSubjectEntity.java</span><br><span class="line">│ │ │ │ │ MemberEntity.java</span><br><span class="line">│ │ │ │ │ MemberLevelEntity.java</span><br><span class="line">│ │ │ │ │ MemberLoginLogEntity.java</span><br><span class="line">│ │ │ │ │ MemberReceiveAddressEntity.java</span><br><span class="line">│ │ │ │ │ MemberStatisticsInfoEntity.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─service</span><br><span class="line">│ │ │ │ │ GrowthChangeHistoryService.java</span><br><span class="line">│ │ │ │ │ IntegrationChangeHistoryService.java</span><br><span class="line">│ │ │ │ │ MemberCollectSpuService.java</span><br><span class="line">│ │ │ │ │ MemberCollectSubjectService.java</span><br><span class="line">│ │ │ │ │ MemberLevelService.java</span><br><span class="line">│ │ │ │ │ MemberLoginLogService.java</span><br><span class="line">│ │ │ │ │ MemberReceiveAddressService.java</span><br><span class="line">│ │ │ │ │ MemberService.java</span><br><span class="line">│ │ │ │ │ MemberStatisticsInfoService.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─impl</span><br><span class="line">│ │ │ │ GrowthChangeHistoryServiceImpl.java</span><br><span class="line">│ │ │ │ IntegrationChangeHistoryServiceImpl.java</span><br><span class="line">│ │ │ │ MemberCollectSpuServiceImpl.java</span><br><span class="line">│ │ │ │ MemberCollectSubjectServiceImpl.java</span><br><span class="line">│ │ │ │ MemberLevelServiceImpl.java</span><br><span class="line">│ │ │ │ MemberLoginLogServiceImpl.java</span><br><span class="line">│ │ │ │ MemberReceiveAddressServiceImpl.java</span><br><span class="line">│ │ │ │ MemberServiceImpl.java</span><br><span class="line">│ │ │ │ MemberStatisticsInfoServiceImpl.java</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─resources</span><br><span class="line">│ │ │ │ application.properties</span><br><span class="line">│ │ │ │ application.yml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─mapper</span><br><span class="line">│ │ │ │ └─member</span><br><span class="line">│ │ │ │ GrowthChangeHistoryDao.xml</span><br><span class="line">│ │ │ │ IntegrationChangeHistoryDao.xml</span><br><span class="line">│ │ │ │ MemberCollectSpuDao.xml</span><br><span class="line">│ │ │ │ MemberCollectSubjectDao.xml</span><br><span class="line">│ │ │ │ MemberDao.xml</span><br><span class="line">│ │ │ │ MemberLevelDao.xml</span><br><span class="line">│ │ │ │ MemberLoginLogDao.xml</span><br><span class="line">│ │ │ │ MemberReceiveAddressDao.xml</span><br><span class="line">│ │ │ │ MemberStatisticsInfoDao.xml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─src</span><br><span class="line">│ │ │ │ └─views</span><br><span class="line">│ │ │ │ └─modules</span><br><span class="line">│ │ │ │ └─member</span><br><span class="line">│ │ │ │ growthchangehistory-add-or-update.vue</span><br><span class="line">│ │ │ │ growthchangehistory.vue</span><br><span class="line">│ │ │ │ integrationchangehistory-add-or-update.vue</span><br><span class="line">│ │ │ │ integrationchangehistory.vue</span><br><span class="line">│ │ │ │ member-add-or-update.vue</span><br><span class="line">│ │ │ │ member.vue</span><br><span class="line">│ │ │ │ membercollectspu-add-or-update.vue</span><br><span class="line">│ │ │ │ membercollectspu.vue</span><br><span class="line">│ │ │ │ membercollectsubject-add-or-update.vue</span><br><span class="line">│ │ │ │ membercollectsubject.vue</span><br><span class="line">│ │ │ │ memberlevel-add-or-update.vue</span><br><span class="line">│ │ │ │ memberlevel.vue</span><br><span class="line">│ │ │ │ memberloginlog-add-or-update.vue</span><br><span class="line">│ │ │ │ memberloginlog.vue</span><br><span class="line">│ │ │ │ memberreceiveaddress-add-or-update.vue</span><br><span class="line">│ │ │ │ memberreceiveaddress.vue</span><br><span class="line">│ │ │ │ memberstatisticsinfo-add-or-update.vue</span><br><span class="line">│ │ │ │ memberstatisticsinfo.vue</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─static</span><br><span class="line">│ │ │ └─templates</span><br><span class="line">│ │ └─test</span><br><span class="line">│ │ └─java</span><br><span class="line">│ │ └─com</span><br><span class="line">│ │ └─atguigu</span><br><span class="line">│ │ └─gulimall</span><br><span class="line">│ │ └─member</span><br><span class="line">│ │ GulimallMemberApplicationTests.java</span><br><span class="line">│ │</span><br><span class="line">│ └─target</span><br><span class="line">│ ├─classes</span><br><span class="line">│ │ │ application.properties</span><br><span class="line">│ │ │ application.yml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─com</span><br><span class="line">│ │ │ └─atguigu</span><br><span class="line">│ │ │ └─gulimall</span><br><span class="line">│ │ │ └─member</span><br><span class="line">│ │ │ │ GulimallMemberApplication.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─controller</span><br><span class="line">│ │ │ │ GrowthChangeHistoryController.class</span><br><span class="line">│ │ │ │ IntegrationChangeHistoryController.class</span><br><span class="line">│ │ │ │ MemberCollectSpuController.class</span><br><span class="line">│ │ │ │ MemberCollectSubjectController.class</span><br><span class="line">│ │ │ │ MemberController.class</span><br><span class="line">│ │ │ │ MemberLevelController.class</span><br><span class="line">│ │ │ │ MemberLoginLogController.class</span><br><span class="line">│ │ │ │ MemberReceiveAddressController.class</span><br><span class="line">│ │ │ │ MemberStatisticsInfoController.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─dao</span><br><span class="line">│ │ │ │ GrowthChangeHistoryDao.class</span><br><span class="line">│ │ │ │ IntegrationChangeHistoryDao.class</span><br><span class="line">│ │ │ │ MemberCollectSpuDao.class</span><br><span class="line">│ │ │ │ MemberCollectSubjectDao.class</span><br><span class="line">│ │ │ │ MemberDao.class</span><br><span class="line">│ │ │ │ MemberLevelDao.class</span><br><span class="line">│ │ │ │ MemberLoginLogDao.class</span><br><span class="line">│ │ │ │ MemberReceiveAddressDao.class</span><br><span class="line">│ │ │ │ MemberStatisticsInfoDao.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─entity</span><br><span class="line">│ │ │ │ GrowthChangeHistoryEntity.class</span><br><span class="line">│ │ │ │ IntegrationChangeHistoryEntity.class</span><br><span class="line">│ │ │ │ MemberCollectSpuEntity.class</span><br><span class="line">│ │ │ │ MemberCollectSubjectEntity.class</span><br><span class="line">│ │ │ │ MemberEntity.class</span><br><span class="line">│ │ │ │ MemberLevelEntity.class</span><br><span class="line">│ │ │ │ MemberLoginLogEntity.class</span><br><span class="line">│ │ │ │ MemberReceiveAddressEntity.class</span><br><span class="line">│ │ │ │ MemberStatisticsInfoEntity.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─service</span><br><span class="line">│ │ │ │ GrowthChangeHistoryService.class</span><br><span class="line">│ │ │ │ IntegrationChangeHistoryService.class</span><br><span class="line">│ │ │ │ MemberCollectSpuService.class</span><br><span class="line">│ │ │ │ MemberCollectSubjectService.class</span><br><span class="line">│ │ │ │ MemberLevelService.class</span><br><span class="line">│ │ │ │ MemberLoginLogService.class</span><br><span class="line">│ │ │ │ MemberReceiveAddressService.class</span><br><span class="line">│ │ │ │ MemberService.class</span><br><span class="line">│ │ │ │ MemberStatisticsInfoService.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─impl</span><br><span class="line">│ │ │ GrowthChangeHistoryServiceImpl.class</span><br><span class="line">│ │ │ IntegrationChangeHistoryServiceImpl.class</span><br><span class="line">│ │ │ MemberCollectSpuServiceImpl.class</span><br><span class="line">│ │ │ MemberCollectSubjectServiceImpl.class</span><br><span class="line">│ │ │ MemberLevelServiceImpl.class</span><br><span class="line">│ │ │ MemberLoginLogServiceImpl.class</span><br><span class="line">│ │ │ MemberReceiveAddressServiceImpl.class</span><br><span class="line">│ │ │ MemberServiceImpl.class</span><br><span class="line">│ │ │ MemberStatisticsInfoServiceImpl.class</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─mapper</span><br><span class="line">│ │ │ └─member</span><br><span class="line">│ │ │ GrowthChangeHistoryDao.xml</span><br><span class="line">│ │ │ IntegrationChangeHistoryDao.xml</span><br><span class="line">│ │ │ MemberCollectSpuDao.xml</span><br><span class="line">│ │ │ MemberCollectSubjectDao.xml</span><br><span class="line">│ │ │ MemberDao.xml</span><br><span class="line">│ │ │ MemberLevelDao.xml</span><br><span class="line">│ │ │ MemberLoginLogDao.xml</span><br><span class="line">│ │ │ MemberReceiveAddressDao.xml</span><br><span class="line">│ │ │ MemberStatisticsInfoDao.xml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─src</span><br><span class="line">│ │ └─views</span><br><span class="line">│ │ └─modules</span><br><span class="line">│ │ └─member</span><br><span class="line">│ │ growthchangehistory-add-or-update.vue</span><br><span class="line">│ │ growthchangehistory.vue</span><br><span class="line">│ │ integrationchangehistory-add-or-update.vue</span><br><span class="line">│ │ integrationchangehistory.vue</span><br><span class="line">│ │ member-add-or-update.vue</span><br><span class="line">│ │ member.vue</span><br><span class="line">│ │ membercollectspu-add-or-update.vue</span><br><span class="line">│ │ membercollectspu.vue</span><br><span class="line">│ │ membercollectsubject-add-or-update.vue</span><br><span class="line">│ │ membercollectsubject.vue</span><br><span class="line">│ │ memberlevel-add-or-update.vue</span><br><span class="line">│ │ memberlevel.vue</span><br><span class="line">│ │ memberloginlog-add-or-update.vue</span><br><span class="line">│ │ memberloginlog.vue</span><br><span class="line">│ │ memberreceiveaddress-add-or-update.vue</span><br><span class="line">│ │ memberreceiveaddress.vue</span><br><span class="line">│ │ memberstatisticsinfo-add-or-update.vue</span><br><span class="line">│ │ memberstatisticsinfo.vue</span><br><span class="line">│ │</span><br><span class="line">│ ├─generated-sources</span><br><span class="line">│ │ └─annotations</span><br><span class="line">│ └─maven-status</span><br><span class="line">│ └─maven-compiler-plugin</span><br><span class="line">│ └─compile</span><br><span class="line">│ └─default-compile</span><br><span class="line">│ createdFiles.lst</span><br><span class="line">│ inputFiles.lst</span><br><span class="line">│</span><br><span class="line">├─gulimall-order</span><br><span class="line">│ │ .gitignore</span><br><span class="line">│ │ gulimall-order.iml</span><br><span class="line">│ │ HELP.md</span><br><span class="line">│ │ mvnw</span><br><span class="line">│ │ mvnw.cmd</span><br><span class="line">│ │ pom.xml</span><br><span class="line">│ │</span><br><span class="line">│ ├─.mvn</span><br><span class="line">│ │ └─wrapper</span><br><span class="line">│ │ maven-wrapper.jar</span><br><span class="line">│ │ maven-wrapper.properties</span><br><span class="line">│ │</span><br><span class="line">│ ├─src</span><br><span class="line">│ │ ├─main</span><br><span class="line">│ │ │ ├─java</span><br><span class="line">│ │ │ │ └─com</span><br><span class="line">│ │ │ │ └─atguigu</span><br><span class="line">│ │ │ │ └─gulimall</span><br><span class="line">│ │ │ │ └─order</span><br><span class="line">│ │ │ │ │ GulimallOrderApplication.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ OrderController.java</span><br><span class="line">│ │ │ │ │ OrderItemController.java</span><br><span class="line">│ │ │ │ │ OrderOperateHistoryController.java</span><br><span class="line">│ │ │ │ │ OrderReturnApplyController.java</span><br><span class="line">│ │ │ │ │ OrderReturnReasonController.java</span><br><span class="line">│ │ │ │ │ OrderSettingController.java</span><br><span class="line">│ │ │ │ │ PaymentInfoController.java</span><br><span class="line">│ │ │ │ │ RefundInfoController.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ OrderDao.java</span><br><span class="line">│ │ │ │ │ OrderItemDao.java</span><br><span class="line">│ │ │ │ │ OrderOperateHistoryDao.java</span><br><span class="line">│ │ │ │ │ OrderReturnApplyDao.java</span><br><span class="line">│ │ │ │ │ OrderReturnReasonDao.java</span><br><span class="line">│ │ │ │ │ OrderSettingDao.java</span><br><span class="line">│ │ │ │ │ PaymentInfoDao.java</span><br><span class="line">│ │ │ │ │ RefundInfoDao.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ OrderEntity.java</span><br><span class="line">│ │ │ │ │ OrderItemEntity.java</span><br><span class="line">│ │ │ │ │ OrderOperateHistoryEntity.java</span><br><span class="line">│ │ │ │ │ OrderReturnApplyEntity.java</span><br><span class="line">│ │ │ │ │ OrderReturnReasonEntity.java</span><br><span class="line">│ │ │ │ │ OrderSettingEntity.java</span><br><span class="line">│ │ │ │ │ PaymentInfoEntity.java</span><br><span class="line">│ │ │ │ │ RefundInfoEntity.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─service</span><br><span class="line">│ │ │ │ │ OrderItemService.java</span><br><span class="line">│ │ │ │ │ OrderOperateHistoryService.java</span><br><span class="line">│ │ │ │ │ OrderReturnApplyService.java</span><br><span class="line">│ │ │ │ │ OrderReturnReasonService.java</span><br><span class="line">│ │ │ │ │ OrderService.java</span><br><span class="line">│ │ │ │ │ OrderSettingService.java</span><br><span class="line">│ │ │ │ │ PaymentInfoService.java</span><br><span class="line">│ │ │ │ │ RefundInfoService.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─impl</span><br><span class="line">│ │ │ │ OrderItemServiceImpl.java</span><br><span class="line">│ │ │ │ OrderOperateHistoryServiceImpl.java</span><br><span class="line">│ │ │ │ OrderReturnApplyServiceImpl.java</span><br><span class="line">│ │ │ │ OrderReturnReasonServiceImpl.java</span><br><span class="line">│ │ │ │ OrderServiceImpl.java</span><br><span class="line">│ │ │ │ OrderSettingServiceImpl.java</span><br><span class="line">│ │ │ │ PaymentInfoServiceImpl.java</span><br><span class="line">│ │ │ │ RefundInfoServiceImpl.java</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─resources</span><br><span class="line">│ │ │ │ application.properties</span><br><span class="line">│ │ │ │ application.yml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─mapper</span><br><span class="line">│ │ │ │ └─order</span><br><span class="line">│ │ │ │ OrderDao.xml</span><br><span class="line">│ │ │ │ OrderItemDao.xml</span><br><span class="line">│ │ │ │ OrderOperateHistoryDao.xml</span><br><span class="line">│ │ │ │ OrderReturnApplyDao.xml</span><br><span class="line">│ │ │ │ OrderReturnReasonDao.xml</span><br><span class="line">│ │ │ │ OrderSettingDao.xml</span><br><span class="line">│ │ │ │ PaymentInfoDao.xml</span><br><span class="line">│ │ │ │ RefundInfoDao.xml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─src</span><br><span class="line">│ │ │ │ └─views</span><br><span class="line">│ │ │ │ └─modules</span><br><span class="line">│ │ │ │ └─order</span><br><span class="line">│ │ │ │ order-add-or-update.vue</span><br><span class="line">│ │ │ │ order.vue</span><br><span class="line">│ │ │ │ orderitem-add-or-update.vue</span><br><span class="line">│ │ │ │ orderitem.vue</span><br><span class="line">│ │ │ │ orderoperatehistory-add-or-update.vue</span><br><span class="line">│ │ │ │ orderoperatehistory.vue</span><br><span class="line">│ │ │ │ orderreturnapply-add-or-update.vue</span><br><span class="line">│ │ │ │ orderreturnapply.vue</span><br><span class="line">│ │ │ │ orderreturnreason-add-or-update.vue</span><br><span class="line">│ │ │ │ orderreturnreason.vue</span><br><span class="line">│ │ │ │ ordersetting-add-or-update.vue</span><br><span class="line">│ │ │ │ ordersetting.vue</span><br><span class="line">│ │ │ │ paymentinfo-add-or-update.vue</span><br><span class="line">│ │ │ │ paymentinfo.vue</span><br><span class="line">│ │ │ │ refundinfo-add-or-update.vue</span><br><span class="line">│ │ │ │ refundinfo.vue</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─static</span><br><span class="line">│ │ │ └─templates</span><br><span class="line">│ │ └─test</span><br><span class="line">│ │ └─java</span><br><span class="line">│ │ └─com</span><br><span class="line">│ │ └─atguigu</span><br><span class="line">│ │ └─gulimall</span><br><span class="line">│ │ └─order</span><br><span class="line">│ │ GulimallOrderApplicationTests.java</span><br><span class="line">│ │</span><br><span class="line">│ └─target</span><br><span class="line">│ ├─classes</span><br><span class="line">│ │ │ application.properties</span><br><span class="line">│ │ │ application.yml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─com</span><br><span class="line">│ │ │ └─atguigu</span><br><span class="line">│ │ │ └─gulimall</span><br><span class="line">│ │ │ ├─gulimallorder</span><br><span class="line">│ │ │ │ GulimallOrderApplication.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─order</span><br><span class="line">│ │ │ │ GulimallOrderApplication.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─controller</span><br><span class="line">│ │ │ │ OrderController.class</span><br><span class="line">│ │ │ │ OrderItemController.class</span><br><span class="line">│ │ │ │ OrderOperateHistoryController.class</span><br><span class="line">│ │ │ │ OrderReturnApplyController.class</span><br><span class="line">│ │ │ │ OrderReturnReasonController.class</span><br><span class="line">│ │ │ │ OrderSettingController.class</span><br><span class="line">│ │ │ │ PaymentInfoController.class</span><br><span class="line">│ │ │ │ RefundInfoController.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─dao</span><br><span class="line">│ │ │ │ OrderDao.class</span><br><span class="line">│ │ │ │ OrderItemDao.class</span><br><span class="line">│ │ │ │ OrderOperateHistoryDao.class</span><br><span class="line">│ │ │ │ OrderReturnApplyDao.class</span><br><span class="line">│ │ │ │ OrderReturnReasonDao.class</span><br><span class="line">│ │ │ │ OrderSettingDao.class</span><br><span class="line">│ │ │ │ PaymentInfoDao.class</span><br><span class="line">│ │ │ │ RefundInfoDao.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─entity</span><br><span class="line">│ │ │ │ OrderEntity.class</span><br><span class="line">│ │ │ │ OrderItemEntity.class</span><br><span class="line">│ │ │ │ OrderOperateHistoryEntity.class</span><br><span class="line">│ │ │ │ OrderReturnApplyEntity.class</span><br><span class="line">│ │ │ │ OrderReturnReasonEntity.class</span><br><span class="line">│ │ │ │ OrderSettingEntity.class</span><br><span class="line">│ │ │ │ PaymentInfoEntity.class</span><br><span class="line">│ │ │ │ RefundInfoEntity.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─service</span><br><span class="line">│ │ │ │ OrderItemService.class</span><br><span class="line">│ │ │ │ OrderOperateHistoryService.class</span><br><span class="line">│ │ │ │ OrderReturnApplyService.class</span><br><span class="line">│ │ │ │ OrderReturnReasonService.class</span><br><span class="line">│ │ │ │ OrderService.class</span><br><span class="line">│ │ │ │ OrderSettingService.class</span><br><span class="line">│ │ │ │ PaymentInfoService.class</span><br><span class="line">│ │ │ │ RefundInfoService.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─impl</span><br><span class="line">│ │ │ OrderItemServiceImpl.class</span><br><span class="line">│ │ │ OrderOperateHistoryServiceImpl.class</span><br><span class="line">│ │ │ OrderReturnApplyServiceImpl.class</span><br><span class="line">│ │ │ OrderReturnReasonServiceImpl.class</span><br><span class="line">│ │ │ OrderServiceImpl.class</span><br><span class="line">│ │ │ OrderSettingServiceImpl.class</span><br><span class="line">│ │ │ PaymentInfoServiceImpl.class</span><br><span class="line">│ │ │ RefundInfoServiceImpl.class</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─mapper</span><br><span class="line">│ │ │ └─order</span><br><span class="line">│ │ │ OrderDao.xml</span><br><span class="line">│ │ │ OrderItemDao.xml</span><br><span class="line">│ │ │ OrderOperateHistoryDao.xml</span><br><span class="line">│ │ │ OrderReturnApplyDao.xml</span><br><span class="line">│ │ │ OrderReturnReasonDao.xml</span><br><span class="line">│ │ │ OrderSettingDao.xml</span><br><span class="line">│ │ │ PaymentInfoDao.xml</span><br><span class="line">│ │ │ RefundInfoDao.xml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─src</span><br><span class="line">│ │ └─views</span><br><span class="line">│ │ └─modules</span><br><span class="line">│ │ └─order</span><br><span class="line">│ │ order-add-or-update.vue</span><br><span class="line">│ │ order.vue</span><br><span class="line">│ │ orderitem-add-or-update.vue</span><br><span class="line">│ │ orderitem.vue</span><br><span class="line">│ │ orderoperatehistory-add-or-update.vue</span><br><span class="line">│ │ orderoperatehistory.vue</span><br><span class="line">│ │ orderreturnapply-add-or-update.vue</span><br><span class="line">│ │ orderreturnapply.vue</span><br><span class="line">│ │ orderreturnreason-add-or-update.vue</span><br><span class="line">│ │ orderreturnreason.vue</span><br><span class="line">│ │ ordersetting-add-or-update.vue</span><br><span class="line">│ │ ordersetting.vue</span><br><span class="line">│ │ paymentinfo-add-or-update.vue</span><br><span class="line">│ │ paymentinfo.vue</span><br><span class="line">│ │ refundinfo-add-or-update.vue</span><br><span class="line">│ │ refundinfo.vue</span><br><span class="line">│ │</span><br><span class="line">│ ├─generated-sources</span><br><span class="line">│ │ └─annotations</span><br><span class="line">│ └─maven-status</span><br><span class="line">│ └─maven-compiler-plugin</span><br><span class="line">│ └─compile</span><br><span class="line">│ └─default-compile</span><br><span class="line">│ createdFiles.lst</span><br><span class="line">│ inputFiles.lst</span><br><span class="line">│</span><br><span class="line">├─gulimall-product</span><br><span class="line">│ │ .gitignore</span><br><span class="line">│ │ gulimall-product.iml</span><br><span class="line">│ │ HELP.md</span><br><span class="line">│ │ mvnw</span><br><span class="line">│ │ mvnw.cmd</span><br><span class="line">│ │ pom.xml</span><br><span class="line">│ │</span><br><span class="line">│ ├─.mvn</span><br><span class="line">│ │ └─wrapper</span><br><span class="line">│ │ maven-wrapper.jar</span><br><span class="line">│ │ maven-wrapper.properties</span><br><span class="line">│ │</span><br><span class="line">│ ├─src</span><br><span class="line">│ │ ├─main</span><br><span class="line">│ │ │ ├─java</span><br><span class="line">│ │ │ │ └─com</span><br><span class="line">│ │ │ │ └─atguigu</span><br><span class="line">│ │ │ │ └─gulimall</span><br><span class="line">│ │ │ │ └─product</span><br><span class="line">│ │ │ │ │ GulimallProductApplication.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ AttrAttrgroupRelationController.java</span><br><span class="line">│ │ │ │ │ AttrController.java</span><br><span class="line">│ │ │ │ │ AttrGroupController.java</span><br><span class="line">│ │ │ │ │ BrandController.java</span><br><span class="line">│ │ │ │ │ CategoryBrandRelationController.java</span><br><span class="line">│ │ │ │ │ CategoryController.java</span><br><span class="line">│ │ │ │ │ CommentReplayController.java</span><br><span class="line">│ │ │ │ │ ProductAttrValueController.java</span><br><span class="line">│ │ │ │ │ SkuImagesController.java</span><br><span class="line">│ │ │ │ │ SkuInfoController.java</span><br><span class="line">│ │ │ │ │ SkuSaleAttrValueController.java</span><br><span class="line">│ │ │ │ │ SpuCommentController.java</span><br><span class="line">│ │ │ │ │ SpuImagesController.java</span><br><span class="line">│ │ │ │ │ SpuInfoController.java</span><br><span class="line">│ │ │ │ │ SpuInfoDescController.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ AttrAttrgroupRelationDao.java</span><br><span class="line">│ │ │ │ │ AttrDao.java</span><br><span class="line">│ │ │ │ │ AttrGroupDao.java</span><br><span class="line">│ │ │ │ │ BrandDao.java</span><br><span class="line">│ │ │ │ │ CategoryBrandRelationDao.java</span><br><span class="line">│ │ │ │ │ CategoryDao.java</span><br><span class="line">│ │ │ │ │ CommentReplayDao.java</span><br><span class="line">│ │ │ │ │ ProductAttrValueDao.java</span><br><span class="line">│ │ │ │ │ SkuImagesDao.java</span><br><span class="line">│ │ │ │ │ SkuInfoDao.java</span><br><span class="line">│ │ │ │ │ SkuSaleAttrValueDao.java</span><br><span class="line">│ │ │ │ │ SpuCommentDao.java</span><br><span class="line">│ │ │ │ │ SpuImagesDao.java</span><br><span class="line">│ │ │ │ │ SpuInfoDao.java</span><br><span class="line">│ │ │ │ │ SpuInfoDescDao.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ AttrAttrgroupRelationEntity.java</span><br><span class="line">│ │ │ │ │ AttrEntity.java</span><br><span class="line">│ │ │ │ │ AttrGroupEntity.java</span><br><span class="line">│ │ │ │ │ BrandEntity.java</span><br><span class="line">│ │ │ │ │ CategoryBrandRelationEntity.java</span><br><span class="line">│ │ │ │ │ CategoryEntity.java</span><br><span class="line">│ │ │ │ │ CommentReplayEntity.java</span><br><span class="line">│ │ │ │ │ ProductAttrValueEntity.java</span><br><span class="line">│ │ │ │ │ SkuImagesEntity.java</span><br><span class="line">│ │ │ │ │ SkuInfoEntity.java</span><br><span class="line">│ │ │ │ │ SkuSaleAttrValueEntity.java</span><br><span class="line">│ │ │ │ │ SpuCommentEntity.java</span><br><span class="line">│ │ │ │ │ SpuImagesEntity.java</span><br><span class="line">│ │ │ │ │ SpuInfoDescEntity.java</span><br><span class="line">│ │ │ │ │ SpuInfoEntity.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─service</span><br><span class="line">│ │ │ │ │ AttrAttrgroupRelationService.java</span><br><span class="line">│ │ │ │ │ AttrGroupService.java</span><br><span class="line">│ │ │ │ │ AttrService.java</span><br><span class="line">│ │ │ │ │ BrandService.java</span><br><span class="line">│ │ │ │ │ CategoryBrandRelationService.java</span><br><span class="line">│ │ │ │ │ CategoryService.java</span><br><span class="line">│ │ │ │ │ CommentReplayService.java</span><br><span class="line">│ │ │ │ │ ProductAttrValueService.java</span><br><span class="line">│ │ │ │ │ SkuImagesService.java</span><br><span class="line">│ │ │ │ │ SkuInfoService.java</span><br><span class="line">│ │ │ │ │ SkuSaleAttrValueService.java</span><br><span class="line">│ │ │ │ │ SpuCommentService.java</span><br><span class="line">│ │ │ │ │ SpuImagesService.java</span><br><span class="line">│ │ │ │ │ SpuInfoDescService.java</span><br><span class="line">│ │ │ │ │ SpuInfoService.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─impl</span><br><span class="line">│ │ │ │ AttrAttrgroupRelationServiceImpl.java</span><br><span class="line">│ │ │ │ AttrGroupServiceImpl.java</span><br><span class="line">│ │ │ │ AttrServiceImpl.java</span><br><span class="line">│ │ │ │ BrandServiceImpl.java</span><br><span class="line">│ │ │ │ CategoryBrandRelationServiceImpl.java</span><br><span class="line">│ │ │ │ CategoryServiceImpl.java</span><br><span class="line">│ │ │ │ CommentReplayServiceImpl.java</span><br><span class="line">│ │ │ │ ProductAttrValueServiceImpl.java</span><br><span class="line">│ │ │ │ SkuImagesServiceImpl.java</span><br><span class="line">│ │ │ │ SkuInfoServiceImpl.java</span><br><span class="line">│ │ │ │ SkuSaleAttrValueServiceImpl.java</span><br><span class="line">│ │ │ │ SpuCommentServiceImpl.java</span><br><span class="line">│ │ │ │ SpuImagesServiceImpl.java</span><br><span class="line">│ │ │ │ SpuInfoDescServiceImpl.java</span><br><span class="line">│ │ │ │ SpuInfoServiceImpl.java</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─resources</span><br><span class="line">│ │ │ │ application.properties</span><br><span class="line">│ │ │ │ application.yml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─mapper</span><br><span class="line">│ │ │ │ └─product</span><br><span class="line">│ │ │ │ AttrAttrgroupRelationDao.xml</span><br><span class="line">│ │ │ │ AttrDao.xml</span><br><span class="line">│ │ │ │ AttrGroupDao.xml</span><br><span class="line">│ │ │ │ BrandDao.xml</span><br><span class="line">│ │ │ │ CategoryBrandRelationDao.xml</span><br><span class="line">│ │ │ │ CategoryDao.xml</span><br><span class="line">│ │ │ │ CommentReplayDao.xml</span><br><span class="line">│ │ │ │ ProductAttrValueDao.xml</span><br><span class="line">│ │ │ │ SkuImagesDao.xml</span><br><span class="line">│ │ │ │ SkuInfoDao.xml</span><br><span class="line">│ │ │ │ SkuSaleAttrValueDao.xml</span><br><span class="line">│ │ │ │ SpuCommentDao.xml</span><br><span class="line">│ │ │ │ SpuImagesDao.xml</span><br><span class="line">│ │ │ │ SpuInfoDao.xml</span><br><span class="line">│ │ │ │ SpuInfoDescDao.xml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─src</span><br><span class="line">│ │ │ │ └─views</span><br><span class="line">│ │ │ │ └─modules</span><br><span class="line">│ │ │ │ └─product</span><br><span class="line">│ │ │ │ attr-add-or-update.vue</span><br><span class="line">│ │ │ │ attr.vue</span><br><span class="line">│ │ │ │ attrattrgrouprelation-add-or-update.vue</span><br><span class="line">│ │ │ │ attrattrgrouprelation.vue</span><br><span class="line">│ │ │ │ attrgroup-add-or-update.vue</span><br><span class="line">│ │ │ │ attrgroup.vue</span><br><span class="line">│ │ │ │ brand-add-or-update.vue</span><br><span class="line">│ │ │ │ brand.vue</span><br><span class="line">│ │ │ │ category-add-or-update.vue</span><br><span class="line">│ │ │ │ category.vue</span><br><span class="line">│ │ │ │ categorybrandrelation-add-or-update.vue</span><br><span class="line">│ │ │ │ categorybrandrelation.vue</span><br><span class="line">│ │ │ │ commentreplay-add-or-update.vue</span><br><span class="line">│ │ │ │ commentreplay.vue</span><br><span class="line">│ │ │ │ productattrvalue-add-or-update.vue</span><br><span class="line">│ │ │ │ productattrvalue.vue</span><br><span class="line">│ │ │ │ skuimages-add-or-update.vue</span><br><span class="line">│ │ │ │ skuimages.vue</span><br><span class="line">│ │ │ │ skuinfo-add-or-update.vue</span><br><span class="line">│ │ │ │ skuinfo.vue</span><br><span class="line">│ │ │ │ skusaleattrvalue-add-or-update.vue</span><br><span class="line">│ │ │ │ skusaleattrvalue.vue</span><br><span class="line">│ │ │ │ spucomment-add-or-update.vue</span><br><span class="line">│ │ │ │ spucomment.vue</span><br><span class="line">│ │ │ │ spuimages-add-or-update.vue</span><br><span class="line">│ │ │ │ spuimages.vue</span><br><span class="line">│ │ │ │ spuinfo-add-or-update.vue</span><br><span class="line">│ │ │ │ spuinfo.vue</span><br><span class="line">│ │ │ │ spuinfodesc-add-or-update.vue</span><br><span class="line">│ │ │ │ spuinfodesc.vue</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─static</span><br><span class="line">│ │ │ └─templates</span><br><span class="line">│ │ └─test</span><br><span class="line">│ │ └─java</span><br><span class="line">│ │ └─com</span><br><span class="line">│ │ └─atguigu</span><br><span class="line">│ │ └─gulimall</span><br><span class="line">│ │ └─product</span><br><span class="line">│ │ GulimallProductApplicationTests.java</span><br><span class="line">│ │</span><br><span class="line">│ └─target</span><br><span class="line">│ ├─classes</span><br><span class="line">│ │ │ application.properties</span><br><span class="line">│ │ │ application.yml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─com</span><br><span class="line">│ │ │ └─atguigu</span><br><span class="line">│ │ │ └─gulimall</span><br><span class="line">│ │ │ └─product</span><br><span class="line">│ │ │ │ GulimallProductApplication.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─controller</span><br><span class="line">│ │ │ │ AttrAttrgroupRelationController.class</span><br><span class="line">│ │ │ │ AttrController.class</span><br><span class="line">│ │ │ │ AttrGroupController.class</span><br><span class="line">│ │ │ │ BrandController.class</span><br><span class="line">│ │ │ │ CategoryBrandRelationController.class</span><br><span class="line">│ │ │ │ CategoryController.class</span><br><span class="line">│ │ │ │ CommentReplayController.class</span><br><span class="line">│ │ │ │ ProductAttrValueController.class</span><br><span class="line">│ │ │ │ SkuImagesController.class</span><br><span class="line">│ │ │ │ SkuInfoController.class</span><br><span class="line">│ │ │ │ SkuSaleAttrValueController.class</span><br><span class="line">│ │ │ │ SpuCommentController.class</span><br><span class="line">│ │ │ │ SpuImagesController.class</span><br><span class="line">│ │ │ │ SpuInfoController.class</span><br><span class="line">│ │ │ │ SpuInfoDescController.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─dao</span><br><span class="line">│ │ │ │ AttrAttrgroupRelationDao.class</span><br><span class="line">│ │ │ │ AttrDao.class</span><br><span class="line">│ │ │ │ AttrGroupDao.class</span><br><span class="line">│ │ │ │ BrandDao.class</span><br><span class="line">│ │ │ │ CategoryBrandRelationDao.class</span><br><span class="line">│ │ │ │ CategoryDao.class</span><br><span class="line">│ │ │ │ CommentReplayDao.class</span><br><span class="line">│ │ │ │ ProductAttrValueDao.class</span><br><span class="line">│ │ │ │ SkuImagesDao.class</span><br><span class="line">│ │ │ │ SkuInfoDao.class</span><br><span class="line">│ │ │ │ SkuSaleAttrValueDao.class</span><br><span class="line">│ │ │ │ SpuCommentDao.class</span><br><span class="line">│ │ │ │ SpuImagesDao.class</span><br><span class="line">│ │ │ │ SpuInfoDao.class</span><br><span class="line">│ │ │ │ SpuInfoDescDao.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─entity</span><br><span class="line">│ │ │ │ AttrAttrgroupRelationEntity.class</span><br><span class="line">│ │ │ │ AttrEntity.class</span><br><span class="line">│ │ │ │ AttrGroupEntity.class</span><br><span class="line">│ │ │ │ BrandEntity.class</span><br><span class="line">│ │ │ │ CategoryBrandRelationEntity.class</span><br><span class="line">│ │ │ │ CategoryEntity.class</span><br><span class="line">│ │ │ │ CommentReplayEntity.class</span><br><span class="line">│ │ │ │ ProductAttrValueEntity.class</span><br><span class="line">│ │ │ │ SkuImagesEntity.class</span><br><span class="line">│ │ │ │ SkuInfoEntity.class</span><br><span class="line">│ │ │ │ SkuSaleAttrValueEntity.class</span><br><span class="line">│ │ │ │ SpuCommentEntity.class</span><br><span class="line">│ │ │ │ SpuImagesEntity.class</span><br><span class="line">│ │ │ │ SpuInfoDescEntity.class</span><br><span class="line">│ │ │ │ SpuInfoEntity.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─service</span><br><span class="line">│ │ │ │ AttrAttrgroupRelationService.class</span><br><span class="line">│ │ │ │ AttrGroupService.class</span><br><span class="line">│ │ │ │ AttrService.class</span><br><span class="line">│ │ │ │ BrandService.class</span><br><span class="line">│ │ │ │ CategoryBrandRelationService.class</span><br><span class="line">│ │ │ │ CategoryService.class</span><br><span class="line">│ │ │ │ CommentReplayService.class</span><br><span class="line">│ │ │ │ ProductAttrValueService.class</span><br><span class="line">│ │ │ │ SkuImagesService.class</span><br><span class="line">│ │ │ │ SkuInfoService.class</span><br><span class="line">│ │ │ │ SkuSaleAttrValueService.class</span><br><span class="line">│ │ │ │ SpuCommentService.class</span><br><span class="line">│ │ │ │ SpuImagesService.class</span><br><span class="line">│ │ │ │ SpuInfoDescService.class</span><br><span class="line">│ │ │ │ SpuInfoService.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─impl</span><br><span class="line">│ │ │ AttrAttrgroupRelationServiceImpl.class</span><br><span class="line">│ │ │ AttrGroupServiceImpl.class</span><br><span class="line">│ │ │ AttrServiceImpl.class</span><br><span class="line">│ │ │ BrandServiceImpl.class</span><br><span class="line">│ │ │ CategoryBrandRelationServiceImpl.class</span><br><span class="line">│ │ │ CategoryServiceImpl.class</span><br><span class="line">│ │ │ CommentReplayServiceImpl.class</span><br><span class="line">│ │ │ ProductAttrValueServiceImpl.class</span><br><span class="line">│ │ │ SkuImagesServiceImpl.class</span><br><span class="line">│ │ │ SkuInfoServiceImpl.class</span><br><span class="line">│ │ │ SkuSaleAttrValueServiceImpl.class</span><br><span class="line">│ │ │ SpuCommentServiceImpl.class</span><br><span class="line">│ │ │ SpuImagesServiceImpl.class</span><br><span class="line">│ │ │ SpuInfoDescServiceImpl.class</span><br><span class="line">│ │ │ SpuInfoServiceImpl.class</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─mapper</span><br><span class="line">│ │ │ └─product</span><br><span class="line">│ │ │ AttrAttrgroupRelationDao.xml</span><br><span class="line">│ │ │ AttrDao.xml</span><br><span class="line">│ │ │ AttrGroupDao.xml</span><br><span class="line">│ │ │ BrandDao.xml</span><br><span class="line">│ │ │ CategoryBrandRelationDao.xml</span><br><span class="line">│ │ │ CategoryDao.xml</span><br><span class="line">│ │ │ CommentReplayDao.xml</span><br><span class="line">│ │ │ ProductAttrValueDao.xml</span><br><span class="line">│ │ │ SkuImagesDao.xml</span><br><span class="line">│ │ │ SkuInfoDao.xml</span><br><span class="line">│ │ │ SkuSaleAttrValueDao.xml</span><br><span class="line">│ │ │ SpuCommentDao.xml</span><br><span class="line">│ │ │ SpuImagesDao.xml</span><br><span class="line">│ │ │ SpuInfoDao.xml</span><br><span class="line">│ │ │ SpuInfoDescDao.xml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─src</span><br><span class="line">│ │ └─views</span><br><span class="line">│ │ └─modules</span><br><span class="line">│ │ └─product</span><br><span class="line">│ │ attr-add-or-update.vue</span><br><span class="line">│ │ attr.vue</span><br><span class="line">│ │ attrattrgrouprelation-add-or-update.vue</span><br><span class="line">│ │ attrattrgrouprelation.vue</span><br><span class="line">│ │ attrgroup-add-or-update.vue</span><br><span class="line">│ │ attrgroup.vue</span><br><span class="line">│ │ brand-add-or-update.vue</span><br><span class="line">│ │ brand.vue</span><br><span class="line">│ │ category-add-or-update.vue</span><br><span class="line">│ │ category.vue</span><br><span class="line">│ │ categorybrandrelation-add-or-update.vue</span><br><span class="line">│ │ categorybrandrelation.vue</span><br><span class="line">│ │ commentreplay-add-or-update.vue</span><br><span class="line">│ │ commentreplay.vue</span><br><span class="line">│ │ productattrvalue-add-or-update.vue</span><br><span class="line">│ │ productattrvalue.vue</span><br><span class="line">│ │ skuimages-add-or-update.vue</span><br><span class="line">│ │ skuimages.vue</span><br><span class="line">│ │ skuinfo-add-or-update.vue</span><br><span class="line">│ │ skuinfo.vue</span><br><span class="line">│ │ skusaleattrvalue-add-or-update.vue</span><br><span class="line">│ │ skusaleattrvalue.vue</span><br><span class="line">│ │ spucomment-add-or-update.vue</span><br><span class="line">│ │ spucomment.vue</span><br><span class="line">│ │ spuimages-add-or-update.vue</span><br><span class="line">│ │ spuimages.vue</span><br><span class="line">│ │ spuinfo-add-or-update.vue</span><br><span class="line">│ │ spuinfo.vue</span><br><span class="line">│ │ spuinfodesc-add-or-update.vue</span><br><span class="line">│ │ spuinfodesc.vue</span><br><span class="line">│ │</span><br><span class="line">│ ├─generated-sources</span><br><span class="line">│ │ └─annotations</span><br><span class="line">│ ├─generated-test-sources</span><br><span class="line">│ │ └─test-annotations</span><br><span class="line">│ ├─maven-status</span><br><span class="line">│ │ └─maven-compiler-plugin</span><br><span class="line">│ │ └─compile</span><br><span class="line">│ │ └─default-compile</span><br><span class="line">│ │ createdFiles.lst</span><br><span class="line">│ │ inputFiles.lst</span><br><span class="line">│ │</span><br><span class="line">│ └─test-classes</span><br><span class="line">│ └─com</span><br><span class="line">│ └─atguigu</span><br><span class="line">│ └─gulimall</span><br><span class="line">│ └─product</span><br><span class="line">│ GulimallProductApplicationTests.class</span><br><span class="line">│</span><br><span class="line">├─gulimall-ware</span><br><span class="line">│ │ .gitignore</span><br><span class="line">│ │ gulimall-ware.iml</span><br><span class="line">│ │ HELP.md</span><br><span class="line">│ │ mvnw</span><br><span class="line">│ │ mvnw.cmd</span><br><span class="line">│ │ pom.xml</span><br><span class="line">│ │</span><br><span class="line">│ ├─.mvn</span><br><span class="line">│ │ └─wrapper</span><br><span class="line">│ │ maven-wrapper.jar</span><br><span class="line">│ │ maven-wrapper.properties</span><br><span class="line">│ │</span><br><span class="line">│ ├─src</span><br><span class="line">│ │ ├─main</span><br><span class="line">│ │ │ ├─java</span><br><span class="line">│ │ │ │ └─com</span><br><span class="line">│ │ │ │ └─atguigu</span><br><span class="line">│ │ │ │ └─gulimall</span><br><span class="line">│ │ │ │ └─ware</span><br><span class="line">│ │ │ │ │ GulimallWareApplication.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ WareInfoController.java</span><br><span class="line">│ │ │ │ │ WareOrderTaskController.java</span><br><span class="line">│ │ │ │ │ WareOrderTaskDetailController.java</span><br><span class="line">│ │ │ │ │ WareSkuController.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ WareInfoDao.java</span><br><span class="line">│ │ │ │ │ WareOrderTaskDao.java</span><br><span class="line">│ │ │ │ │ WareOrderTaskDetailDao.java</span><br><span class="line">│ │ │ │ │ WareSkuDao.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ WareInfoEntity.java</span><br><span class="line">│ │ │ │ │ WareOrderTaskDetailEntity.java</span><br><span class="line">│ │ │ │ │ WareOrderTaskEntity.java</span><br><span class="line">│ │ │ │ │ WareSkuEntity.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─service</span><br><span class="line">│ │ │ │ │ WareInfoService.java</span><br><span class="line">│ │ │ │ │ WareOrderTaskDetailService.java</span><br><span class="line">│ │ │ │ │ WareOrderTaskService.java</span><br><span class="line">│ │ │ │ │ WareSkuService.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─impl</span><br><span class="line">│ │ │ │ WareInfoServiceImpl.java</span><br><span class="line">│ │ │ │ WareOrderTaskDetailServiceImpl.java</span><br><span class="line">│ │ │ │ WareOrderTaskServiceImpl.java</span><br><span class="line">│ │ │ │ WareSkuServiceImpl.java</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─resources</span><br><span class="line">│ │ │ │ application.yml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─mapper</span><br><span class="line">│ │ │ │ └─ware</span><br><span class="line">│ │ │ │ WareInfoDao.xml</span><br><span class="line">│ │ │ │ WareOrderTaskDao.xml</span><br><span class="line">│ │ │ │ WareOrderTaskDetailDao.xml</span><br><span class="line">│ │ │ │ WareSkuDao.xml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─src</span><br><span class="line">│ │ │ └─views</span><br><span class="line">│ │ │ └─modules</span><br><span class="line">│ │ │ └─ware</span><br><span class="line">│ │ │ wareinfo-add-or-update.vue</span><br><span class="line">│ │ │ wareinfo.vue</span><br><span class="line">│ │ │ wareordertask-add-or-update.vue</span><br><span class="line">│ │ │ wareordertask.vue</span><br><span class="line">│ │ │ wareordertaskdetail-add-or-update.vue</span><br><span class="line">│ │ │ wareordertaskdetail.vue</span><br><span class="line">│ │ │ waresku-add-or-update.vue</span><br><span class="line">│ │ │ waresku.vue</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─test</span><br><span class="line">│ │ └─java</span><br><span class="line">│ │ └─com</span><br><span class="line">│ │ └─atguigu</span><br><span class="line">│ │ └─gulimall</span><br><span class="line">│ │ └─gulimallware</span><br><span class="line">│ │ GulimallWareApplicationTests.java</span><br><span class="line">│ │</span><br><span class="line">│ └─target</span><br><span class="line">│ ├─classes</span><br><span class="line">│ │ │ application.yml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─com</span><br><span class="line">│ │ │ └─atguigu</span><br><span class="line">│ │ │ └─gulimall</span><br><span class="line">│ │ │ ├─gulimallware</span><br><span class="line">│ │ │ │ GulimallWareApplication.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─ware</span><br><span class="line">│ │ │ │ GulimallWareApplication.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─controller</span><br><span class="line">│ │ │ │ WareInfoController.class</span><br><span class="line">│ │ │ │ WareOrderTaskController.class</span><br><span class="line">│ │ │ │ WareOrderTaskDetailController.class</span><br><span class="line">│ │ │ │ WareSkuController.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─dao</span><br><span class="line">│ │ │ │ WareInfoDao.class</span><br><span class="line">│ │ │ │ WareOrderTaskDao.class</span><br><span class="line">│ │ │ │ WareOrderTaskDetailDao.class</span><br><span class="line">│ │ │ │ WareSkuDao.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─entity</span><br><span class="line">│ │ │ │ WareInfoEntity.class</span><br><span class="line">│ │ │ │ WareOrderTaskDetailEntity.class</span><br><span class="line">│ │ │ │ WareOrderTaskEntity.class</span><br><span class="line">│ │ │ │ WareSkuEntity.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─service</span><br><span class="line">│ │ │ │ WareInfoService.class</span><br><span class="line">│ │ │ │ WareOrderTaskDetailService.class</span><br><span class="line">│ │ │ │ WareOrderTaskService.class</span><br><span class="line">│ │ │ │ WareSkuService.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─impl</span><br><span class="line">│ │ │ WareInfoServiceImpl.class</span><br><span class="line">│ │ │ WareOrderTaskDetailServiceImpl.class</span><br><span class="line">│ │ │ WareOrderTaskServiceImpl.class</span><br><span class="line">│ │ │ WareSkuServiceImpl.class</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─mapper</span><br><span class="line">│ │ │ └─ware</span><br><span class="line">│ │ │ WareInfoDao.xml</span><br><span class="line">│ │ │ WareOrderTaskDao.xml</span><br><span class="line">│ │ │ WareOrderTaskDetailDao.xml</span><br><span class="line">│ │ │ WareSkuDao.xml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─src</span><br><span class="line">│ │ └─views</span><br><span class="line">│ │ └─modules</span><br><span class="line">│ │ └─ware</span><br><span class="line">│ │ wareinfo-add-or-update.vue</span><br><span class="line">│ │ wareinfo.vue</span><br><span class="line">│ │ wareordertask-add-or-update.vue</span><br><span class="line">│ │ wareordertask.vue</span><br><span class="line">│ │ wareordertaskdetail-add-or-update.vue</span><br><span class="line">│ │ wareordertaskdetail.vue</span><br><span class="line">│ │ waresku-add-or-update.vue</span><br><span class="line">│ │ waresku.vue</span><br><span class="line">│ │</span><br><span class="line">│ ├─generated-sources</span><br><span class="line">│ │ └─annotations</span><br><span class="line">│ ├─generated-test-sources</span><br><span class="line">│ │ └─test-annotations</span><br><span class="line">│ ├─maven-status</span><br><span class="line">│ │ └─maven-compiler-plugin</span><br><span class="line">│ │ └─compile</span><br><span class="line">│ │ └─default-compile</span><br><span class="line">│ │ createdFiles.lst</span><br><span class="line">│ │ inputFiles.lst</span><br><span class="line">│ │</span><br><span class="line">│ └─test-classes</span><br><span class="line">│ └─com</span><br><span class="line">│ └─atguigu</span><br><span class="line">│ └─gulimall</span><br><span class="line">│ └─gulimallware</span><br><span class="line">│ GulimallWareApplicationTests.class</span><br><span class="line">│</span><br><span class="line">├─renren-fast</span><br><span class="line">│ │ .gitignore</span><br><span class="line">│ │ docker-compose.yml</span><br><span class="line">│ │ Dockerfile</span><br><span class="line">│ │ LICENSE</span><br><span class="line">│ │ pom.xml</span><br><span class="line">│ │ README.md</span><br><span class="line">│ │ renren-fast.iml</span><br><span class="line">│ │</span><br><span class="line">│ ├─db</span><br><span class="line">│ │ mysql.sql</span><br><span class="line">│ │ oracle.sql</span><br><span class="line">│ │ postgresql.sql</span><br><span class="line">│ │ sqlserver.sql</span><br><span class="line">│ │</span><br><span class="line">│ ├─src</span><br><span class="line">│ │ ├─main</span><br><span class="line">│ │ │ ├─java</span><br><span class="line">│ │ │ │ └─io</span><br><span class="line">│ │ │ │ └─renren</span><br><span class="line">│ │ │ │ │ RenrenApplication.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─common</span><br><span class="line">│ │ │ │ │ ├─annotation</span><br><span class="line">│ │ │ │ │ │ SysLog.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─aspect</span><br><span class="line">│ │ │ │ │ │ RedisAspect.java</span><br><span class="line">│ │ │ │ │ │ SysLogAspect.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─exception</span><br><span class="line">│ │ │ │ │ │ RRException.java</span><br><span class="line">│ │ │ │ │ │ RRExceptionHandler.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─utils</span><br><span class="line">│ │ │ │ │ │ ConfigConstant.java</span><br><span class="line">│ │ │ │ │ │ Constant.java</span><br><span class="line">│ │ │ │ │ │ DateUtils.java</span><br><span class="line">│ │ │ │ │ │ HttpContextUtils.java</span><br><span class="line">│ │ │ │ │ │ IPUtils.java</span><br><span class="line">│ │ │ │ │ │ MapUtils.java</span><br><span class="line">│ │ │ │ │ │ PageUtils.java</span><br><span class="line">│ │ │ │ │ │ Query.java</span><br><span class="line">│ │ │ │ │ │ R.java</span><br><span class="line">│ │ │ │ │ │ RedisKeys.java</span><br><span class="line">│ │ │ │ │ │ RedisUtils.java</span><br><span class="line">│ │ │ │ │ │ ShiroUtils.java</span><br><span class="line">│ │ │ │ │ │ SpringContextUtils.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─validator</span><br><span class="line">│ │ │ │ │ │ │ Assert.java</span><br><span class="line">│ │ │ │ │ │ │ ValidatorUtils.java</span><br><span class="line">│ │ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ │ └─group</span><br><span class="line">│ │ │ │ │ │ AddGroup.java</span><br><span class="line">│ │ │ │ │ │ AliyunGroup.java</span><br><span class="line">│ │ │ │ │ │ Group.java</span><br><span class="line">│ │ │ │ │ │ QcloudGroup.java</span><br><span class="line">│ │ │ │ │ │ QiniuGroup.java</span><br><span class="line">│ │ │ │ │ │ UpdateGroup.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ └─xss</span><br><span class="line">│ │ │ │ │ HTMLFilter.java</span><br><span class="line">│ │ │ │ │ SQLFilter.java</span><br><span class="line">│ │ │ │ │ XssFilter.java</span><br><span class="line">│ │ │ │ │ XssHttpServletRequestWrapper.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─config</span><br><span class="line">│ │ │ │ │ CorsConfig.java</span><br><span class="line">│ │ │ │ │ FilterConfig.java</span><br><span class="line">│ │ │ │ │ KaptchaConfig.java</span><br><span class="line">│ │ │ │ │ MybatisPlusConfig.java</span><br><span class="line">│ │ │ │ │ RedisConfig.java</span><br><span class="line">│ │ │ │ │ ShiroConfig.java</span><br><span class="line">│ │ │ │ │ SwaggerConfig.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─datasource</span><br><span class="line">│ │ │ │ │ ├─annotation</span><br><span class="line">│ │ │ │ │ │ DataSource.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─aspect</span><br><span class="line">│ │ │ │ │ │ DataSourceAspect.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─config</span><br><span class="line">│ │ │ │ │ │ DynamicContextHolder.java</span><br><span class="line">│ │ │ │ │ │ DynamicDataSource.java</span><br><span class="line">│ │ │ │ │ │ DynamicDataSourceConfig.java</span><br><span class="line">│ │ │ │ │ │ DynamicDataSourceFactory.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ └─properties</span><br><span class="line">│ │ │ │ │ DataSourceProperties.java</span><br><span class="line">│ │ │ │ │ DynamicDataSourceProperties.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─modules</span><br><span class="line">│ │ │ │ ├─app</span><br><span class="line">│ │ │ │ │ ├─annotation</span><br><span class="line">│ │ │ │ │ │ Login.java</span><br><span class="line">│ │ │ │ │ │ LoginUser.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─config</span><br><span class="line">│ │ │ │ │ │ WebMvcConfig.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ │ AppLoginController.java</span><br><span class="line">│ │ │ │ │ │ AppRegisterController.java</span><br><span class="line">│ │ │ │ │ │ AppTestController.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ │ UserDao.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ │ UserEntity.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─form</span><br><span class="line">│ │ │ │ │ │ LoginForm.java</span><br><span class="line">│ │ │ │ │ │ RegisterForm.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─interceptor</span><br><span class="line">│ │ │ │ │ │ AuthorizationInterceptor.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─resolver</span><br><span class="line">│ │ │ │ │ │ LoginUserHandlerMethodArgumentResolver.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─service</span><br><span class="line">│ │ │ │ │ │ │ UserService.java</span><br><span class="line">│ │ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ │ └─impl</span><br><span class="line">│ │ │ │ │ │ UserServiceImpl.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ └─utils</span><br><span class="line">│ │ │ │ │ JwtUtils.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─job</span><br><span class="line">│ │ │ │ │ ├─config</span><br><span class="line">│ │ │ │ │ │ ScheduleConfig.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ │ ScheduleJobController.java</span><br><span class="line">│ │ │ │ │ │ ScheduleJobLogController.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ │ ScheduleJobDao.java</span><br><span class="line">│ │ │ │ │ │ ScheduleJobLogDao.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ │ ScheduleJobEntity.java</span><br><span class="line">│ │ │ │ │ │ ScheduleJobLogEntity.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─service</span><br><span class="line">│ │ │ │ │ │ │ ScheduleJobLogService.java</span><br><span class="line">│ │ │ │ │ │ │ ScheduleJobService.java</span><br><span class="line">│ │ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ │ └─impl</span><br><span class="line">│ │ │ │ │ │ ScheduleJobLogServiceImpl.java</span><br><span class="line">│ │ │ │ │ │ ScheduleJobServiceImpl.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─task</span><br><span class="line">│ │ │ │ │ │ ITask.java</span><br><span class="line">│ │ │ │ │ │ TestTask.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ └─utils</span><br><span class="line">│ │ │ │ │ ScheduleJob.java</span><br><span class="line">│ │ │ │ │ ScheduleUtils.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─oss</span><br><span class="line">│ │ │ │ │ ├─cloud</span><br><span class="line">│ │ │ │ │ │ AliyunCloudStorageService.java</span><br><span class="line">│ │ │ │ │ │ CloudStorageConfig.java</span><br><span class="line">│ │ │ │ │ │ CloudStorageService.java</span><br><span class="line">│ │ │ │ │ │ OSSFactory.java</span><br><span class="line">│ │ │ │ │ │ QcloudCloudStorageService.java</span><br><span class="line">│ │ │ │ │ │ QiniuCloudStorageService.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ │ SysOssController.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ │ SysOssDao.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ │ SysOssEntity.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ └─service</span><br><span class="line">│ │ │ │ │ │ SysOssService.java</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ └─impl</span><br><span class="line">│ │ │ │ │ SysOssServiceImpl.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─sys</span><br><span class="line">│ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ AbstractController.java</span><br><span class="line">│ │ │ │ │ SysConfigController.java</span><br><span class="line">│ │ │ │ │ SysLogController.java</span><br><span class="line">│ │ │ │ │ SysLoginController.java</span><br><span class="line">│ │ │ │ │ SysMenuController.java</span><br><span class="line">│ │ │ │ │ SysRoleController.java</span><br><span class="line">│ │ │ │ │ SysUserController.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ SysCaptchaDao.java</span><br><span class="line">│ │ │ │ │ SysConfigDao.java</span><br><span class="line">│ │ │ │ │ SysLogDao.java</span><br><span class="line">│ │ │ │ │ SysMenuDao.java</span><br><span class="line">│ │ │ │ │ SysRoleDao.java</span><br><span class="line">│ │ │ │ │ SysRoleMenuDao.java</span><br><span class="line">│ │ │ │ │ SysUserDao.java</span><br><span class="line">│ │ │ │ │ SysUserRoleDao.java</span><br><span class="line">│ │ │ │ │ SysUserTokenDao.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ SysCaptchaEntity.java</span><br><span class="line">│ │ │ │ │ SysConfigEntity.java</span><br><span class="line">│ │ │ │ │ SysLogEntity.java</span><br><span class="line">│ │ │ │ │ SysMenuEntity.java</span><br><span class="line">│ │ │ │ │ SysRoleEntity.java</span><br><span class="line">│ │ │ │ │ SysRoleMenuEntity.java</span><br><span class="line">│ │ │ │ │ SysUserEntity.java</span><br><span class="line">│ │ │ │ │ SysUserRoleEntity.java</span><br><span class="line">│ │ │ │ │ SysUserTokenEntity.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─form</span><br><span class="line">│ │ │ │ │ PasswordForm.java</span><br><span class="line">│ │ │ │ │ SysLoginForm.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─oauth2</span><br><span class="line">│ │ │ │ │ OAuth2Filter.java</span><br><span class="line">│ │ │ │ │ OAuth2Realm.java</span><br><span class="line">│ │ │ │ │ OAuth2Token.java</span><br><span class="line">│ │ │ │ │ TokenGenerator.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─redis</span><br><span class="line">│ │ │ │ │ SysConfigRedis.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─service</span><br><span class="line">│ │ │ │ │ ShiroService.java</span><br><span class="line">│ │ │ │ │ SysCaptchaService.java</span><br><span class="line">│ │ │ │ │ SysConfigService.java</span><br><span class="line">│ │ │ │ │ SysLogService.java</span><br><span class="line">│ │ │ │ │ SysMenuService.java</span><br><span class="line">│ │ │ │ │ SysRoleMenuService.java</span><br><span class="line">│ │ │ │ │ SysRoleService.java</span><br><span class="line">│ │ │ │ │ SysUserRoleService.java</span><br><span class="line">│ │ │ │ │ SysUserService.java</span><br><span class="line">│ │ │ │ │ SysUserTokenService.java</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─impl</span><br><span class="line">│ │ │ │ ShiroServiceImpl.java</span><br><span class="line">│ │ │ │ SysCaptchaServiceImpl.java</span><br><span class="line">│ │ │ │ SysConfigServiceImpl.java</span><br><span class="line">│ │ │ │ SysLogServiceImpl.java</span><br><span class="line">│ │ │ │ SysMenuServiceImpl.java</span><br><span class="line">│ │ │ │ SysRoleMenuServiceImpl.java</span><br><span class="line">│ │ │ │ SysRoleServiceImpl.java</span><br><span class="line">│ │ │ │ SysUserRoleServiceImpl.java</span><br><span class="line">│ │ │ │ SysUserServiceImpl.java</span><br><span class="line">│ │ │ │ SysUserTokenServiceImpl.java</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─resources</span><br><span class="line">│ │ │ │ application-dev.yml</span><br><span class="line">│ │ │ │ application-prod.yml</span><br><span class="line">│ │ │ │ application-test.yml</span><br><span class="line">│ │ │ │ application.yml</span><br><span class="line">│ │ │ │ banner.txt</span><br><span class="line">│ │ │ │ logback-spring.xml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─mapper</span><br><span class="line">│ │ │ │ ├─app</span><br><span class="line">│ │ │ │ │ UserDao.xml</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─job</span><br><span class="line">│ │ │ │ │ ScheduleJobDao.xml</span><br><span class="line">│ │ │ │ │ ScheduleJobLogDao.xml</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─oss</span><br><span class="line">│ │ │ │ │ SysOssDao.xml</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─sys</span><br><span class="line">│ │ │ │ SysConfigDao.xml</span><br><span class="line">│ │ │ │ SysLogDao.xml</span><br><span class="line">│ │ │ │ SysMenuDao.xml</span><br><span class="line">│ │ │ │ SysRoleDao.xml</span><br><span class="line">│ │ │ │ SysRoleMenuDao.xml</span><br><span class="line">│ │ │ │ SysUserDao.xml</span><br><span class="line">│ │ │ │ SysUserRoleDao.xml</span><br><span class="line">│ │ │ │ SysUserTokenDao.xml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─static</span><br><span class="line">│ │ │ │ favicon.ico</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─swagger</span><br><span class="line">│ │ │ │ favicon-16x16.png</span><br><span class="line">│ │ │ │ favicon-32x32.png</span><br><span class="line">│ │ │ │ index.html</span><br><span class="line">│ │ │ │ index.yaml</span><br><span class="line">│ │ │ │ o2c.html</span><br><span class="line">│ │ │ │ oauth2-redirect.html</span><br><span class="line">│ │ │ │ swagger-ui-bundle.js</span><br><span class="line">│ │ │ │ swagger-ui-bundle.js.map</span><br><span class="line">│ │ │ │ swagger-ui-standalone-preset.js</span><br><span class="line">│ │ │ │ swagger-ui-standalone-preset.js.map</span><br><span class="line">│ │ │ │ swagger-ui.css</span><br><span class="line">│ │ │ │ swagger-ui.css.map</span><br><span class="line">│ │ │ │ swagger-ui.js</span><br><span class="line">│ │ │ │ swagger-ui.js.map</span><br><span class="line">│ │ │ │ swagger-ui.min.js</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─css</span><br><span class="line">│ │ │ │ print.css</span><br><span class="line">│ │ │ │ reset.css</span><br><span class="line">│ │ │ │ screen.css</span><br><span class="line">│ │ │ │ style.css</span><br><span class="line">│ │ │ │ typography.css</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─fonts</span><br><span class="line">│ │ │ │ DroidSans-Bold.ttf</span><br><span class="line">│ │ │ │ DroidSans.ttf</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─images</span><br><span class="line">│ │ │ │ collapse.gif</span><br><span class="line">│ │ │ │ expand.gif</span><br><span class="line">│ │ │ │ explorer_icons.png</span><br><span class="line">│ │ │ │ favicon-16x16.png</span><br><span class="line">│ │ │ │ favicon-32x32.png</span><br><span class="line">│ │ │ │ favicon.ico</span><br><span class="line">│ │ │ │ logo_small.png</span><br><span class="line">│ │ │ │ pet_store_api.png</span><br><span class="line">│ │ │ │ throbber.gif</span><br><span class="line">│ │ │ │ wordnik_api.png</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─lang</span><br><span class="line">│ │ │ │ en.js</span><br><span class="line">│ │ │ │ translator.js</span><br><span class="line">│ │ │ │ zh-cn.js</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─lib</span><br><span class="line">│ │ │ backbone-min.js</span><br><span class="line">│ │ │ es5-shim.js</span><br><span class="line">│ │ │ handlebars-4.0.5.js</span><br><span class="line">│ │ │ highlight.9.1.0.pack.js</span><br><span class="line">│ │ │ highlight.9.1.0.pack_extended.js</span><br><span class="line">│ │ │ jquery-1.8.0.min.js</span><br><span class="line">│ │ │ jquery.ba-bbq.min.js</span><br><span class="line">│ │ │ jquery.slideto.min.js</span><br><span class="line">│ │ │ jquery.wiggle.min.js</span><br><span class="line">│ │ │ js-yaml.min.js</span><br><span class="line">│ │ │ jsoneditor.min.js</span><br><span class="line">│ │ │ lodash.min.js</span><br><span class="line">│ │ │ marked.js</span><br><span class="line">│ │ │ object-assign-pollyfill.js</span><br><span class="line">│ │ │ sanitize-html.min.js</span><br><span class="line">│ │ │ swagger-oauth.js</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─test</span><br><span class="line">│ │ └─java</span><br><span class="line">│ │ └─io</span><br><span class="line">│ │ └─renren</span><br><span class="line">│ │ │ DynamicDataSourceTest.java</span><br><span class="line">│ │ │ JwtTest.java</span><br><span class="line">│ │ │ RedisTest.java</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─service</span><br><span class="line">│ │ DynamicDataSourceTestService.java</span><br><span class="line">│ │</span><br><span class="line">│ └─target</span><br><span class="line">│ ├─classes</span><br><span class="line">│ │ │ application-dev.yml</span><br><span class="line">│ │ │ application-prod.yml</span><br><span class="line">│ │ │ application-test.yml</span><br><span class="line">│ │ │ application.yml</span><br><span class="line">│ │ │ banner.txt</span><br><span class="line">│ │ │ logback-spring.xml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─io</span><br><span class="line">│ │ │ └─renren</span><br><span class="line">│ │ │ │ RenrenApplication.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─common</span><br><span class="line">│ │ │ │ ├─annotation</span><br><span class="line">│ │ │ │ │ SysLog.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─aspect</span><br><span class="line">│ │ │ │ │ RedisAspect.class</span><br><span class="line">│ │ │ │ │ SysLogAspect.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─exception</span><br><span class="line">│ │ │ │ │ RRException.class</span><br><span class="line">│ │ │ │ │ RRExceptionHandler.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─utils</span><br><span class="line">│ │ │ │ │ ConfigConstant.class</span><br><span class="line">│ │ │ │ │ Constant$CloudService.class</span><br><span class="line">│ │ │ │ │ Constant$MenuType.class</span><br><span class="line">│ │ │ │ │ Constant$ScheduleStatus.class</span><br><span class="line">│ │ │ │ │ Constant.class</span><br><span class="line">│ │ │ │ │ DateUtils.class</span><br><span class="line">│ │ │ │ │ HttpContextUtils.class</span><br><span class="line">│ │ │ │ │ IPUtils.class</span><br><span class="line">│ │ │ │ │ MapUtils.class</span><br><span class="line">│ │ │ │ │ PageUtils.class</span><br><span class="line">│ │ │ │ │ Query.class</span><br><span class="line">│ │ │ │ │ R.class</span><br><span class="line">│ │ │ │ │ RedisKeys.class</span><br><span class="line">│ │ │ │ │ RedisUtils.class</span><br><span class="line">│ │ │ │ │ ShiroUtils.class</span><br><span class="line">│ │ │ │ │ SpringContextUtils.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─validator</span><br><span class="line">│ │ │ │ │ │ Assert.class</span><br><span class="line">│ │ │ │ │ │ ValidatorUtils.class</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ └─group</span><br><span class="line">│ │ │ │ │ AddGroup.class</span><br><span class="line">│ │ │ │ │ AliyunGroup.class</span><br><span class="line">│ │ │ │ │ Group.class</span><br><span class="line">│ │ │ │ │ QcloudGroup.class</span><br><span class="line">│ │ │ │ │ QiniuGroup.class</span><br><span class="line">│ │ │ │ │ UpdateGroup.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─xss</span><br><span class="line">│ │ │ │ HTMLFilter.class</span><br><span class="line">│ │ │ │ SQLFilter.class</span><br><span class="line">│ │ │ │ XssFilter.class</span><br><span class="line">│ │ │ │ XssHttpServletRequestWrapper$1.class</span><br><span class="line">│ │ │ │ XssHttpServletRequestWrapper.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─config</span><br><span class="line">│ │ │ │ CorsConfig.class</span><br><span class="line">│ │ │ │ FilterConfig.class</span><br><span class="line">│ │ │ │ KaptchaConfig.class</span><br><span class="line">│ │ │ │ MybatisPlusConfig.class</span><br><span class="line">│ │ │ │ RedisConfig.class</span><br><span class="line">│ │ │ │ ShiroConfig.class</span><br><span class="line">│ │ │ │ SwaggerConfig.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─datasource</span><br><span class="line">│ │ │ │ ├─annotation</span><br><span class="line">│ │ │ │ │ DataSource.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─aspect</span><br><span class="line">│ │ │ │ │ DataSourceAspect.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─config</span><br><span class="line">│ │ │ │ │ DynamicContextHolder$1.class</span><br><span class="line">│ │ │ │ │ DynamicContextHolder.class</span><br><span class="line">│ │ │ │ │ DynamicDataSource.class</span><br><span class="line">│ │ │ │ │ DynamicDataSourceConfig.class</span><br><span class="line">│ │ │ │ │ DynamicDataSourceFactory.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─properties</span><br><span class="line">│ │ │ │ DataSourceProperties.class</span><br><span class="line">│ │ │ │ DynamicDataSourceProperties.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─modules</span><br><span class="line">│ │ │ ├─app</span><br><span class="line">│ │ │ │ ├─annotation</span><br><span class="line">│ │ │ │ │ Login.class</span><br><span class="line">│ │ │ │ │ LoginUser.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─config</span><br><span class="line">│ │ │ │ │ WebMvcConfig.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ AppLoginController.class</span><br><span class="line">│ │ │ │ │ AppRegisterController.class</span><br><span class="line">│ │ │ │ │ AppTestController.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ UserDao.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ UserEntity.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─form</span><br><span class="line">│ │ │ │ │ LoginForm.class</span><br><span class="line">│ │ │ │ │ RegisterForm.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─interceptor</span><br><span class="line">│ │ │ │ │ AuthorizationInterceptor.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─resolver</span><br><span class="line">│ │ │ │ │ LoginUserHandlerMethodArgumentResolver.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─service</span><br><span class="line">│ │ │ │ │ │ UserService.class</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ └─impl</span><br><span class="line">│ │ │ │ │ UserServiceImpl.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─utils</span><br><span class="line">│ │ │ │ JwtUtils.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─job</span><br><span class="line">│ │ │ │ ├─config</span><br><span class="line">│ │ │ │ │ ScheduleConfig.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ ScheduleJobController.class</span><br><span class="line">│ │ │ │ │ ScheduleJobLogController.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ ScheduleJobDao.class</span><br><span class="line">│ │ │ │ │ ScheduleJobLogDao.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ ScheduleJobEntity.class</span><br><span class="line">│ │ │ │ │ ScheduleJobLogEntity.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─service</span><br><span class="line">│ │ │ │ │ │ ScheduleJobLogService.class</span><br><span class="line">│ │ │ │ │ │ ScheduleJobService.class</span><br><span class="line">│ │ │ │ │ │</span><br><span class="line">│ │ │ │ │ └─impl</span><br><span class="line">│ │ │ │ │ ScheduleJobLogServiceImpl.class</span><br><span class="line">│ │ │ │ │ ScheduleJobServiceImpl.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─task</span><br><span class="line">│ │ │ │ │ ITask.class</span><br><span class="line">│ │ │ │ │ TestTask.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─utils</span><br><span class="line">│ │ │ │ ScheduleJob.class</span><br><span class="line">│ │ │ │ ScheduleUtils.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─oss</span><br><span class="line">│ │ │ │ ├─cloud</span><br><span class="line">│ │ │ │ │ AliyunCloudStorageService.class</span><br><span class="line">│ │ │ │ │ CloudStorageConfig.class</span><br><span class="line">│ │ │ │ │ CloudStorageService.class</span><br><span class="line">│ │ │ │ │ OSSFactory.class</span><br><span class="line">│ │ │ │ │ QcloudCloudStorageService.class</span><br><span class="line">│ │ │ │ │ QiniuCloudStorageService.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─controller</span><br><span class="line">│ │ │ │ │ SysOssController.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─dao</span><br><span class="line">│ │ │ │ │ SysOssDao.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ ├─entity</span><br><span class="line">│ │ │ │ │ SysOssEntity.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─service</span><br><span class="line">│ │ │ │ │ SysOssService.class</span><br><span class="line">│ │ │ │ │</span><br><span class="line">│ │ │ │ └─impl</span><br><span class="line">│ │ │ │ SysOssServiceImpl.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─sys</span><br><span class="line">│ │ │ ├─controller</span><br><span class="line">│ │ │ │ AbstractController.class</span><br><span class="line">│ │ │ │ SysConfigController.class</span><br><span class="line">│ │ │ │ SysLogController.class</span><br><span class="line">│ │ │ │ SysLoginController.class</span><br><span class="line">│ │ │ │ SysMenuController.class</span><br><span class="line">│ │ │ │ SysRoleController.class</span><br><span class="line">│ │ │ │ SysUserController.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─dao</span><br><span class="line">│ │ │ │ SysCaptchaDao.class</span><br><span class="line">│ │ │ │ SysConfigDao.class</span><br><span class="line">│ │ │ │ SysLogDao.class</span><br><span class="line">│ │ │ │ SysMenuDao.class</span><br><span class="line">│ │ │ │ SysRoleDao.class</span><br><span class="line">│ │ │ │ SysRoleMenuDao.class</span><br><span class="line">│ │ │ │ SysUserDao.class</span><br><span class="line">│ │ │ │ SysUserRoleDao.class</span><br><span class="line">│ │ │ │ SysUserTokenDao.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─entity</span><br><span class="line">│ │ │ │ SysCaptchaEntity.class</span><br><span class="line">│ │ │ │ SysConfigEntity.class</span><br><span class="line">│ │ │ │ SysLogEntity.class</span><br><span class="line">│ │ │ │ SysMenuEntity.class</span><br><span class="line">│ │ │ │ SysRoleEntity.class</span><br><span class="line">│ │ │ │ SysRoleMenuEntity.class</span><br><span class="line">│ │ │ │ SysUserEntity.class</span><br><span class="line">│ │ │ │ SysUserRoleEntity.class</span><br><span class="line">│ │ │ │ SysUserTokenEntity.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─form</span><br><span class="line">│ │ │ │ PasswordForm.class</span><br><span class="line">│ │ │ │ SysLoginForm.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─oauth2</span><br><span class="line">│ │ │ │ OAuth2Filter.class</span><br><span class="line">│ │ │ │ OAuth2Realm.class</span><br><span class="line">│ │ │ │ OAuth2Token.class</span><br><span class="line">│ │ │ │ TokenGenerator.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─redis</span><br><span class="line">│ │ │ │ SysConfigRedis.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─service</span><br><span class="line">│ │ │ │ ShiroService.class</span><br><span class="line">│ │ │ │ SysCaptchaService.class</span><br><span class="line">│ │ │ │ SysConfigService.class</span><br><span class="line">│ │ │ │ SysLogService.class</span><br><span class="line">│ │ │ │ SysMenuService.class</span><br><span class="line">│ │ │ │ SysRoleMenuService.class</span><br><span class="line">│ │ │ │ SysRoleService.class</span><br><span class="line">│ │ │ │ SysUserRoleService.class</span><br><span class="line">│ │ │ │ SysUserService.class</span><br><span class="line">│ │ │ │ SysUserTokenService.class</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─impl</span><br><span class="line">│ │ │ ShiroServiceImpl.class</span><br><span class="line">│ │ │ SysCaptchaServiceImpl.class</span><br><span class="line">│ │ │ SysConfigServiceImpl.class</span><br><span class="line">│ │ │ SysLogServiceImpl.class</span><br><span class="line">│ │ │ SysMenuServiceImpl.class</span><br><span class="line">│ │ │ SysRoleMenuServiceImpl.class</span><br><span class="line">│ │ │ SysRoleServiceImpl.class</span><br><span class="line">│ │ │ SysUserRoleServiceImpl.class</span><br><span class="line">│ │ │ SysUserServiceImpl.class</span><br><span class="line">│ │ │ SysUserTokenServiceImpl.class</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─mapper</span><br><span class="line">│ │ │ ├─app</span><br><span class="line">│ │ │ │ UserDao.xml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─job</span><br><span class="line">│ │ │ │ ScheduleJobDao.xml</span><br><span class="line">│ │ │ │ ScheduleJobLogDao.xml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ ├─oss</span><br><span class="line">│ │ │ │ SysOssDao.xml</span><br><span class="line">│ │ │ │</span><br><span class="line">│ │ │ └─sys</span><br><span class="line">│ │ │ SysConfigDao.xml</span><br><span class="line">│ │ │ SysLogDao.xml</span><br><span class="line">│ │ │ SysMenuDao.xml</span><br><span class="line">│ │ │ SysRoleDao.xml</span><br><span class="line">│ │ │ SysRoleMenuDao.xml</span><br><span class="line">│ │ │ SysUserDao.xml</span><br><span class="line">│ │ │ SysUserRoleDao.xml</span><br><span class="line">│ │ │ SysUserTokenDao.xml</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─META-INF</span><br><span class="line">│ │ │ spring-configuration-metadata.json</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─static</span><br><span class="line">│ │ │ favicon.ico</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─swagger</span><br><span class="line">│ │ │ favicon-16x16.png</span><br><span class="line">│ │ │ favicon-32x32.png</span><br><span class="line">│ │ │ index.html</span><br><span class="line">│ │ │ index.yaml</span><br><span class="line">│ │ │ o2c.html</span><br><span class="line">│ │ │ oauth2-redirect.html</span><br><span class="line">│ │ │ swagger-ui-bundle.js</span><br><span class="line">│ │ │ swagger-ui-bundle.js.map</span><br><span class="line">│ │ │ swagger-ui-standalone-preset.js</span><br><span class="line">│ │ │ swagger-ui-standalone-preset.js.map</span><br><span class="line">│ │ │ swagger-ui.css</span><br><span class="line">│ │ │ swagger-ui.css.map</span><br><span class="line">│ │ │ swagger-ui.js</span><br><span class="line">│ │ │ swagger-ui.js.map</span><br><span class="line">│ │ │ swagger-ui.min.js</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─css</span><br><span class="line">│ │ │ print.css</span><br><span class="line">│ │ │ reset.css</span><br><span class="line">│ │ │ screen.css</span><br><span class="line">│ │ │ style.css</span><br><span class="line">│ │ │ typography.css</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─fonts</span><br><span class="line">│ │ │ DroidSans-Bold.ttf</span><br><span class="line">│ │ │ DroidSans.ttf</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─images</span><br><span class="line">│ │ │ collapse.gif</span><br><span class="line">│ │ │ expand.gif</span><br><span class="line">│ │ │ explorer_icons.png</span><br><span class="line">│ │ │ favicon-16x16.png</span><br><span class="line">│ │ │ favicon-32x32.png</span><br><span class="line">│ │ │ favicon.ico</span><br><span class="line">│ │ │ logo_small.png</span><br><span class="line">│ │ │ pet_store_api.png</span><br><span class="line">│ │ │ throbber.gif</span><br><span class="line">│ │ │ wordnik_api.png</span><br><span class="line">│ │ │</span><br><span class="line">│ │ ├─lang</span><br><span class="line">│ │ │ en.js</span><br><span class="line">│ │ │ translator.js</span><br><span class="line">│ │ │ zh-cn.js</span><br><span class="line">│ │ │</span><br><span class="line">│ │ └─lib</span><br><span class="line">│ │ backbone-min.js</span><br><span class="line">│ │ es5-shim.js</span><br><span class="line">│ │ handlebars-4.0.5.js</span><br><span class="line">│ │ highlight.9.1.0.pack.js</span><br><span class="line">│ │ highlight.9.1.0.pack_extended.js</span><br><span class="line">│ │ jquery-1.8.0.min.js</span><br><span class="line">│ │ jquery.ba-bbq.min.js</span><br><span class="line">│ │ jquery.slideto.min.js</span><br><span class="line">│ │ jquery.wiggle.min.js</span><br><span class="line">│ │ js-yaml.min.js</span><br><span class="line">│ │ jsoneditor.min.js</span><br><span class="line">│ │ lodash.min.js</span><br><span class="line">│ │ marked.js</span><br><span class="line">│ │ object-assign-pollyfill.js</span><br><span class="line">│ │ sanitize-html.min.js</span><br><span class="line">│ │ swagger-oauth.js</span><br><span class="line">│ │</span><br><span class="line">│ └─generated-sources</span><br><span class="line">│ └─annotations</span><br><span class="line">└─renren-generator</span><br><span class="line"> │ .gitignore</span><br><span class="line"> │ LICENSE</span><br><span class="line"> │ pom.xml</span><br><span class="line"> │ README.md</span><br><span class="line"> │ renren-generator.iml</span><br><span class="line"> │</span><br><span class="line"> ├─src</span><br><span class="line"> │ ├─main</span><br><span class="line"> │ │ ├─java</span><br><span class="line"> │ │ │ └─io</span><br><span class="line"> │ │ │ └─renren</span><br><span class="line"> │ │ │ │ RenrenApplicationGenerator.java</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─adaptor</span><br><span class="line"> │ │ │ │ MongoTableInfoAdaptor.java</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─config</span><br><span class="line"> │ │ │ │ DbConfig.java</span><br><span class="line"> │ │ │ │ MongoCondition.java</span><br><span class="line"> │ │ │ │ MongoConfig.java</span><br><span class="line"> │ │ │ │ MongoManager.java</span><br><span class="line"> │ │ │ │ MongoNullCondition.java</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─controller</span><br><span class="line"> │ │ │ │ SysGeneratorController.java</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─dao</span><br><span class="line"> │ │ │ │ GeneratorDao.java</span><br><span class="line"> │ │ │ │ MongoDBGeneratorDao.java</span><br><span class="line"> │ │ │ │ MySQLGeneratorDao.java</span><br><span class="line"> │ │ │ │ OracleGeneratorDao.java</span><br><span class="line"> │ │ │ │ PostgreSQLGeneratorDao.java</span><br><span class="line"> │ │ │ │ SQLServerGeneratorDao.java</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─entity</span><br><span class="line"> │ │ │ │ │ ColumnEntity.java</span><br><span class="line"> │ │ │ │ │ TableEntity.java</span><br><span class="line"> │ │ │ │ │</span><br><span class="line"> │ │ │ │ └─mongo</span><br><span class="line"> │ │ │ │ MongoDefinition.java</span><br><span class="line"> │ │ │ │ MongoGeneratorEntity.java</span><br><span class="line"> │ │ │ │ Type.java</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─factory</span><br><span class="line"> │ │ │ │ MongoDBCollectionFactory.java</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─service</span><br><span class="line"> │ │ │ │ SysGeneratorService.java</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ └─utils</span><br><span class="line"> │ │ │ Constant.java</span><br><span class="line"> │ │ │ DateUtils.java</span><br><span class="line"> │ │ │ GenUtils.java</span><br><span class="line"> │ │ │ MongoScanner.java</span><br><span class="line"> │ │ │ PageUtils.java</span><br><span class="line"> │ │ │ Query.java</span><br><span class="line"> │ │ │ R.java</span><br><span class="line"> │ │ │ RRException.java</span><br><span class="line"> │ │ │ RRExceptionHandler.java</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ └─resources</span><br><span class="line"> │ │ │ application.yml</span><br><span class="line"> │ │ │ generator.properties</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─mapper</span><br><span class="line"> │ │ │ MySQLGeneratorDao.xml</span><br><span class="line"> │ │ │ OracleGeneratorDao.xml</span><br><span class="line"> │ │ │ PostgreSQLGeneratorDao.xml</span><br><span class="line"> │ │ │ SQLServerGeneratorDao.xml</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─static</span><br><span class="line"> │ │ │ │ favicon.ico</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─css</span><br><span class="line"> │ │ │ │ AdminLTE.min.css</span><br><span class="line"> │ │ │ │ all-skins.min.css</span><br><span class="line"> │ │ │ │ bootstrap.min.css</span><br><span class="line"> │ │ │ │ font-awesome.min.css</span><br><span class="line"> │ │ │ │ main.css</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─fonts</span><br><span class="line"> │ │ │ │ fontawesome-webfont.eot</span><br><span class="line"> │ │ │ │ fontawesome-webfont.svg</span><br><span class="line"> │ │ │ │ fontawesome-webfont.ttf</span><br><span class="line"> │ │ │ │ fontawesome-webfont.woff</span><br><span class="line"> │ │ │ │ fontawesome-webfont.woff2</span><br><span class="line"> │ │ │ │ FontAwesome.otf</span><br><span class="line"> │ │ │ │ glyphicons-halflings-regular.eot</span><br><span class="line"> │ │ │ │ glyphicons-halflings-regular.svg</span><br><span class="line"> │ │ │ │ glyphicons-halflings-regular.ttf</span><br><span class="line"> │ │ │ │ glyphicons-halflings-regular.woff</span><br><span class="line"> │ │ │ │ glyphicons-halflings-regular.woff2</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─js</span><br><span class="line"> │ │ │ │ common.js</span><br><span class="line"> │ │ │ │ generator.js</span><br><span class="line"> │ │ │ │ index.js</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─libs</span><br><span class="line"> │ │ │ │ app.js</span><br><span class="line"> │ │ │ │ app.min.js</span><br><span class="line"> │ │ │ │ bootstrap.min.js</span><br><span class="line"> │ │ │ │ fastclick.min.js</span><br><span class="line"> │ │ │ │ jquery.min.js</span><br><span class="line"> │ │ │ │ jquery.slimscroll.min.js</span><br><span class="line"> │ │ │ │ router.js</span><br><span class="line"> │ │ │ │ vue.min.js</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ └─plugins</span><br><span class="line"> │ │ │ ├─jqgrid</span><br><span class="line"> │ │ │ │ grid.locale-cn.js</span><br><span class="line"> │ │ │ │ jquery.jqGrid.min.js</span><br><span class="line"> │ │ │ │ ui.jqgrid-bootstrap-ui.css</span><br><span class="line"> │ │ │ │ ui.jqgrid-bootstrap.css</span><br><span class="line"> │ │ │ │ ui.jqgrid.css</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ └─layer</span><br><span class="line"> │ │ │ │ layer.js</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ ├─mobile</span><br><span class="line"> │ │ │ │ │ layer.js</span><br><span class="line"> │ │ │ │ │</span><br><span class="line"> │ │ │ │ └─need</span><br><span class="line"> │ │ │ │ layer.css</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ └─skin</span><br><span class="line"> │ │ │ ├─default</span><br><span class="line"> │ │ │ │ icon-ext.png</span><br><span class="line"> │ │ │ │ icon.png</span><br><span class="line"> │ │ │ │ layer.css</span><br><span class="line"> │ │ │ │ loading-0.gif</span><br><span class="line"> │ │ │ │ loading-1.gif</span><br><span class="line"> │ │ │ │ loading-2.gif</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ └─moon</span><br><span class="line"> │ │ │ default.png</span><br><span class="line"> │ │ │ style.css</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─template</span><br><span class="line"> │ │ │ add-or-update.vue.vm</span><br><span class="line"> │ │ │ Controller.java.vm</span><br><span class="line"> │ │ │ Dao.java.vm</span><br><span class="line"> │ │ │ Dao.xml.vm</span><br><span class="line"> │ │ │ Entity.java.vm</span><br><span class="line"> │ │ │ index.vue.vm</span><br><span class="line"> │ │ │ menu.sql.vm</span><br><span class="line"> │ │ │ MongoChildrenEntity.java.vm</span><br><span class="line"> │ │ │ MongoEntity.java.vm</span><br><span class="line"> │ │ │ Service.java.vm</span><br><span class="line"> │ │ │ ServiceImpl.java.vm</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ └─views</span><br><span class="line"> │ │ generator.html</span><br><span class="line"> │ │ index.html</span><br><span class="line"> │ │ main.html</span><br><span class="line"> │ │</span><br><span class="line"> │ └─test</span><br><span class="line"> │ └─java</span><br><span class="line"> │ └─io</span><br><span class="line"> │ └─renren</span><br><span class="line"> │ RenrenApplicationTests.java</span><br><span class="line"> │</span><br><span class="line"> └─target</span><br><span class="line"> ├─classes</span><br><span class="line"> │ │ application.yml</span><br><span class="line"> │ │ generator.properties</span><br><span class="line"> │ │</span><br><span class="line"> │ ├─io</span><br><span class="line"> │ │ └─renren</span><br><span class="line"> │ │ │ RenrenApplicationGenerator.class</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─adaptor</span><br><span class="line"> │ │ │ MongoTableInfoAdaptor.class</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─config</span><br><span class="line"> │ │ │ DbConfig.class</span><br><span class="line"> │ │ │ MongoCondition.class</span><br><span class="line"> │ │ │ MongoConfig.class</span><br><span class="line"> │ │ │ MongoManager.class</span><br><span class="line"> │ │ │ MongoNullCondition.class</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─controller</span><br><span class="line"> │ │ │ SysGeneratorController.class</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─dao</span><br><span class="line"> │ │ │ GeneratorDao.class</span><br><span class="line"> │ │ │ MongoDBGeneratorDao.class</span><br><span class="line"> │ │ │ MySQLGeneratorDao.class</span><br><span class="line"> │ │ │ OracleGeneratorDao.class</span><br><span class="line"> │ │ │ PostgreSQLGeneratorDao.class</span><br><span class="line"> │ │ │ SQLServerGeneratorDao.class</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─entity</span><br><span class="line"> │ │ │ │ ColumnEntity.class</span><br><span class="line"> │ │ │ │ TableEntity.class</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ └─mongo</span><br><span class="line"> │ │ │ MongoDefinition.class</span><br><span class="line"> │ │ │ MongoGeneratorEntity.class</span><br><span class="line"> │ │ │ Type.class</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─factory</span><br><span class="line"> │ │ │ MongoDBCollectionFactory.class</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─service</span><br><span class="line"> │ │ │ SysGeneratorService.class</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ └─utils</span><br><span class="line"> │ │ Constant.class</span><br><span class="line"> │ │ DateUtils.class</span><br><span class="line"> │ │ GenUtils.class</span><br><span class="line"> │ │ MongoScanner$ForkJoinGetProcessName.class</span><br><span class="line"> │ │ MongoScanner$ForkJoinProcessType.class</span><br><span class="line"> │ │ MongoScanner.class</span><br><span class="line"> │ │ PageUtils.class</span><br><span class="line"> │ │ Query.class</span><br><span class="line"> │ │ R.class</span><br><span class="line"> │ │ RRException.class</span><br><span class="line"> │ │ RRExceptionHandler.class</span><br><span class="line"> │ │</span><br><span class="line"> │ ├─mapper</span><br><span class="line"> │ │ MySQLGeneratorDao.xml</span><br><span class="line"> │ │ OracleGeneratorDao.xml</span><br><span class="line"> │ │ PostgreSQLGeneratorDao.xml</span><br><span class="line"> │ │ SQLServerGeneratorDao.xml</span><br><span class="line"> │ │</span><br><span class="line"> │ ├─static</span><br><span class="line"> │ │ │ favicon.ico</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─css</span><br><span class="line"> │ │ │ AdminLTE.min.css</span><br><span class="line"> │ │ │ all-skins.min.css</span><br><span class="line"> │ │ │ bootstrap.min.css</span><br><span class="line"> │ │ │ font-awesome.min.css</span><br><span class="line"> │ │ │ main.css</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─fonts</span><br><span class="line"> │ │ │ fontawesome-webfont.eot</span><br><span class="line"> │ │ │ fontawesome-webfont.svg</span><br><span class="line"> │ │ │ fontawesome-webfont.ttf</span><br><span class="line"> │ │ │ fontawesome-webfont.woff</span><br><span class="line"> │ │ │ fontawesome-webfont.woff2</span><br><span class="line"> │ │ │ FontAwesome.otf</span><br><span class="line"> │ │ │ glyphicons-halflings-regular.eot</span><br><span class="line"> │ │ │ glyphicons-halflings-regular.svg</span><br><span class="line"> │ │ │ glyphicons-halflings-regular.ttf</span><br><span class="line"> │ │ │ glyphicons-halflings-regular.woff</span><br><span class="line"> │ │ │ glyphicons-halflings-regular.woff2</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─js</span><br><span class="line"> │ │ │ common.js</span><br><span class="line"> │ │ │ generator.js</span><br><span class="line"> │ │ │ index.js</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─libs</span><br><span class="line"> │ │ │ app.js</span><br><span class="line"> │ │ │ app.min.js</span><br><span class="line"> │ │ │ bootstrap.min.js</span><br><span class="line"> │ │ │ fastclick.min.js</span><br><span class="line"> │ │ │ jquery.min.js</span><br><span class="line"> │ │ │ jquery.slimscroll.min.js</span><br><span class="line"> │ │ │ router.js</span><br><span class="line"> │ │ │ vue.min.js</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ └─plugins</span><br><span class="line"> │ │ ├─jqgrid</span><br><span class="line"> │ │ │ grid.locale-cn.js</span><br><span class="line"> │ │ │ jquery.jqGrid.min.js</span><br><span class="line"> │ │ │ ui.jqgrid-bootstrap-ui.css</span><br><span class="line"> │ │ │ ui.jqgrid-bootstrap.css</span><br><span class="line"> │ │ │ ui.jqgrid.css</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ └─layer</span><br><span class="line"> │ │ │ layer.js</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ ├─mobile</span><br><span class="line"> │ │ │ │ layer.js</span><br><span class="line"> │ │ │ │</span><br><span class="line"> │ │ │ └─need</span><br><span class="line"> │ │ │ layer.css</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ └─skin</span><br><span class="line"> │ │ ├─default</span><br><span class="line"> │ │ │ icon-ext.png</span><br><span class="line"> │ │ │ icon.png</span><br><span class="line"> │ │ │ layer.css</span><br><span class="line"> │ │ │ loading-0.gif</span><br><span class="line"> │ │ │ loading-1.gif</span><br><span class="line"> │ │ │ loading-2.gif</span><br><span class="line"> │ │ │</span><br><span class="line"> │ │ └─moon</span><br><span class="line"> │ │ default.png</span><br><span class="line"> │ │ style.css</span><br><span class="line"> │ │</span><br><span class="line"> │ ├─template</span><br><span class="line"> │ │ add-or-update.vue.vm</span><br><span class="line"> │ │ Controller.java.vm</span><br><span class="line"> │ │ Dao.java.vm</span><br><span class="line"> │ │ Dao.xml.vm</span><br><span class="line"> │ │ Entity.java.vm</span><br><span class="line"> │ │ index.vue.vm</span><br><span class="line"> │ │ menu.sql.vm</span><br><span class="line"> │ │ MongoChildrenEntity.java.vm</span><br><span class="line"> │ │ MongoEntity.java.vm</span><br><span class="line"> │ │ Service.java.vm</span><br><span class="line"> │ │ ServiceImpl.java.vm</span><br><span class="line"> │ │</span><br><span class="line"> │ └─views</span><br><span class="line"> │ generator.html</span><br><span class="line"> │ index.html</span><br><span class="line"> │ main.html</span><br><span class="line"> │</span><br><span class="line"> └─generated-sources</span><br><span class="line"> └─annotations</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h1 id="四-项目前置知识"><a href="#四-项目前置知识" class="headerlink" title="四.项目前置知识"></a>四.项目前置知识</h1><h2 id="1-SpringCloud-Alibaba"><a href="#1-SpringCloud-Alibaba" class="headerlink" title="1.SpringCloud Alibaba"></a>1.SpringCloud Alibaba</h2><h3 id="1-1简介"><a href="#1-1简介" class="headerlink" title="1.1简介"></a>1.1简介</h3><pre><code>SpringCloud Alibaba致力于提供微服务开发的一站式解决方案。此项目包含开发分布式应用微服务必须的组件方便开发者通过SpringCloud编程模型轻松使用这些组件来开发分布式的应用服务。
依托SpringCloud Alibaba你只需要添加一些注解和少量的配置就可以将SpringCloud应用接入阿里微服务解决方案通过阿里中间件来迅速搭建分布式应用系统。
</code></pre>
<p>github的地址:<a target="_blank" rel="noopener" href="https://github.com/alibaba/spring-cloud-alibaba">https://github.com/alibaba/spring-cloud-alibaba</a></p>
<h3 id="1-2为什么使用SpringCloud-Alibaba"><a href="#1-2为什么使用SpringCloud-Alibaba" class="headerlink" title="1.2为什么使用SpringCloud Alibaba"></a>1.2为什么使用SpringCloud Alibaba</h3><p><strong>SpringCloud的不足:</strong></p>
<ul>
<li>部分组件停止维护,给开发带来不便</li>
<li>环境搭建复杂,没有完善的可视化界面,需要大量的二次开发和定制</li>
<li>配置复杂,难以上手,部分配置差别难以区分和合理应用</li>
</ul>
<p><strong>SpringCloud Alibaba的优势:</strong></p>
<p>阿里使用过的组件经历了考验,性能强悍,设计合理,开源成套的搭配和可视化的界面给开发带来极大的便利,搭建简单,学习成本低。</p>
<h3 id="1-3-SpringCloud-Alibaba最终的技术搭配方案"><a href="#1-3-SpringCloud-Alibaba最终的技术搭配方案" class="headerlink" title="1.3 SpringCloud Alibaba最终的技术搭配方案"></a>1.3 SpringCloud Alibaba最终的技术搭配方案</h3><p><strong>SpringCloud Alibaba - Nacos :注册中心(服务发现&#x2F;注册)</strong></p>
<p><strong>SpringCloud Alibaba - Nacos :配置中心(动态的配置管理)</strong></p>
<p><strong>SpringCloud - Ribbon: 负载均衡</strong></p>
<p><strong>SpringCloud - Feign: 声明式HTTP客户端远程调用服务&#x2F;服务调用)</strong></p>
<p><strong>SpringCloud Alibaba - Sentinel服务容错限流、降级、熔断</strong></p>
<p><strong>SpringCloud - Gateway: API网关webflux编程模式</strong></p>
<p><strong>SpringCloud - Sleuth调用链监控</strong></p>
<p><strong>SpringCloud Alibaba - Seata原Fescar即分布式事务解决方案</strong></p>
<img src="/pictures/image-20230519161707857.png" alt="image-20230519161707857" style="zoom:150%;" />
<h3 id="1-4-项目中使用SpringCloud-Alibaba"><a href="#1-4-项目中使用SpringCloud-Alibaba" class="headerlink" title="1.4 项目中使用SpringCloud Alibaba"></a>1.4 项目中使用SpringCloud Alibaba</h3><p>在common模块中添加如下的依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">dependencyManagement</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">dependencies</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.alibaba.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-alibaba-dependencies<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">version</span>&gt;</span>2.2.0.RELEASE<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">type</span>&gt;</span>pom<span class="tag">&lt;/<span class="name">type</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">scope</span>&gt;</span>import<span class="tag">&lt;/<span class="name">scope</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">dependencies</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependencyManagement</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h3 id="1-5-SpringCloud-Alibaba的组件"><a href="#1-5-SpringCloud-Alibaba的组件" class="headerlink" title="1.5 SpringCloud Alibaba的组件"></a>1.5 SpringCloud Alibaba的组件</h3><h4 id="1-Nacos注册中心"><a href="#1-Nacos注册中心" class="headerlink" title="1.Nacos注册中心"></a>1.Nacos注册中心</h4><img src="/pictures/image-20230519162859782.png" alt="image-20230519162859782" style="zoom:150%;" />
<p><strong>简介</strong></p>
<p>Nacos 是阿里巴巴推出来的一个新开源项目,这是一个更易于构建云原生应用的动态服务发现、配置管理和服务管理平台。</p>
<p>Nacos 致力于帮助您发现、配置和管理微服务。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据及流量管理。</p>
<p>Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。 Nacos 是构建以“服务”为中心的现代应用架构 (例如微服务范式、云原生范式) 的服务基础设施</p>
<p><strong>Nacos 支持如下核心特性</strong></p>
<p>1服务发现 支持 DNS 与 RPC 服务发现,也提供原生 SDK 、OpenAPI 等多种服务注册方式和 DNS、HTTP 与 API 等多种服务发现方式。<br>2服务健康监测 Nacos 提供对服务的实时的健康检查,阻止向不健康的主机或服务实例发送请求。<br>3动态配置服务 Nacos 提供配置统一管理功能,能够帮助我们将配置以中心化、外部化和动态化的方式管理所有环境的应用配置和服务配置。<br>4动态 DNS 服务: Nacos 支持动态 DNS 服务权重路由,能够让我们很容易地实现中间层负载均衡、更灵活的路由策略、流量控制以及数据中心内网的简单 DNS 解析服务。<br>5服务及其元数据管理 Nacos 支持从微服务平台建设的视角管理数据中心的所有服务及元数据,包括管理服务的描述、生命周期、服务的静态依赖分析、服务的健康状态、服务的流量管理、路由及安全策略、服务的 SLA 以及最首要的 metrics 统计数据。</p>
<p><strong>使用nacos</strong></p>
<p>使用之前需要下载nacos并启动nacos的服务</p>
<p><img src="/pictures/image-20230519164012950.png" alt="image-20230519164012950"></p>
<p>在common工程中添加依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.alibaba.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-starter-alibaba-nacos-discovery<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>配置中心中配置Nacos的地址</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">application:</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">gulimall-coupon</span> <span class="comment">#指定服务的名字,指定了名字才能注册到注册中心中</span></span><br><span class="line"> <span class="attr">cloud:</span></span><br><span class="line"> <span class="attr">nacos:</span></span><br><span class="line"> <span class="attr">server-addr:</span> <span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span><span class="string">:8848</span> <span class="comment">#指定注册中心的地址信息</span></span><br></pre></td></tr></table></figure>
<p>在每个启动类上使用注解开启服务的注册与发现功能</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//开启服务的注册与发现功能</span></span><br><span class="line"><span class="meta">@EnableDiscoveryClient</span></span><br></pre></td></tr></table></figure>
<p>查看注册服务列表</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">通过访问: http://localhost:8848/nacos</span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230519165606784.png" alt="image-20230519165606784"></p>
<h4 id="2-Feign声明式远程调用"><a href="#2-Feign声明式远程调用" class="headerlink" title="2.Feign声明式远程调用"></a>2.Feign声明式远程调用</h4><p><strong>简介</strong></p>
<pre><code>Feign是一个声明式的HTTP客户端它的目的是让远程调用变得更简单。Feign提供了HTTP请求的模板通过**编写简单的接口和插入注解**就可以定义好HTTP请求的参数、格式、地址等信息。
Feign整合了Ribbon负载均衡和Hystrix服务熔断可以让我们不再需要显式的使用这两个组件。
</code></pre>
<p><strong>使用</strong></p>
<p>引入依赖,每个模块都需要引入这个依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"> <span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-starter-openfeign<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>编写代码测试远程调用,这里我们以用户模块调用优惠卷模块来获取用户的拥有的优惠卷为例来测试远程调用。</p>
<p><em><strong>会员模块提供获取用户名下优惠卷的方法</strong></em></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 获取用户明名下的优惠卷</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@RequestMapping(&quot;member/list&quot;)</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">membercoupons</span><span class="params">()</span>&#123;</span><br><span class="line"> <span class="type">CouponEntity</span> <span class="variable">couponEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">CouponEntity</span>();</span><br><span class="line"> couponEntity.setCouponName(<span class="string">&quot;满一百减五十&quot;</span>);</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">&quot;coupons&quot;</span>,Arrays.asList(couponEntity));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><em><strong>用户模块远程调用优惠卷模块</strong></em></p>
<p>远程调用别的服务端步骤</p>
<ol>
<li><p>引入open-feign的依赖</p>
</li>
<li><p>调用端编写一个接口告诉SpringCloud这个接口需要调用远程服务</p>
<p>声明接口的每一个方法都是调用哪个远程服务的那个请求</p>
</li>
<li><p>开启远程调用的功能,在调用端的启动类上添加**@EnableFeignClients**注解</p>
</li>
</ol>
<p><em><strong>在用户模块创建一个Feign包(维护的时候见名知义),声明调用的接口,在启动类上添加注解</strong></em></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//注解</span></span><br><span class="line"><span class="comment">//basePackages声明的远程调用的接口所在的包</span></span><br><span class="line"><span class="meta">@EnableFeignClients(basePackages = &quot;com.atguigu.gulimall.member.feign&quot;)</span></span><br></pre></td></tr></table></figure>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.member.feign;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.atguigu.common.utils.R;</span><br><span class="line"><span class="keyword">import</span> org.springframework.cloud.openfeign.FeignClient;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestMapping;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> GongChangjiang</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/5/19</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 远程调用优惠卷服务</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@FeignClient(&quot;gulimall-coupon&quot;)</span><span class="comment">//告诉springCloud这是一个远程客户端并指定要调用服务的服务名</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">interface</span> <span class="title class_">CouponFeignService</span> &#123;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 这里需要写全路径</span></span><br><span class="line"><span class="comment"> * 远程调用优惠卷模块中获取优惠卷信息的方法</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@RequestMapping(&quot;/coupon/coupon/member/list&quot;)</span></span><br><span class="line"> <span class="keyword">public</span> R <span class="title function_">membercoupons</span><span class="params">()</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><em><strong>测试远程调用</strong></em></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Autowired</span></span><br><span class="line"><span class="keyword">private</span> CouponFeignService couponFeignService;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 测试远程调用优惠卷模块的服务</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@RequestMapping(&quot;/coupons&quot;)</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">test</span><span class="params">()</span>&#123;</span><br><span class="line"> <span class="type">MemberEntity</span> <span class="variable">memberEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MemberEntity</span>();</span><br><span class="line"> memberEntity.setNickname(<span class="string">&quot;张三&quot;</span>);</span><br><span class="line"> <span class="type">R</span> <span class="variable">membercoupons</span> <span class="operator">=</span> couponFeignService.membercoupons();</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">&quot;member&quot;</span>, memberEntity).put(<span class="string">&quot;coupons&quot;</span>, membercoupons.get(<span class="string">&quot;coupons&quot;</span>));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>测试的时候出现的小问题</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc</span></span><br><span class="line"><span class="comment">出现这个问题是没有loadbalanc,但是nacos中ribbon会造成loadbalanc包失效,在common的pom中的依赖改成如下的依赖--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.alibaba.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-starter-alibaba-nacos-discovery<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">exclusions</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">exclusion</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-starter-netflix-ribbon<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">exclusion</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">exclusions</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-loadbalancer<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">version</span>&gt;</span>2.2.2.RELEASE<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>处理完上面的报错之后,浏览器访问 <a target="_blank" rel="noopener" href="http://localhost:8000/member/member/coupons">http://localhost:8000/member/member/coupons</a> ,显示如下的内容,说明远程调用成功</p>
<p><img src="/pictures/image-20230519210917423.png" alt="image-20230519210917423"></p>
<h4 id="3-Nacos配置中心"><a href="#3-Nacos配置中心" class="headerlink" title="3.Nacos配置中心"></a>3.Nacos配置中心</h4><p><strong>简介</strong></p>
<p>简介见上面的nacos注册中心这里的Nacos配置中心和上面的nacos注册中心是同一个东西</p>
<p><strong>使用</strong></p>
<p>1.在common中引入nacos配置中心的依赖和上面的注册中心的依赖不一样</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.alibaba.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-starter-alibaba-nacos-config<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>2.给需要配置中心管理的模块下创建配置文件<strong>bootstrap.properties</strong>这个文件会优先于application.properties读取</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#服务名</span></span><br><span class="line"><span class="attr">spring.application.name</span>=<span class="string">gulimall-coupon</span></span><br><span class="line"><span class="comment">#Nacos配置中心的地址的地址</span></span><br><span class="line"><span class="comment">#注意看这里多了一个config和模块中nacos的地址还是有区别的</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.server-addr</span>=<span class="string">127.0.0.1:8848</span></span><br></pre></td></tr></table></figure>
<p>3.测试</p>
<p>3.1.在application.properties配置文件中添加如下的配置</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">coupon.user.name</span>=<span class="string">zhansan</span></span><br><span class="line"><span class="attr">coupon.user.age</span>=<span class="string">18</span></span><br></pre></td></tr></table></figure>
<p>3.2 编写接口并访问测试</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 获取配置文件中的配置信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Value(&quot;$&#123;user.name&#125;&quot;)</span></span><br><span class="line"><span class="keyword">private</span> String name;</span><br><span class="line"><span class="meta">@Value(&quot;$&#123;user.age&#125;&quot;)</span></span><br><span class="line"><span class="keyword">private</span> Integer age;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 测试优先获取哪个配置文件的值</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@RequestMapping(&quot;/test&quot;)</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">test</span><span class="params">()</span>&#123;</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">&quot;name&quot;</span>,name).put(<span class="string">&quot;age&quot;</span>,age);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>测试的结果如下:</p>
<img src="/pictures/image-20230519213945320.png" alt="image-20230519213945320" style="zoom: 200%;" />
<p>3.3 需求:应用不重启,实时的修改配置文件中的值</p>
<p>3.3.1 在Nacos配置中心中创建一个名为 <strong>应用名.properties</strong>(例如:gulimall-coupon.properties 的配置文件</p>
<p>进入nacos管理的可视化页面点击<strong>配置列表</strong>,点击 <strong>+</strong> ,新建一个配置 同时将配置文件中name值改为lihua</p>
<p><img src="/pictures/image-20230519215420623.png" alt="image-20230519215420623"></p>
<p>发布之后,就可以在配置列表中看到这个配置了</p>
<p><img src="/pictures/image-20230519215232782.png" alt="image-20230519215232782"></p>
<p>重启项目测试,配置中心的配置是否生效</p>
<p>没有生效的话添加这个依赖springBoot2.4以上的版本需要</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-starter-bootstrap<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">version</span>&gt;</span>4.0.1<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>生效的话这时刷新页面可以看到name已经由zhangsan变成lihua了</p>
<img src="/pictures/image-20230519220357933.png" alt="image-20230519220357933" style="zoom:150%;" />
<p>3.3.2 想让配置文件实时生效的话,这时我们还要添加以下的注解,然后重启应用,让注解生效</p>
<p>注意: <strong>@RefreshScope</strong> 这里的注解添加在<strong>Controller</strong>上,不是添加在启动类上</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//给需要配置中心统一配置的模块的Controller上上添加@RefreshScope的注解</span></span><br><span class="line"><span class="meta">@RefreshScope</span></span><br></pre></td></tr></table></figure>
<p><strong>最终测试</strong></p>
<p>这时我们在配置中心中修改配置并发布,这些配置就可以实时的生效了</p>
<p>我们在配置中心修改name和age的值并发布</p>
<p><img src="/pictures/image-20230519220922701.png" alt="image-20230519220922701"></p>
<p>这时刷新请求接口的页面,我们可以看到页面中的数据发生了实时的变化</p>
<img src="/pictures/image-20230519223403139.png" alt="image-20230519223403139" style="zoom:150%;" />
<p><strong>总结</strong></p>
<p>实现nacos配置中心统一配置的流程</p>
<ol>
<li><p>引入依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.alibaba.cloud<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-cloud-starter-alibaba-nacos-config<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure></li>
<li><p>创建一个bootstrap.properties的配置文件添加如下的内容:</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#服务名</span></span><br><span class="line"><span class="attr">spring.application.name</span>=<span class="string">gulimall-coupon</span></span><br><span class="line"><span class="comment">#Nacos配置中心的地址</span></span><br><span class="line"><span class="comment">#注意看这里多了一个config和模块中nacos的地址还是有区别的</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.server-addr</span>=<span class="string">127.0.0.1:8848</span></span><br></pre></td></tr></table></figure></li>
<li><p>需要给配置中心中新建一个数据集(Data Id)为 <strong>应用名.properties</strong>(例如:gulimall-coupon.properties的配置。默认规则: 应用名.properties</p>
</li>
<li><p>给 应用名.properties 添加任何配置 这些配置都可以在配置中心配置生效</p>
</li>
<li><p>在Controller上添加**@RefreshScope**注解就可以实时的动态刷新配置,配置中心更新了配置并发布了之后,配置实时的生效。</p>
</li>
</ol>
<p><strong>注意</strong></p>
<p><em>如果配置中心和当前应用的配置文件都配置了相同的项,优先使用配置中心的配置</em></p>
<p><strong>细节</strong></p>
<p><strong>命名空间:</strong> 配置隔离</p>
<p>默认public保留空间</p>
<p>1.可以分别设置开发、测试、生产环境的命名空间,不同的环境下使用不同的命名空间中的配置</p>
<p>通过命令空间实现环境隔离</p>
<p>在<strong>bootstrap.properties</strong>设置使用哪个命名空间,可以在配置文件中添加如下的配置</p>
<p><img src="/pictures/image-20230519225637848.png" alt="image-20230519225637848"></p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 切换名称空间</span></span><br><span class="line"><span class="comment"># 可以选择对应的命名空间 # 写上对应环境的命名空间ID</span></span><br><span class="line"><span class="comment"># 使用唯一的命名空间ID</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.namespace</span>=<span class="string">8a84e478-92d0-4581-a316-b0274fc76eb8</span></span><br></pre></td></tr></table></figure>
<p>2.可以为每一个微服务可以创建自己的命名空间,让每个服务的配置放在每个服务的命名空间下</p>
<p><strong>配置集:</strong>所有的配置的集合</p>
<p><strong>配置集ID:</strong> 类似文件名</p>
<pre><code>Data Id: 就是配置集ID
</code></pre>
<p><strong>配置分组:</strong></p>
<p>默认所有的配置集都属于 : DEFAULT_GROUP</p>
<p>例如在<strong>生产环境的命名空间</strong>下,淘宝的<strong>配置分组</strong>有以下几个: 双十一688平时</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#指定配置分组</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.group</span>=<span class="string">1111</span></span><br></pre></td></tr></table></figure>
<p><strong>Tips同一个命名空间下可能会有不同的配置分组</strong></p>
<p><strong>每个微服务创建自己的命令空间,使用配置分组区分环境 dev、test、prod</strong></p>
<p><em><strong>从配置中心中读取多个配置集(配置文件):</strong></em></p>
<p>可以在bootstrap.properties添加以下的配置</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#第一个配置文件</span></span><br><span class="line"><span class="comment">#配置文件名</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.ext-config[0].data-id</span>=<span class="string">datasource.yml </span></span><br><span class="line"><span class="comment">#配置文件的对应的配置分组</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.ext-config[0].group</span>=<span class="string">dev</span></span><br><span class="line"><span class="comment">#是否动态的刷新</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.ext-config[0].refresh</span>=<span class="string">true</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">#第二个配置文件</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.ext-config[1].data-id</span>=<span class="string">mybatis.yml</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.ext-config[1].group</span>=<span class="string">dev</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.ext-config[1].refresh</span>=<span class="string">true</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">#第三个配置文件</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.ext-config[2].data-id</span>=<span class="string">others.yml</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.ext-config[2].group</span>=<span class="string">dev</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.ext-config[2].refresh</span>=<span class="string">true</span></span><br></pre></td></tr></table></figure>
<p><strong>总结:</strong></p>
<p>1.微服务的任何配置信息,任何配置文件都可以放在配置中心中</p>
<p>2.加载配置中心的哪些配置文件只需要在bootstrap.properties说明加载哪些配置文件即可</p>
<p>3.如果配置中心和当前应用的配置文件都配置了相同的项,优先使用配置中心的配置</p>
<h4 id="4-Gateway网关"><a href="#4-Gateway网关" class="headerlink" title="4.Gateway网关"></a>4.Gateway网关</h4><img src="/pictures/image-20230519233741029.png" alt="image-20230519233741029" style="zoom:150%;" />
<p><strong>简介</strong></p>
<pre><code>网关最为流量的入口,常用的功能包括**路由转发**、**权限校验**、**限流控制**等。SpringCloud gateway是springcloud官方提供的第二代网关框架取代了Zull网关。
</code></pre>
<p><strong>网关的功能</strong></p>
<ul>
<li>针对所有请求进行登陆<strong>统一鉴权(登录态)</strong>、<strong>限流</strong>、<strong>缓存</strong>、<strong>日志(用户打点)</strong>。</li>
<li>可以根据不同的请求路径pattern来进行请求的鉴权、转发、和拒绝。</li>
<li><strong>协议转化</strong>。针对后段多种不同的协议在网关层统一处理后以HTTP对外提供服务。</li>
<li>提供<strong>统一的错误码</strong>。</li>
<li>请求转发,并且可以基于网关实现<strong>内网与外网的隔离</strong>。</li>
</ul>
<p><strong>使用</strong></p>
<ol>
<li><p>创建一个springboot initializr的工程 勾选上Gateway的依赖</p>
</li>
<li><p>在网关模块的pom.xml文件中添加上对common工程的依赖</p>
</li>
<li><p>在网关的启动类上添加上**@EnableDiscoveryClient**的注解,把网关注册到注册中心</p>
</li>
<li><p>配置nacos的地址和服务名信息</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#配置网关的地址</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.server-addr</span>=<span class="string">127.0.0.1:8848</span></span><br><span class="line"><span class="comment">#服务名</span></span><br><span class="line"><span class="attr">spring.application.name</span>=<span class="string">gulimall-gateway</span></span><br></pre></td></tr></table></figure></li>
<li><p>创建<strong>bootstrap.properties</strong>配置文件将网关模块的配置通过交给nacos配置中心管理</p>
<p><img src="/pictures/image-20230520205015056.png" alt="image-20230520205015056"></p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">spring.application.name</span>=<span class="string">gulimall-gateway</span></span><br><span class="line"><span class="comment">#配置配置中心的地址</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.server-addr</span>=<span class="string">127.0.0.1:8848</span></span><br><span class="line"><span class="comment">#名称空间</span></span><br><span class="line"><span class="attr">spring.cloud.nacos.config.namespace</span>=<span class="string">4a8e80ba-3d3c-40ef-897f-d400797c4676</span></span><br></pre></td></tr></table></figure></li>
<li><p>启动测试</p>
<p>启动之后出现的问题及解决方案:</p>
<p><strong>a</strong>.单元测试@Test注解爆红,是我们更换了springboot的版本的原因删除爆红的地方重新导包即可</p>
<p><strong>b</strong>.数据库相关的报错,是因为网关中没有使用数据库,就没有配置数据库的配置,我们通过@SpringBootApplication(exclude &#x3D; {DataSourceAutoConfiguration.class})解决。</p>
</li>
<li><p>转发测试</p>
<p><strong>测试案例:</strong>我们在浏览器的地址栏输入localhost:88?url&#x3D;baidu就给我们转发到百度,输入localhost:88?url&#x3D;qq就给我们转发到腾讯qq</p>
<p><strong>实现:</strong>创建一个yml的配置文件在配置文件中添加如下的配置</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">cloud:</span></span><br><span class="line"> <span class="attr">gateway:</span></span><br><span class="line"> <span class="attr">routes:</span></span><br><span class="line"> <span class="comment"># 路由的唯一id</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">id:</span> <span class="string">baidu_route</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">https://www.baidu.com</span></span><br><span class="line"> <span class="comment"># 断言什么时候去上面那个url</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="comment"># 下面的这句话的意思是如果请求中存在请求参数url=baidu我们就去 https://www.baidu.com这个url</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Query=url,baidu</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">id:</span> <span class="string">qq_route</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">https://www.qq.com</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="comment"># 下面的这句话的意思是如果请求中存在请求参数url=qq我们就去 https://www.qq.com这个url</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Query=url,qq</span></span><br></pre></td></tr></table></figure>
<img src="/pictures/image-20230520212001874.png" alt="image-20230520212001874" style="zoom:150%;" /></li>
</ol>
<h2 id="2-前端开发的基础知识"><a href="#2-前端开发的基础知识" class="headerlink" title="2.前端开发的基础知识"></a>2.前端开发的基础知识</h2><p><strong><a href="https://jasonsgong.gitee.io/posts/432.html">前端基础知识 | The Blog (gitee.io)</a></strong></p>
<p><strong>前后端技术类比</strong></p>
<p><img src="/pictures/image-20230520212351174.png" alt="image-20230520212351174"></p>
<h1 id="五-基础篇程序设计"><a href="#五-基础篇程序设计" class="headerlink" title="五.基础篇程序设计"></a>五.基础篇程序设计</h1><p><strong>提示</strong>:所有的API路径一定要和老师的一样不然在后面会吃亏!!!</p>
<h2 id="1-商品服务"><a href="#1-商品服务" class="headerlink" title="1.商品服务"></a>1.商品服务</h2><h3 id="1-1-三级分类"><a href="#1-1-三级分类" class="headerlink" title="1.1 三级分类"></a>1.1 三级分类</h3><h4 id="1-1-1-查询-递归树形结构数据获取"><a href="#1-1-1-查询-递归树形结构数据获取" class="headerlink" title="1.1.1 查询-递归树形结构数据获取"></a>1.1.1 查询-递归树形结构数据获取</h4><p><strong>controller</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 查询所有的分类以及子分类,以树形结构组装起来</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@RequestMapping(&quot;/list/tree&quot;)</span></span><br><span class="line"> <span class="keyword">public</span> R <span class="title function_">list</span><span class="params">()</span>&#123;</span><br><span class="line"> List&lt;CategoryEntity&gt; entities = categoryService.listWithTree();</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">&quot;data&quot;</span>, entities);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p><strong>service</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.product.service.impl;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.annotation.Autowired;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Service;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.List;</span><br><span class="line"><span class="keyword">import</span> java.util.Map;</span><br><span class="line"><span class="keyword">import</span> java.util.stream.Collectors;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.core.metadata.IPage;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.common.utils.PageUtils;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.common.utils.Query;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.atguigu.gulimall.product.dao.CategoryDao;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.gulimall.product.entity.CategoryEntity;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.gulimall.product.service.CategoryService;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">@Service(&quot;categoryService&quot;)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">CategoryServiceImpl</span> <span class="keyword">extends</span> <span class="title class_">ServiceImpl</span>&lt;CategoryDao, CategoryEntity&gt; <span class="keyword">implements</span> <span class="title class_">CategoryService</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="keyword">private</span> CategoryDao categoryDao;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">queryPage</span><span class="params">(Map&lt;String, Object&gt; params)</span> &#123;</span><br><span class="line"> IPage&lt;CategoryEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;CategoryEntity&gt;().getPage(params),</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">QueryWrapper</span>&lt;CategoryEntity&gt;()</span><br><span class="line"> );</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 查询所有分类,以树形结构显示</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> List&lt;CategoryEntity&gt; <span class="title function_">listWithTree</span><span class="params">()</span> &#123;</span><br><span class="line"> <span class="comment">//查出所有的分类</span></span><br><span class="line"> List&lt;CategoryEntity&gt; entities = categoryDao.selectList(<span class="literal">null</span>);</span><br><span class="line"> <span class="comment">//组装成父子的树形结构</span></span><br><span class="line"> <span class="comment">//找到所有的一级分类</span></span><br><span class="line"> List&lt;CategoryEntity&gt; level1List = entities.stream().filter(categoryEntity -&gt;</span><br><span class="line"> <span class="comment">//父级分类的id等于0的就是一级分类</span></span><br><span class="line"> categoryEntity.getParentCid() == <span class="number">0</span></span><br><span class="line"> ).map((menu) -&gt; &#123;</span><br><span class="line"> <span class="comment">//为当前分类的子分类赋值</span></span><br><span class="line"> menu.setChildren(getChildren(menu, entities));</span><br><span class="line"> <span class="keyword">return</span> menu;</span><br><span class="line"> &#125;).sorted((menu1, menu2) -&gt; &#123;</span><br><span class="line"> <span class="comment">//排序</span></span><br><span class="line"> <span class="keyword">return</span> (menu1.getSort() == <span class="literal">null</span> ? <span class="number">0</span> : menu1.getSort()) - (menu2.getSort() == <span class="literal">null</span> ? <span class="number">0</span> : menu2.getSort());</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> level1List;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 递归查询所有菜单的子菜单</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> root 当前分类</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> all 所有的分类数据</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 子菜单的集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> List&lt;CategoryEntity&gt; <span class="title function_">getChildren</span><span class="params">(CategoryEntity root, List&lt;CategoryEntity&gt; all)</span> &#123;</span><br><span class="line"> List&lt;CategoryEntity&gt; children = all.stream().filter(categoryEntity -&gt; &#123;</span><br><span class="line"> <span class="keyword">return</span> categoryEntity.getParentCid().equals(root.getCatId());</span><br><span class="line"> &#125;).map(categoryEntity -&gt; &#123;</span><br><span class="line"> <span class="comment">//1.递归找子菜单</span></span><br><span class="line"> categoryEntity.setChildren(getChildren(categoryEntity, all));</span><br><span class="line"> <span class="keyword">return</span> categoryEntity;</span><br><span class="line"> &#125;).sorted((menu1, menu2) -&gt; &#123;</span><br><span class="line"> <span class="comment">//2.菜单的排序</span></span><br><span class="line"> <span class="keyword">return</span> (menu1.getSort() == <span class="literal">null</span> ? <span class="number">0</span> : menu1.getSort()) - (menu2.getSort() == <span class="literal">null</span> ? <span class="number">0</span> : menu2.getSort());</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> <span class="keyword">return</span> children;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="1-1-2-配置路由和网关和路径重写"><a href="#1-1-2-配置路由和网关和路径重写" class="headerlink" title="1.1.2 配置路由和网关和路径重写"></a>1.1.2 配置路由和网关和路径重写</h4><p>前端访问的地址</p>
<p><img src="/pictures/image-20230529170214769.png" alt="image-20230529170214769"></p>
<p>前端代码中的配置</p>
<p><img src="/pictures/image-20230529170149102.png" alt="image-20230529170149102"></p>
<p>修改访问的基准路径统一访问网关再由网关做请求的转发转发到指定的服务中去renren-fast-vue\static\config\index.js文件</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 开发环境</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line">;(<span class="keyword">function</span> (<span class="params"></span>) &#123;</span><br><span class="line"> <span class="variable language_">window</span>.<span class="property">SITE_CONFIG</span> = &#123;&#125;;</span><br><span class="line"></span><br><span class="line"> <span class="comment">// api接口请求地址</span></span><br><span class="line"> <span class="variable language_">window</span>.<span class="property">SITE_CONFIG</span>[<span class="string">&#x27;baseUrl&#x27;</span>] = <span class="string">&#x27;http://localhost:88&#x27;</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">// cdn地址 = 域名 + 版本号</span></span><br><span class="line"> <span class="variable language_">window</span>.<span class="property">SITE_CONFIG</span>[<span class="string">&#x27;domain&#x27;</span>] = <span class="string">&#x27;./&#x27;</span>; <span class="comment">// 域名</span></span><br><span class="line"> <span class="variable language_">window</span>.<span class="property">SITE_CONFIG</span>[<span class="string">&#x27;version&#x27;</span>] = <span class="string">&#x27;&#x27;</span>; <span class="comment">// 版本号(年月日时分)</span></span><br><span class="line"> <span class="variable language_">window</span>.<span class="property">SITE_CONFIG</span>[<span class="string">&#x27;cdnUrl&#x27;</span>] = <span class="variable language_">window</span>.<span class="property">SITE_CONFIG</span>.<span class="property">domain</span> + <span class="variable language_">window</span>.<span class="property">SITE_CONFIG</span>.<span class="property">version</span>;</span><br><span class="line">&#125;)();</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>将renren-fast注册到注册中心中去</p>
<p>修改pom.xml中的依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!-- 修改springBoot的版本 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">parent</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-parent<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">version</span>&gt;</span>2.2.6.RELEASE<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">relativePath</span>/&gt;</span> </span><br><span class="line"><span class="tag">&lt;/<span class="name">parent</span>&gt;</span></span><br><span class="line"><span class="comment">&lt;!-- 依赖common文件,获取nacos相关的注解 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.atguigu<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>gulimall-common<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">version</span>&gt;</span>1.0-SNAPSHOT<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>在启动类上添加@EnableDiscoveryClient注解在配置文件中添加上nacos地址的配置</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">cloud:</span></span><br><span class="line"> <span class="attr">nacos:</span></span><br><span class="line"> <span class="attr">discovery:</span></span><br><span class="line"> <span class="attr">server-addr:</span> <span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span><span class="string">:8848</span></span><br></pre></td></tr></table></figure>
<p>修改网关中的断言,让前台的请求转发到正确的路径上</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">cloud:</span></span><br><span class="line"> <span class="attr">gateway:</span></span><br><span class="line"> <span class="attr">routes:</span></span><br><span class="line"> <span class="comment"># 路由的唯一id</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">id:</span> <span class="string">admin_route</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">lb://renren-fast</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Path=/api/**</span></span><br><span class="line"> <span class="comment"># 路径重写</span></span><br><span class="line"> <span class="attr">filters:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">RewritePath=/api/(?&lt;segment&gt;.*),/renren-fast/$\&#123;segment&#125;</span></span><br><span class="line"><span class="comment"># 前端项目中的基准路径 http://localhost:88/api</span></span><br><span class="line"><span class="comment"># http://localhost:88/api/captcha.jpg 路径重写为 http://localhost:8080/renren-fast/captcha.jpg</span></span><br></pre></td></tr></table></figure>
<p>解决登录的时候的跨域问题</p>
<p>浏览器中的跨域的报错信息</p>
<p><img src="/pictures/image-20230530111856491.png" alt="image-20230530111856491"></p>
<p>跨域问题的介绍</p>
<p><img src="/pictures/image-20230530112115261.png" alt="image-20230530112115261"></p>
<p> 跨域流程</p>
<p><a target="_blank" rel="noopener" href="https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CORS">文档介绍</a></p>
<p><img src="/pictures/image-20230530112630678.png" alt="image-20230530112630678"></p>
<p>跨域的解决方案</p>
<ol>
<li>使用nginx部署为同一域</li>
<li>配置当前请求允许跨域 (在网关中通过过滤器给请求添加响应头)</li>
</ol>
<p>跨域的配置</p>
<p>添加跨域的配置类</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.eatguigu.gulimall.gateway.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.Bean;</span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.Configuration;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.cors.CorsConfiguration;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.cors.reactive.CorsWebFilter;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> GongChangjiang</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/5/30</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 跨域配置类</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Configuration</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">CorsConfig</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Bean</span></span><br><span class="line"> <span class="keyword">public</span> CorsWebFilter <span class="title function_">corsWebFilter</span><span class="params">()</span>&#123;</span><br><span class="line"> <span class="type">UrlBasedCorsConfigurationSource</span> <span class="variable">source</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">UrlBasedCorsConfigurationSource</span>();</span><br><span class="line"> <span class="type">CorsConfiguration</span> <span class="variable">corsConfiguration</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">CorsConfiguration</span>();</span><br><span class="line"> <span class="comment">//1.配置跨域</span></span><br><span class="line"> <span class="comment">//允许所有的请求头跨域</span></span><br><span class="line"> corsConfiguration.addAllowedHeader(<span class="string">&quot;*&quot;</span>);</span><br><span class="line"> <span class="comment">//允许所有的请求方式跨域</span></span><br><span class="line"> corsConfiguration.addAllowedMethod(<span class="string">&quot;*&quot;</span>);</span><br><span class="line"> <span class="comment">//任意请求来源都可以跨域</span></span><br><span class="line"> <span class="comment">//corsConfiguration.addAllowedOrigin(&quot;*&quot;); 老版本的springBoot使用这个新版本的使用下面这个</span></span><br><span class="line"> corsConfiguration.addAllowedOriginPattern(<span class="string">&quot;*&quot;</span>);</span><br><span class="line"> <span class="comment">//允许携带cookie跨域</span></span><br><span class="line"> corsConfiguration.setAllowCredentials(<span class="literal">true</span>);</span><br><span class="line"> source.registerCorsConfiguration(<span class="string">&quot;/**&quot;</span>,corsConfiguration);</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">CorsWebFilter</span>(source);</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>注掉renren-fast工程中的跨域配置避免产生两次跨域的问题</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * Copyright (c) 2016-2019 人人开源 All rights reserved.</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * https://www.renren.io</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * 版权所有,侵权必究!</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">package</span> io.renren.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.Configuration;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.servlet.config.annotation.CorsRegistry;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.servlet.config.annotation.WebMvcConfigurer;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Configuration</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">CorsConfig</span> <span class="keyword">implements</span> <span class="title class_">WebMvcConfigurer</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">// @Override</span></span><br><span class="line"><span class="comment">// public void addCorsMappings(CorsRegistry registry) &#123;</span></span><br><span class="line"><span class="comment">// registry.addMapping(&quot;/**&quot;)</span></span><br><span class="line"><span class="comment">// .allowedOrigins(&quot;*&quot;)</span></span><br><span class="line"><span class="comment">// .allowCredentials(true)</span></span><br><span class="line"><span class="comment">// .allowedMethods(&quot;GET&quot;, &quot;POST&quot;, &quot;PUT&quot;, &quot;DELETE&quot;, &quot;OPTIONS&quot;)</span></span><br><span class="line"><span class="comment">// .maxAge(3600);</span></span><br><span class="line"><span class="comment">// &#125;</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>再次测试,成功的进入后台管理系统</p>
<h4 id="1-2-3-查询-页面中树形显示"><a href="#1-2-3-查询-页面中树形显示" class="headerlink" title="1.2.3 查询-页面中树形显示"></a>1.2.3 查询-页面中树形显示</h4><p><strong>新增一个商品系统的目录,并在该目录下创建一个分类维护的二级分类</strong></p>
<p>1.添加一个一级分类</p>
<p><img src="/pictures/image-20230529161308671.png" alt="image-20230529161308671"></p>
<p><img src="/pictures/image-20230529161317694.png" alt="image-20230529161317694"></p>
<p>2.在商品系统的一级分类下添加一个分类维护的二级分类</p>
<p><img src="/pictures/image-20230529161648257.png" alt="image-20230529161648257"></p>
<p>3.路径的问题</p>
<p><img src="/pictures/image-20230529162235482.png" alt="image-20230529162235482"></p>
<p>4.路径与文件的对应关系</p>
<p><img src="/pictures/image-20230529162946584.png" alt="image-20230529162946584"></p>
<p>5.发送请求的示例</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;div&gt;</span><br><span class="line"> &lt;!-- 树形控件 --&gt;</span><br><span class="line"> &lt;el-tree</span><br><span class="line"> :data=&quot;data&quot;</span><br><span class="line"> :props=&quot;defaultProps&quot;</span><br><span class="line"> @node-click=&quot;handleNodeClick&quot;</span><br><span class="line"> &gt;&lt;/el-tree&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">export default &#123;</span><br><span class="line"> //定义变量</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> data: [],</span><br><span class="line"> defaultProps: &#123;</span><br><span class="line"> children: &quot;children&quot;,</span><br><span class="line"> label: &quot;label&quot;,</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() &#123;</span><br><span class="line"> this.getMenus();</span><br><span class="line"> &#125;,</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: &#123;</span><br><span class="line"> handleNodeClick(data) &#123;</span><br><span class="line"> console.log(data);</span><br><span class="line"> &#125;,</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() &#123;</span><br><span class="line"> //正式的发送请求</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/list/tree&quot;),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> console.log(data);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line">&lt;style&gt;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p>6.树形显示商品的分类信息</p>
<p>前端修改网关商品模块的路由(注意:匹配精确的路由放在模糊的路由的上面)</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">cloud:</span></span><br><span class="line"> <span class="attr">gateway:</span></span><br><span class="line"> <span class="attr">routes:</span></span><br><span class="line"> <span class="comment">#这个路由精确一些,放在上面,避免被下面模糊的路由吞掉</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">id:</span> <span class="string">product_route</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">lb://gulimall-product</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Path=/api/product/**</span></span><br><span class="line"> <span class="attr">filters:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">RewritePath=/api/(?&lt;segment&gt;.*),/$\&#123;segment&#125;</span></span><br><span class="line"> </span><br><span class="line"> <span class="comment"># 路由的唯一id</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">id:</span> <span class="string">admin_route</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">lb://renren-fast</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Path=/api/**</span></span><br><span class="line"> <span class="comment"># 路径重写</span></span><br><span class="line"> <span class="attr">filters:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">RewritePath=/api/(?&lt;segment&gt;.*),/renren-fast/$\&#123;segment&#125;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 前端项目中的基准路径 http://localhost:88/api</span></span><br><span class="line"><span class="comment"># http://localhost:88/api/captcha.jpg 路径重写为 http://localhost:8080/renren-fast/captcha.jpg</span></span><br></pre></td></tr></table></figure>
<p>前端发送请求,正确地获取数据</p>
<p><img src="/pictures/image-20230530172846989.png" alt="image-20230530172846989"></p>
<p>在页面上显示数据</p>
<p>Element的配置</p>
<p><img src="/pictures/image-20230530173658950.png" alt="image-20230530173658950"></p>
<p>前端代码</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;div&gt;</span><br><span class="line"> &lt;!-- 树形控件 --&gt;</span><br><span class="line"> &lt;el-tree</span><br><span class="line"> :data=&quot;menus&quot;</span><br><span class="line"> :props=&quot;defaultProps&quot;</span><br><span class="line"> @node-click=&quot;handleNodeClick&quot;</span><br><span class="line"> &gt;&lt;/el-tree&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">export default &#123;</span><br><span class="line"> //定义变量</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> menus: [],</span><br><span class="line"> defaultProps: &#123;//这里的配置看官方的文档</span><br><span class="line"> children: &quot;children&quot;,//父节点上的子节点</span><br><span class="line"> label: &quot;name&quot;,//每个对象要显示的属性值,比如我们当前要显示商品分类中的分类名的值这里就改成name</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() &#123;</span><br><span class="line"> //调用获取商品分类数据的方法</span><br><span class="line"> this.getMenus();</span><br><span class="line"> &#125;,</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: &#123;</span><br><span class="line"> handleNodeClick(data) &#123;</span><br><span class="line"> console.log(data);</span><br><span class="line"> &#125;,</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/list/tree&quot;),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line"></span><br><span class="line">&lt;style&gt;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p>显示的效果</p>
<p><img src="/pictures/image-20230530173801824.png" alt="image-20230530173801824"></p>
<h4 id="1-2-4-删除-删除商品分类"><a href="#1-2-4-删除-删除商品分类" class="headerlink" title="1.2.4 删除-删除商品分类"></a>1.2.4 删除-删除商品分类</h4><p>前端页面修改</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;!-- 树形控件--&gt;</span><br><span class="line"> &lt;!-- :expand-on-click-node=&quot;false&quot;设置为点击箭头的时候才会展开,避免点击删除的按钮的时候展开 --&gt;</span><br><span class="line"> &lt;!-- show-checkbox表示开启选择框批量选择--&gt;</span><br><span class="line"> &lt;!-- node-key表示在整个树中唯一的表示 --&gt;</span><br><span class="line"> &lt;el-tree</span><br><span class="line"> :data=&quot;menus&quot;</span><br><span class="line"> :props=&quot;defaultProps&quot;</span><br><span class="line"> :expand-on-click-node=&quot;false&quot;</span><br><span class="line"> show-checkbox</span><br><span class="line"> node-key=&quot;catId&quot;</span><br><span class="line"> :default-expanded-keys=&quot;expandedKey&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;span class=&quot;custom-tree-node&quot; slot-scope=&quot;&#123; node, data &#125;&quot;&gt;</span><br><span class="line"> &lt;span&gt;&#123;&#123; node.label &#125;&#125;&lt;/span&gt;</span><br><span class="line"> &lt;span&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;node.level &lt;= 2&quot;</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;mini&quot;</span><br><span class="line"> @click=&quot;() =&gt; append(data)&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> 添加</span><br><span class="line"> &lt;/el-button&gt;</span><br><span class="line"> &lt;!-- 添加判断,没有下一级节点的时候就显示删除的按钮 --&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;data.children.length &lt;= 0&quot;</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;mini&quot;</span><br><span class="line"> @click=&quot;() =&gt; remove(node, data)&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> 删除</span><br><span class="line"> &lt;/el-button&gt;</span><br><span class="line"> &lt;/span&gt;</span><br><span class="line"> &lt;/span&gt;&lt;/el-tree</span><br><span class="line"> &gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">export default &#123;</span><br><span class="line"> //定义变量</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> menus: [],</span><br><span class="line"> defaultProps: &#123;</span><br><span class="line"> //这里的配置看官方的文档</span><br><span class="line"> children: &quot;children&quot;, //父节点上的子节点</span><br><span class="line"> label: &quot;name&quot;, //每个对象要显示的属性值,比如我们当前要显示商品分类中的分类名的值这里就改成name</span><br><span class="line"> &#125;,</span><br><span class="line"> expandedKey:[] //需要展开的数组,用于删除之后树形控件仍然展开</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() &#123;</span><br><span class="line"> //调用获取商品分类数据的方法</span><br><span class="line"> this.getMenus();</span><br><span class="line"> &#125;,</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: &#123;</span><br><span class="line"> append(data) &#123;</span><br><span class="line"> console.log(&quot;append: &quot;, data);</span><br><span class="line"> &#125;,</span><br><span class="line"> //删除节点的方法</span><br><span class="line"> remove(node, data) &#123;</span><br><span class="line"> var ids = [data.catId];</span><br><span class="line"> this.$confirm(`是否要删除[$&#123;data.name&#125;]菜单?`, &quot;提示&quot;, &#123;</span><br><span class="line"> confirmButtonText: &quot;确定&quot;,</span><br><span class="line"> cancelButtonText: &quot;取消&quot;,</span><br><span class="line"> type: &quot;warning&quot;,</span><br><span class="line"> &#125;)</span><br><span class="line"> .then(() =&gt; &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/delete&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;菜单删除成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> //刷新一下页面</span><br><span class="line"> this.getMenus();</span><br><span class="line"> //设置需要默认展开的菜单(依然展开刚才删除的节点)</span><br><span class="line"> this.expandedKey = [node.parent.data.catId]</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;)</span><br><span class="line"> .catch(() =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> type: &quot;info&quot;,</span><br><span class="line"> message: &quot;已取消删除&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/list/tree&quot;),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line"></span><br><span class="line">&lt;style&gt;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p><strong>配置逻辑删除</strong></p>
<p>配置全局的逻辑删除规则</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">mybatis-plus:</span></span><br><span class="line"> <span class="attr">global-config:</span></span><br><span class="line"> <span class="attr">db-config:</span></span><br><span class="line"> <span class="attr">logic-delete-value:</span> <span class="number">1</span> <span class="comment"># 逻辑已删除值(默认为 1)</span></span><br><span class="line"> <span class="attr">logic-not-delete-value:</span> <span class="number">0</span> <span class="comment"># 逻辑未删除值(默认为 0)</span></span><br></pre></td></tr></table></figure>
<p>在showStatus上添加上逻辑删除的注解</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@TableLogic(value = &quot;1&quot;,delval = &quot;0&quot;)</span></span><br></pre></td></tr></table></figure>
<p>后端代码的实现</p>
<p>controlller</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 删除</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@RequestMapping(&quot;/delete&quot;)</span></span><br><span class="line"><span class="comment">//@RequiresPermissions(&quot;product:category:delete&quot;)</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">delete</span><span class="params">(<span class="meta">@RequestBody</span> Long[] catIds)</span> &#123;</span><br><span class="line"> <span class="comment">//检查当前删除的菜单,是否被别的地方引用</span></span><br><span class="line"> <span class="comment">//categoryService.removeByIds(Arrays.asList(catIds));</span></span><br><span class="line"> categoryService.removeMenuByIds(Arrays.asList(catIds));</span><br><span class="line"> <span class="keyword">return</span> R.ok();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>service 这里后面需要优化</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 删除分类的方法</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> list 分类id的集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">removeMenuByIds</span><span class="params">(List&lt;Long&gt; list)</span> &#123;</span><br><span class="line"> <span class="comment">//TODO 检查当前删除的菜单是否被其他的地方引用 后面优化</span></span><br><span class="line"> <span class="comment">//逻辑删除</span></span><br><span class="line"> categoryDao.deleteBatchIds(list);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="1-2-5-添加-添加商品分类"><a href="#1-2-5-添加-添加商品分类" class="headerlink" title="1.2.5 添加-添加商品分类"></a>1.2.5 添加-添加商品分类</h4><p>前端代码</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;div&gt;</span><br><span class="line"> &lt;!-- 树形控件--&gt;</span><br><span class="line"> &lt;!-- :expand-on-click-node=&quot;false&quot;设置为点击箭头的时候才会展开,避免点击删除的按钮的时候展开 --&gt;</span><br><span class="line"> &lt;!-- show-checkbox表示开启选择框批量选择--&gt;</span><br><span class="line"> &lt;!-- node-key表示在整个树中唯一的表示 --&gt;</span><br><span class="line"> &lt;el-tree</span><br><span class="line"> :data=&quot;menus&quot;</span><br><span class="line"> :props=&quot;defaultProps&quot;</span><br><span class="line"> :expand-on-click-node=&quot;false&quot;</span><br><span class="line"> show-checkbox</span><br><span class="line"> node-key=&quot;catId&quot;</span><br><span class="line"> :default-expanded-keys=&quot;expandedKey&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;span class=&quot;custom-tree-node&quot; slot-scope=&quot;&#123; node, data &#125;&quot;&gt;</span><br><span class="line"> &lt;span&gt;&#123;&#123; node.label &#125;&#125;&lt;/span&gt;</span><br><span class="line"> &lt;span&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;node.level &lt;= 2&quot;</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;mini&quot;</span><br><span class="line"> @click=&quot;() =&gt; append(data)&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> 添加</span><br><span class="line"> &lt;/el-button&gt;</span><br><span class="line"> &lt;!-- 添加判断,没有下一级节点的时候就显示删除的按钮 --&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;data.children.length &lt;= 0&quot;</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;mini&quot;</span><br><span class="line"> @click=&quot;() =&gt; remove(node, data)&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> 删除</span><br><span class="line"> &lt;/el-button&gt;</span><br><span class="line"> &lt;/span&gt;</span><br><span class="line"> &lt;/span&gt;&lt;/el-tree</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;!-- 添加分类的时候弹出的对话框 --&gt;</span><br><span class="line"> &lt;el-dialog title=&quot;提示&quot; :visible.sync=&quot;dialogVisible&quot; width=&quot;30%&quot;&gt;</span><br><span class="line"> &lt;el-form :model=&quot;category&quot;&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;分类名称&quot;&gt;</span><br><span class="line"> &lt;el-input v-model=&quot;category.name&quot; autocomplete=&quot;off&quot;&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;/el-form&gt;</span><br><span class="line"> &lt;span slot=&quot;footer&quot; class=&quot;dialog-footer&quot;&gt;</span><br><span class="line"> &lt;el-button @click=&quot;dialogVisible = false&quot;&gt;取 消&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button type=&quot;primary&quot; @click=&quot;addCategory&quot;&gt;确 定&lt;/el-button&gt;</span><br><span class="line"> &lt;/span&gt;</span><br><span class="line"> &lt;/el-dialog&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">export default &#123;</span><br><span class="line"> //定义变量</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> menus: [],</span><br><span class="line"> defaultProps: &#123;</span><br><span class="line"> //这里的配置看官方的文档</span><br><span class="line"> children: &quot;children&quot;, //父节点上的子节点</span><br><span class="line"> label: &quot;name&quot;, //每个对象要显示的属性值,比如我们当前要显示商品分类中的分类名的值这里就改成name</span><br><span class="line"> &#125;,</span><br><span class="line"> expandedKey: [], //需要展开的数组,用于删除之后树形控件仍然展开</span><br><span class="line"> dialogVisible: false, //添加菜单的对话框的开启或者关闭</span><br><span class="line"> //表单绑定的对象</span><br><span class="line"> category: &#123;</span><br><span class="line"> name: &quot;&quot;, //分类的名称</span><br><span class="line"> parentCid: 0, //父类的id</span><br><span class="line"> catLevel: 0, //分类的级别</span><br><span class="line"> showStatus: 1, //是否显示该分类</span><br><span class="line"> sort: 0, //排序</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() &#123;</span><br><span class="line"> //调用获取商品分类数据的方法</span><br><span class="line"> this.getMenus();</span><br><span class="line"> &#125;,</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: &#123;</span><br><span class="line"> //添加分类(弹出的对话框确定按钮执行的方法)</span><br><span class="line"> addCategory() &#123;</span><br><span class="line"> console.log(&quot;提交的数据:&quot;, this.category);</span><br><span class="line"> //将添加的数据返回给后端</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/save&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(this.category, false),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;菜单添加成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> //刷新一下页面</span><br><span class="line"> this.getMenus()</span><br><span class="line"> //设置需要默认展开的菜单(依然展开刚才添加的节点)</span><br><span class="line"> this.expandedKey = [this.category.parentCid];</span><br><span class="line"> &#125;);</span><br><span class="line"> //关闭对话框</span><br><span class="line"> this.dialogVisible = false;</span><br><span class="line"> &#125;,</span><br><span class="line"> //添加分类的方法</span><br><span class="line"> append(data) &#123;</span><br><span class="line"> //清空一下表单的数据</span><br><span class="line"> this.category.name = &quot;&quot;;</span><br><span class="line"> //打开添加的对话框</span><br><span class="line"> this.dialogVisible = true;</span><br><span class="line"> //为分类的对象赋值</span><br><span class="line"> this.category.parentCid = data.catId;</span><br><span class="line"> this.category.catLevel = data.catLevel * 1 + 1; //防止catLevel是一个字符串</span><br><span class="line"> &#125;,</span><br><span class="line"> //删除节点的方法</span><br><span class="line"> remove(node, data) &#123;</span><br><span class="line"> var ids = [data.catId];</span><br><span class="line"> this.$confirm(`是否要删除[$&#123;data.name&#125;]菜单?`, &quot;提示&quot;, &#123;</span><br><span class="line"> confirmButtonText: &quot;确定&quot;,</span><br><span class="line"> cancelButtonText: &quot;取消&quot;,</span><br><span class="line"> type: &quot;warning&quot;,</span><br><span class="line"> &#125;)</span><br><span class="line"> .then(() =&gt; &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/delete&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;菜单删除成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> //刷新一下页面</span><br><span class="line"> this.getMenus();</span><br><span class="line"> //设置需要默认展开的菜单(依然展开刚才删除的节点)</span><br><span class="line"> this.expandedKey = [node.parent.data.catId];</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;)</span><br><span class="line"> .catch(() =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> type: &quot;info&quot;,</span><br><span class="line"> message: &quot;已取消删除&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/list/tree&quot;),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line"></span><br><span class="line">&lt;style&gt;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p>后端代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 保存</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@RequestMapping(&quot;/save&quot;)</span></span><br><span class="line"><span class="comment">//@RequiresPermissions(&quot;product:category:save&quot;)</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">save</span><span class="params">(<span class="meta">@RequestBody</span> CategoryEntity category)</span> &#123;</span><br><span class="line"> categoryService.save(category);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> R.ok();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>实现的效果</p>
<p><img src="/pictures/image-20230605163004850.png" alt="image-20230605163004850"></p>
<h4 id="1-2-6-修改-修改商品的分类"><a href="#1-2-6-修改-修改商品的分类" class="headerlink" title="1.2.6 修改-修改商品的分类"></a>1.2.6 修改-修改商品的分类</h4><p>前端的代码(太复杂了,没有写完)</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;div&gt;</span><br><span class="line"> &lt;!-- 树形控件--&gt;</span><br><span class="line"> &lt;!-- :expand-on-click-node=&quot;false&quot;设置为点击箭头的时候才会展开,避免点击删除的按钮的时候展开 --&gt;</span><br><span class="line"> &lt;!-- show-checkbox表示开启选择框批量选择--&gt;</span><br><span class="line"> &lt;!-- node-key表示在整个树中唯一的表示 --&gt;</span><br><span class="line"> &lt;!-- draggable 实现节点自由拖拽的效果 --&gt;</span><br><span class="line"> &lt;el-tree</span><br><span class="line"> :data=&quot;menus&quot;</span><br><span class="line"> :props=&quot;defaultProps&quot;</span><br><span class="line"> :expand-on-click-node=&quot;false&quot;</span><br><span class="line"> show-checkbox</span><br><span class="line"> node-key=&quot;catId&quot;</span><br><span class="line"> :default-expanded-keys=&quot;expandedKey&quot;</span><br><span class="line"> draggable</span><br><span class="line"> :allow-drop=&quot;allowDrop&quot;</span><br><span class="line"> @node-drop=&quot;handleDrop&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;span class=&quot;custom-tree-node&quot; slot-scope=&quot;&#123; node, data &#125;&quot;&gt;</span><br><span class="line"> &lt;span&gt;&#123;&#123; node.label &#125;&#125;&lt;/span&gt;</span><br><span class="line"> &lt;span&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;node.level &lt;= 2&quot;</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;mini&quot;</span><br><span class="line"> @click=&quot;() =&gt; append(data)&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> 添加</span><br><span class="line"> &lt;/el-button&gt;</span><br><span class="line"> &lt;el-button type=&quot;text&quot; size=&quot;mini&quot; @click=&quot;() =&gt; edit(data)&quot;&gt;</span><br><span class="line"> 修改</span><br><span class="line"> &lt;/el-button&gt;</span><br><span class="line"> &lt;!-- 添加判断,没有下一级节点的时候就显示删除的按钮 --&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;data.children.length &lt;= 0&quot;</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;mini&quot;</span><br><span class="line"> @click=&quot;() =&gt; remove(node, data)&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> 删除</span><br><span class="line"> &lt;/el-button&gt;</span><br><span class="line"> &lt;/span&gt;</span><br><span class="line"> &lt;/span&gt;&lt;/el-tree</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;!-- 添加分类的时候弹出的对话框 --&gt;</span><br><span class="line"> &lt;el-dialog</span><br><span class="line"> :title=&quot;title&quot;</span><br><span class="line"> :visible.sync=&quot;dialogVisible&quot;</span><br><span class="line"> width=&quot;30%&quot;</span><br><span class="line"> :close-on-click-modal=&quot;false&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-form :model=&quot;category&quot;&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;分类名称&quot;&gt;</span><br><span class="line"> &lt;el-input v-model=&quot;category.name&quot; autocomplete=&quot;off&quot;&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;图标&quot;&gt;</span><br><span class="line"> &lt;el-input v-model=&quot;category.icon&quot; autocomplete=&quot;off&quot;&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;计量单位&quot;&gt;</span><br><span class="line"> &lt;el-input</span><br><span class="line"> v-model=&quot;category.productUnit&quot;</span><br><span class="line"> autocomplete=&quot;off&quot;</span><br><span class="line"> &gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;/el-form&gt;</span><br><span class="line"> &lt;span slot=&quot;footer&quot; class=&quot;dialog-footer&quot;&gt;</span><br><span class="line"> &lt;el-button @click=&quot;dialogVisible = false&quot;&gt;取 消&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button type=&quot;primary&quot; @click=&quot;submitDate&quot;&gt;确 定&lt;/el-button&gt;</span><br><span class="line"> &lt;/span&gt;</span><br><span class="line"> &lt;/el-dialog&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">export default &#123;</span><br><span class="line"> //定义变量</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> updateNodes: [], //经过修改之后的节点的信息</span><br><span class="line"> maxLevel: 0, //最大的层级</span><br><span class="line"> title: &quot;&quot;, //弹出框的提示信息</span><br><span class="line"> dialogType: &quot;&quot;, //弹出的对话框的类型 edit/add</span><br><span class="line"> menus: [],</span><br><span class="line"> defaultProps: &#123;</span><br><span class="line"> //这里的配置看官方的文档</span><br><span class="line"> children: &quot;children&quot;, //父节点上的子节点</span><br><span class="line"> label: &quot;name&quot;, //每个对象要显示的属性值,比如我们当前要显示商品分类中的分类名的值这里就改成name</span><br><span class="line"> &#125;,</span><br><span class="line"> expandedKey: [], //需要展开的数组,用于删除之后树形控件仍然展开</span><br><span class="line"> dialogVisible: false, //添加菜单的对话框的开启或者关闭</span><br><span class="line"> //表单绑定的对象</span><br><span class="line"> category: &#123;</span><br><span class="line"> name: &quot;&quot;, //分类的名称</span><br><span class="line"> parentCid: 0, //父类的id</span><br><span class="line"> catLevel: 0, //分类的级别</span><br><span class="line"> showStatus: 1, //是否显示该分类</span><br><span class="line"> sort: 0, //排序</span><br><span class="line"> catId: null, //分类的id信息</span><br><span class="line"> icon: &quot;&quot;, //商品分类的图标</span><br><span class="line"> productUnit: &quot;&quot;, //计量单位</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> //钩子函数</span><br><span class="line"> created() &#123;</span><br><span class="line"> //调用获取商品分类数据的方法</span><br><span class="line"> this.getMenus();</span><br><span class="line"> &#125;,</span><br><span class="line"></span><br><span class="line"> //方法</span><br><span class="line"> methods: &#123;</span><br><span class="line"> //拖拽成功之后调用这个函数进行回调的处理</span><br><span class="line"> handleDrop(draggingNode, dropNode, dropType, ev) &#123;</span><br><span class="line"> console.log(&quot;handleDrop: &quot;, draggingNode, dropNode, dropType);</span><br><span class="line"> //当前的节点的最新父节点id</span><br><span class="line"> let pCid = 0; //当前节点的组最新父节点id</span><br><span class="line"> let siblings = null; //当前的节点的兄弟节点</span><br><span class="line"> //判断的节点的进入的方式</span><br><span class="line"> if (dropType == &quot;before&quot; || dropType == &quot;after&quot;) &#123;</span><br><span class="line"> pCid =</span><br><span class="line"> dropNode.parent.data.catId == undefined</span><br><span class="line"> ? 0</span><br><span class="line"> : dropNode.parent.data.catId;</span><br><span class="line"> siblings = dropNode.parent.childNodes;</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> pCid = dropNode.data.catId;</span><br><span class="line"> siblings = dropNode.childNodes;</span><br><span class="line"> &#125;</span><br><span class="line"> //当前的节点的最新的顺序</span><br><span class="line"> for (let i = 0; i &lt; siblings.length; i++) &#123;</span><br><span class="line"> if (siblings[i].data.catId == draggingNode.data.catId) &#123;</span><br><span class="line"> //如果当前遍历的是正在拖拽的节点</span><br><span class="line"> let catLevel = draggingNode.catLevel;</span><br><span class="line"> if (siblings[i].level != draggingNode.level) &#123;</span><br><span class="line"> //当前的节点的层级发生的变化</span><br><span class="line"> catLevel = siblings[i].level;</span><br><span class="line"> //修改子节点的层级</span><br><span class="line"> this.updateChildNodeLevel(siblings[i]);</span><br><span class="line"> &#125;</span><br><span class="line"> this.updateNodes.push(&#123;</span><br><span class="line"> catId: siblings[i].data.catId,</span><br><span class="line"> sort: i,</span><br><span class="line"> parentCid: pCid,</span><br><span class="line"> catLevel: catLevel,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.updateNodes.push(&#123; catId: siblings[i].data.catId, sort: i &#125;);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> //当前的拖拽节点的最新的层级</span><br><span class="line"> console.log(&quot;updateNodes:&quot;, this.updateNodes);</span><br><span class="line"> &#125;,</span><br><span class="line"> //递归修改子节点的层级</span><br><span class="line"> updateChildNodeLevel(node) &#123;</span><br><span class="line"> if ((node.childNodes, length &gt; 0)) &#123;</span><br><span class="line"> for (let i = 0; i &lt; node.childNodes.length; i++) &#123;</span><br><span class="line"> var cNode = node.childNodes[i].data;</span><br><span class="line"> this.updateNodes.push(&#123;</span><br><span class="line"> catId: cNode.catId,</span><br><span class="line"> catLevel: node.childNodes[i].level,</span><br><span class="line"> &#125;);</span><br><span class="line"> //递归调用</span><br><span class="line"> this.updateChildNodeLevel(node.childNodes[i]);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> //拖拽之后节点的位置的判断 是否的可以放在该位置上面</span><br><span class="line"> allowDrop(draggingNode, dropNode, type) &#123;</span><br><span class="line"> //判断被拖动的当前节点以及所在的父节点的总层数不能大于三</span><br><span class="line"> //被拖动的当前节点的总层数</span><br><span class="line"> console.log(&quot;allowDrop:&quot;, draggingNode, dropNode, type);</span><br><span class="line"> //获取当前节点的总层数</span><br><span class="line"> this.countNodeLevel(draggingNode.data);</span><br><span class="line"> let deep = this.maxLevel - draggingNode.data.catLevel + 1;</span><br><span class="line"> console.log(&quot;深度:&quot;, deep);</span><br><span class="line"> if ((type = &quot;inner&quot;)) &#123;</span><br><span class="line"> return deep + dropNode.level &lt;= 3;</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> return deep + dropNode.parent.level &lt;= 3;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> //统计当前的节点的总层数</span><br><span class="line"> countNodeLevel(node) &#123;</span><br><span class="line"> //找到所有子节点 求出最大深度</span><br><span class="line"> if (node.children != null &amp;&amp; node.children.length &gt; 0) &#123;</span><br><span class="line"> for (let i = 0; i &lt; node.children.length; i++) &#123;</span><br><span class="line"> if (node.children[i].catLevel &gt; this.maxLevel) &#123;</span><br><span class="line"> this.maxLevel = node.children[i].catLevel;</span><br><span class="line"> &#125;</span><br><span class="line"> //递归一下</span><br><span class="line"> this.countNodeLevel(node.children[i]);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> //弹出修改的对话框,并做数据的回显</span><br><span class="line"> edit(data) &#123;</span><br><span class="line"> //修改的title</span><br><span class="line"> this.title = &quot;修改分类&quot;;</span><br><span class="line"> //设置弹出的对话框为修改的类型</span><br><span class="line"> this.dialogType = &quot;edit&quot;;</span><br><span class="line"> //发送请求回显数据</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(`/product/category/info/$&#123;data.catId&#125;`),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> //请求成功 回显数据</span><br><span class="line"> console.log(&quot;回显的数据:&quot;, data);</span><br><span class="line"> this.category.name = data.data.name;</span><br><span class="line"> this.category.catId = data.data.catId;</span><br><span class="line"> this.category.icon = data.data.icon;</span><br><span class="line"> this.category.productUnit = data.data.productUnit;</span><br><span class="line"> this.category.parentCid = data.data.parentCid;</span><br><span class="line"> &#125;);</span><br><span class="line"> //弹出对话框</span><br><span class="line"> this.dialogVisible = true;</span><br><span class="line"> &#125;,</span><br><span class="line"> //保存或者添加数据</span><br><span class="line"> submitDate() &#123;</span><br><span class="line"> if (this.dialogType == &quot;add&quot;) &#123;</span><br><span class="line"> //调用添加的方法</span><br><span class="line"> this.addCategory();</span><br><span class="line"> &#125;</span><br><span class="line"> if (this.dialogType == &quot;edit&quot;) &#123;</span><br><span class="line"> //修改的方法</span><br><span class="line"> this.editCategory();</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> //修改商品的分类信息</span><br><span class="line"> editCategory() &#123;</span><br><span class="line"> //只发送我们要修改的数据</span><br><span class="line"> var &#123; catId, name, icon, productUnit &#125; = this.category;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/update&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(&#123; catId, name, icon, productUnit &#125;, false),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;分类修改成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> //关闭弹出框</span><br><span class="line"> this.dialogVisible = false;</span><br><span class="line"> //刷新一下表单</span><br><span class="line"> this.getMenus();</span><br><span class="line"> //设置默认展开的菜单</span><br><span class="line"> this.expandedKey = [this.category.parentCid];</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> //添加分类(弹出的对话框确定按钮执行的方法)</span><br><span class="line"> addCategory() &#123;</span><br><span class="line"> console.log(&quot;提交的数据:&quot;, this.category);</span><br><span class="line"> //将添加的数据返回给后端</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/save&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(this.category, false),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;分类添加成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> //刷新一下页面</span><br><span class="line"> this.getMenus();</span><br><span class="line"> //设置需要默认展开的菜单(依然展开刚才添加的节点)</span><br><span class="line"> this.expandedKey = [this.category.parentCid];</span><br><span class="line"> &#125;);</span><br><span class="line"> //关闭对话框</span><br><span class="line"> this.dialogVisible = false;</span><br><span class="line"> &#125;,</span><br><span class="line"> //添加分类的方法</span><br><span class="line"> append(data) &#123;</span><br><span class="line"> //添加的title</span><br><span class="line"> this.title = &quot;添加分类&quot;;</span><br><span class="line"> //设置当前提交的对话框为添加的对话框</span><br><span class="line"> this.dialogType = &quot;add&quot;;</span><br><span class="line"> //清空一下表单的数据</span><br><span class="line"> this.category.name = &quot;&quot;;</span><br><span class="line"> //打开添加的对话框</span><br><span class="line"> this.dialogVisible = true;</span><br><span class="line"> //为分类的对象赋值</span><br><span class="line"> this.category.parentCid = data.catId;</span><br><span class="line"> this.category.catLevel = data.catLevel * 1 + 1; //防止catLevel是一个字符串</span><br><span class="line"> this.catId = null;</span><br><span class="line"> this.category.icon = &quot;&quot;;</span><br><span class="line"> this.category.productUnit = &quot;&quot;;</span><br><span class="line"> this.category.sort = 0;</span><br><span class="line"> this.category.showStatus = 1;</span><br><span class="line"> &#125;,</span><br><span class="line"> //删除节点的方法</span><br><span class="line"> remove(node, data) &#123;</span><br><span class="line"> var ids = [data.catId];</span><br><span class="line"> this.$confirm(`是否要删除[$&#123;data.name&#125;]菜单?`, &quot;提示&quot;, &#123;</span><br><span class="line"> confirmButtonText: &quot;确定&quot;,</span><br><span class="line"> cancelButtonText: &quot;取消&quot;,</span><br><span class="line"> type: &quot;warning&quot;,</span><br><span class="line"> &#125;)</span><br><span class="line"> .then(() =&gt; &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/delete&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;菜单删除成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> //刷新一下页面</span><br><span class="line"> this.getMenus();</span><br><span class="line"> //设置需要默认展开的菜单(依然展开刚才删除的节点)</span><br><span class="line"> this.expandedKey = [node.parent.data.catId];</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;)</span><br><span class="line"> .catch(() =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> type: &quot;info&quot;,</span><br><span class="line"> message: &quot;已取消删除&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> //获取所有的菜单</span><br><span class="line"> getMenus() &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/list/tree&quot;),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line"></span><br><span class="line">&lt;style&gt;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p>老师的前端的代码</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br><span class="line">335</span><br><span class="line">336</span><br><span class="line">337</span><br><span class="line">338</span><br><span class="line">339</span><br><span class="line">340</span><br><span class="line">341</span><br><span class="line">342</span><br><span class="line">343</span><br><span class="line">344</span><br><span class="line">345</span><br><span class="line">346</span><br><span class="line">347</span><br><span class="line">348</span><br><span class="line">349</span><br><span class="line">350</span><br><span class="line">351</span><br><span class="line">352</span><br><span class="line">353</span><br><span class="line">354</span><br><span class="line">355</span><br><span class="line">356</span><br><span class="line">357</span><br><span class="line">358</span><br><span class="line">359</span><br><span class="line">360</span><br><span class="line">361</span><br><span class="line">362</span><br><span class="line">363</span><br><span class="line">364</span><br><span class="line">365</span><br><span class="line">366</span><br><span class="line">367</span><br><span class="line">368</span><br><span class="line">369</span><br><span class="line">370</span><br><span class="line">371</span><br><span class="line">372</span><br><span class="line">373</span><br><span class="line">374</span><br><span class="line">375</span><br><span class="line">376</span><br><span class="line">377</span><br><span class="line">378</span><br><span class="line">379</span><br><span class="line">380</span><br><span class="line">381</span><br><span class="line">382</span><br><span class="line">383</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;div&gt;</span><br><span class="line"> &lt;el-switch v-model=&quot;draggable&quot; active-text=&quot;开启拖拽&quot; inactive-text=&quot;关闭拖拽&quot;&gt;&lt;/el-switch&gt;</span><br><span class="line"> &lt;el-button v-if=&quot;draggable&quot; @click=&quot;batchSave&quot;&gt;批量保存&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button type=&quot;danger&quot; @click=&quot;batchDelete&quot;&gt;批量删除&lt;/el-button&gt;</span><br><span class="line"> &lt;el-tree</span><br><span class="line"> :data=&quot;menus&quot;</span><br><span class="line"> :props=&quot;defaultProps&quot;</span><br><span class="line"> :expand-on-click-node=&quot;false&quot;</span><br><span class="line"> show-checkbox</span><br><span class="line"> node-key=&quot;catId&quot;</span><br><span class="line"> :default-expanded-keys=&quot;expandedKey&quot;</span><br><span class="line"> :draggable=&quot;draggable&quot;</span><br><span class="line"> :allow-drop=&quot;allowDrop&quot;</span><br><span class="line"> @node-drop=&quot;handleDrop&quot;</span><br><span class="line"> ref=&quot;menuTree&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;span class=&quot;custom-tree-node&quot; slot-scope=&quot;&#123; node, data &#125;&quot;&gt;</span><br><span class="line"> &lt;span&gt;&#123;&#123; node.label &#125;&#125;&lt;/span&gt;</span><br><span class="line"> &lt;span&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;node.level &lt;=2&quot;</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;mini&quot;</span><br><span class="line"> @click=&quot;() =&gt; append(data)&quot;</span><br><span class="line"> &gt;Append&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button type=&quot;text&quot; size=&quot;mini&quot; @click=&quot;edit(data)&quot;&gt;edit&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;node.childNodes.length==0&quot;</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;mini&quot;</span><br><span class="line"> @click=&quot;() =&gt; remove(node, data)&quot;</span><br><span class="line"> &gt;Delete&lt;/el-button&gt;</span><br><span class="line"> &lt;/span&gt;</span><br><span class="line"> &lt;/span&gt;</span><br><span class="line"> &lt;/el-tree&gt;</span><br><span class="line"></span><br><span class="line"> &lt;el-dialog</span><br><span class="line"> :title=&quot;title&quot;</span><br><span class="line"> :visible.sync=&quot;dialogVisible&quot;</span><br><span class="line"> width=&quot;30%&quot;</span><br><span class="line"> :close-on-click-modal=&quot;false&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-form :model=&quot;category&quot;&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;分类名称&quot;&gt;</span><br><span class="line"> &lt;el-input v-model=&quot;category.name&quot; autocomplete=&quot;off&quot;&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;图标&quot;&gt;</span><br><span class="line"> &lt;el-input v-model=&quot;category.icon&quot; autocomplete=&quot;off&quot;&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;计量单位&quot;&gt;</span><br><span class="line"> &lt;el-input v-model=&quot;category.productUnit&quot; autocomplete=&quot;off&quot;&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;/el-form&gt;</span><br><span class="line"> &lt;span slot=&quot;footer&quot; class=&quot;dialog-footer&quot;&gt;</span><br><span class="line"> &lt;el-button @click=&quot;dialogVisible = false&quot;&gt;取 消&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button type=&quot;primary&quot; @click=&quot;submitData&quot;&gt;确 定&lt;/el-button&gt;</span><br><span class="line"> &lt;/span&gt;</span><br><span class="line"> &lt;/el-dialog&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">//这里可以导入其他文件比如组件工具js第三方插件jsjson文件图片文件等等</span><br><span class="line">//例如import 《组件名称》 from &#x27;《组件路径》&#x27;;</span><br><span class="line"></span><br><span class="line">export default &#123;</span><br><span class="line"> //import引入的组件需要注入到对象中才能使用</span><br><span class="line"> components: &#123;&#125;,</span><br><span class="line"> props: &#123;&#125;,</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> pCid: [],</span><br><span class="line"> draggable: false,</span><br><span class="line"> updateNodes: [],</span><br><span class="line"> maxLevel: 0,</span><br><span class="line"> title: &quot;&quot;,</span><br><span class="line"> dialogType: &quot;&quot;, //edit,add</span><br><span class="line"> category: &#123;</span><br><span class="line"> name: &quot;&quot;,</span><br><span class="line"> parentCid: 0,</span><br><span class="line"> catLevel: 0,</span><br><span class="line"> showStatus: 1,</span><br><span class="line"> sort: 0,</span><br><span class="line"> productUnit: &quot;&quot;,</span><br><span class="line"> icon: &quot;&quot;,</span><br><span class="line"> catId: null</span><br><span class="line"> &#125;,</span><br><span class="line"> dialogVisible: false,</span><br><span class="line"> menus: [],</span><br><span class="line"> expandedKey: [],</span><br><span class="line"> defaultProps: &#123;</span><br><span class="line"> children: &quot;children&quot;,</span><br><span class="line"> label: &quot;name&quot;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"></span><br><span class="line"> //计算属性 类似于data概念</span><br><span class="line"> computed: &#123;&#125;,</span><br><span class="line"> //监控data中的数据变化</span><br><span class="line"> watch: &#123;&#125;,</span><br><span class="line"> //方法集合</span><br><span class="line"> methods: &#123;</span><br><span class="line"> getMenus() &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/list/tree&quot;),</span><br><span class="line"> method: &quot;get&quot;</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> console.log(&quot;成功获取到菜单数据...&quot;, data.data);</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> batchDelete() &#123;</span><br><span class="line"> let catIds = [];</span><br><span class="line"> let checkedNodes = this.$refs.menuTree.getCheckedNodes();</span><br><span class="line"> console.log(&quot;被选中的元素&quot;, checkedNodes);</span><br><span class="line"> for (let i = 0; i &lt; checkedNodes.length; i++) &#123;</span><br><span class="line"> catIds.push(checkedNodes[i].catId);</span><br><span class="line"> &#125;</span><br><span class="line"> this.$confirm(`是否批量删除【$&#123;catIds&#125;】菜单?`, &quot;提示&quot;, &#123;</span><br><span class="line"> confirmButtonText: &quot;确定&quot;,</span><br><span class="line"> cancelButtonText: &quot;取消&quot;,</span><br><span class="line"> type: &quot;warning&quot;</span><br><span class="line"> &#125;)</span><br><span class="line"> .then(() =&gt; &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/delete&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(catIds, false)</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;菜单批量删除成功&quot;,</span><br><span class="line"> type: &quot;success&quot;</span><br><span class="line"> &#125;);</span><br><span class="line"> this.getMenus();</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;)</span><br><span class="line"> .catch(() =&gt; &#123;&#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> batchSave() &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/update/sort&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(this.updateNodes, false)</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;菜单顺序等修改成功&quot;,</span><br><span class="line"> type: &quot;success&quot;</span><br><span class="line"> &#125;);</span><br><span class="line"> //刷新出新的菜单</span><br><span class="line"> this.getMenus();</span><br><span class="line"> //设置需要默认展开的菜单</span><br><span class="line"> this.expandedKey = this.pCid;</span><br><span class="line"> this.updateNodes = [];</span><br><span class="line"> this.maxLevel = 0;</span><br><span class="line"> // this.pCid = 0;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> handleDrop(draggingNode, dropNode, dropType, ev) &#123;</span><br><span class="line"> console.log(&quot;handleDrop: &quot;, draggingNode, dropNode, dropType);</span><br><span class="line"> //1、当前节点最新的父节点id</span><br><span class="line"> let pCid = 0;</span><br><span class="line"> let siblings = null;</span><br><span class="line"> if (dropType == &quot;before&quot; || dropType == &quot;after&quot;) &#123;</span><br><span class="line"> pCid =</span><br><span class="line"> dropNode.parent.data.catId == undefined</span><br><span class="line"> ? 0</span><br><span class="line"> : dropNode.parent.data.catId;</span><br><span class="line"> siblings = dropNode.parent.childNodes;</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> pCid = dropNode.data.catId;</span><br><span class="line"> siblings = dropNode.childNodes;</span><br><span class="line"> &#125;</span><br><span class="line"> this.pCid.push(pCid);</span><br><span class="line"></span><br><span class="line"> //2、当前拖拽节点的最新顺序</span><br><span class="line"> for (let i = 0; i &lt; siblings.length; i++) &#123;</span><br><span class="line"> if (siblings[i].data.catId == draggingNode.data.catId) &#123;</span><br><span class="line"> //如果遍历的是当前正在拖拽的节点</span><br><span class="line"> let catLevel = draggingNode.level;</span><br><span class="line"> if (siblings[i].level != draggingNode.level) &#123;</span><br><span class="line"> //当前节点的层级发生变化</span><br><span class="line"> catLevel = siblings[i].level;</span><br><span class="line"> //修改他子节点的层级</span><br><span class="line"> this.updateChildNodeLevel(siblings[i]);</span><br><span class="line"> &#125;</span><br><span class="line"> this.updateNodes.push(&#123;</span><br><span class="line"> catId: siblings[i].data.catId,</span><br><span class="line"> sort: i,</span><br><span class="line"> parentCid: pCid,</span><br><span class="line"> catLevel: catLevel</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.updateNodes.push(&#123; catId: siblings[i].data.catId, sort: i &#125;);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> //3、当前拖拽节点的最新层级</span><br><span class="line"> console.log(&quot;updateNodes&quot;, this.updateNodes);</span><br><span class="line"> &#125;,</span><br><span class="line"> updateChildNodeLevel(node) &#123;</span><br><span class="line"> if (node.childNodes.length &gt; 0) &#123;</span><br><span class="line"> for (let i = 0; i &lt; node.childNodes.length; i++) &#123;</span><br><span class="line"> var cNode = node.childNodes[i].data;</span><br><span class="line"> this.updateNodes.push(&#123;</span><br><span class="line"> catId: cNode.catId,</span><br><span class="line"> catLevel: node.childNodes[i].level</span><br><span class="line"> &#125;);</span><br><span class="line"> this.updateChildNodeLevel(node.childNodes[i]);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> allowDrop(draggingNode, dropNode, type) &#123;</span><br><span class="line"> //1、被拖动的当前节点以及所在的父节点总层数不能大于3</span><br><span class="line"></span><br><span class="line"> //1、被拖动的当前节点总层数</span><br><span class="line"> console.log(&quot;allowDrop:&quot;, draggingNode, dropNode, type);</span><br><span class="line"> //</span><br><span class="line"> this.countNodeLevel(draggingNode);</span><br><span class="line"> //当前正在拖动的节点+父节点所在的深度不大于3即可</span><br><span class="line"> let deep = Math.abs(this.maxLevel - draggingNode.level) + 1;</span><br><span class="line"> console.log(&quot;深度:&quot;, deep);</span><br><span class="line"></span><br><span class="line"> // this.maxLevel</span><br><span class="line"> if (type == &quot;inner&quot;) &#123;</span><br><span class="line"> // console.log(</span><br><span class="line"> // `this.maxLevel$&#123;this.maxLevel&#125;draggingNode.data.catLevel$&#123;draggingNode.data.catLevel&#125;dropNode.level$&#123;dropNode.level&#125;`</span><br><span class="line"> // );</span><br><span class="line"> return deep + dropNode.level &lt;= 3;</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> return deep + dropNode.parent.level &lt;= 3;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> countNodeLevel(node) &#123;</span><br><span class="line"> //找到所有子节点,求出最大深度</span><br><span class="line"> if (node.childNodes != null &amp;&amp; node.childNodes.length &gt; 0) &#123;</span><br><span class="line"> for (let i = 0; i &lt; node.childNodes.length; i++) &#123;</span><br><span class="line"> if (node.childNodes[i].level &gt; this.maxLevel) &#123;</span><br><span class="line"> this.maxLevel = node.childNodes[i].level;</span><br><span class="line"> &#125;</span><br><span class="line"> this.countNodeLevel(node.childNodes[i]);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> edit(data) &#123;</span><br><span class="line"> console.log(&quot;要修改的数据&quot;, data);</span><br><span class="line"> this.dialogType = &quot;edit&quot;;</span><br><span class="line"> this.title = &quot;修改分类&quot;;</span><br><span class="line"> this.dialogVisible = true;</span><br><span class="line"></span><br><span class="line"> //发送请求获取当前节点最新的数据</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(`/product/category/info/$&#123;data.catId&#125;`),</span><br><span class="line"> method: &quot;get&quot;</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> //请求成功</span><br><span class="line"> console.log(&quot;要回显的数据&quot;, data);</span><br><span class="line"> this.category.name = data.data.name;</span><br><span class="line"> this.category.catId = data.data.catId;</span><br><span class="line"> this.category.icon = data.data.icon;</span><br><span class="line"> this.category.productUnit = data.data.productUnit;</span><br><span class="line"> this.category.parentCid = data.data.parentCid;</span><br><span class="line"> this.category.catLevel = data.data.catLevel;</span><br><span class="line"> this.category.sort = data.data.sort;</span><br><span class="line"> this.category.showStatus = data.data.showStatus;</span><br><span class="line"> /**</span><br><span class="line"> * parentCid: 0,</span><br><span class="line"> catLevel: 0,</span><br><span class="line"> showStatus: 1,</span><br><span class="line"> sort: 0,</span><br><span class="line"> */</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> append(data) &#123;</span><br><span class="line"> console.log(&quot;append&quot;, data);</span><br><span class="line"> this.dialogType = &quot;add&quot;;</span><br><span class="line"> this.title = &quot;添加分类&quot;;</span><br><span class="line"> this.dialogVisible = true;</span><br><span class="line"> this.category.parentCid = data.catId;</span><br><span class="line"> this.category.catLevel = data.catLevel * 1 + 1;</span><br><span class="line"> this.category.catId = null;</span><br><span class="line"> this.category.name = &quot;&quot;;</span><br><span class="line"> this.category.icon = &quot;&quot;;</span><br><span class="line"> this.category.productUnit = &quot;&quot;;</span><br><span class="line"> this.category.sort = 0;</span><br><span class="line"> this.category.showStatus = 1;</span><br><span class="line"> &#125;,</span><br><span class="line"></span><br><span class="line"> submitData() &#123;</span><br><span class="line"> if (this.dialogType == &quot;add&quot;) &#123;</span><br><span class="line"> this.addCategory();</span><br><span class="line"> &#125;</span><br><span class="line"> if (this.dialogType == &quot;edit&quot;) &#123;</span><br><span class="line"> this.editCategory();</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> //修改三级分类数据</span><br><span class="line"> editCategory() &#123;</span><br><span class="line"> var &#123; catId, name, icon, productUnit &#125; = this.category;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/update&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(&#123; catId, name, icon, productUnit &#125;, false)</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;菜单修改成功&quot;,</span><br><span class="line"> type: &quot;success&quot;</span><br><span class="line"> &#125;);</span><br><span class="line"> //关闭对话框</span><br><span class="line"> this.dialogVisible = false;</span><br><span class="line"> //刷新出新的菜单</span><br><span class="line"> this.getMenus();</span><br><span class="line"> //设置需要默认展开的菜单</span><br><span class="line"> this.expandedKey = [this.category.parentCid];</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> //添加三级分类</span><br><span class="line"> addCategory() &#123;</span><br><span class="line"> console.log(&quot;提交的三级分类数据&quot;, this.category);</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/save&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(this.category, false)</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;菜单保存成功&quot;,</span><br><span class="line"> type: &quot;success&quot;</span><br><span class="line"> &#125;);</span><br><span class="line"> //关闭对话框</span><br><span class="line"> this.dialogVisible = false;</span><br><span class="line"> //刷新出新的菜单</span><br><span class="line"> this.getMenus();</span><br><span class="line"> //设置需要默认展开的菜单</span><br><span class="line"> this.expandedKey = [this.category.parentCid];</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"></span><br><span class="line"> remove(node, data) &#123;</span><br><span class="line"> var ids = [data.catId];</span><br><span class="line"> this.$confirm(`是否删除【$&#123;data.name&#125;】菜单?`, &quot;提示&quot;, &#123;</span><br><span class="line"> confirmButtonText: &quot;确定&quot;,</span><br><span class="line"> cancelButtonText: &quot;取消&quot;,</span><br><span class="line"> type: &quot;warning&quot;</span><br><span class="line"> &#125;)</span><br><span class="line"> .then(() =&gt; &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/delete&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(ids, false)</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;菜单删除成功&quot;,</span><br><span class="line"> type: &quot;success&quot;</span><br><span class="line"> &#125;);</span><br><span class="line"> //刷新出新的菜单</span><br><span class="line"> this.getMenus();</span><br><span class="line"> //设置需要默认展开的菜单</span><br><span class="line"> this.expandedKey = [node.parent.data.catId];</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;)</span><br><span class="line"> .catch(() =&gt; &#123;&#125;);</span><br><span class="line"></span><br><span class="line"> console.log(&quot;remove&quot;, node, data);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> //生命周期 - 创建完成可以访问当前this实例</span><br><span class="line"> created() &#123;</span><br><span class="line"> this.getMenus();</span><br><span class="line"> &#125;,</span><br><span class="line"> //生命周期 - 挂载完成可以访问DOM元素</span><br><span class="line"> mounted() &#123;&#125;,</span><br><span class="line"> beforeCreate() &#123;&#125;, //生命周期 - 创建之前</span><br><span class="line"> beforeMount() &#123;&#125;, //生命周期 - 挂载之前</span><br><span class="line"> beforeUpdate() &#123;&#125;, //生命周期 - 更新之前</span><br><span class="line"> updated() &#123;&#125;, //生命周期 - 更新之后</span><br><span class="line"> beforeDestroy() &#123;&#125;, //生命周期 - 销毁之前</span><br><span class="line"> destroyed() &#123;&#125;, //生命周期 - 销毁完成</span><br><span class="line"> activated() &#123;&#125; //如果页面有keep-alive缓存功能这个函数会触发</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line">&lt;style scoped&gt;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p>后端的代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 批量修改商品的分类信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@RequestMapping(&quot;/update/sort&quot;)</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">updateSort</span><span class="params">(<span class="meta">@RequestBody</span> CategoryEntity[] categoryEntities)</span> &#123;</span><br><span class="line"> categoryService.updateBatchById(Arrays.asList(categoryEntities));</span><br><span class="line"> <span class="keyword">return</span> R.ok();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="1-2-品牌管理"><a href="#1-2-品牌管理" class="headerlink" title="1.2 品牌管理"></a>1.2 品牌管理</h3><h4 id="1-2-1-品牌的增删改查功能"><a href="#1-2-1-品牌的增删改查功能" class="headerlink" title="1.2.1 品牌的增删改查功能"></a>1.2.1 品牌的增删改查功能</h4><p>这里前端的代码是和先前生成的后端的代码一起生成的</p>
<p><img src="/pictures/image-20230611111440999.png" alt="image-20230611111440999"></p>
<p><strong>商品品牌的列表显示</strong></p>
<p>优化之后的前端的代码 (表头的优化 需要按钮显示的使用按钮进行显示)</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;div class=&quot;mod-config&quot;&gt;</span><br><span class="line"> &lt;el-form</span><br><span class="line"> :inline=&quot;true&quot;</span><br><span class="line"> :model=&quot;dataForm&quot;</span><br><span class="line"> @keyup.enter.native=&quot;getDataList()&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-form-item&gt;</span><br><span class="line"> &lt;el-input</span><br><span class="line"> v-model=&quot;dataForm.key&quot;</span><br><span class="line"> placeholder=&quot;参数名&quot;</span><br><span class="line"> clearable</span><br><span class="line"> &gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item&gt;</span><br><span class="line"> &lt;el-button @click=&quot;getDataList()&quot;&gt;查询&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;isAuth(&#x27;product:brand:save&#x27;)&quot;</span><br><span class="line"> type=&quot;primary&quot;</span><br><span class="line"> @click=&quot;addOrUpdateHandle()&quot;</span><br><span class="line"> &gt;新增&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;isAuth(&#x27;product:brand:delete&#x27;)&quot;</span><br><span class="line"> type=&quot;danger&quot;</span><br><span class="line"> @click=&quot;deleteHandle()&quot;</span><br><span class="line"> :disabled=&quot;dataListSelections.length &lt;= 0&quot;</span><br><span class="line"> &gt;批量删除&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;/el-form&gt;</span><br><span class="line"> &lt;el-table</span><br><span class="line"> :data=&quot;dataList&quot;</span><br><span class="line"> border</span><br><span class="line"> v-loading=&quot;dataListLoading&quot;</span><br><span class="line"> @selection-change=&quot;selectionChangeHandle&quot;</span><br><span class="line"> style=&quot;width: 100%&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> type=&quot;selection&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> width=&quot;50&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;brandId&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;品牌id&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;name&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;品牌名&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;logo&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;品牌logo地址&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;descript&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;介绍&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;showStatus&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;显示状态&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;template slot-scope=&quot;scope&quot;&gt;</span><br><span class="line"> &lt;el-switch</span><br><span class="line"> v-model=&quot;scope.row.showStatus&quot;</span><br><span class="line"> active-color=&quot;#13ce66&quot;</span><br><span class="line"> inactive-color=&quot;#ff4949&quot;</span><br><span class="line"> :active-value=&quot;1&quot;</span><br><span class="line"> :inactive-value=&quot;0&quot;</span><br><span class="line"> @change=&quot;updateBrandStatus(scope.row)&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-switch&gt;</span><br><span class="line"> &lt;/template&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;firstLetter&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;检索首字母&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;sort&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;排序&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> fixed=&quot;right&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> width=&quot;150&quot;</span><br><span class="line"> label=&quot;操作&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;template slot-scope=&quot;scope&quot;&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;small&quot;</span><br><span class="line"> @click=&quot;addOrUpdateHandle(scope.row.brandId)&quot;</span><br><span class="line"> &gt;修改&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;small&quot;</span><br><span class="line"> @click=&quot;deleteHandle(scope.row.brandId)&quot;</span><br><span class="line"> &gt;删除&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/template&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;/el-table&gt;</span><br><span class="line"> &lt;el-pagination</span><br><span class="line"> @size-change=&quot;sizeChangeHandle&quot;</span><br><span class="line"> @current-change=&quot;currentChangeHandle&quot;</span><br><span class="line"> :current-page=&quot;pageIndex&quot;</span><br><span class="line"> :page-sizes=&quot;[10, 20, 50, 100]&quot;</span><br><span class="line"> :page-size=&quot;pageSize&quot;</span><br><span class="line"> :total=&quot;totalPage&quot;</span><br><span class="line"> layout=&quot;total, sizes, prev, pager, next, jumper&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-pagination&gt;</span><br><span class="line"> &lt;!-- 弹窗, 新增 / 修改 --&gt;</span><br><span class="line"> &lt;add-or-update</span><br><span class="line"> v-if=&quot;addOrUpdateVisible&quot;</span><br><span class="line"> ref=&quot;addOrUpdate&quot;</span><br><span class="line"> @refreshDataList=&quot;getDataList&quot;</span><br><span class="line"> &gt;&lt;/add-or-update&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">import AddOrUpdate from &quot;./brand-add-or-update&quot;;</span><br><span class="line">export default &#123;</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> dataForm: &#123;</span><br><span class="line"> key: &quot;&quot;,</span><br><span class="line"> &#125;,</span><br><span class="line"> dataList: [],</span><br><span class="line"> pageIndex: 1,</span><br><span class="line"> pageSize: 10,</span><br><span class="line"> totalPage: 0,</span><br><span class="line"> dataListLoading: false,</span><br><span class="line"> dataListSelections: [],</span><br><span class="line"> addOrUpdateVisible: false,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> components: &#123;</span><br><span class="line"> AddOrUpdate,</span><br><span class="line"> &#125;,</span><br><span class="line"> activated() &#123;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> methods: &#123;</span><br><span class="line"> //修改品牌的显示的状态的</span><br><span class="line"> updateBrandStatus(data) &#123;</span><br><span class="line"> console.log(&quot;修改的状态信息:&quot;, data);</span><br><span class="line"> let &#123; brandId, showStatus &#125; = data;</span><br><span class="line"> //发送修改状态的请求</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(`/product/brand/update`),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(</span><br><span class="line"> &#123; brandId: brandId, showStatus: showStatus &#125;,</span><br><span class="line"> false</span><br><span class="line"> ),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;状态更新成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> // 获取数据列表</span><br><span class="line"> getDataList() &#123;</span><br><span class="line"> this.dataListLoading = true;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/brand/list&quot;),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> params: this.$http.adornParams(&#123;</span><br><span class="line"> page: this.pageIndex,</span><br><span class="line"> limit: this.pageSize,</span><br><span class="line"> key: this.dataForm.key,</span><br><span class="line"> &#125;),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> if (data &amp;&amp; data.code === 0) &#123;</span><br><span class="line"> this.dataList = data.page.list;</span><br><span class="line"> this.totalPage = data.page.totalCount;</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.dataList = [];</span><br><span class="line"> this.totalPage = 0;</span><br><span class="line"> &#125;</span><br><span class="line"> this.dataListLoading = false;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> // 每页数</span><br><span class="line"> sizeChangeHandle(val) &#123;</span><br><span class="line"> this.pageSize = val;</span><br><span class="line"> this.pageIndex = 1;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> // 当前页</span><br><span class="line"> currentChangeHandle(val) &#123;</span><br><span class="line"> this.pageIndex = val;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> // 多选</span><br><span class="line"> selectionChangeHandle(val) &#123;</span><br><span class="line"> this.dataListSelections = val;</span><br><span class="line"> &#125;,</span><br><span class="line"> // 新增 / 修改</span><br><span class="line"> addOrUpdateHandle(id) &#123;</span><br><span class="line"> this.addOrUpdateVisible = true;</span><br><span class="line"> this.$nextTick(() =&gt; &#123;</span><br><span class="line"> this.$refs.addOrUpdate.init(id);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> // 删除</span><br><span class="line"> deleteHandle(id) &#123;</span><br><span class="line"> var ids = id</span><br><span class="line"> ? [id]</span><br><span class="line"> : this.dataListSelections.map((item) =&gt; &#123;</span><br><span class="line"> return item.brandId;</span><br><span class="line"> &#125;);</span><br><span class="line"> this.$confirm(</span><br><span class="line"> `确定对[id=$&#123;ids.join(&quot;,&quot;)&#125;]进行[$&#123;id ? &quot;删除&quot; : &quot;批量删除&quot;&#125;]操作?`,</span><br><span class="line"> &quot;提示&quot;,</span><br><span class="line"> &#123;</span><br><span class="line"> confirmButtonText: &quot;确定&quot;,</span><br><span class="line"> cancelButtonText: &quot;取消&quot;,</span><br><span class="line"> type: &quot;warning&quot;,</span><br><span class="line"> &#125;</span><br><span class="line"> ).then(() =&gt; &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/brand/delete&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> if (data &amp;&amp; data.code === 0) &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;操作成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> duration: 1500,</span><br><span class="line"> onClose: () =&gt; &#123;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.$message.error(data.msg);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>
<p>后端代码(修改品牌的显示状态)</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 修改</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@RequestMapping(&quot;/update&quot;)</span></span><br><span class="line"><span class="comment">//@RequiresPermissions(&quot;product:brand:update&quot;)</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">update</span><span class="params">(<span class="meta">@RequestBody</span> BrandEntity brand)</span>&#123;</span><br><span class="line"> brandService.updateById(brand);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> R.ok();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>品牌添加功能</strong></p>
<p><strong><a href="https://jasonsgong.gitee.io/posts/6319.html">阿里云对象存储OSS | The Blog (gitee.io)</a></strong></p>
<p><img src="/pictures/image-20230611153418426.png" alt="image-20230611153418426"></p>
<p><strong>前端的代码</strong></p>
<p>品牌管理的列表页面</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;div class=&quot;mod-config&quot;&gt;</span><br><span class="line"> &lt;el-form</span><br><span class="line"> :inline=&quot;true&quot;</span><br><span class="line"> :model=&quot;dataForm&quot;</span><br><span class="line"> @keyup.enter.native=&quot;getDataList()&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-form-item&gt;</span><br><span class="line"> &lt;el-input</span><br><span class="line"> v-model=&quot;dataForm.key&quot;</span><br><span class="line"> placeholder=&quot;参数名&quot;</span><br><span class="line"> clearable</span><br><span class="line"> &gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item&gt;</span><br><span class="line"> &lt;el-button @click=&quot;getDataList()&quot;&gt;查询&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;isAuth(&#x27;product:brand:save&#x27;)&quot;</span><br><span class="line"> type=&quot;primary&quot;</span><br><span class="line"> @click=&quot;addOrUpdateHandle()&quot;</span><br><span class="line"> &gt;新增&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;isAuth(&#x27;product:brand:delete&#x27;)&quot;</span><br><span class="line"> type=&quot;danger&quot;</span><br><span class="line"> @click=&quot;deleteHandle()&quot;</span><br><span class="line"> :disabled=&quot;dataListSelections.length &lt;= 0&quot;</span><br><span class="line"> &gt;批量删除&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;/el-form&gt;</span><br><span class="line"> &lt;el-table</span><br><span class="line"> :data=&quot;dataList&quot;</span><br><span class="line"> border</span><br><span class="line"> v-loading=&quot;dataListLoading&quot;</span><br><span class="line"> @selection-change=&quot;selectionChangeHandle&quot;</span><br><span class="line"> style=&quot;width: 100%&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> type=&quot;selection&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> width=&quot;50&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;brandId&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;品牌id&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;name&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;品牌名&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;logo&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;品牌logo地址&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;template slot-scope=&quot;scope&quot;&gt;</span><br><span class="line"> &lt;img :src=&quot;scope.row.logo&quot; style=&quot;width: 100px; height: 80px&quot;&gt;</span><br><span class="line"> &lt;/template&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;descript&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;介绍&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;showStatus&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;显示状态&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;template slot-scope=&quot;scope&quot;&gt;</span><br><span class="line"> &lt;el-switch</span><br><span class="line"> v-model=&quot;scope.row.showStatus&quot;</span><br><span class="line"> active-color=&quot;#13ce66&quot;</span><br><span class="line"> inactive-color=&quot;#ff4949&quot;</span><br><span class="line"> :active-value=&quot;1&quot;</span><br><span class="line"> :inactive-value=&quot;0&quot;</span><br><span class="line"> @change=&quot;updateBrandStatus(scope.row)&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-switch&gt;</span><br><span class="line"> &lt;/template&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;firstLetter&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;检索首字母&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;sort&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;排序&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> fixed=&quot;right&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> width=&quot;150&quot;</span><br><span class="line"> label=&quot;操作&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;template slot-scope=&quot;scope&quot;&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;small&quot;</span><br><span class="line"> @click=&quot;addOrUpdateHandle(scope.row.brandId)&quot;</span><br><span class="line"> &gt;修改&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;small&quot;</span><br><span class="line"> @click=&quot;deleteHandle(scope.row.brandId)&quot;</span><br><span class="line"> &gt;删除&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/template&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;/el-table&gt;</span><br><span class="line"> &lt;el-pagination</span><br><span class="line"> @size-change=&quot;sizeChangeHandle&quot;</span><br><span class="line"> @current-change=&quot;currentChangeHandle&quot;</span><br><span class="line"> :current-page=&quot;pageIndex&quot;</span><br><span class="line"> :page-sizes=&quot;[10, 20, 50, 100]&quot;</span><br><span class="line"> :page-size=&quot;pageSize&quot;</span><br><span class="line"> :total=&quot;totalPage&quot;</span><br><span class="line"> layout=&quot;total, sizes, prev, pager, next, jumper&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-pagination&gt;</span><br><span class="line"> &lt;!-- 弹窗, 新增 / 修改 --&gt;</span><br><span class="line"> &lt;add-or-update</span><br><span class="line"> v-if=&quot;addOrUpdateVisible&quot;</span><br><span class="line"> ref=&quot;addOrUpdate&quot;</span><br><span class="line"> @refreshDataList=&quot;getDataList&quot;</span><br><span class="line"> &gt;&lt;/add-or-update&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">import AddOrUpdate from &quot;./brand-add-or-update&quot;;</span><br><span class="line">export default &#123;</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> dataForm: &#123;</span><br><span class="line"> key: &quot;&quot;,</span><br><span class="line"> &#125;,</span><br><span class="line"> dataList: [],</span><br><span class="line"> pageIndex: 1,</span><br><span class="line"> pageSize: 10,</span><br><span class="line"> totalPage: 0,</span><br><span class="line"> dataListLoading: false,</span><br><span class="line"> dataListSelections: [],</span><br><span class="line"> addOrUpdateVisible: false,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> components: &#123;</span><br><span class="line"> AddOrUpdate,</span><br><span class="line"> &#125;,</span><br><span class="line"> activated() &#123;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> methods: &#123;</span><br><span class="line"> //修改品牌的显示的状态的</span><br><span class="line"> updateBrandStatus(data) &#123;</span><br><span class="line"> console.log(&quot;修改的状态信息:&quot;, data);</span><br><span class="line"> let &#123; brandId, showStatus &#125; = data;</span><br><span class="line"> //发送修改状态的请求</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(`/product/brand/update`),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(</span><br><span class="line"> &#123; brandId: brandId, showStatus: showStatus &#125;,</span><br><span class="line"> false</span><br><span class="line"> ),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;状态更新成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> // 获取数据列表</span><br><span class="line"> getDataList() &#123;</span><br><span class="line"> this.dataListLoading = true;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/brand/list&quot;),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> params: this.$http.adornParams(&#123;</span><br><span class="line"> page: this.pageIndex,</span><br><span class="line"> limit: this.pageSize,</span><br><span class="line"> key: this.dataForm.key,</span><br><span class="line"> &#125;),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> if (data &amp;&amp; data.code === 0) &#123;</span><br><span class="line"> this.dataList = data.page.list;</span><br><span class="line"> this.totalPage = data.page.totalCount;</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.dataList = [];</span><br><span class="line"> this.totalPage = 0;</span><br><span class="line"> &#125;</span><br><span class="line"> this.dataListLoading = false;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> // 每页数</span><br><span class="line"> sizeChangeHandle(val) &#123;</span><br><span class="line"> this.pageSize = val;</span><br><span class="line"> this.pageIndex = 1;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> // 当前页</span><br><span class="line"> currentChangeHandle(val) &#123;</span><br><span class="line"> this.pageIndex = val;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> // 多选</span><br><span class="line"> selectionChangeHandle(val) &#123;</span><br><span class="line"> this.dataListSelections = val;</span><br><span class="line"> &#125;,</span><br><span class="line"> // 新增 / 修改</span><br><span class="line"> addOrUpdateHandle(id) &#123;</span><br><span class="line"> this.addOrUpdateVisible = true;</span><br><span class="line"> this.$nextTick(() =&gt; &#123;</span><br><span class="line"> this.$refs.addOrUpdate.init(id);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> // 删除</span><br><span class="line"> deleteHandle(id) &#123;</span><br><span class="line"> var ids = id</span><br><span class="line"> ? [id]</span><br><span class="line"> : this.dataListSelections.map((item) =&gt; &#123;</span><br><span class="line"> return item.brandId;</span><br><span class="line"> &#125;);</span><br><span class="line"> this.$confirm(</span><br><span class="line"> `确定对[id=$&#123;ids.join(&quot;,&quot;)&#125;]进行[$&#123;id ? &quot;删除&quot; : &quot;批量删除&quot;&#125;]操作?`,</span><br><span class="line"> &quot;提示&quot;,</span><br><span class="line"> &#123;</span><br><span class="line"> confirmButtonText: &quot;确定&quot;,</span><br><span class="line"> cancelButtonText: &quot;取消&quot;,</span><br><span class="line"> type: &quot;warning&quot;,</span><br><span class="line"> &#125;</span><br><span class="line"> ).then(() =&gt; &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/brand/delete&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> if (data &amp;&amp; data.code === 0) &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;操作成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> duration: 1500,</span><br><span class="line"> onClose: () =&gt; &#123;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.$message.error(data.msg);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>品牌管理的添加和修改组件</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;el-dialog</span><br><span class="line"> :title=&quot;!dataForm.brandId ? &#x27;新增&#x27; : &#x27;修改&#x27;&quot;</span><br><span class="line"> :close-on-click-modal=&quot;false&quot;</span><br><span class="line"> :visible.sync=&quot;visible&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-form</span><br><span class="line"> :model=&quot;dataForm&quot;</span><br><span class="line"> :rules=&quot;dataRule&quot;</span><br><span class="line"> ref=&quot;dataForm&quot;</span><br><span class="line"> @keyup.enter.native=&quot;dataFormSubmit()&quot;</span><br><span class="line"> label-width=&quot;140px&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-form-item label=&quot;品牌名&quot; prop=&quot;name&quot;&gt;</span><br><span class="line"> &lt;el-input v-model=&quot;dataForm.name&quot; placeholder=&quot;品牌名&quot;&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;品牌logo地址&quot; prop=&quot;logo&quot;&gt;</span><br><span class="line"> &lt;!-- &lt;el-input v-model=&quot;dataForm.logo&quot; placeholder=&quot;品牌logo地址&quot;&gt;&lt;/el-input&gt; --&gt;</span><br><span class="line"> &lt;!-- 自定义的组件 --&gt;</span><br><span class="line"> &lt;SingleUpload v-model=&quot;dataForm.logo&quot;&gt;&lt;/SingleUpload&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;介绍&quot; prop=&quot;descript&quot;&gt;</span><br><span class="line"> &lt;el-input v-model=&quot;dataForm.descript&quot; placeholder=&quot;介绍&quot;&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;显示状态&quot; prop=&quot;showStatus&quot;&gt;</span><br><span class="line"> &lt;el-switch</span><br><span class="line"> v-model=&quot;dataForm.showStatus&quot;</span><br><span class="line"> active-color=&quot;#13ce66&quot;</span><br><span class="line"> inactive-color=&quot;#ff4949&quot;</span><br><span class="line"> :active-value=&quot;1&quot;</span><br><span class="line"> :inactive-value=&quot;0&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-switch&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;检索首字母&quot; prop=&quot;firstLetter&quot;&gt;</span><br><span class="line"> &lt;el-input</span><br><span class="line"> v-model=&quot;dataForm.firstLetter&quot;</span><br><span class="line"> placeholder=&quot;检索首字母&quot;</span><br><span class="line"> &gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=&quot;排序&quot; prop=&quot;sort&quot;&gt;</span><br><span class="line"> &lt;el-input v-model.number=&quot;dataForm.sort&quot; placeholder=&quot;排序&quot;&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;/el-form&gt;</span><br><span class="line"> &lt;span slot=&quot;footer&quot; class=&quot;dialog-footer&quot;&gt;</span><br><span class="line"> &lt;el-button @click=&quot;visible = false&quot;&gt;取消&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button type=&quot;primary&quot; @click=&quot;dataFormSubmit()&quot;&gt;确定&lt;/el-button&gt;</span><br><span class="line"> &lt;/span&gt;</span><br><span class="line"> &lt;/el-dialog&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">import SingleUpload from &quot;@/components/upload/singleUpload&quot;;</span><br><span class="line">export default &#123;</span><br><span class="line"> components: &#123; SingleUpload &#125;, //声明一下组件</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> visible: false,</span><br><span class="line"> dataForm: &#123;</span><br><span class="line"> brandId: 0,</span><br><span class="line"> name: &quot;&quot;,</span><br><span class="line"> logo: &quot;&quot;,</span><br><span class="line"> descript: &quot;&quot;,</span><br><span class="line"> showStatus: 1,</span><br><span class="line"> firstLetter: &quot;&quot;,</span><br><span class="line"> sort: 0,</span><br><span class="line"> &#125;,</span><br><span class="line"> dataRule: &#123;</span><br><span class="line"> name: [&#123; required: true, message: &quot;品牌名不能为空&quot;, trigger: &quot;blur&quot; &#125;],</span><br><span class="line"> logo: [</span><br><span class="line"> &#123; required: true, message: &quot;品牌logo地址不能为空&quot;, trigger: &quot;blur&quot; &#125;,</span><br><span class="line"> ],</span><br><span class="line"> descript: [</span><br><span class="line"> &#123; required: true, message: &quot;介绍不能为空&quot;, trigger: &quot;blur&quot; &#125;,</span><br><span class="line"> ],</span><br><span class="line"> showStatus: [</span><br><span class="line"> &#123;</span><br><span class="line"> required: true,</span><br><span class="line"> message: &quot;显示状态[0-不显示1-显示]不能为空&quot;,</span><br><span class="line"> trigger: &quot;blur&quot;,</span><br><span class="line"> &#125;,</span><br><span class="line"> ],</span><br><span class="line"> firstLetter: [</span><br><span class="line"> &#123;</span><br><span class="line"> validator: (rule, value, callback) =&gt; &#123;</span><br><span class="line"> if (value == &quot;&quot;) &#123;</span><br><span class="line"> //检测是不是空串</span><br><span class="line"> callback(new Error(&quot;检索首字母不能为空&quot;));</span><br><span class="line"> &#125; else if (!/^[a-zA-Z]$/.test(value)) &#123;</span><br><span class="line"> //检测输入的是不是字母</span><br><span class="line"> callback(new Error(&quot;首字母必须是a-z或者A-Z&quot;));</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> //成功</span><br><span class="line"> callback();</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> trigger: &quot;blur&quot;,</span><br><span class="line"> &#125;,</span><br><span class="line"> ],</span><br><span class="line"> sort: [</span><br><span class="line"> &#123;</span><br><span class="line"> validator: (rule, value, callback) =&gt; &#123;</span><br><span class="line"> if (value === &quot;&quot;) &#123;</span><br><span class="line"> //检测是不是空串</span><br><span class="line"> callback(new Error(&quot;排序不能为空&quot;));</span><br><span class="line"> &#125; else if (!Number.isInteger(value) || value &lt; 0) &#123;</span><br><span class="line"> //检测输入的是不是字母</span><br><span class="line"> callback(new Error(&quot;排序必须为整数并且大于0&quot;));</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> //成功</span><br><span class="line"> callback();</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> trigger: &quot;blur&quot;,</span><br><span class="line"> &#125;,</span><br><span class="line"> ],</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> methods: &#123;</span><br><span class="line"> init(id) &#123;</span><br><span class="line"> this.dataForm.brandId = id || 0;</span><br><span class="line"> this.visible = true;</span><br><span class="line"> this.$nextTick(() =&gt; &#123;</span><br><span class="line"> this.$refs[&quot;dataForm&quot;].resetFields();</span><br><span class="line"> if (this.dataForm.brandId) &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(</span><br><span class="line"> `/product/brand/info/$&#123;this.dataForm.brandId&#125;`</span><br><span class="line"> ),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> params: this.$http.adornParams(),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> if (data &amp;&amp; data.code === 0) &#123;</span><br><span class="line"> this.dataForm.name = data.brand.name;</span><br><span class="line"> this.dataForm.logo = data.brand.logo;</span><br><span class="line"> this.dataForm.descript = data.brand.descript;</span><br><span class="line"> this.dataForm.showStatus = data.brand.showStatus;</span><br><span class="line"> this.dataForm.firstLetter = data.brand.firstLetter;</span><br><span class="line"> this.dataForm.sort = data.brand.sort;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> // 表单提交</span><br><span class="line"> dataFormSubmit() &#123;</span><br><span class="line"> this.$refs[&quot;dataForm&quot;].validate((valid) =&gt; &#123;</span><br><span class="line"> if (valid) &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(</span><br><span class="line"> `/product/brand/$&#123;!this.dataForm.brandId ? &quot;save&quot; : &quot;update&quot;&#125;`</span><br><span class="line"> ),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(&#123;</span><br><span class="line"> brandId: this.dataForm.brandId || undefined,</span><br><span class="line"> name: this.dataForm.name,</span><br><span class="line"> logo: this.dataForm.logo,</span><br><span class="line"> descript: this.dataForm.descript,</span><br><span class="line"> showStatus: this.dataForm.showStatus,</span><br><span class="line"> firstLetter: this.dataForm.firstLetter,</span><br><span class="line"> sort: this.dataForm.sort,</span><br><span class="line"> &#125;),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> if (data &amp;&amp; data.code === 0) &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;操作成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> duration: 1500,</span><br><span class="line"> onClose: () =&gt; &#123;</span><br><span class="line"> this.visible = false;</span><br><span class="line"> this.$emit(&quot;refreshDataList&quot;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.$message.error(data.msg);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>
<p><strong>后端的代码</strong></p>
<p><em>图片上传相关的后台接口</em></p>
<p>配置文件<br>apllication.yml</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">cloud:</span></span><br><span class="line"> <span class="attr">nacos:</span></span><br><span class="line"> <span class="attr">discovery:</span></span><br><span class="line"> <span class="attr">server-addr:</span> <span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span><span class="string">:8848</span></span><br><span class="line"> <span class="attr">alicloud:</span></span><br><span class="line"> <span class="attr">access-key:</span> <span class="string">XXXXXXXXXXXXXXXXXXXX</span></span><br><span class="line"> <span class="attr">secret-key:</span> <span class="string">XXXXXXXXXXXXXXXXXXXX</span></span><br><span class="line"> <span class="attr">oss:</span></span><br><span class="line"> <span class="attr">endpoint:</span> <span class="string">oss-cn-beijing.aliyuncs.com</span> </span><br><span class="line"> <span class="attr">bucket:</span> <span class="string">gulimall-0611</span> <span class="comment">#因为是公用的配置,这个配置是自己配置的</span></span><br><span class="line"></span><br><span class="line"> <span class="attr">application:</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">gulimall-third-party</span></span><br><span class="line"></span><br><span class="line"><span class="attr">server:</span></span><br><span class="line"> <span class="attr">port:</span> <span class="number">30000</span></span><br></pre></td></tr></table></figure>
<p>Controller</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.thirdparty.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.aliyun.oss.OSS;</span><br><span class="line"><span class="keyword">import</span> com.aliyun.oss.OSSClientBuilder;</span><br><span class="line"><span class="keyword">import</span> com.aliyun.oss.common.utils.BinaryUtil;</span><br><span class="line"><span class="keyword">import</span> com.aliyun.oss.model.MatchMode;</span><br><span class="line"><span class="keyword">import</span> com.aliyun.oss.model.PolicyConditions;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.common.utils.R;</span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.annotation.Autowired;</span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.annotation.Value;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestMapping;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RestController;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.text.SimpleDateFormat;</span><br><span class="line"><span class="keyword">import</span> java.util.Date;</span><br><span class="line"><span class="keyword">import</span> java.util.LinkedHashMap;</span><br><span class="line"><span class="keyword">import</span> java.util.Map;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Jason Gong</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/6/11</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 阿里云对象存储的控制器方法</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"></span><br><span class="line"><span class="meta">@RestController</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">OSSController</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> OSS ossClient;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Value(&quot;$&#123;spring.cloud.alicloud.oss.endpoint&#125;&quot;)</span></span><br><span class="line"> <span class="keyword">private</span> String endpoint;</span><br><span class="line"> <span class="meta">@Value(&quot;$&#123;spring.cloud.alicloud.oss.bucket&#125;&quot;)</span></span><br><span class="line"> <span class="keyword">private</span> String bucket;</span><br><span class="line"> <span class="meta">@Value(&quot;$&#123;spring.cloud.alicloud.access-key&#125;&quot;)</span></span><br><span class="line"> <span class="keyword">private</span> String accessId;</span><br><span class="line"> <span class="meta">@Value(&quot;$&#123;spring.cloud.alicloud.secret-key&#125;&quot;)</span></span><br><span class="line"> <span class="keyword">private</span> String accessKey;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@RequestMapping(&quot;/oss/policy&quot;)</span></span><br><span class="line"> <span class="keyword">public</span> R <span class="title function_">policy</span><span class="params">()</span> &#123;</span><br><span class="line"> <span class="comment">// 填写Host地址格式为https://bucketname.endpoint。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">host</span> <span class="operator">=</span> <span class="string">&quot;https://&quot;</span>+bucket+<span class="string">&quot;.&quot;</span>+endpoint;</span><br><span class="line"> <span class="comment">// 设置上传回调URL即回调服务器地址用于处理应用服务器与OSS之间的通信。OSS会在文件上传完成后把文件上传信息通过此回调URL发送给应用服务器。</span></span><br><span class="line"> <span class="comment">//String callbackUrl = &quot;https://192.168.0.0:8888&quot;;</span></span><br><span class="line"> <span class="comment">// 设置上传到OSS文件的前缀可置空此项。置空后文件将上传至Bucket的根目录下。</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">format</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SimpleDateFormat</span>(<span class="string">&quot;yyyy/MM/dd&quot;</span>).format(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> <span class="type">String</span> <span class="variable">dir</span> <span class="operator">=</span> format+<span class="string">&quot;/&quot;</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">// 创建ossClient实例。</span></span><br><span class="line"> <span class="type">OSS</span> <span class="variable">ossClient</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">OSSClientBuilder</span>().build(endpoint, accessId, accessKey);</span><br><span class="line"> Map&lt;String, String&gt; respMap = <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">try</span> &#123;</span><br><span class="line"> <span class="type">long</span> <span class="variable">expireTime</span> <span class="operator">=</span> <span class="number">30</span>;</span><br><span class="line"> <span class="type">long</span> <span class="variable">expireEndTime</span> <span class="operator">=</span> System.currentTimeMillis() + expireTime * <span class="number">1000</span>;</span><br><span class="line"> <span class="type">Date</span> <span class="variable">expiration</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Date</span>(expireEndTime);</span><br><span class="line"> <span class="type">PolicyConditions</span> <span class="variable">policyConds</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PolicyConditions</span>();</span><br><span class="line"> policyConds.addConditionItem(PolicyConditions.COND_CONTENT_LENGTH_RANGE, <span class="number">0</span>, <span class="number">1048576000</span>);</span><br><span class="line"> policyConds.addConditionItem(MatchMode.StartWith, PolicyConditions.COND_KEY, dir);</span><br><span class="line"></span><br><span class="line"> <span class="type">String</span> <span class="variable">postPolicy</span> <span class="operator">=</span> ossClient.generatePostPolicy(expiration, policyConds);</span><br><span class="line"> <span class="type">byte</span>[] binaryData = postPolicy.getBytes(<span class="string">&quot;utf-8&quot;</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">encodedPolicy</span> <span class="operator">=</span> BinaryUtil.toBase64String(binaryData);</span><br><span class="line"> <span class="type">String</span> <span class="variable">postSignature</span> <span class="operator">=</span> ossClient.calculatePostSignature(postPolicy);</span><br><span class="line"></span><br><span class="line"> respMap = <span class="keyword">new</span> <span class="title class_">LinkedHashMap</span>&lt;String, String&gt;();</span><br><span class="line"> respMap.put(<span class="string">&quot;accessId&quot;</span>, accessId);</span><br><span class="line"> respMap.put(<span class="string">&quot;policy&quot;</span>, encodedPolicy);</span><br><span class="line"> respMap.put(<span class="string">&quot;signature&quot;</span>, postSignature);</span><br><span class="line"> respMap.put(<span class="string">&quot;dir&quot;</span>, dir);</span><br><span class="line"> respMap.put(<span class="string">&quot;host&quot;</span>, host);</span><br><span class="line"> respMap.put(<span class="string">&quot;expire&quot;</span>, String.valueOf(expireEndTime / <span class="number">1000</span>));</span><br><span class="line"> <span class="comment">// respMap.put(&quot;expire&quot;, formatISO8601Date(expiration));</span></span><br><span class="line"> &#125; <span class="keyword">catch</span> (Exception e) &#123;</span><br><span class="line"> System.out.println(e.getMessage());</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">&quot;data&quot;</span>,respMap);</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>配置网关,通过网关访问到该接口</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="bullet">-</span> <span class="attr">id:</span> <span class="string">third_party_route</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">lb://gulimall-third-party</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Path=/api/thirdparty/**</span></span><br><span class="line"> <span class="attr">filters:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">RewritePath=/api/thirdparty/(?&lt;segment&gt;.*),/$\&#123;segment&#125;</span></span><br></pre></td></tr></table></figure>
<h4 id="1-2-2-JSR303-数据校验"><a href="#1-2-2-JSR303-数据校验" class="headerlink" title="1.2.2 JSR303-数据校验"></a>1.2.2 JSR303-数据校验</h4><p><strong><a href="https://jasonsgong.gitee.io/posts/27166.html">数据校验 | The Blog (gitee.io)</a></strong></p>
<p>1.依赖文件</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.hibernate<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>hibernate-validator<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">version</span>&gt;</span>6.0.7.Final<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>2.在实体类上添加上校验的规则</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.product.entity;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.TableId;</span><br><span class="line"><span class="keyword">import</span> com.baomidou.mybatisplus.annotation.TableName;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.Serializable;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> lombok.Data;</span><br><span class="line"><span class="keyword">import</span> org.hibernate.validator.constraints.URL;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.*;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 品牌</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> JasonGong</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@email</span> JasonGong@gmail.com</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 2023-05-19 00:23:36</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Data</span></span><br><span class="line"><span class="meta">@TableName(&quot;pms_brand&quot;)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">BrandEntity</span> <span class="keyword">implements</span> <span class="title class_">Serializable</span> &#123;</span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="type">long</span> <span class="variable">serialVersionUID</span> <span class="operator">=</span> <span class="number">1L</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 品牌id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@TableId</span></span><br><span class="line"> <span class="keyword">private</span> Long brandId;</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 品牌名</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@NotBlank(message = &quot;品牌名必须提交&quot;)</span> <span class="comment">//非空的校验</span></span><br><span class="line"> <span class="keyword">private</span> String name;</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 品牌logo地址</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@NotEmpty</span></span><br><span class="line"> <span class="meta">@URL(message = &quot;logo必须是一个合法的URL地址&quot;)</span><span class="comment">//URL的校验</span></span><br><span class="line"> <span class="keyword">private</span> String logo;</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 介绍</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> String descript;</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 显示状态[0-不显示1-显示]</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> Integer showStatus;</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 检索首字母</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@NotEmpty</span></span><br><span class="line"> <span class="meta">@Pattern(regexp = &quot;^[a-zA-Z]$&quot;, message = &quot;检索首字母必须是一个字母&quot;)</span><span class="comment">//正则表达式的校验</span></span><br><span class="line"> <span class="keyword">private</span> String firstLetter;</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 排序</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@NotNull</span></span><br><span class="line"> <span class="meta">@Min(value = 0, message = &quot;排序必须大于等于0&quot;)</span><span class="comment">//最小值是0</span></span><br><span class="line"> <span class="keyword">private</span> Integer sort;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>3.接口上开启检验,并自定义校验出错时的返回值</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 保存</span></span><br><span class="line"><span class="comment"> *&quot;<span class="doctag">@Valid</span>&quot; 开启校验</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> result 检验之后响应的结果信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@RequestMapping(&quot;/save&quot;)</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">save</span><span class="params">(<span class="meta">@Valid</span> <span class="meta">@RequestBody</span> BrandEntity brand, BindingResult result)</span>&#123;</span><br><span class="line"> <span class="keyword">if</span>(result.hasErrors())&#123;</span><br><span class="line"> Map&lt;String,String&gt; map = <span class="keyword">new</span> <span class="title class_">HashMap</span>&lt;&gt;();</span><br><span class="line"> <span class="comment">//获取检验的错误结果</span></span><br><span class="line"> <span class="keyword">for</span> (FieldError fieldError : result.getFieldErrors()) &#123;</span><br><span class="line"> <span class="comment">//获取到错误的提示</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">defaultMessage</span> <span class="operator">=</span> fieldError.getDefaultMessage();</span><br><span class="line"> <span class="comment">//获取错误的属性的名字</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">field</span> <span class="operator">=</span> fieldError.getField();</span><br><span class="line"> map.put(field,defaultMessage);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> R.error(<span class="number">400</span>,<span class="string">&quot;提交的数据不合法&quot;</span>).put(<span class="string">&quot;data&quot;</span>,map);</span><br><span class="line"> &#125;<span class="keyword">else</span> &#123;</span><br><span class="line"> brandService.save(brand);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> R.ok();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>返回的json格式示例</p>
<p><img src="/pictures/image-20230612165021780.png" alt="image-20230612165021780"></p>
<h4 id="1-2-3-统一异常处理"><a href="#1-2-3-统一异常处理" class="headerlink" title="1.2.3 统一异常处理"></a>1.2.3 统一异常处理</h4><p><strong><a href="https://jasonsgong.gitee.io/posts/31385.html">统一异常处理 | The Blog (gitee.io)</a></strong></p>
<p>统一异常返回状态码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.common.exception;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Jason Gong</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/6/12</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 返回的状态码信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">enum</span> <span class="title class_">BizCodeEnum</span> &#123;</span><br><span class="line"> UNKNOWN_EXCEPTION(<span class="number">10000</span>,<span class="string">&quot;系统未知异常&quot;</span>),</span><br><span class="line"> VALID_EXCEPTION(<span class="number">10001</span>,<span class="string">&quot;参数格式校验&quot;</span>);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Integer code;</span><br><span class="line"> <span class="keyword">private</span> String msg;</span><br><span class="line"></span><br><span class="line"> BizCodeEnum(Integer code, String msg) &#123;</span><br><span class="line"> <span class="built_in">this</span>.code = code;</span><br><span class="line"> <span class="built_in">this</span>.msg = msg;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> Integer <span class="title function_">getCode</span><span class="params">()</span> &#123;</span><br><span class="line"> <span class="keyword">return</span> code;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">getMsg</span><span class="params">()</span> &#123;</span><br><span class="line"> <span class="keyword">return</span> msg;</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>创建异常处理类</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.product.exception;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.atguigu.common.exception.BizCodeEnum;</span><br><span class="line"><span class="keyword">import</span> com.atguigu.common.utils.R;</span><br><span class="line"><span class="keyword">import</span> lombok.extern.slf4j.Slf4j;</span><br><span class="line"><span class="keyword">import</span> org.springframework.validation.BindingResult;</span><br><span class="line"><span class="keyword">import</span> org.springframework.validation.FieldError;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.MethodArgumentNotValidException;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.ExceptionHandler;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RestControllerAdvice;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.HashMap;</span><br><span class="line"><span class="keyword">import</span> java.util.Map;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Jason Gong</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/6/12</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 异常处理类</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Slf4j</span></span><br><span class="line"><span class="meta">@RestControllerAdvice(basePackages = &quot;com.atguigu.gulimall.product.controller&quot;)</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">GulimallExceptionControllerAdvice</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 统一处理数据校验的异常</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> e 数据校验的异常</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@ExceptionHandler(value = MethodArgumentNotValidException.class)</span></span><br><span class="line"> <span class="keyword">public</span> R <span class="title function_">handleValidException</span><span class="params">(MethodArgumentNotValidException e)</span>&#123;</span><br><span class="line"> log.error(<span class="string">&quot;数据校验出现问题:&#123;&#125;,异常类型:&#123;&#125;&quot;</span>,e.getMessage(),e.getClass());</span><br><span class="line"> Map&lt;String,String&gt; map = <span class="keyword">new</span> <span class="title class_">HashMap</span>&lt;&gt;();</span><br><span class="line"> <span class="comment">//获取检验的错误结果</span></span><br><span class="line"> <span class="type">BindingResult</span> <span class="variable">result</span> <span class="operator">=</span> e.getBindingResult();</span><br><span class="line"> <span class="keyword">for</span> (FieldError fieldError : result.getFieldErrors()) &#123;</span><br><span class="line"> <span class="comment">//获取到错误的提示</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">defaultMessage</span> <span class="operator">=</span> fieldError.getDefaultMessage();</span><br><span class="line"> <span class="comment">//获取错误的属性的名字</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">field</span> <span class="operator">=</span> fieldError.getField();</span><br><span class="line"> map.put(field,defaultMessage);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> R.error(BizCodeEnum.VALID_EXCEPTION.getCode(),BizCodeEnum.VALID_EXCEPTION.getMsg()).put(<span class="string">&quot;data&quot;</span>,map);</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 捕获任意的异常</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@ExceptionHandler(value = Throwable.class)</span></span><br><span class="line"> <span class="keyword">public</span> R <span class="title function_">handleException</span><span class="params">()</span>&#123;</span><br><span class="line"> <span class="keyword">return</span> R.error(BizCodeEnum.UNKNOWN_EXCEPTION.getCode(), BizCodeEnum.UNKNOWN_EXCEPTION.getMsg());</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="1-2-4-关联分类功能"><a href="#1-2-4-关联分类功能" class="headerlink" title="1.2.4 关联分类功能"></a>1.2.4 关联分类功能</h4><p>功能截图</p>
<p><img src="/pictures/image-20230618232437618.png" alt="image-20230618232437618"></p>
<p>后端代码的实现</p>
<p>查询品牌和分类的关联关系</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 查询商品的关联分类数据</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> brandId 品牌的id</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 关联的分类数据</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@GetMapping(&quot;/catelog/list&quot;)</span></span><br><span class="line"> <span class="keyword">public</span> R <span class="title function_">catelogList</span><span class="params">(<span class="meta">@RequestParam(&quot;brandId&quot;)</span> Long brandId)</span>&#123;</span><br><span class="line"> LambdaQueryWrapper&lt;CategoryBrandRelationEntity&gt; queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;&gt;();</span><br><span class="line"> queryWrapper.eq(CategoryBrandRelationEntity::getBrandId,brandId);</span><br><span class="line"> List&lt;CategoryBrandRelationEntity&gt; categoryBrandRelationEntityList = categoryBrandRelationService.list(queryWrapper);</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">&quot;data&quot;</span>, categoryBrandRelationEntityList);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>新增品牌和商品的关联关系</p>
<p>controller</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 保存商品的关联的分类数据信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@PostMapping(&quot;/save&quot;)</span></span><br><span class="line"> <span class="keyword">public</span> R <span class="title function_">saveCategoryBrandRelation</span><span class="params">(<span class="meta">@RequestBody</span> CategoryBrandRelationEntity categoryBrandRelation)</span>&#123;</span><br><span class="line"> categoryBrandRelationService.saveDetail(categoryBrandRelation);</span><br><span class="line"> <span class="keyword">return</span> R.ok();</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>service</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 保存商品和分类的关联数据</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> categoryBrandRelation 商品和分类的关联数据表</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">saveDetail</span><span class="params">(CategoryBrandRelationEntity categoryBrandRelation)</span> &#123;</span><br><span class="line"> <span class="comment">//获取品牌的id和关联分类的id</span></span><br><span class="line"> <span class="type">Long</span> <span class="variable">brandId</span> <span class="operator">=</span> categoryBrandRelation.getBrandId();</span><br><span class="line"> <span class="type">Long</span> <span class="variable">catelogId</span> <span class="operator">=</span> categoryBrandRelation.getCatelogId();</span><br><span class="line"> <span class="comment">//根据id查询对应的品牌名和分类名</span></span><br><span class="line"> <span class="type">BrandEntity</span> <span class="variable">brand</span> <span class="operator">=</span> brandDao.selectById(brandId);</span><br><span class="line"> <span class="type">CategoryEntity</span> <span class="variable">category</span> <span class="operator">=</span> categoryDao.selectById(catelogId);</span><br><span class="line"> <span class="comment">//设置值并保存</span></span><br><span class="line"> categoryBrandRelation.setBrandName(brand.getName());</span><br><span class="line"> categoryBrandRelation.setCatelogName(category.getName());</span><br><span class="line"> <span class="built_in">this</span>.save(categoryBrandRelation);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p><strong>注意</strong>:这里品牌和关联分类之间的关系表中使用了冗余的字段,所以在修改品牌的时候,关系表中的字段也要修改一下</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">updateDetail</span><span class="params">(BrandEntity brand)</span> &#123;</span><br><span class="line"> <span class="comment">//保证冗余字段的数据的一致性</span></span><br><span class="line"> <span class="comment">//更新品牌表中的数据</span></span><br><span class="line"> <span class="built_in">this</span>.updateById(brand);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(brand.getName())) &#123;</span><br><span class="line"> <span class="comment">//同步更新关联表中的数据</span></span><br><span class="line"> categoryBrandRelationService.updateBrand(brand.getBrandId(),brand.getName());</span><br><span class="line"> <span class="comment">//TODO 更新其他的关联</span></span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>关联的分类也是冗余的字段 也要同步修改</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 级联更新所有的关联的数据</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> category 商品分类的实体</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">updateCascade</span><span class="params">(CategoryEntity category)</span> &#123;</span><br><span class="line"> <span class="comment">//更新分类表中的数据</span></span><br><span class="line"> <span class="built_in">this</span>.updateById(category);</span><br><span class="line"> <span class="comment">//更新分类与品牌名关联表中分类的名称</span></span><br><span class="line"> categoryBrandRelationService.updateCategory(category.getCatId(),category.getName());</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>功能实现之后的截图</p>
<p><img src="/pictures/image-20230619111515367.png" alt="image-20230619111515367"></p>
<h3 id="1-3-平台属性"><a href="#1-3-平台属性" class="headerlink" title="1.3 平台属性"></a>1.3 平台属性</h3><p>创建属性管理的菜单(通过sql导入所有的菜单,导入所有以后需要使用的菜单)</p>
<p>资料中的sys_menus.sql文件保存的是所有的菜单信息</p>
<p><img src="/pictures/image-20230616152846339.png" alt="image-20230616152846339"></p>
<p><strong>谷粒商城的接口的在线文档:<a target="_blank" rel="noopener" href="https://easydoc.net/s/78237135">https://easydoc.net/s/78237135</a></strong></p>
<p><img src="/pictures/image-20230616153304953.png" alt="image-20230616153304953"></p>
<p><strong>Object的划分</strong></p>
<ol>
<li><p>PO 持久对象</p>
<p>PO就是对应数据库中某个表的一条记录多个记录可以用PO的集合。PO中应该不包含对数据库的操作。</p>
</li>
<li><p>DO 领域对象</p>
<p>就是从现实世界中抽象出来的有形或者无形的业务实体。</p>
</li>
<li><p>TO 数据传输对象</p>
<p>不同的应用程序之间传输的对象</p>
</li>
<li><p>DTO 数据传输对象</p>
<p>泛指展示层与服务层之间的数据传输对象</p>
</li>
<li><p>VO 值对象</p>
<p>视图对象 接收页面传入过来的数据,封装对象;将业务处理完成的对象,封装成页面需要的数据</p>
</li>
<li><p>BO 业务对象</p>
</li>
<li><p>POJO 简单无规则的java对象</p>
</li>
<li><p>DAO 数据访问对象</p>
</li>
</ol>
<h4 id="1-3-1-属性分组功能"><a href="#1-3-1-属性分组功能" class="headerlink" title="1.3.1 属性分组功能"></a>1.3.1 属性分组功能</h4><p>实现一个分类 联动的显示相应的分组信息</p>
<p>抽取商品分类的组件</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;el-tree</span><br><span class="line"> :data=&quot;menus&quot;</span><br><span class="line"> :props=&quot;defaultProps&quot;</span><br><span class="line"> node-key=&quot;catId&quot;</span><br><span class="line"> ref=&quot;menuTree&quot;</span><br><span class="line"> &gt;&lt;/el-tree&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"> &lt;script&gt;</span><br><span class="line">export default &#123;</span><br><span class="line"> components: &#123;&#125;,</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> menus: [],</span><br><span class="line"> expandedKey: [],</span><br><span class="line"> defaultProps: &#123;</span><br><span class="line"> children: &quot;children&quot;,</span><br><span class="line"> label: &quot;name&quot;,</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> created() &#123;</span><br><span class="line"> this.getMenus();</span><br><span class="line"> &#125;,</span><br><span class="line"> methods: &#123;</span><br><span class="line"> getMenus() &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/list/tree&quot;),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> console.log(&quot;商品分类数据:&quot;, data.data);</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line"> </span><br><span class="line"> &lt;style&gt;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p>属性分组页面</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;el-row :gutter=&quot;20&quot;&gt;</span><br><span class="line"> &lt;el-col :span=&quot;6&quot;&gt; &lt;category&gt;&lt;/category&gt;&lt;/el-col&gt;</span><br><span class="line"> &lt;el-col :span=&quot;18&quot;&gt;</span><br><span class="line"> &lt;div class=&quot;mod-config&quot;&gt;</span><br><span class="line"> &lt;el-form :inline=&quot;true&quot; :model=&quot;dataForm&quot; @keyup.enter.native=&quot;getDataList()&quot;&gt;</span><br><span class="line"> &lt;el-form-item&gt;</span><br><span class="line"> &lt;el-input v-model=&quot;dataForm.key&quot; placeholder=&quot;参数名&quot; clearable&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item&gt;</span><br><span class="line"> &lt;el-button @click=&quot;getDataList()&quot;&gt;查询&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button v-if=&quot;isAuth(&#x27;product:attrgroup:save&#x27;)&quot; type=&quot;primary&quot; @click=&quot;addOrUpdateHandle()&quot;&gt;新增&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button v-if=&quot;isAuth(&#x27;product:attrgroup:delete&#x27;)&quot; type=&quot;danger&quot; @click=&quot;deleteHandle()&quot; :disabled=&quot;dataListSelections.length &lt;= 0&quot;&gt;批量删除&lt;/el-button&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;/el-form&gt;</span><br><span class="line"> &lt;el-table</span><br><span class="line"> :data=&quot;dataList&quot;</span><br><span class="line"> border</span><br><span class="line"> v-loading=&quot;dataListLoading&quot;</span><br><span class="line"> @selection-change=&quot;selectionChangeHandle&quot;</span><br><span class="line"> style=&quot;width: 100%;&quot;&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> type=&quot;selection&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> width=&quot;50&quot;&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;attrGroupId&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;分组id&quot;&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;attrGroupName&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;组名&quot;&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;sort&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;排序&quot;&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;descript&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;描述&quot;&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;icon&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;组图标&quot;&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;catelogId&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;所属分类id&quot;&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> fixed=&quot;right&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> width=&quot;150&quot;</span><br><span class="line"> label=&quot;操作&quot;&gt;</span><br><span class="line"> &lt;template slot-scope=&quot;scope&quot;&gt;</span><br><span class="line"> &lt;el-button type=&quot;text&quot; size=&quot;small&quot; @click=&quot;addOrUpdateHandle(scope.row.attrGroupId)&quot;&gt;修改&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button type=&quot;text&quot; size=&quot;small&quot; @click=&quot;deleteHandle(scope.row.attrGroupId)&quot;&gt;删除&lt;/el-button&gt;</span><br><span class="line"> &lt;/template&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;/el-table&gt;</span><br><span class="line"> &lt;el-pagination</span><br><span class="line"> @size-change=&quot;sizeChangeHandle&quot;</span><br><span class="line"> @current-change=&quot;currentChangeHandle&quot;</span><br><span class="line"> :current-page=&quot;pageIndex&quot;</span><br><span class="line"> :page-sizes=&quot;[10, 20, 50, 100]&quot;</span><br><span class="line"> :page-size=&quot;pageSize&quot;</span><br><span class="line"> :total=&quot;totalPage&quot;</span><br><span class="line"> layout=&quot;total, sizes, prev, pager, next, jumper&quot;&gt;</span><br><span class="line"> &lt;/el-pagination&gt;</span><br><span class="line"> &lt;!-- 弹窗, 新增 / 修改 --&gt;</span><br><span class="line"> &lt;add-or-update v-if=&quot;addOrUpdateVisible&quot; ref=&quot;addOrUpdate&quot; @refreshDataList=&quot;getDataList&quot;&gt;&lt;/add-or-update&gt;</span><br><span class="line"> &lt;/div&gt;&lt;/el-col&gt;</span><br><span class="line"> &lt;/el-row&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line">&lt;script&gt;</span><br><span class="line">import Category from &quot;../common/category.vue&quot;;</span><br><span class="line">import AddOrUpdate from &#x27;./attrgroup-add-or-update&#x27;</span><br><span class="line">export default &#123;</span><br><span class="line"> data () &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> dataForm: &#123;</span><br><span class="line"> key: &#x27;&#x27;</span><br><span class="line"> &#125;,</span><br><span class="line"> dataList: [],</span><br><span class="line"> pageIndex: 1,</span><br><span class="line"> pageSize: 10,</span><br><span class="line"> totalPage: 0,</span><br><span class="line"> dataListLoading: false,</span><br><span class="line"> dataListSelections: [],</span><br><span class="line"> addOrUpdateVisible: false</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> components: &#123;</span><br><span class="line"> AddOrUpdate,Category</span><br><span class="line"> &#125;,</span><br><span class="line"> activated () &#123;</span><br><span class="line"> this.getDataList()</span><br><span class="line"> &#125;,</span><br><span class="line"> methods: &#123;</span><br><span class="line"> // 获取数据列表</span><br><span class="line"> getDataList () &#123;</span><br><span class="line"> this.dataListLoading = true</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&#x27;/product/attrgroup/list&#x27;),</span><br><span class="line"> method: &#x27;get&#x27;,</span><br><span class="line"> params: this.$http.adornParams(&#123;</span><br><span class="line"> &#x27;page&#x27;: this.pageIndex,</span><br><span class="line"> &#x27;limit&#x27;: this.pageSize,</span><br><span class="line"> &#x27;key&#x27;: this.dataForm.key</span><br><span class="line"> &#125;)</span><br><span class="line"> &#125;).then((&#123;data&#125;) =&gt; &#123;</span><br><span class="line"> if (data &amp;&amp; data.code === 0) &#123;</span><br><span class="line"> this.dataList = data.page.list</span><br><span class="line"> this.totalPage = data.page.totalCount</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.dataList = []</span><br><span class="line"> this.totalPage = 0</span><br><span class="line"> &#125;</span><br><span class="line"> this.dataListLoading = false</span><br><span class="line"> &#125;)</span><br><span class="line"> &#125;,</span><br><span class="line"> // 每页数</span><br><span class="line"> sizeChangeHandle (val) &#123;</span><br><span class="line"> this.pageSize = val</span><br><span class="line"> this.pageIndex = 1</span><br><span class="line"> this.getDataList()</span><br><span class="line"> &#125;,</span><br><span class="line"> // 当前页</span><br><span class="line"> currentChangeHandle (val) &#123;</span><br><span class="line"> this.pageIndex = val</span><br><span class="line"> this.getDataList()</span><br><span class="line"> &#125;,</span><br><span class="line"> // 多选</span><br><span class="line"> selectionChangeHandle (val) &#123;</span><br><span class="line"> this.dataListSelections = val</span><br><span class="line"> &#125;,</span><br><span class="line"> // 新增 / 修改</span><br><span class="line"> addOrUpdateHandle (id) &#123;</span><br><span class="line"> this.addOrUpdateVisible = true</span><br><span class="line"> this.$nextTick(() =&gt; &#123;</span><br><span class="line"> this.$refs.addOrUpdate.init(id)</span><br><span class="line"> &#125;)</span><br><span class="line"> &#125;,</span><br><span class="line"> // 删除</span><br><span class="line"> deleteHandle (id) &#123;</span><br><span class="line"> var ids = id ? [id] : this.dataListSelections.map(item =&gt; &#123;</span><br><span class="line"> return item.attrGroupId</span><br><span class="line"> &#125;)</span><br><span class="line"> this.$confirm(`确定对[id=$&#123;ids.join(&#x27;,&#x27;)&#125;]进行[$&#123;id ? &#x27;删除&#x27; : &#x27;批量删除&#x27;&#125;]操作?`, &#x27;提示&#x27;, &#123;</span><br><span class="line"> confirmButtonText: &#x27;确定&#x27;,</span><br><span class="line"> cancelButtonText: &#x27;取消&#x27;,</span><br><span class="line"> type: &#x27;warning&#x27;</span><br><span class="line"> &#125;).then(() =&gt; &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&#x27;/product/attrgroup/delete&#x27;),</span><br><span class="line"> method: &#x27;post&#x27;,</span><br><span class="line"> data: this.$http.adornData(ids, false)</span><br><span class="line"> &#125;).then((&#123;data&#125;) =&gt; &#123;</span><br><span class="line"> if (data &amp;&amp; data.code === 0) &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &#x27;操作成功&#x27;,</span><br><span class="line"> type: &#x27;success&#x27;,</span><br><span class="line"> duration: 1500,</span><br><span class="line"> onClose: () =&gt; &#123;</span><br><span class="line"> this.getDataList()</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;)</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.$message.error(data.msg)</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;)</span><br><span class="line"> &#125;)</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line">&lt;style&gt;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p>页面效果</p>
<p><img src="/pictures/image-20230617173759895.png" alt="image-20230617173759895"></p>
<p><strong>父子组件中数据的传递</strong></p>
<p>子组件给父组件传递的数据,事件传递,子组件给父组件发送一个事件,事件传递</p>
<p>子组件调整</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;el-tree</span><br><span class="line"> :data=&quot;menus&quot;</span><br><span class="line"> :props=&quot;defaultProps&quot;</span><br><span class="line"> node-key=&quot;catId&quot;</span><br><span class="line"> ref=&quot;menuTree&quot;</span><br><span class="line"> @node-click=&quot;nodeclick&quot;</span><br><span class="line"> &gt;&lt;/el-tree&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"> &lt;script&gt;</span><br><span class="line">export default &#123;</span><br><span class="line"> components: &#123;&#125;,</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> menus: [],</span><br><span class="line"> expandedKey: [],</span><br><span class="line"> defaultProps: &#123;</span><br><span class="line"> children: &quot;children&quot;,</span><br><span class="line"> label: &quot;name&quot;,</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> created() &#123;</span><br><span class="line"> this.getMenus();</span><br><span class="line"> &#125;,</span><br><span class="line"> methods: &#123;</span><br><span class="line"> getMenus() &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/category/list/tree&quot;),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> console.log(&quot;商品分类数据:&quot;, data.data);</span><br><span class="line"> this.menus = data.data;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> nodeclick(data,node,component) &#123;</span><br><span class="line"> console.log(&quot;子组件被点击,传递的数据有:data:&quot;,data,&quot;node:&quot;,node,&quot;component:&quot;,component);</span><br><span class="line"> //子组件向父组件传递数据</span><br><span class="line"> this.$emit(&quot;tree-node-click&quot;,data,node,component);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line"> </span><br><span class="line"> &lt;style&gt;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p>父组件接受相应的数据</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;el-row :gutter=&quot;20&quot;&gt;</span><br><span class="line"> &lt;el-col :span=&quot;6&quot;&gt;</span><br><span class="line"> &lt;category @tree-node-click=&quot;treeNodeClick&quot;&gt;&lt;/category</span><br><span class="line"> &gt;&lt;/el-col&gt;</span><br><span class="line"> &lt;el-col :span=&quot;18&quot;&gt;</span><br><span class="line"> &lt;div class=&quot;mod-config&quot;&gt;</span><br><span class="line"> &lt;el-form</span><br><span class="line"> :inline=&quot;true&quot;</span><br><span class="line"> :model=&quot;dataForm&quot;</span><br><span class="line"> @keyup.enter.native=&quot;getDataList()&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-form-item&gt;</span><br><span class="line"> &lt;el-input</span><br><span class="line"> v-model=&quot;dataForm.key&quot;</span><br><span class="line"> placeholder=&quot;参数名&quot;</span><br><span class="line"> clearable</span><br><span class="line"> &gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item&gt;</span><br><span class="line"> &lt;el-button @click=&quot;getDataList()&quot;&gt;查询&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;isAuth(&#x27;product:attrgroup:save&#x27;)&quot;</span><br><span class="line"> type=&quot;primary&quot;</span><br><span class="line"> @click=&quot;addOrUpdateHandle()&quot;</span><br><span class="line"> &gt;新增&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> v-if=&quot;isAuth(&#x27;product:attrgroup:delete&#x27;)&quot;</span><br><span class="line"> type=&quot;danger&quot;</span><br><span class="line"> @click=&quot;deleteHandle()&quot;</span><br><span class="line"> :disabled=&quot;dataListSelections.length &lt;= 0&quot;</span><br><span class="line"> &gt;批量删除&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;/el-form&gt;</span><br><span class="line"> &lt;el-table</span><br><span class="line"> :data=&quot;dataList&quot;</span><br><span class="line"> border</span><br><span class="line"> v-loading=&quot;dataListLoading&quot;</span><br><span class="line"> @selection-change=&quot;selectionChangeHandle&quot;</span><br><span class="line"> style=&quot;width: 100%&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> type=&quot;selection&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> width=&quot;50&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;attrGroupId&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;分组id&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;attrGroupName&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;组名&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;sort&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;排序&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;descript&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;描述&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;icon&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;组图标&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> prop=&quot;catelogId&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> label=&quot;所属分类id&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;el-table-column</span><br><span class="line"> fixed=&quot;right&quot;</span><br><span class="line"> header-align=&quot;center&quot;</span><br><span class="line"> align=&quot;center&quot;</span><br><span class="line"> width=&quot;150&quot;</span><br><span class="line"> label=&quot;操作&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;template slot-scope=&quot;scope&quot;&gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;small&quot;</span><br><span class="line"> @click=&quot;addOrUpdateHandle(scope.row.attrGroupId)&quot;</span><br><span class="line"> &gt;修改&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-button</span><br><span class="line"> type=&quot;text&quot;</span><br><span class="line"> size=&quot;small&quot;</span><br><span class="line"> @click=&quot;deleteHandle(scope.row.attrGroupId)&quot;</span><br><span class="line"> &gt;删除&lt;/el-button</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/template&gt;</span><br><span class="line"> &lt;/el-table-column&gt;</span><br><span class="line"> &lt;/el-table&gt;</span><br><span class="line"> &lt;el-pagination</span><br><span class="line"> @size-change=&quot;sizeChangeHandle&quot;</span><br><span class="line"> @current-change=&quot;currentChangeHandle&quot;</span><br><span class="line"> :current-page=&quot;pageIndex&quot;</span><br><span class="line"> :page-sizes=&quot;[10, 20, 50, 100]&quot;</span><br><span class="line"> :page-size=&quot;pageSize&quot;</span><br><span class="line"> :total=&quot;totalPage&quot;</span><br><span class="line"> layout=&quot;total, sizes, prev, pager, next, jumper&quot;</span><br><span class="line"> &gt;</span><br><span class="line"> &lt;/el-pagination&gt;</span><br><span class="line"> &lt;!-- 弹窗, 新增 / 修改 --&gt;</span><br><span class="line"> &lt;add-or-update</span><br><span class="line"> v-if=&quot;addOrUpdateVisible&quot;</span><br><span class="line"> ref=&quot;addOrUpdate&quot;</span><br><span class="line"> @refreshDataList=&quot;getDataList&quot;</span><br><span class="line"> &gt;&lt;/add-or-update&gt;&lt;/div</span><br><span class="line"> &gt;&lt;/el-col&gt;</span><br><span class="line"> &lt;/el-row&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line">&lt;script&gt;</span><br><span class="line">import Category from &quot;../common/category.vue&quot;;</span><br><span class="line">import AddOrUpdate from &quot;./attrgroup-add-or-update&quot;;</span><br><span class="line">export default &#123;</span><br><span class="line"> data() &#123;</span><br><span class="line"> return &#123;</span><br><span class="line"> catId: 0,</span><br><span class="line"> dataForm: &#123;</span><br><span class="line"> key: &quot;&quot;,</span><br><span class="line"> &#125;,</span><br><span class="line"> dataList: [],</span><br><span class="line"> pageIndex: 1,</span><br><span class="line"> pageSize: 10,</span><br><span class="line"> totalPage: 0,</span><br><span class="line"> dataListLoading: false,</span><br><span class="line"> dataListSelections: [],</span><br><span class="line"> addOrUpdateVisible: false,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> components: &#123;</span><br><span class="line"> AddOrUpdate,</span><br><span class="line"> Category,</span><br><span class="line"> &#125;,</span><br><span class="line"> activated() &#123;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> methods: &#123;</span><br><span class="line"> treeNodeClick(data, node, component) &#123;</span><br><span class="line"> //获取子组件传递过来的值</span><br><span class="line"> console.log(</span><br><span class="line"> &quot;获取子组件传递过来的值:data:&quot;,</span><br><span class="line"> data,</span><br><span class="line"> &quot;node&quot;,</span><br><span class="line"> node,</span><br><span class="line"> &quot;component:&quot;,</span><br><span class="line"> component</span><br><span class="line"> );</span><br><span class="line"> //查询三级分类信息 当点击三级分类id的时候 才查询相关的信息</span><br><span class="line"> if(node.level == 3)&#123;</span><br><span class="line"> this.catId = data.catId;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;,</span><br><span class="line"> // 获取数据列表</span><br><span class="line"> getDataList() &#123;</span><br><span class="line"> this.dataListLoading = true;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(`/product/attrgroup/list/$&#123;this.catId&#125;`),</span><br><span class="line"> method: &quot;get&quot;,</span><br><span class="line"> params: this.$http.adornParams(&#123;</span><br><span class="line"> page: this.pageIndex,</span><br><span class="line"> limit: this.pageSize,</span><br><span class="line"> key: this.dataForm.key,</span><br><span class="line"> &#125;),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> if (data &amp;&amp; data.code === 0) &#123;</span><br><span class="line"> this.dataList = data.page.list;</span><br><span class="line"> this.totalPage = data.page.totalCount;</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.dataList = [];</span><br><span class="line"> this.totalPage = 0;</span><br><span class="line"> &#125;</span><br><span class="line"> this.dataListLoading = false;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> // 每页数</span><br><span class="line"> sizeChangeHandle(val) &#123;</span><br><span class="line"> this.pageSize = val;</span><br><span class="line"> this.pageIndex = 1;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> // 当前页</span><br><span class="line"> currentChangeHandle(val) &#123;</span><br><span class="line"> this.pageIndex = val;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> // 多选</span><br><span class="line"> selectionChangeHandle(val) &#123;</span><br><span class="line"> this.dataListSelections = val;</span><br><span class="line"> &#125;,</span><br><span class="line"> // 新增 / 修改</span><br><span class="line"> addOrUpdateHandle(id) &#123;</span><br><span class="line"> this.addOrUpdateVisible = true;</span><br><span class="line"> this.$nextTick(() =&gt; &#123;</span><br><span class="line"> this.$refs.addOrUpdate.init(id);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> // 删除</span><br><span class="line"> deleteHandle(id) &#123;</span><br><span class="line"> var ids = id</span><br><span class="line"> ? [id]</span><br><span class="line"> : this.dataListSelections.map((item) =&gt; &#123;</span><br><span class="line"> return item.attrGroupId;</span><br><span class="line"> &#125;);</span><br><span class="line"> this.$confirm(</span><br><span class="line"> `确定对[id=$&#123;ids.join(&quot;,&quot;)&#125;]进行[$&#123;id ? &quot;删除&quot; : &quot;批量删除&quot;&#125;]操作?`,</span><br><span class="line"> &quot;提示&quot;,</span><br><span class="line"> &#123;</span><br><span class="line"> confirmButtonText: &quot;确定&quot;,</span><br><span class="line"> cancelButtonText: &quot;取消&quot;,</span><br><span class="line"> type: &quot;warning&quot;,</span><br><span class="line"> &#125;</span><br><span class="line"> ).then(() =&gt; &#123;</span><br><span class="line"> this.$http(&#123;</span><br><span class="line"> url: this.$http.adornUrl(&quot;/product/attrgroup/delete&quot;),</span><br><span class="line"> method: &quot;post&quot;,</span><br><span class="line"> data: this.$http.adornData(ids, false),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> if (data &amp;&amp; data.code === 0) &#123;</span><br><span class="line"> this.$message(&#123;</span><br><span class="line"> message: &quot;操作成功&quot;,</span><br><span class="line"> type: &quot;success&quot;,</span><br><span class="line"> duration: 1500,</span><br><span class="line"> onClose: () =&gt; &#123;</span><br><span class="line"> this.getDataList();</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125; else &#123;</span><br><span class="line"> this.$message.error(data.msg);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line"></span><br><span class="line">&lt;style&gt;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p>后端代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">queryPage</span><span class="params">(Map&lt;String, Object&gt; params, Long catelogId)</span> &#123;</span><br><span class="line"> <span class="comment">//首先先判断catelogId是不是0 如果是0的话就查询所有的属性分组信息</span></span><br><span class="line"> <span class="keyword">if</span> (catelogId == <span class="number">0</span>) &#123;</span><br><span class="line"> IPage&lt;AttrGroupEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;AttrGroupEntity&gt;().getPage(params),</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">QueryWrapper</span>&lt;AttrGroupEntity&gt;()</span><br><span class="line"> );</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> &#125; <span class="keyword">else</span> &#123;</span><br><span class="line"> <span class="comment">//查询的时候传递过来的关键词</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;key&quot;</span>);</span><br><span class="line"> <span class="comment">//SQL语句:select * from pms_attr_group where catelog_id = ? and (attr_group_id = key or attr_group_name = %key%)</span></span><br><span class="line"> LambdaQueryWrapper&lt;AttrGroupEntity&gt; queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;&gt;();</span><br><span class="line"> queryWrapper.eq(AttrGroupEntity::getCatelogId, catelogId);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) &#123;</span><br><span class="line"> queryWrapper.and((obj) -&gt; &#123;</span><br><span class="line"> obj.eq(AttrGroupEntity::getAttrGroupId, key).or().like(AttrGroupEntity::getAttrGroupName, key);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;</span><br><span class="line"> IPage&lt;AttrGroupEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;AttrGroupEntity&gt;().getPage(params),</span><br><span class="line"> queryWrapper</span><br><span class="line"> );</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p><strong>属性分组的添加功能</strong></p>
<p>前端代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line"> &lt;el-dialog</span><br><span class="line"> :title=<span class="string">&quot;!dataForm.attrGroupId ? &#x27;新增&#x27; : &#x27;修改&#x27;&quot;</span></span><br><span class="line"> :close-on-click-modal=<span class="string">&quot;false&quot;</span></span><br><span class="line"> :visible.sync=<span class="string">&quot;visible&quot;</span></span><br><span class="line"> <span class="meta">@closed</span>=<span class="string">&quot;dialogClose&quot;</span></span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-form</span><br><span class="line"> :model=<span class="string">&quot;dataForm&quot;</span></span><br><span class="line"> :rules=<span class="string">&quot;dataRule&quot;</span></span><br><span class="line"> ref=<span class="string">&quot;dataForm&quot;</span></span><br><span class="line"> <span class="meta">@keyup</span>.enter.<span class="keyword">native</span>=<span class="string">&quot;dataFormSubmit()&quot;</span></span><br><span class="line"> label-width=<span class="string">&quot;100px&quot;</span></span><br><span class="line"> &gt;</span><br><span class="line"> &lt;el-form-item label=<span class="string">&quot;组名&quot;</span> prop=<span class="string">&quot;attrGroupName&quot;</span>&gt;</span><br><span class="line"> &lt;el-input</span><br><span class="line"> v-model=<span class="string">&quot;dataForm.attrGroupName&quot;</span></span><br><span class="line"> placeholder=<span class="string">&quot;组名&quot;</span></span><br><span class="line"> &gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=<span class="string">&quot;排序&quot;</span> prop=<span class="string">&quot;sort&quot;</span>&gt;</span><br><span class="line"> &lt;el-input v-model=<span class="string">&quot;dataForm.sort&quot;</span> placeholder=<span class="string">&quot;排序&quot;</span>&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=<span class="string">&quot;描述&quot;</span> prop=<span class="string">&quot;descript&quot;</span>&gt;</span><br><span class="line"> &lt;el-input v-model=<span class="string">&quot;dataForm.descript&quot;</span> placeholder=<span class="string">&quot;描述&quot;</span>&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=<span class="string">&quot;组图标&quot;</span> prop=<span class="string">&quot;icon&quot;</span>&gt;</span><br><span class="line"> &lt;el-input v-model=<span class="string">&quot;dataForm.icon&quot;</span> placeholder=<span class="string">&quot;组图标&quot;</span>&gt;&lt;/el-input&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;el-form-item label=<span class="string">&quot;所属分类id&quot;</span> prop=<span class="string">&quot;catelogId&quot;</span>&gt;</span><br><span class="line"> &lt;!-- &lt;el-input v-model=<span class="string">&quot;dataForm.catelogId&quot;</span> placeholder=<span class="string">&quot;所属分类id&quot;</span>&gt;&lt;/el-input&gt; --&gt;</span><br><span class="line"> &lt;el-cascader</span><br><span class="line"> v-model=<span class="string">&quot;dataForm.catelogPath&quot;</span></span><br><span class="line"> :options=<span class="string">&quot;categorys&quot;</span></span><br><span class="line"> :props=<span class="string">&quot;props&quot;</span></span><br><span class="line"> placeholder=<span class="string">&quot;试试搜索:手机&quot;</span></span><br><span class="line"> filterable</span><br><span class="line"> &gt;&lt;/el-cascader&gt;</span><br><span class="line"> &lt;/el-form-item&gt;</span><br><span class="line"> &lt;/el-form&gt;</span><br><span class="line"> &lt;span slot=<span class="string">&quot;footer&quot;</span> class=<span class="string">&quot;dialog-footer&quot;</span>&gt;</span><br><span class="line"> &lt;el-button <span class="meta">@click</span>=<span class="string">&quot;visible = false&quot;</span>&gt;取消&lt;/el-button&gt;</span><br><span class="line"> &lt;el-button type=<span class="string">&quot;primary&quot;</span> <span class="meta">@click</span>=<span class="string">&quot;dataFormSubmit()&quot;</span>&gt;确定&lt;/el-button&gt;</span><br><span class="line"> &lt;/span&gt;</span><br><span class="line"> &lt;/el-dialog&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line"><span class="keyword">import</span> Category from <span class="string">&quot;../common/category.vue&quot;</span>;</span><br><span class="line"></span><br><span class="line">export <span class="keyword">default</span> &#123;</span><br><span class="line"> data() &#123;</span><br><span class="line"> <span class="keyword">return</span> &#123;</span><br><span class="line"> props: &#123;</span><br><span class="line"> value: <span class="string">&quot;catId&quot;</span>,</span><br><span class="line"> label: <span class="string">&quot;name&quot;</span>,</span><br><span class="line"> children: <span class="string">&quot;children&quot;</span>,</span><br><span class="line"> &#125;,</span><br><span class="line"> categorys: [], <span class="comment">//所有的三级分类信息</span></span><br><span class="line"> visible: <span class="literal">false</span>,</span><br><span class="line"> dataForm: &#123;</span><br><span class="line"> attrGroupId: <span class="number">0</span>,</span><br><span class="line"> attrGroupName: <span class="string">&quot;&quot;</span>,</span><br><span class="line"> sort: <span class="string">&quot;&quot;</span>,</span><br><span class="line"> descript: <span class="string">&quot;&quot;</span>,</span><br><span class="line"> icon: <span class="string">&quot;&quot;</span>,</span><br><span class="line"> catelogPath: [],</span><br><span class="line"> catelogId: <span class="number">0</span>,</span><br><span class="line"> &#125;,</span><br><span class="line"> dataRule: &#123;</span><br><span class="line"> attrGroupName: [</span><br><span class="line"> &#123; required: <span class="literal">true</span>, message: <span class="string">&quot;组名不能为空&quot;</span>, trigger: <span class="string">&quot;blur&quot;</span> &#125;,</span><br><span class="line"> ],</span><br><span class="line"> sort: [&#123; required: <span class="literal">true</span>, message: <span class="string">&quot;排序不能为空&quot;</span>, trigger: <span class="string">&quot;blur&quot;</span> &#125;],</span><br><span class="line"> descript: [</span><br><span class="line"> &#123; required: <span class="literal">true</span>, message: <span class="string">&quot;描述不能为空&quot;</span>, trigger: <span class="string">&quot;blur&quot;</span> &#125;,</span><br><span class="line"> ],</span><br><span class="line"> icon: [&#123; required: <span class="literal">true</span>, message: <span class="string">&quot;组图标不能为空&quot;</span>, trigger: <span class="string">&quot;blur&quot;</span> &#125;],</span><br><span class="line"> catelogId: [</span><br><span class="line"> &#123; required: <span class="literal">true</span>, message: <span class="string">&quot;所属分类id不能为空&quot;</span>, trigger: <span class="string">&quot;blur&quot;</span> &#125;,</span><br><span class="line"> ],</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;;</span><br><span class="line"> &#125;,</span><br><span class="line"> created() &#123;</span><br><span class="line"> <span class="built_in">this</span>.getCategorys();</span><br><span class="line"> &#125;,</span><br><span class="line"> methods: &#123;</span><br><span class="line"> dialogClose() &#123;</span><br><span class="line"> <span class="built_in">this</span>.dataForm.catelogPath = [];</span><br><span class="line"> &#125;,</span><br><span class="line"> getCategorys() &#123;</span><br><span class="line"> <span class="built_in">this</span>.$http(&#123;</span><br><span class="line"> url: <span class="built_in">this</span>.$http.adornUrl(<span class="string">&quot;/product/category/list/tree&quot;</span>),</span><br><span class="line"> method: <span class="string">&quot;get&quot;</span>,</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> <span class="built_in">this</span>.categorys = data.data;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> init(id) &#123;</span><br><span class="line"> <span class="built_in">this</span>.dataForm.attrGroupId = id || <span class="number">0</span>;</span><br><span class="line"> <span class="built_in">this</span>.visible = <span class="literal">true</span>;</span><br><span class="line"> <span class="built_in">this</span>.$nextTick(() =&gt; &#123;</span><br><span class="line"> <span class="built_in">this</span>.$refs[<span class="string">&quot;dataForm&quot;</span>].resetFields();</span><br><span class="line"> <span class="keyword">if</span> (<span class="built_in">this</span>.dataForm.attrGroupId) &#123;</span><br><span class="line"> <span class="built_in">this</span>.$http(&#123;</span><br><span class="line"> url: <span class="built_in">this</span>.$http.adornUrl(</span><br><span class="line"> `/product/attrgroup/info/$&#123;<span class="built_in">this</span>.dataForm.attrGroupId&#125;`</span><br><span class="line"> ),</span><br><span class="line"> method: <span class="string">&quot;get&quot;</span>,</span><br><span class="line"> params: <span class="built_in">this</span>.$http.adornParams(),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> <span class="keyword">if</span> (data &amp;&amp; data.code === <span class="number">0</span>) &#123;</span><br><span class="line"> <span class="built_in">this</span>.dataForm.attrGroupName = data.attrGroup.attrGroupName;</span><br><span class="line"> <span class="built_in">this</span>.dataForm.sort = data.attrGroup.sort;</span><br><span class="line"> <span class="built_in">this</span>.dataForm.descript = data.attrGroup.descript;</span><br><span class="line"> <span class="built_in">this</span>.dataForm.icon = data.attrGroup.icon;</span><br><span class="line"> <span class="built_in">this</span>.dataForm.catelogId = data.attrGroup.catelogId;</span><br><span class="line"> <span class="comment">//查出catelog的完整路径</span></span><br><span class="line"> <span class="built_in">this</span>.dataForm.catelogPath = data.attrGroup.catelogPath;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> <span class="comment">// 表单提交</span></span><br><span class="line"> dataFormSubmit() &#123;</span><br><span class="line"> <span class="built_in">this</span>.$refs[<span class="string">&quot;dataForm&quot;</span>].validate((valid) =&gt; &#123;</span><br><span class="line"> <span class="keyword">if</span> (valid) &#123;</span><br><span class="line"> <span class="built_in">this</span>.$http(&#123;</span><br><span class="line"> url: <span class="built_in">this</span>.$http.adornUrl(</span><br><span class="line"> `/product/attrgroup/$&#123;</span><br><span class="line"> !<span class="built_in">this</span>.dataForm.attrGroupId ? <span class="string">&quot;save&quot;</span> : <span class="string">&quot;update&quot;</span></span><br><span class="line"> &#125;`</span><br><span class="line"> ),</span><br><span class="line"> method: <span class="string">&quot;post&quot;</span>,</span><br><span class="line"> data: <span class="built_in">this</span>.$http.adornData(&#123;</span><br><span class="line"> attrGroupId: <span class="built_in">this</span>.dataForm.attrGroupId || undefined,</span><br><span class="line"> attrGroupName: <span class="built_in">this</span>.dataForm.attrGroupName,</span><br><span class="line"> sort: <span class="built_in">this</span>.dataForm.sort,</span><br><span class="line"> descript: <span class="built_in">this</span>.dataForm.descript,</span><br><span class="line"> icon: <span class="built_in">this</span>.dataForm.icon,</span><br><span class="line"> catelogId:</span><br><span class="line"> <span class="built_in">this</span>.dataForm.catelogPath[<span class="built_in">this</span>.dataForm.catelogPath.length - <span class="number">1</span>],</span><br><span class="line"> &#125;),</span><br><span class="line"> &#125;).then((&#123; data &#125;) =&gt; &#123;</span><br><span class="line"> <span class="keyword">if</span> (data &amp;&amp; data.code === <span class="number">0</span>) &#123;</span><br><span class="line"> <span class="built_in">this</span>.$message(&#123;</span><br><span class="line"> message: <span class="string">&quot;操作成功&quot;</span>,</span><br><span class="line"> type: <span class="string">&quot;success&quot;</span>,</span><br><span class="line"> duration: <span class="number">1500</span>,</span><br><span class="line"> onClose: () =&gt; &#123;</span><br><span class="line"> <span class="built_in">this</span>.visible = <span class="literal">false</span>;</span><br><span class="line"> <span class="built_in">this</span>.$emit(<span class="string">&quot;refreshDataList&quot;</span>);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125; <span class="keyword">else</span> &#123;</span><br><span class="line"> <span class="built_in">this</span>.$message.error(data.msg);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;,</span><br><span class="line"> &#125;,</span><br><span class="line">&#125;;</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>
<p>后端代码</p>
<p>在商品分类的children上加上@JsonInclude注解解决后面的级联选择多出一个空白的选择的问题</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@JsonInclude(JsonInclude.Include.NON_EMPTY)</span></span><br><span class="line"><span class="meta">@TableField(exist = false)</span><span class="comment">//这个注解要加,因为这个属性不是数据库中的字段</span></span><br><span class="line"><span class="keyword">private</span> List&lt;CategoryEntity&gt; children;<span class="comment">//这里的属性名不是瞎起的,与ElementUI中的显示相对应,这里改了,前端也要改</span></span><br></pre></td></tr></table></figure>
<p>修改的时候,级联选择部分数据的回显</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 找到catelog的完整路径</span><br><span class="line"> * @param catelogId 路径的最后一个catelog的id</span><br><span class="line"> * @return 完整的路径</span><br><span class="line"> */</span><br><span class="line"> @Override</span><br><span class="line"> public Long[] findCatelogPath(Long catelogId) &#123;</span><br><span class="line"> List&lt;Long&gt; paths = new ArrayList&lt;&gt;();</span><br><span class="line"> List&lt;Long&gt; parentPath = findParentPath(catelogId, paths);</span><br><span class="line"> Collections.reverse(parentPath);</span><br><span class="line"> return (Long[]) parentPath.toArray(new Long[parentPath.size()]);</span><br><span class="line"> &#125;</span><br><span class="line"> /**</span><br><span class="line"> * 递归找出所有的路径</span><br><span class="line"> */</span><br><span class="line"> private List&lt;Long&gt; findParentPath(Long catelogId,List&lt;Long&gt; paths)&#123;</span><br><span class="line"> paths.add(catelogId);</span><br><span class="line"> //根据id查询相关的信息</span><br><span class="line"> CategoryEntity category = this.getById(catelogId);</span><br><span class="line"> if(category.getParentCid()!=0)&#123;</span><br><span class="line"> findParentPath(category.getParentCid(),paths);</span><br><span class="line"> &#125;</span><br><span class="line"> return paths;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>属性关联商品的规格参数和基本属性信息</p>
<p>功能描述</p>
<p><img src="/pictures/image-20230625090118059.png" alt="image-20230625090118059"></p>
<p>查询商品下关联的属性分组信息</p>
<p>查询商品关联属性分组的后端关键代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 根据分组的id查询关联的所有属性</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> attrgroupId 分组的id</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 关联的所有属性组成集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> List&lt;AttrEntity&gt; <span class="title function_">getRelationAttr</span><span class="params">(Long attrgroupId)</span> &#123;</span><br><span class="line"> <span class="comment">//根据中间表查询出属性分组的id信息</span></span><br><span class="line"> List&lt;AttrAttrgroupRelationEntity&gt; relationEntityList = relationDao.selectList(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;AttrAttrgroupRelationEntity&gt;().eq(AttrAttrgroupRelationEntity::getAttrGroupId, attrgroupId));</span><br><span class="line"> List&lt;Long&gt; attrIds = <span class="keyword">new</span> <span class="title class_">ArrayList</span>&lt;&gt;();</span><br><span class="line"> <span class="keyword">for</span> (AttrAttrgroupRelationEntity relationEntity : relationEntityList) &#123;</span><br><span class="line"> attrIds.add(relationEntity.getAttrId());</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//根据属性分组的id查询属性分组的详细信息</span></span><br><span class="line"> <span class="keyword">return</span> (List&lt;AttrEntity&gt;) <span class="built_in">this</span>.listByIds(attrIds);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>移除关联属性分组的功能后端的关键代码</p>
<p>service层的代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 批量删除商品关联的属性分组信息</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> vos 属性id和属性分组id组成的集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">deleteRelation</span><span class="params">(AttrGroupRelationVo[] vos)</span> &#123;</span><br><span class="line"> List&lt;AttrAttrgroupRelationEntity&gt; entities = Arrays.asList(vos).stream().map((item) -&gt; &#123;</span><br><span class="line"> <span class="type">AttrAttrgroupRelationEntity</span> <span class="variable">relationEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">AttrAttrgroupRelationEntity</span>();</span><br><span class="line"> BeanUtils.copyProperties(item, relationEntity);</span><br><span class="line"> <span class="keyword">return</span> relationEntity;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> relationDao.deleteBatchRelation(entities);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>dao层的代码</p>
<p>使用动态的sql批量的删除属性和分组的关联关系</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--void deleteBatchRelation(List&lt;AttrAttrgroupRelationEntity&gt; entities);--&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">delete</span> <span class="attr">id</span>=<span class="string">&quot;deleteBatchRelation&quot;</span>&gt;</span></span><br><span class="line"> delete from `pms_attr_attrgroup_relation` where</span><br><span class="line"> <span class="tag">&lt;<span class="name">foreach</span> <span class="attr">collection</span>=<span class="string">&quot;entities&quot;</span> <span class="attr">item</span>=<span class="string">&quot;item&quot;</span> <span class="attr">separator</span>=<span class="string">&quot; OR &quot;</span>&gt;</span></span><br><span class="line"> (attr_id = #&#123;item.attrId&#125;) and attr_group_id = #&#123;item.attrGroupId&#125;</span><br><span class="line"> <span class="tag">&lt;/<span class="name">foreach</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">delete</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>查询属性分组没有关联的属性</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 获取当前分组没有关联的所有属性</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> params 分页相关的参数</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> attrgroupId 属性分组的id</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 分页相关的数据</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">getNoRelationAttr</span><span class="params">(Map&lt;String, Object&gt; params, Long attrgroupId)</span> &#123;</span><br><span class="line"> <span class="comment">//当前的分组只能关联自己所属的分类里面的所有属性 例如手机的分类里面只能关联手机的所有属性</span></span><br><span class="line"> <span class="type">AttrGroupEntity</span> <span class="variable">attrGroupEntity</span> <span class="operator">=</span> attrGroupDao.selectById(attrgroupId);</span><br><span class="line"> <span class="type">Long</span> <span class="variable">catelogId</span> <span class="operator">=</span> attrGroupEntity.getCatelogId();</span><br><span class="line"> <span class="comment">//当前分组只能关联别的分组没有引用的属性</span></span><br><span class="line"> List&lt;AttrGroupEntity&gt; groups = attrGroupDao.selectList(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;AttrGroupEntity&gt;().eq(AttrGroupEntity::getCatelogId, catelogId));</span><br><span class="line"> List&lt;Long&gt; collect = groups.stream().map((item) -&gt; &#123;</span><br><span class="line"> <span class="keyword">return</span> item.getAttrGroupId();</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> List&lt;AttrAttrgroupRelationEntity&gt; groupId = relationDao.selectList(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;AttrAttrgroupRelationEntity&gt;().in(AttrAttrgroupRelationEntity::getAttrGroupId, collect));</span><br><span class="line"> List&lt;Long&gt; attrIds = groupId.stream().map((item) -&gt; &#123;</span><br><span class="line"> <span class="keyword">return</span> item.getAttrId();</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> LambdaQueryWrapper&lt;AttrEntity&gt; queryWrapper =</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;AttrEntity&gt;().eq(AttrEntity::getCatelogId, catelogId).eq(AttrEntity::getAttrType,ProductConstant.AttrEnum.ATTR_TYPE_BASE.getCode());</span><br><span class="line"> <span class="keyword">if</span> (attrIds != <span class="literal">null</span> &amp;&amp; attrIds.size() &gt; <span class="number">0</span>) &#123;</span><br><span class="line"> queryWrapper.notIn(AttrEntity::getAttrId, attrIds);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;key&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) &#123;</span><br><span class="line"> queryWrapper.eq(AttrEntity::getAttrId, key).or().like(AttrEntity::getAttrName, key);</span><br><span class="line"> &#125;</span><br><span class="line"> IPage&lt;AttrEntity&gt; page = <span class="built_in">this</span>.page(<span class="keyword">new</span> <span class="title class_">Query</span>&lt;AttrEntity&gt;().getPage(params), queryWrapper);</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>给属性关联相关的规格参数和销售属性</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">saveBatch</span><span class="params">(List&lt;AttrGroupRelationVo&gt; vos)</span> &#123;</span><br><span class="line"> List&lt;AttrAttrgroupRelationEntity&gt; entities = vos.stream().map((item) -&gt; &#123;</span><br><span class="line"> <span class="type">AttrAttrgroupRelationEntity</span> <span class="variable">relationEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">AttrAttrgroupRelationEntity</span>();</span><br><span class="line"> BeanUtils.copyProperties(item, relationEntity);</span><br><span class="line"> <span class="keyword">return</span> relationEntity;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> <span class="built_in">this</span>.saveBatch(entities);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<h4 id="1-3-2-规格参数功能"><a href="#1-3-2-规格参数功能" class="headerlink" title="1.3.2 规格参数功能"></a>1.3.2 规格参数功能</h4><p>功能截图</p>
<p><img src="/pictures/image-20230619111338153.png" alt="image-20230619111338153"></p>
<p>新增功能的后端关键代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 保存规格参数信息</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> attr 页面中提交的规格参数相关的信息组成的实体</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Transactional</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">saveAttr</span><span class="params">(AttrVo attr)</span> &#123;</span><br><span class="line"> <span class="type">AttrEntity</span> <span class="variable">attrEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">AttrEntity</span>();</span><br><span class="line"> BeanUtils.copyProperties(attr,attrEntity);</span><br><span class="line"> <span class="comment">//保存基本的数据</span></span><br><span class="line"> <span class="built_in">this</span>.save(attrEntity);</span><br><span class="line"> <span class="comment">//保存关联关系</span></span><br><span class="line"> <span class="type">AttrAttrgroupRelationEntity</span> <span class="variable">relationEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">AttrAttrgroupRelationEntity</span>();</span><br><span class="line"> relationEntity.setAttrGroupId(attr.getAttrGroupId());</span><br><span class="line"> relationEntity.setAttrId(attrEntity.getAttrId());</span><br><span class="line"> relationDao.insert(relationEntity);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>查询列表后端的关键代码</p>
<p>这里使用的stream流处理数据没有使用多表联合查询来查询数据</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">queryBaseAttrPage</span><span class="params">(Map&lt;String, Object&gt; params, Long catelogId)</span> &#123;</span><br><span class="line"> LambdaQueryWrapper&lt;AttrEntity&gt; queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;&gt;();</span><br><span class="line"> <span class="keyword">if</span> (catelogId != <span class="number">0</span>) &#123;<span class="comment">//等于0就是查询所有的分类信息下的规格参数信息</span></span><br><span class="line"> queryWrapper.eq(AttrEntity::getCatelogId, catelogId);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//获取检索的条件</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;key&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) &#123;</span><br><span class="line"> queryWrapper.like(AttrEntity::getAttrName, key).or().eq(AttrEntity::getAttrId, key);</span><br><span class="line"> &#125;</span><br><span class="line"> IPage&lt;AttrEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;AttrEntity&gt;().getPage(params),</span><br><span class="line"> queryWrapper</span><br><span class="line"> );</span><br><span class="line"> <span class="type">PageUtils</span> <span class="variable">pageUtils</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> List&lt;AttrEntity&gt; records = page.getRecords();</span><br><span class="line"> List&lt;AttrRespVo&gt; respVos = records.stream().map((attrEntity) -&gt; &#123;</span><br><span class="line"> <span class="type">AttrRespVo</span> <span class="variable">attrRespVo</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">AttrRespVo</span>();</span><br><span class="line"> BeanUtils.copyProperties(attrEntity, attrRespVo);</span><br><span class="line"> <span class="comment">//设置三级商品分类名和分组名</span></span><br><span class="line"> <span class="comment">//设置所属的商品的分类名</span></span><br><span class="line"> <span class="type">CategoryEntity</span> <span class="variable">categoryEntity</span> <span class="operator">=</span> categoryDao.selectById(attrRespVo.getCatelogId());</span><br><span class="line"> <span class="keyword">if</span> (categoryEntity != <span class="literal">null</span>) &#123;</span><br><span class="line"> attrRespVo.setCatelogName(categoryEntity.getName());</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//设置分组名需要从中间表查询分组的id再查询分组名</span></span><br><span class="line"> <span class="comment">//先从中间表查询到分组的id</span></span><br><span class="line"> <span class="type">AttrAttrgroupRelationEntity</span> <span class="variable">relationEntity</span> <span class="operator">=</span> relationDao.selectOne(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;AttrAttrgroupRelationEntity&gt;().eq(AttrAttrgroupRelationEntity::getAttrId, attrRespVo.getAttrId()));</span><br><span class="line"> <span class="comment">//从分组的表中查询分组名</span></span><br><span class="line"> <span class="keyword">if</span> (relationEntity != <span class="literal">null</span>) &#123;</span><br><span class="line"> <span class="type">AttrGroupEntity</span> <span class="variable">attrGroupEntity</span> <span class="operator">=</span> attrGroupDao.selectById(relationEntity.getAttrGroupId());</span><br><span class="line"> attrRespVo.setGroupName(attrGroupEntity.getAttrGroupName());</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> attrRespVo;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> pageUtils.setList(respVos);</span><br><span class="line"> <span class="keyword">return</span> pageUtils;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>规格参数修改功能后端的关键代码</p>
<p>修改前的数据回显</p>
<p>查询属性的详情信息</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 查询属性的详细信息</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> attrId 属性的id</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 属性的详细信息封装的集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> AttrRespVo <span class="title function_">getAttrInfo</span><span class="params">(Long attrId)</span> &#123;</span><br><span class="line"> <span class="type">AttrRespVo</span> <span class="variable">attrRespVo</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">AttrRespVo</span>();</span><br><span class="line"> <span class="comment">//查询属性的基本信息</span></span><br><span class="line"> <span class="type">AttrEntity</span> <span class="variable">attr</span> <span class="operator">=</span> <span class="built_in">this</span>.getById(attrId);</span><br><span class="line"> BeanUtils.copyProperties(attr, attrRespVo);</span><br><span class="line"> <span class="comment">//查询分组id和分类的详细路径</span></span><br><span class="line"> <span class="comment">//分组信息的设置</span></span><br><span class="line"> <span class="type">AttrAttrgroupRelationEntity</span> <span class="variable">relationEntity</span> <span class="operator">=</span> relationDao.selectOne(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;AttrAttrgroupRelationEntity&gt;().eq(AttrAttrgroupRelationEntity::getAttrId, attrRespVo.getAttrId()));</span><br><span class="line"> <span class="keyword">if</span> (relationEntity != <span class="literal">null</span>) &#123;</span><br><span class="line"> attrRespVo.setAttrGroupId(relationEntity.getAttrGroupId());</span><br><span class="line"> <span class="type">AttrGroupEntity</span> <span class="variable">attrGroupEntity</span> <span class="operator">=</span> attrGroupDao.selectById(relationEntity.getAttrGroupId());</span><br><span class="line"> <span class="keyword">if</span> (attrGroupEntity != <span class="literal">null</span>) &#123;</span><br><span class="line"> attrRespVo.setGroupName(attrGroupEntity.getAttrGroupName());</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//设置分类信息</span></span><br><span class="line"> <span class="type">Long</span> <span class="variable">catelogId</span> <span class="operator">=</span> attr.getCatelogId();</span><br><span class="line"> <span class="comment">//查询分类的完整路径</span></span><br><span class="line"> Long[] catelogPath = categoryService.findCatelogPath(catelogId);</span><br><span class="line"> <span class="keyword">if</span> (catelogPath != <span class="literal">null</span>) &#123;</span><br><span class="line"> attrRespVo.setCatelogPath(catelogPath);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//设置分类名</span></span><br><span class="line"> <span class="type">CategoryEntity</span> <span class="variable">category</span> <span class="operator">=</span> categoryDao.selectById(catelogId);</span><br><span class="line"> <span class="keyword">if</span> (category != <span class="literal">null</span>) &#123;</span><br><span class="line"> attrRespVo.setCatelogName(category.getName());</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> attrRespVo;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>修改的时候页面回显的效果</p>
<p><img src="/pictures/image-20230624192906124.png" alt="image-20230624192906124"></p>
<p>修改功能后端的关键代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 修改属性的方法</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> attr 页面传输过来的商品属性的实体</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Transactional</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">updateAttr</span><span class="params">(AttrVo attr)</span> &#123;</span><br><span class="line"> <span class="comment">//修改基本的数据</span></span><br><span class="line"> <span class="type">AttrEntity</span> <span class="variable">attrEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">AttrEntity</span>();</span><br><span class="line"> BeanUtils.copyProperties(attr, attrEntity);</span><br><span class="line"> <span class="built_in">this</span>.updateById(attrEntity);</span><br><span class="line"> <span class="comment">//修改关联表的数据</span></span><br><span class="line"> <span class="type">AttrAttrgroupRelationEntity</span> <span class="variable">relationEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">AttrAttrgroupRelationEntity</span>();</span><br><span class="line"> BeanUtils.copyProperties(attr, relationEntity);</span><br><span class="line"> LambdaQueryWrapper&lt;AttrAttrgroupRelationEntity&gt; queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;&gt;();</span><br><span class="line"> queryWrapper.eq(AttrAttrgroupRelationEntity::getAttrId, relationEntity.getAttrId());</span><br><span class="line"> <span class="type">Integer</span> <span class="variable">count</span> <span class="operator">=</span> relationDao.selectCount(queryWrapper);</span><br><span class="line"> <span class="keyword">if</span> (count &gt; <span class="number">0</span>) &#123;<span class="comment">//判断是修改还是添加的操作</span></span><br><span class="line"> relationDao.update(relationEntity, queryWrapper);</span><br><span class="line"> &#125; <span class="keyword">else</span> &#123;</span><br><span class="line"> relationDao.insert(relationEntity);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<h4 id="1-3-3-销售属性功能"><a href="#1-3-3-销售属性功能" class="headerlink" title="1.3.3 销售属性功能"></a>1.3.3 销售属性功能</h4><p>分类属性列表显示</p>
<p>controller层的代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * /product/attr/sale/list/&#123;catelogId&#125;</span></span><br><span class="line"><span class="comment"> * 路径 /product/attr/base/list/&#123;catelogId&#125;</span></span><br><span class="line"><span class="comment"> * 规格参数的列表显示</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> params 条件查询的参数</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> catelogId 商品分类的id</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 规格参数的分页数据</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@GetMapping(&quot;/&#123;attrType&#125;/list/&#123;catelogId&#125;&quot;)</span></span><br><span class="line"> <span class="keyword">public</span> R <span class="title function_">baseAttrList</span><span class="params">(<span class="meta">@RequestParam</span> Map&lt;String, Object&gt; params, <span class="meta">@PathVariable</span> Long catelogId, <span class="meta">@PathVariable(&quot;attrType&quot;)</span> String type)</span> &#123;</span><br><span class="line"> log.warn(<span class="string">&quot;规格参数分页的查询条件:&#123;&#125;,商品分类的id:&#123;&#125;&quot;</span>, params, catelogId);</span><br><span class="line"> <span class="type">PageUtils</span> <span class="variable">page</span> <span class="operator">=</span> attrService.queryBaseAttrPage(params, catelogId,type);</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">&quot;page&quot;</span>, page);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>service层的代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">queryBaseAttrPage</span><span class="params">(Map&lt;String, Object&gt; params, Long catelogId, String type)</span> &#123;</span><br><span class="line"> LambdaQueryWrapper&lt;AttrEntity&gt; queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;&gt;();</span><br><span class="line"> <span class="comment">//路径中属性的attrType是base就是基本属性否则就代表的是销售属性</span></span><br><span class="line"> queryWrapper.eq(AttrEntity::getAttrType, <span class="string">&quot;base&quot;</span>.equalsIgnoreCase(type) ? <span class="number">1</span> : <span class="number">0</span>);</span><br><span class="line"> <span class="keyword">if</span> (catelogId != <span class="number">0</span>) &#123;<span class="comment">//等于0就是查询所有的分类信息下的规格参数信息</span></span><br><span class="line"> queryWrapper.eq(AttrEntity::getCatelogId, catelogId);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//获取检索的条件</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;key&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) &#123;</span><br><span class="line"> queryWrapper.like(AttrEntity::getAttrName, key).or().eq(AttrEntity::getAttrId, key);</span><br><span class="line"> &#125;</span><br><span class="line"> IPage&lt;AttrEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;AttrEntity&gt;().getPage(params),</span><br><span class="line"> queryWrapper</span><br><span class="line"> );</span><br><span class="line"> <span class="type">PageUtils</span> <span class="variable">pageUtils</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> List&lt;AttrEntity&gt; records = page.getRecords();</span><br><span class="line"> List&lt;AttrRespVo&gt; respVos = records.stream().map((attrEntity) -&gt; &#123;</span><br><span class="line"> <span class="type">AttrRespVo</span> <span class="variable">attrRespVo</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">AttrRespVo</span>();</span><br><span class="line"> BeanUtils.copyProperties(attrEntity, attrRespVo);</span><br><span class="line"> <span class="comment">//设置三级商品分类名和分组名</span></span><br><span class="line"> <span class="comment">//设置所属的商品的分类名</span></span><br><span class="line"> <span class="type">CategoryEntity</span> <span class="variable">categoryEntity</span> <span class="operator">=</span> categoryDao.selectById(attrRespVo.getCatelogId());</span><br><span class="line"> <span class="keyword">if</span> (categoryEntity != <span class="literal">null</span>) &#123;</span><br><span class="line"> attrRespVo.setCatelogName(categoryEntity.getName());</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//设置分组名需要从中间表查询分组的id再查询分组名</span></span><br><span class="line"> <span class="comment">//先从中间表查询到分组的id</span></span><br><span class="line"> <span class="type">AttrAttrgroupRelationEntity</span> <span class="variable">relationEntity</span> <span class="operator">=</span> relationDao.selectOne(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;AttrAttrgroupRelationEntity&gt;().eq(AttrAttrgroupRelationEntity::getAttrId, attrRespVo.getAttrId()));</span><br><span class="line"> <span class="comment">//从分组的表中查询分组名</span></span><br><span class="line"> <span class="keyword">if</span> (relationEntity != <span class="literal">null</span>) &#123;</span><br><span class="line"> <span class="type">AttrGroupEntity</span> <span class="variable">attrGroupEntity</span> <span class="operator">=</span> attrGroupDao.selectById(relationEntity.getAttrGroupId());</span><br><span class="line"> <span class="keyword">if</span> (attrGroupEntity != <span class="literal">null</span>) &#123;</span><br><span class="line"> attrRespVo.setGroupName(attrGroupEntity.getAttrGroupName());</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> attrRespVo;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> pageUtils.setList(respVos);</span><br><span class="line"> <span class="keyword">return</span> pageUtils;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>完整的功能展示</p>
<p><img src="/pictures/image-20230625090037616.png" alt="image-20230625090037616"></p>
<h3 id="1-4-商品维护"><a href="#1-4-商品维护" class="headerlink" title="1.4 商品维护"></a>1.4 商品维护</h3><h4 id="1-4-1-SPU管理"><a href="#1-4-1-SPU管理" class="headerlink" title="1.4.1 SPU管理"></a>1.4.1 SPU管理</h4><p><strong>条件查询功能Spu检索</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * Spu检索功能</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> params 分页相关的数据</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 分页对象</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">queryPageByCondition</span><span class="params">(Map&lt;String, Object&gt; params)</span> &#123;</span><br><span class="line"> LambdaQueryWrapper&lt;SpuInfoEntity&gt; queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;&gt;();</span><br><span class="line"> <span class="comment">//关键字检索</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;key&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) &#123;</span><br><span class="line"> <span class="comment">//这里使用了or为了和下面的区分开来,要使用and,将下面这个条件用括号括起来</span></span><br><span class="line"> <span class="comment">//SELECT COUNT(1) FROM pms_spu_info WHERE (((spu_name LIKE ? OR id = ?)) AND catalog_id = ? AND brand_id = ? AND publish_status = ?)</span></span><br><span class="line"> queryWrapper.and((wrapper) -&gt; &#123;</span><br><span class="line"> wrapper.like(SpuInfoEntity::getSpuName, key).or().eq(SpuInfoEntity::getId, key);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//分类</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">catelogId</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;catelogId&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(catelogId)) &#123;</span><br><span class="line"> queryWrapper.eq(SpuInfoEntity::getCatalogId, catelogId);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//品牌</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">brandId</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;brandId&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(brandId)) &#123;</span><br><span class="line"> queryWrapper.eq(SpuInfoEntity::getBrandId, brandId);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//状态</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">status</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;status&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(status)) &#123;</span><br><span class="line"> queryWrapper.eq(SpuInfoEntity::getPublishStatus, status);</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> IPage&lt;SpuInfoEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;SpuInfoEntity&gt;().getPage(params),</span><br><span class="line"> queryWrapper</span><br><span class="line"> );</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>实现的功能</p>
<p><img src="/pictures/image-20230627102918192.png" alt="image-20230627102918192"></p>
<p>前端显示时间格式的数据有问题</p>
<p>配置文件中的配置</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">jackson:</span></span><br><span class="line"> <span class="attr">date-format:</span> <span class="string">yyyy-MM-dd</span> <span class="string">HH:mm:ss</span></span><br><span class="line"> <span class="attr">time-zone:</span> <span class="string">GMT+8</span></span><br></pre></td></tr></table></figure>
<p><strong>商品规格的回显</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 查询商品的规格属性</span></span><br><span class="line"><span class="comment"> * /product/attr/base/listforspu/&#123;spuId&#125;</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@GetMapping(&quot;/base/listforspu/&#123;spuId&#125;&quot;)</span></span><br><span class="line"><span class="keyword">public</span> R <span class="title function_">baseAttrList</span><span class="params">(<span class="meta">@PathVariable(&quot;spuId&quot;)</span> Long spuId)</span>&#123;</span><br><span class="line"> List&lt;ProductAttrValueEntity&gt; entities = productAttrValueService.baseAttrListForSpu(spuId);</span><br><span class="line"> <span class="keyword">return</span> R.ok().put(<span class="string">&quot;data&quot;</span>,entities);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>修改商品的规格</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 修改商品的规格参数</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> spuId 商品的id</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> productAttrValueEntities 提交的修改之后的商品规格参数组成的集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Transactional</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">updateSpuAttr</span><span class="params">(Long spuId, List&lt;ProductAttrValueEntity&gt; productAttrValueEntities)</span> &#123;</span><br><span class="line"> <span class="comment">//1.删除这个spuId之前对应的所有属性</span></span><br><span class="line"> <span class="built_in">this</span>.baseMapper.delete(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;ProductAttrValueEntity&gt;().eq(ProductAttrValueEntity::getSpuId,spuId));</span><br><span class="line"> <span class="comment">//2.添加修改之后的商品的属性信息</span></span><br><span class="line"> List&lt;ProductAttrValueEntity&gt; collect = productAttrValueEntities.stream().map(item -&gt; &#123;</span><br><span class="line"> item.setSpuId(spuId);</span><br><span class="line"> <span class="keyword">return</span> item;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> <span class="built_in">this</span>.saveBatch(collect);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>实现的功能</p>
<p><img src="/pictures/image-20230628165931139.png" alt="image-20230628165931139"></p>
<p>中间遇到的问题,点击规格页面显示400的问题</p>
<p><img src="/pictures/image-20230628171558364.png" alt="image-20230628171558364"></p>
<p>解决方案</p>
<p>第一步:在gulimall-admin数据库中执行以下的sql语句</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">INSERT</span> <span class="keyword">INTO</span> sys_menu (menu_id, parent_id, name, url, perms, type, icon, order_num) <span class="keyword">VALUES</span> (<span class="number">76</span>, <span class="number">37</span>, <span class="string">&#x27;规格维护&#x27;</span>, <span class="string">&#x27;product/attrupdate&#x27;</span>, <span class="string">&#x27;&#x27;</span>, <span class="number">2</span>, <span class="string">&#x27;log&#x27;</span>, <span class="number">0</span>);</span><br></pre></td></tr></table></figure>
<p>第二步:将前端src&#x2F;router&#x2F;index.js替换成如下的内容</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 全站路由配置</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * 建议:</span></span><br><span class="line"><span class="comment"> * 1. 代码中路由统一使用name属性跳转(不使用path属性)</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">import</span> <span class="title class_">Vue</span> <span class="keyword">from</span> <span class="string">&#x27;vue&#x27;</span></span><br><span class="line"><span class="keyword">import</span> <span class="title class_">Router</span> <span class="keyword">from</span> <span class="string">&#x27;vue-router&#x27;</span></span><br><span class="line"><span class="keyword">import</span> http <span class="keyword">from</span> <span class="string">&#x27;@/utils/httpRequest&#x27;</span></span><br><span class="line"><span class="keyword">import</span> &#123; isURL &#125; <span class="keyword">from</span> <span class="string">&#x27;@/utils/validate&#x27;</span></span><br><span class="line"><span class="keyword">import</span> &#123; clearLoginInfo &#125; <span class="keyword">from</span> <span class="string">&#x27;@/utils&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="title class_">Vue</span>.<span class="title function_">use</span>(<span class="title class_">Router</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">// 开发环境不使用懒加载, 因为懒加载页面太多的话会造成webpack热更新太慢, 所以只有生产环境使用懒加载</span></span><br><span class="line"><span class="keyword">const</span> _import = <span class="built_in">require</span>(<span class="string">&#x27;./import-&#x27;</span> + process.<span class="property">env</span>.<span class="property">NODE_ENV</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">// 全局路由(无需嵌套上左右整体布局)</span></span><br><span class="line"><span class="keyword">const</span> globalRoutes = [</span><br><span class="line"> &#123; <span class="attr">path</span>: <span class="string">&#x27;/404&#x27;</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">&#x27;common/404&#x27;</span>), <span class="attr">name</span>: <span class="string">&#x27;404&#x27;</span>, <span class="attr">meta</span>: &#123; <span class="attr">title</span>: <span class="string">&#x27;404未找到&#x27;</span> &#125; &#125;,</span><br><span class="line"> &#123; <span class="attr">path</span>: <span class="string">&#x27;/login&#x27;</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">&#x27;common/login&#x27;</span>), <span class="attr">name</span>: <span class="string">&#x27;login&#x27;</span>, <span class="attr">meta</span>: &#123; <span class="attr">title</span>: <span class="string">&#x27;登录&#x27;</span> &#125; &#125;</span><br><span class="line">]</span><br><span class="line"></span><br><span class="line"><span class="comment">// 主入口路由(需嵌套上左右整体布局)</span></span><br><span class="line"><span class="keyword">const</span> mainRoutes = &#123;</span><br><span class="line"> <span class="attr">path</span>: <span class="string">&#x27;/&#x27;</span>,</span><br><span class="line"> <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">&#x27;main&#x27;</span>),</span><br><span class="line"> <span class="attr">name</span>: <span class="string">&#x27;main&#x27;</span>,</span><br><span class="line"> <span class="attr">redirect</span>: &#123; <span class="attr">name</span>: <span class="string">&#x27;home&#x27;</span> &#125;,</span><br><span class="line"> <span class="attr">meta</span>: &#123; <span class="attr">title</span>: <span class="string">&#x27;主入口整体布局&#x27;</span> &#125;,</span><br><span class="line"> <span class="attr">children</span>: [</span><br><span class="line"> <span class="comment">// 通过meta对象设置路由展示方式</span></span><br><span class="line"> <span class="comment">// 1. isTab: 是否通过tab展示内容, true: 是, false: 否</span></span><br><span class="line"> <span class="comment">// 2. iframeUrl: 是否通过iframe嵌套展示内容, &#x27;以http[s]://开头&#x27;: 是, &#x27;&#x27;: 否</span></span><br><span class="line"> <span class="comment">// 提示: 如需要通过iframe嵌套展示内容, 但不通过tab打开, 请自行创建组件使用iframe处理!</span></span><br><span class="line"> &#123; <span class="attr">path</span>: <span class="string">&#x27;/home&#x27;</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">&#x27;common/home&#x27;</span>), <span class="attr">name</span>: <span class="string">&#x27;home&#x27;</span>, <span class="attr">meta</span>: &#123; <span class="attr">title</span>: <span class="string">&#x27;首页&#x27;</span> &#125; &#125;,</span><br><span class="line"> &#123; <span class="attr">path</span>: <span class="string">&#x27;/theme&#x27;</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">&#x27;common/theme&#x27;</span>), <span class="attr">name</span>: <span class="string">&#x27;theme&#x27;</span>, <span class="attr">meta</span>: &#123; <span class="attr">title</span>: <span class="string">&#x27;主题&#x27;</span> &#125; &#125;,</span><br><span class="line"> &#123; <span class="attr">path</span>: <span class="string">&#x27;/demo-echarts&#x27;</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">&#x27;demo/echarts&#x27;</span>), <span class="attr">name</span>: <span class="string">&#x27;demo-echarts&#x27;</span>, <span class="attr">meta</span>: &#123; <span class="attr">title</span>: <span class="string">&#x27;demo-echarts&#x27;</span>, <span class="attr">isTab</span>: <span class="literal">true</span> &#125; &#125;,</span><br><span class="line"> &#123; <span class="attr">path</span>: <span class="string">&#x27;/demo-ueditor&#x27;</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">&#x27;demo/ueditor&#x27;</span>), <span class="attr">name</span>: <span class="string">&#x27;demo-ueditor&#x27;</span>, <span class="attr">meta</span>: &#123; <span class="attr">title</span>: <span class="string">&#x27;demo-ueditor&#x27;</span>, <span class="attr">isTab</span>: <span class="literal">true</span> &#125; &#125;,</span><br><span class="line"> &#123; <span class="attr">path</span>: <span class="string">&#x27;/product-attrupdate&#x27;</span>, <span class="attr">component</span>: <span class="title function_">_import</span>(<span class="string">&#x27;modules/product/attrupdate&#x27;</span>), <span class="attr">name</span>: <span class="string">&#x27;attr-update&#x27;</span>, <span class="attr">meta</span>: &#123; <span class="attr">title</span>: <span class="string">&#x27;规格维护&#x27;</span>, <span class="attr">isTab</span>: <span class="literal">true</span> &#125; &#125;</span><br><span class="line"> ],</span><br><span class="line"> <span class="title function_">beforeEnter</span>(<span class="params">to, <span class="keyword">from</span>, next</span>) &#123;</span><br><span class="line"> <span class="keyword">let</span> token = <span class="title class_">Vue</span>.<span class="property">cookie</span>.<span class="title function_">get</span>(<span class="string">&#x27;token&#x27;</span>)</span><br><span class="line"> <span class="keyword">if</span> (!token || !<span class="regexp">/\S/</span>.<span class="title function_">test</span>(token)) &#123;</span><br><span class="line"> <span class="title function_">clearLoginInfo</span>()</span><br><span class="line"> <span class="title function_">next</span>(&#123; <span class="attr">name</span>: <span class="string">&#x27;login&#x27;</span> &#125;)</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="title function_">next</span>()</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> router = <span class="keyword">new</span> <span class="title class_">Router</span>(&#123;</span><br><span class="line"> <span class="attr">mode</span>: <span class="string">&#x27;hash&#x27;</span>,</span><br><span class="line"> <span class="attr">scrollBehavior</span>: <span class="function">() =&gt;</span> (&#123; <span class="attr">y</span>: <span class="number">0</span> &#125;),</span><br><span class="line"> <span class="attr">isAddDynamicMenuRoutes</span>: <span class="literal">false</span>, <span class="comment">// 是否已经添加动态(菜单)路由</span></span><br><span class="line"> <span class="attr">routes</span>: globalRoutes.<span class="title function_">concat</span>(mainRoutes)</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line">router.<span class="title function_">beforeEach</span>(<span class="function">(<span class="params">to, <span class="keyword">from</span>, next</span>) =&gt;</span> &#123;</span><br><span class="line"> <span class="comment">// 添加动态(菜单)路由</span></span><br><span class="line"> <span class="comment">// 1. 已经添加 or 全局路由, 直接访问</span></span><br><span class="line"> <span class="comment">// 2. 获取菜单列表, 添加并保存本地存储</span></span><br><span class="line"> <span class="keyword">if</span> (router.<span class="property">options</span>.<span class="property">isAddDynamicMenuRoutes</span> || <span class="title function_">fnCurrentRouteType</span>(to, globalRoutes) === <span class="string">&#x27;global&#x27;</span>) &#123;</span><br><span class="line"> <span class="title function_">next</span>()</span><br><span class="line"> &#125; <span class="keyword">else</span> &#123;</span><br><span class="line"> <span class="title function_">http</span>(&#123;</span><br><span class="line"> <span class="attr">url</span>: http.<span class="title function_">adornUrl</span>(<span class="string">&#x27;/sys/menu/nav&#x27;</span>),</span><br><span class="line"> <span class="attr">method</span>: <span class="string">&#x27;get&#x27;</span>,</span><br><span class="line"> <span class="attr">params</span>: http.<span class="title function_">adornParams</span>()</span><br><span class="line"> &#125;).<span class="title function_">then</span>(<span class="function">(<span class="params">&#123; data &#125;</span>) =&gt;</span> &#123;</span><br><span class="line"> <span class="keyword">if</span> (data &amp;&amp; data.<span class="property">code</span> === <span class="number">0</span>) &#123;</span><br><span class="line"> <span class="title function_">fnAddDynamicMenuRoutes</span>(data.<span class="property">menuList</span>)</span><br><span class="line"> router.<span class="property">options</span>.<span class="property">isAddDynamicMenuRoutes</span> = <span class="literal">true</span></span><br><span class="line"> <span class="variable language_">sessionStorage</span>.<span class="title function_">setItem</span>(<span class="string">&#x27;menuList&#x27;</span>, <span class="title class_">JSON</span>.<span class="title function_">stringify</span>(data.<span class="property">menuList</span> || <span class="string">&#x27;[]&#x27;</span>))</span><br><span class="line"> <span class="variable language_">sessionStorage</span>.<span class="title function_">setItem</span>(<span class="string">&#x27;permissions&#x27;</span>, <span class="title class_">JSON</span>.<span class="title function_">stringify</span>(data.<span class="property">permissions</span> || <span class="string">&#x27;[]&#x27;</span>))</span><br><span class="line"> <span class="title function_">next</span>(&#123; ...to, <span class="attr">replace</span>: <span class="literal">true</span> &#125;)</span><br><span class="line"> &#125; <span class="keyword">else</span> &#123;</span><br><span class="line"> <span class="variable language_">sessionStorage</span>.<span class="title function_">setItem</span>(<span class="string">&#x27;menuList&#x27;</span>, <span class="string">&#x27;[]&#x27;</span>)</span><br><span class="line"> <span class="variable language_">sessionStorage</span>.<span class="title function_">setItem</span>(<span class="string">&#x27;permissions&#x27;</span>, <span class="string">&#x27;[]&#x27;</span>)</span><br><span class="line"> <span class="title function_">next</span>()</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;).<span class="title function_">catch</span>(<span class="function">(<span class="params">e</span>) =&gt;</span> &#123;</span><br><span class="line"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">`%c<span class="subst">$&#123;e&#125;</span> 请求菜单列表和权限失败,跳转至登录页!!`</span>, <span class="string">&#x27;color:blue&#x27;</span>)</span><br><span class="line"> router.<span class="title function_">push</span>(&#123; <span class="attr">name</span>: <span class="string">&#x27;login&#x27;</span> &#125;)</span><br><span class="line"> &#125;)</span><br><span class="line"> &#125;</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 判断当前路由类型, global: 全局路由, main: 主入口路由</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> &#123;<span class="type">*</span>&#125; route 当前路由</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">fnCurrentRouteType</span>(<span class="params">route, globalRoutes = []</span>) &#123;</span><br><span class="line"> <span class="keyword">var</span> temp = []</span><br><span class="line"> <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>; i &lt; globalRoutes.<span class="property">length</span>; i++) &#123;</span><br><span class="line"> <span class="keyword">if</span> (route.<span class="property">path</span> === globalRoutes[i].<span class="property">path</span>) &#123;</span><br><span class="line"> <span class="keyword">return</span> <span class="string">&#x27;global&#x27;</span></span><br><span class="line"> &#125; <span class="keyword">else</span> <span class="keyword">if</span> (globalRoutes[i].<span class="property">children</span> &amp;&amp; globalRoutes[i].<span class="property">children</span>.<span class="property">length</span> &gt;= <span class="number">1</span>) &#123;</span><br><span class="line"> temp = temp.<span class="title function_">concat</span>(globalRoutes[i].<span class="property">children</span>)</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> temp.<span class="property">length</span> &gt;= <span class="number">1</span> ? <span class="title function_">fnCurrentRouteType</span>(route, temp) : <span class="string">&#x27;main&#x27;</span></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 添加动态(菜单)路由</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> &#123;<span class="type">*</span>&#125; menuList 菜单列表</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> &#123;<span class="type">*</span>&#125; routes 递归创建的动态(菜单)路由</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">fnAddDynamicMenuRoutes</span>(<span class="params">menuList = [], routes = []</span>) &#123;</span><br><span class="line"> <span class="keyword">var</span> temp = []</span><br><span class="line"> <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>; i &lt; menuList.<span class="property">length</span>; i++) &#123;</span><br><span class="line"> <span class="keyword">if</span> (menuList[i].<span class="property">list</span> &amp;&amp; menuList[i].<span class="property">list</span>.<span class="property">length</span> &gt;= <span class="number">1</span>) &#123;</span><br><span class="line"> temp = temp.<span class="title function_">concat</span>(menuList[i].<span class="property">list</span>)</span><br><span class="line"> &#125; <span class="keyword">else</span> <span class="keyword">if</span> (menuList[i].<span class="property">url</span> &amp;&amp; <span class="regexp">/\S/</span>.<span class="title function_">test</span>(menuList[i].<span class="property">url</span>)) &#123;</span><br><span class="line"> menuList[i].<span class="property">url</span> = menuList[i].<span class="property">url</span>.<span class="title function_">replace</span>(<span class="regexp">/^\//</span>, <span class="string">&#x27;&#x27;</span>)</span><br><span class="line"> <span class="keyword">var</span> route = &#123;</span><br><span class="line"> <span class="attr">path</span>: menuList[i].<span class="property">url</span>.<span class="title function_">replace</span>(<span class="string">&#x27;/&#x27;</span>, <span class="string">&#x27;-&#x27;</span>),</span><br><span class="line"> <span class="attr">component</span>: <span class="literal">null</span>,</span><br><span class="line"> <span class="attr">name</span>: menuList[i].<span class="property">url</span>.<span class="title function_">replace</span>(<span class="string">&#x27;/&#x27;</span>, <span class="string">&#x27;-&#x27;</span>),</span><br><span class="line"> <span class="attr">meta</span>: &#123;</span><br><span class="line"> <span class="attr">menuId</span>: menuList[i].<span class="property">menuId</span>,</span><br><span class="line"> <span class="attr">title</span>: menuList[i].<span class="property">name</span>,</span><br><span class="line"> <span class="attr">isDynamic</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="attr">isTab</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="attr">iframeUrl</span>: <span class="string">&#x27;&#x27;</span></span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">// url以http[s]://开头, 通过iframe展示</span></span><br><span class="line"> <span class="keyword">if</span> (<span class="title function_">isURL</span>(menuList[i].<span class="property">url</span>)) &#123;</span><br><span class="line"> route[<span class="string">&#x27;path&#x27;</span>] = <span class="string">`i-<span class="subst">$&#123;menuList[i].menuId&#125;</span>`</span></span><br><span class="line"> route[<span class="string">&#x27;name&#x27;</span>] = <span class="string">`i-<span class="subst">$&#123;menuList[i].menuId&#125;</span>`</span></span><br><span class="line"> route[<span class="string">&#x27;meta&#x27;</span>][<span class="string">&#x27;iframeUrl&#x27;</span>] = menuList[i].<span class="property">url</span></span><br><span class="line"> &#125; <span class="keyword">else</span> &#123;</span><br><span class="line"> <span class="keyword">try</span> &#123;</span><br><span class="line"> route[<span class="string">&#x27;component&#x27;</span>] = <span class="title function_">_import</span>(<span class="string">`modules/<span class="subst">$&#123;menuList[i].url&#125;</span>`</span>) || <span class="literal">null</span></span><br><span class="line"> &#125; <span class="keyword">catch</span> (e) &#123; &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> routes.<span class="title function_">push</span>(route)</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">if</span> (temp.<span class="property">length</span> &gt;= <span class="number">1</span>) &#123;</span><br><span class="line"> <span class="title function_">fnAddDynamicMenuRoutes</span>(temp, routes)</span><br><span class="line"> &#125; <span class="keyword">else</span> &#123;</span><br><span class="line"> mainRoutes.<span class="property">name</span> = <span class="string">&#x27;main-dynamic&#x27;</span></span><br><span class="line"> mainRoutes.<span class="property">children</span> = routes</span><br><span class="line"> router.<span class="title function_">addRoutes</span>([</span><br><span class="line"> mainRoutes,</span><br><span class="line"> &#123; <span class="attr">path</span>: <span class="string">&#x27;*&#x27;</span>, <span class="attr">redirect</span>: &#123; <span class="attr">name</span>: <span class="string">&#x27;404&#x27;</span> &#125; &#125;</span><br><span class="line"> ])</span><br><span class="line"> <span class="variable language_">sessionStorage</span>.<span class="title function_">setItem</span>(<span class="string">&#x27;dynamicMenuRoutes&#x27;</span>, <span class="title class_">JSON</span>.<span class="title function_">stringify</span>(mainRoutes.<span class="property">children</span> || <span class="string">&#x27;[]&#x27;</span>))</span><br><span class="line"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;\n&#x27;</span>)</span><br><span class="line"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;%c!&lt;-------------------- 动态(菜单)路由 s --------------------&gt;&#x27;</span>, <span class="string">&#x27;color:blue&#x27;</span>)</span><br><span class="line"> <span class="variable language_">console</span>.<span class="title function_">log</span>(mainRoutes.<span class="property">children</span>)</span><br><span class="line"> <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;%c!&lt;-------------------- 动态(菜单)路由 e --------------------&gt;&#x27;</span>, <span class="string">&#x27;color:blue&#x27;</span>)</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> router</span><br></pre></td></tr></table></figure>
<h4 id="1-4-2-发布商品"><a href="#1-4-2-发布商品" class="headerlink" title="1.4.2 发布商品"></a>1.4.2 发布商品</h4><p><strong>根据商品的分类联动的查询商品的品牌</strong></p>
<p><img src="/pictures/image-20230626101113941.png" alt="image-20230626101113941"></p>
<p>后端关键部分的代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 查询商品分类关联的品牌信息</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 某一商品分类下关联的品牌信息组成的集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> List&lt;BrandEntity&gt; <span class="title function_">getBrandsByCatId</span><span class="params">(Long catId)</span> &#123;</span><br><span class="line"> List&lt;CategoryBrandRelationEntity&gt; categoryBrandRelationEntityList = relationDao.selectList(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;CategoryBrandRelationEntity&gt;().eq(CategoryBrandRelationEntity::getCatelogId, catId));</span><br><span class="line"> List&lt;BrandEntity&gt; brandEntityList = categoryBrandRelationEntityList.stream().map(item -&gt; &#123;</span><br><span class="line"> <span class="type">Long</span> <span class="variable">brandId</span> <span class="operator">=</span> item.getBrandId();</span><br><span class="line"> <span class="keyword">return</span> brandService.getById(brandId);</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> <span class="keyword">return</span> brandEntityList;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p><strong>根据JSON数据生成实体类</strong></p>
<p>生成工具: <a target="_blank" rel="noopener" href="https://www.bejson.com/">https://www.bejson.com/</a></p>
<p><img src="/pictures/image-20230626142854091.png" alt="image-20230626142854091"></p>
<p>前端提交的发布商品的详细信息</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;spuName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;华为Mate30 Pro&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;spuDescription&quot;</span><span class="punctuation">:</span> <span class="string">&quot;华为手机&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;catalogId&quot;</span><span class="punctuation">:</span> <span class="number">225</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;brandId&quot;</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;weight&quot;</span><span class="punctuation">:</span> <span class="number">0.198</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;publishStatus&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;decript&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/7b9f237d-9d37-4087-83bd-13d0ea76eda4_73366cc235d68202.jpg&quot;</span><span class="punctuation">,</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/e5c4fbe5-0685-4a12-8623-a4972c623d6c_528211b97272d88a.jpg&quot;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;images&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/7627fc94-1ac7-4406-8e1c-3866a002918b_0d40c24b264aa511.jpg&quot;</span><span class="punctuation">,</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/e5364a2e-9f46-433b-827b-33c1ff8c991c_919c850652e98031.jpg&quot;</span><span class="punctuation">,</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/997dd5dd-be60-4547-871c-23b1273df596_1f15cdbcf9e1273c.jpg&quot;</span><span class="punctuation">,</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/788f45d7-d399-4482-88db-4dd939a51f4a_2b1837c6c50add30.jpg&quot;</span><span class="punctuation">,</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/b18dd3f9-3a38-4e9a-86a0-8c24db552a09_3c24f9cd69534030.jpg&quot;</span><span class="punctuation">,</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/d19426e9-c518-4fc8-85dd-7fae758a4000_23d9fbb256ea5d4a.jpg&quot;</span><span class="punctuation">,</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/7200dec5-af25-4264-87dc-19985c4cbe23_335b2c690e43a8f8.jpg&quot;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;bounds&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;buyBounds&quot;</span><span class="punctuation">:</span> <span class="number">500</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;growBounds&quot;</span><span class="punctuation">:</span> <span class="number">500</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;baseAttrs&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValues&quot;</span><span class="punctuation">:</span> <span class="string">&quot;2019&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;showDesc&quot;</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">4</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValues&quot;</span><span class="punctuation">:</span> <span class="string">&quot;mate30pro&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;showDesc&quot;</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">10</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValues&quot;</span><span class="punctuation">:</span> <span class="string">&quot;45W&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;showDesc&quot;</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">11</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValues&quot;</span><span class="punctuation">:</span> <span class="string">&quot;LCD;OLED&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;showDesc&quot;</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">8</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValues&quot;</span><span class="punctuation">:</span> <span class="string">&quot;16GB&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;showDesc&quot;</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skus&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attr&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">7</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;手机颜色&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValue&quot;</span><span class="punctuation">:</span> <span class="string">&quot;星河银&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">9</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;商品产地&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValue&quot;</span><span class="punctuation">:</span> <span class="string">&quot;中国&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;华为Mate30 Pro 星河银 中国&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="string">&quot;5799&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuTitle&quot;</span><span class="punctuation">:</span> <span class="string">&quot;华为HUAWEI 华为Mate30 Pro全网通智能手机 (5G/4G)&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuSubtitle&quot;</span><span class="punctuation">:</span> <span class="string">&quot;星河银的副标题&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;images&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/7627fc94-1ac7-4406-8e1c-3866a002918b_0d40c24b264aa511.jpg&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/e5364a2e-9f46-433b-827b-33c1ff8c991c_919c850652e98031.jpg&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/788f45d7-d399-4482-88db-4dd939a51f4a_2b1837c6c50add30.jpg&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/b18dd3f9-3a38-4e9a-86a0-8c24db552a09_3c24f9cd69534030.jpg&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;descar&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">&quot;星河银&quot;</span><span class="punctuation">,</span> <span class="string">&quot;中国&quot;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;fullCount&quot;</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;discount&quot;</span><span class="punctuation">:</span> <span class="number">0.98</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;countStatus&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;fullPrice&quot;</span><span class="punctuation">:</span> <span class="number">10000</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;reducePrice&quot;</span><span class="punctuation">:</span> <span class="number">50</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;priceStatus&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;memberPrice&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;id&quot;</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;name&quot;</span><span class="punctuation">:</span> <span class="string">&quot;铜牌会员&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="number">5788</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;id&quot;</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;name&quot;</span><span class="punctuation">:</span> <span class="string">&quot;银牌会员&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="number">5699</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attr&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">7</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;手机颜色&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValue&quot;</span><span class="punctuation">:</span> <span class="string">&quot;亮黑色&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">9</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;商品产地&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValue&quot;</span><span class="punctuation">:</span> <span class="string">&quot;中国&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;华为Mate30 Pro 亮黑色 中国&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="string">&quot;6299&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuTitle&quot;</span><span class="punctuation">:</span> <span class="string">&quot;华为HUAWEI 华为Mate30 Pro全网通智能手机 (5G/4G)&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuSubtitle&quot;</span><span class="punctuation">:</span> <span class="string">&quot;亮黑色的副标题&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;images&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/997dd5dd-be60-4547-871c-23b1273df596_1f15cdbcf9e1273c.jpg&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/7200dec5-af25-4264-87dc-19985c4cbe23_335b2c690e43a8f8.jpg&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;descar&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">&quot;亮黑色&quot;</span><span class="punctuation">,</span> <span class="string">&quot;中国&quot;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;fullCount&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;discount&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;countStatus&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;fullPrice&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;reducePrice&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;priceStatus&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;memberPrice&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;id&quot;</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;name&quot;</span><span class="punctuation">:</span> <span class="string">&quot;铜牌会员&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;id&quot;</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;name&quot;</span><span class="punctuation">:</span> <span class="string">&quot;银牌会员&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attr&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">7</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;手机颜色&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValue&quot;</span><span class="punctuation">:</span> <span class="string">&quot;翡冷翠&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">9</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;商品产地&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValue&quot;</span><span class="punctuation">:</span> <span class="string">&quot;中国&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;华为Mate30 Pro 翡冷翠 中国&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="string">&quot;6299&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuTitle&quot;</span><span class="punctuation">:</span> <span class="string">&quot;华为HUAWEI 华为Mate30 Pro全网通智能手机 (5G/4G)&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuSubtitle&quot;</span><span class="punctuation">:</span> <span class="string">&quot;翡冷翠的副标题&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;images&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/997dd5dd-be60-4547-871c-23b1273df596_1f15cdbcf9e1273c.jpg&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/d19426e9-c518-4fc8-85dd-7fae758a4000_23d9fbb256ea5d4a.jpg&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;descar&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">&quot;翡冷翠&quot;</span><span class="punctuation">,</span> <span class="string">&quot;中国&quot;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;fullCount&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;discount&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;countStatus&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;fullPrice&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;reducePrice&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;priceStatus&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;memberPrice&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;id&quot;</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;name&quot;</span><span class="punctuation">:</span> <span class="string">&quot;铜牌会员&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;id&quot;</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;name&quot;</span><span class="punctuation">:</span> <span class="string">&quot;银牌会员&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attr&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">7</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;手机颜色&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValue&quot;</span><span class="punctuation">:</span> <span class="string">&quot;罗兰紫&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="number">9</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;商品产地&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValue&quot;</span><span class="punctuation">:</span> <span class="string">&quot;中国&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuName&quot;</span><span class="punctuation">:</span> <span class="string">&quot;华为Mate30 Pro 罗兰紫 中国&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="string">&quot;5799&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuTitle&quot;</span><span class="punctuation">:</span> <span class="string">&quot;华为HUAWEI 华为Mate30 Pro全网通智能手机 (5G/4G)&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuSubtitle&quot;</span><span class="punctuation">:</span> <span class="string">&quot;罗兰紫的副标题&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;images&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/e5364a2e-9f46-433b-827b-33c1ff8c991c_919c850652e98031.jpg&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://gulimall-0611.oss-cn-beijing.aliyuncs.com/2023/06/26/997dd5dd-be60-4547-871c-23b1273df596_1f15cdbcf9e1273c.jpg&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;imgUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;defaultImg&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;descar&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="string">&quot;罗兰紫&quot;</span><span class="punctuation">,</span> <span class="string">&quot;中国&quot;</span><span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;fullCount&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;discount&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;countStatus&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;fullPrice&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;reducePrice&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;priceStatus&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;memberPrice&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;id&quot;</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;name&quot;</span><span class="punctuation">:</span> <span class="string">&quot;铜牌会员&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;id&quot;</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;name&quot;</span><span class="punctuation">:</span> <span class="string">&quot;银牌会员&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;price&quot;</span><span class="punctuation">:</span> <span class="number">0</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">]</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>
<p>下载生成的实体类代码</p>
<p><img src="/pictures/image-20230626143051042.png" alt="image-20230626143051042"></p>
<p>生成的实体类(将生成的实体类复制到项目中指定的位置)</p>
<p><img src="/pictures/image-20230626143228035.png" alt="image-20230626143228035"></p>
<p><strong>发布商品信息(核心业务)</strong></p>
<p>后端关键代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 发布商品的功能</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> vo 需要保存的商品信息封装的数据</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Transactional</span></span><br><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">saveSpuInfo</span><span class="params">(SpuSaveVo vo)</span> &#123;</span><br><span class="line"> <span class="comment">//保存spu的基本信息 pms_spu_info</span></span><br><span class="line"> <span class="type">SpuInfoEntity</span> <span class="variable">infoEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SpuInfoEntity</span>();</span><br><span class="line"> BeanUtils.copyProperties(vo, infoEntity);</span><br><span class="line"> infoEntity.setCreateTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> infoEntity.setUpdateTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> <span class="built_in">this</span>.saveBaseSpuInfo(infoEntity);</span><br><span class="line"> <span class="comment">//保存spu的描述图片 pms_spu_info_desc</span></span><br><span class="line"> List&lt;String&gt; decript = vo.getDecript();</span><br><span class="line"> <span class="type">SpuInfoDescEntity</span> <span class="variable">descEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SpuInfoDescEntity</span>();</span><br><span class="line"> descEntity.setSpuId(infoEntity.getId());</span><br><span class="line"> descEntity.setDecript(String.join(<span class="string">&quot;,&quot;</span>, decript));</span><br><span class="line"> spuInfoDescService.saveSpuInfoDecript(descEntity);</span><br><span class="line"> <span class="comment">//保存spu的图片集 pms_spu_images</span></span><br><span class="line"> List&lt;String&gt; images = vo.getImages();</span><br><span class="line"> spuImagesService.saveImages(infoEntity.getId(), images);</span><br><span class="line"> <span class="comment">//保存spu的规格参数 pms_product_attr_value</span></span><br><span class="line"> List&lt;BaseAttrs&gt; baseAttrs = vo.getBaseAttrs();</span><br><span class="line"> List&lt;ProductAttrValueEntity&gt; collect = baseAttrs.stream().map(attr -&gt; &#123;</span><br><span class="line"> <span class="type">ProductAttrValueEntity</span> <span class="variable">valueEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ProductAttrValueEntity</span>();</span><br><span class="line"> valueEntity.setAttrId(attr.getAttrId());</span><br><span class="line"> <span class="type">AttrEntity</span> <span class="variable">attrEntity</span> <span class="operator">=</span> attrService.getById(attr.getAttrId());</span><br><span class="line"> valueEntity.setAttrName(attrEntity.getAttrName());</span><br><span class="line"> valueEntity.setAttrValue(attr.getAttrValues());</span><br><span class="line"> valueEntity.setQuickShow(attr.getShowDesc());</span><br><span class="line"> valueEntity.setSpuId(infoEntity.getId());</span><br><span class="line"> <span class="keyword">return</span> valueEntity;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> productAttrValueService.saveProductAttr(collect);</span><br><span class="line"> <span class="comment">//保存spu的积分信息</span></span><br><span class="line"> <span class="type">Bounds</span> <span class="variable">bounds</span> <span class="operator">=</span> vo.getBounds();</span><br><span class="line"> <span class="type">SpuBoundTo</span> <span class="variable">spuBoundTo</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SpuBoundTo</span>();</span><br><span class="line"> spuBoundTo.setSpuId(infoEntity.getId());</span><br><span class="line"> BeanUtils.copyProperties(bounds, spuBoundTo);</span><br><span class="line"> <span class="type">R</span> <span class="variable">r</span> <span class="operator">=</span> couponFeignService.saveSpuBounds(spuBoundTo);</span><br><span class="line"> <span class="keyword">if</span> (r.getCode() != <span class="number">0</span>) &#123;</span><br><span class="line"> log.error(<span class="string">&quot;远程保存spu的积分信息失败&quot;</span>);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//保存当前spu对应的sku信息</span></span><br><span class="line"> List&lt;Skus&gt; skus = vo.getSkus();</span><br><span class="line"> <span class="keyword">if</span> (skus != <span class="literal">null</span> &amp;&amp; skus.size() != <span class="number">0</span>) &#123;</span><br><span class="line"> skus.forEach(item -&gt; &#123;</span><br><span class="line"> <span class="type">String</span> <span class="variable">defaultImg</span> <span class="operator">=</span> <span class="string">&quot;&quot;</span>;</span><br><span class="line"> <span class="keyword">for</span> (Images img : item.getImages()) &#123;</span><br><span class="line"> <span class="keyword">if</span> (img.getDefaultImg() == <span class="number">1</span>) &#123;</span><br><span class="line"> defaultImg = img.getImgUrl();</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="type">SkuInfoEntity</span> <span class="variable">skuInfoEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SkuInfoEntity</span>();</span><br><span class="line"> BeanUtils.copyProperties(item, skuInfoEntity);</span><br><span class="line"> skuInfoEntity.setBrandId(infoEntity.getBrandId());</span><br><span class="line"> skuInfoEntity.setCatalogId(infoEntity.getCatalogId());</span><br><span class="line"> skuInfoEntity.setSaleCount(<span class="number">0L</span>);</span><br><span class="line"> skuInfoEntity.setSpuId(infoEntity.getId());</span><br><span class="line"> skuInfoEntity.setSkuDefaultImg(defaultImg);</span><br><span class="line"> <span class="comment">// 保存sku的基本信息pms_sku_info</span></span><br><span class="line"> skuInfoService.saveSkuInfo(skuInfoEntity);</span><br><span class="line"> <span class="type">Long</span> <span class="variable">skuId</span> <span class="operator">=</span> skuInfoEntity.getSkuId();</span><br><span class="line"> List&lt;SkuImagesEntity&gt; imagesEntities = item.getImages().stream().map(img -&gt; &#123;</span><br><span class="line"> <span class="type">SkuImagesEntity</span> <span class="variable">skuImagesEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SkuImagesEntity</span>();</span><br><span class="line"> skuImagesEntity.setSkuId(skuId);</span><br><span class="line"> skuImagesEntity.setImgUrl(img.getImgUrl());</span><br><span class="line"> skuImagesEntity.setDefaultImg(img.getDefaultImg());</span><br><span class="line"> <span class="keyword">return</span> skuImagesEntity;</span><br><span class="line"> &#125;).filter(entity -&gt; &#123;</span><br><span class="line"> <span class="comment">//返回true就添加上去</span></span><br><span class="line"> <span class="keyword">return</span> !StringUtils.isEmpty(entity.getImgUrl());</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> <span class="comment">// 保存sku的图片信息pms_sku_images</span></span><br><span class="line"> skuImagesService.saveBatch(imagesEntities);</span><br><span class="line"> <span class="comment">// sku的销售属性信息pms_sku_sale_attr_value</span></span><br><span class="line"> List&lt;Attr&gt; attrs = item.getAttr();</span><br><span class="line"> List&lt;SkuSaleAttrValueEntity&gt; skuSaleAttrValueEntities = attrs.stream().map(attr -&gt; &#123;</span><br><span class="line"> <span class="type">SkuSaleAttrValueEntity</span> <span class="variable">skuSaleAttrValueEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SkuSaleAttrValueEntity</span>();</span><br><span class="line"> BeanUtils.copyProperties(attr, skuSaleAttrValueEntity);</span><br><span class="line"> skuSaleAttrValueEntity.setSkuId(skuId);</span><br><span class="line"> <span class="keyword">return</span> skuSaleAttrValueEntity;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> skuSaleAttrValueService.saveBatch(skuSaleAttrValueEntities);</span><br><span class="line"> <span class="comment">// sku的优惠信息、满减等信息gulimall_sms-&gt;sms_sku_ladder\sms_sku_full_reduction\sms_member_price</span></span><br><span class="line"> <span class="type">SkuReductionTo</span> <span class="variable">skuReductionTo</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SkuReductionTo</span>();</span><br><span class="line"> BeanUtils.copyProperties(item, skuReductionTo);</span><br><span class="line"> List&lt;MemberPrice&gt; memberPrices = item.getMemberPrice().stream().map(memberPrice -&gt; &#123;</span><br><span class="line"> <span class="type">MemberPrice</span> <span class="variable">memberPriceTo</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">MemberPrice</span>();</span><br><span class="line"> BeanUtils.copyProperties(memberPrice, memberPriceTo);</span><br><span class="line"> <span class="keyword">return</span> memberPriceTo;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> skuReductionTo.setMemberPrice(memberPrices);</span><br><span class="line"> skuReductionTo.setSkuId(skuId);</span><br><span class="line"> <span class="keyword">if</span> (skuReductionTo.getFullCount() &gt; <span class="number">0</span> || skuReductionTo.getFullPrice().compareTo(<span class="keyword">new</span> <span class="title class_">BigDecimal</span>(<span class="string">&quot;0&quot;</span>)) == <span class="number">1</span>) &#123;</span><br><span class="line"> <span class="type">R</span> <span class="variable">r1</span> <span class="operator">=</span> couponFeignService.saveSkuReduction(skuReductionTo);</span><br><span class="line"> <span class="keyword">if</span> (r1.getCode() != <span class="number">0</span>) &#123;</span><br><span class="line"> log.error(<span class="string">&quot;远程调用sku的优惠信息、满减信息失败&quot;</span>);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>最终的实现效果</p>
<p><img src="/pictures/image-20230626184303186.png" alt="image-20230626184303186"></p>
<p><img src="/pictures/image-20230626182832804.png" alt="image-20230626182832804"></p>
<h4 id="1-4-3-商品管理"><a href="#1-4-3-商品管理" class="headerlink" title="1.4.3 商品管理"></a>1.4.3 商品管理</h4><p><strong>Sku检索</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 检索条件</span></span><br><span class="line"><span class="comment"> * &#123;</span></span><br><span class="line"><span class="comment"> * page: 1,//当前页码</span></span><br><span class="line"><span class="comment"> * limit: 10,//每页记录数</span></span><br><span class="line"><span class="comment"> * sidx: &#x27;id&#x27;,//排序字段</span></span><br><span class="line"><span class="comment"> * order: &#x27;asc/desc&#x27;,//排序方式</span></span><br><span class="line"><span class="comment"> * key: &#x27;华为&#x27;,//检索关键字</span></span><br><span class="line"><span class="comment"> * catelogId: 0,</span></span><br><span class="line"><span class="comment"> * brandId: 0,</span></span><br><span class="line"><span class="comment"> * min: 0,</span></span><br><span class="line"><span class="comment"> * max: 0</span></span><br><span class="line"><span class="comment"> * &#125;</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">queryPageByCondition</span><span class="params">(Map&lt;String, Object&gt; params)</span> &#123;</span><br><span class="line"> LambdaQueryWrapper&lt;SkuInfoEntity&gt; queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;&gt;();</span><br><span class="line"> <span class="comment">//Preparing: SELECT sku_id,sku_name,sku_title,catalog_id,sale_count,price,brand_id,sku_default_img,sku_subtitle,sku_desc,spu_id</span></span><br><span class="line"> <span class="comment">// FROM pms_sku_info</span></span><br><span class="line"> <span class="comment">// WHERE (( (sku_id = ? OR sku_name LIKE ?) ) AND catalog_id = ? AND brand_id = ? AND price &gt;= ? AND price &lt;= ?) LIMIT ?,?</span></span><br><span class="line"> <span class="comment">//检索关键字</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;key&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) &#123;</span><br><span class="line"> queryWrapper.and((wrapper) -&gt; &#123;</span><br><span class="line"> wrapper.eq(SkuInfoEntity::getSkuId, key).or().like(SkuInfoEntity::getSkuName, key);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//分类</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">catelogId</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;catelogId&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(catelogId) &amp;&amp; !<span class="string">&quot;0&quot;</span>.equalsIgnoreCase(catelogId)) &#123;</span><br><span class="line"> queryWrapper.eq(SkuInfoEntity::getCatalogId, catelogId);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//品牌</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">brandId</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;brandId&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(brandId) &amp;&amp; !<span class="string">&quot;0&quot;</span>.equalsIgnoreCase(brandId)) &#123;</span><br><span class="line"> queryWrapper.eq(SkuInfoEntity::getBrandId, brandId);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//价格区间</span></span><br><span class="line"> <span class="type">String</span> <span class="variable">min</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;min&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(min)) &#123;</span><br><span class="line"> queryWrapper.ge(SkuInfoEntity::getPrice, min);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="type">String</span> <span class="variable">max</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;max&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(max)) &#123;</span><br><span class="line"> <span class="keyword">try</span> &#123;</span><br><span class="line"> <span class="type">BigDecimal</span> <span class="variable">bigDecimal</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">BigDecimal</span>(max);</span><br><span class="line"> <span class="keyword">if</span>(bigDecimal.compareTo(<span class="keyword">new</span> <span class="title class_">BigDecimal</span>(<span class="string">&quot;0&quot;</span>))==<span class="number">1</span>)&#123;<span class="comment">//说明大于0</span></span><br><span class="line"> queryWrapper.le(SkuInfoEntity::getPrice, max);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125; <span class="keyword">catch</span> (Exception e) &#123;</span><br><span class="line"> log.error(<span class="string">&quot;com/atguigu/gulimall/product/service/impl/SkuInfoServiceImpl&quot;</span>);</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(e);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> IPage&lt;SkuInfoEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;SkuInfoEntity&gt;().getPage(params),</span><br><span class="line"> queryWrapper</span><br><span class="line"> );</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>实现的效果</p>
<p><img src="/pictures/image-20230627112218894.png" alt="image-20230627112218894"></p>
<h2 id="2-库存系统"><a href="#2-库存系统" class="headerlink" title="2.库存系统"></a>2.库存系统</h2><h3 id="2-1-仓库维护"><a href="#2-1-仓库维护" class="headerlink" title="2.1 仓库维护"></a>2.1 仓库维护</h3><p><strong>仓库的分页加条件查询</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">queryPage</span><span class="params">(Map&lt;String, Object&gt; params)</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="comment">//分页查询的条件</span></span><br><span class="line"> LambdaQueryWrapper&lt;WareInfoEntity&gt; queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;&gt;();</span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;key&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) &#123;</span><br><span class="line"> queryWrapper.like(WareInfoEntity::getName, key).or()</span><br><span class="line"> .eq(WareInfoEntity::getId, key)</span><br><span class="line"> .or().like(WareInfoEntity::getAddress, key)</span><br><span class="line"> .or().like(WareInfoEntity::getAreacode, key);</span><br><span class="line"> &#125;</span><br><span class="line"> IPage&lt;WareInfoEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;WareInfoEntity&gt;().getPage(params),</span><br><span class="line"> queryWrapper</span><br><span class="line"> );</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>实现的效果</p>
<p><img src="/pictures/image-20230627153518692.png" alt="image-20230627153518692"></p>
<h3 id="2-2-库存工作单"><a href="#2-2-库存工作单" class="headerlink" title="2.2 库存工作单"></a>2.2 库存工作单</h3><h3 id="2-3-商品库存"><a href="#2-3-商品库存" class="headerlink" title="2.3 商品库存"></a>2.3 商品库存</h3><p><strong>商品库存的条件查询</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * &#123;</span></span><br><span class="line"><span class="comment"> * page: 1,//当前页码</span></span><br><span class="line"><span class="comment"> * limit: 10,//每页记录数</span></span><br><span class="line"><span class="comment"> * sidx: &#x27;id&#x27;,//排序字段</span></span><br><span class="line"><span class="comment"> * order: &#x27;asc/desc&#x27;,//排序方式</span></span><br><span class="line"><span class="comment"> * wareId: 123,//仓库id</span></span><br><span class="line"><span class="comment"> * skuId: 123//商品id</span></span><br><span class="line"><span class="comment"> * &#125;</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">queryPage</span><span class="params">(Map&lt;String, Object&gt; params)</span> &#123;</span><br><span class="line"> LambdaQueryWrapper&lt;WareSkuEntity&gt; queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;&gt;();</span><br><span class="line"> <span class="type">String</span> <span class="variable">wareId</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;wareId&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(wareId)) &#123;</span><br><span class="line"> queryWrapper.eq(WareSkuEntity::getWareId, wareId);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="type">String</span> <span class="variable">skuId</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;skuId&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(skuId)) &#123;</span><br><span class="line"> queryWrapper.eq(WareSkuEntity::getSkuId, skuId);</span><br><span class="line"> &#125;</span><br><span class="line"> IPage&lt;WareSkuEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;WareSkuEntity&gt;().getPage(params),</span><br><span class="line"> queryWrapper</span><br><span class="line"> );</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>实现的效果</p>
<p><img src="/pictures/image-20230627160605717.png" alt="image-20230627160605717"></p>
<h3 id="2-4-采购单维护"><a href="#2-4-采购单维护" class="headerlink" title="2.4 采购单维护"></a>2.4 采购单维护</h3><h4 id="2-4-1-采购需求"><a href="#2-4-1-采购需求" class="headerlink" title="2.4.1 采购需求"></a>2.4.1 采购需求</h4><p><strong>采购需求的分页加条件查询</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * status: 0,//状态</span></span><br><span class="line"><span class="comment"> * wareId: 1,//仓库id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">queryPage</span><span class="params">(Map&lt;String, Object&gt; params)</span> &#123;</span><br><span class="line"> LambdaQueryWrapper&lt;PurchaseDetailEntity&gt; queryWrapper = <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;&gt;();</span><br><span class="line"> <span class="type">String</span> <span class="variable">status</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;status&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(status)) &#123;</span><br><span class="line"> queryWrapper.eq(PurchaseDetailEntity::getStatus, status);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="type">String</span> <span class="variable">wareId</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;wareId&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(wareId)) &#123;</span><br><span class="line"> queryWrapper.eq(PurchaseDetailEntity::getWareId, wareId);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="type">String</span> <span class="variable">key</span> <span class="operator">=</span> (String) params.get(<span class="string">&quot;key&quot;</span>);</span><br><span class="line"> <span class="keyword">if</span> (!StringUtils.isEmpty(key)) &#123;</span><br><span class="line"> queryWrapper.and((wrapper-&gt;&#123;</span><br><span class="line"> wrapper.eq(PurchaseDetailEntity::getPurchaseId, key).or().like(PurchaseDetailEntity::getSkuId,key);</span><br><span class="line"> &#125;));</span><br><span class="line"> &#125;</span><br><span class="line"> IPage&lt;PurchaseDetailEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;PurchaseDetailEntity&gt;().getPage(params),</span><br><span class="line"> queryWrapper</span><br><span class="line"> );</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>实现的效果</p>
<p><img src="/pictures/image-20230627161955351.png" alt="image-20230627161955351"></p>
<p><strong>合并采购单</strong></p>
<p>业务需求介绍</p>
<p><img src="/pictures/image-20230627162707377.png" alt="image-20230627162707377"></p>
<p>获取没有领取的采购单,将采购需求合并到这个采购单</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 获取没有领取的采购单</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> PageUtils <span class="title function_">queryPageUnreceivePurchase</span><span class="params">(Map&lt;String, Object&gt; params)</span> &#123;</span><br><span class="line"> IPage&lt;PurchaseEntity&gt; page = <span class="built_in">this</span>.page(</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">Query</span>&lt;PurchaseEntity&gt;().getPage(params),</span><br><span class="line"> <span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;PurchaseEntity&gt;().eq(PurchaseEntity::getStatus,<span class="number">0</span>).or().eq(PurchaseEntity::getStatus,<span class="number">1</span>)</span><br><span class="line"> );</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">PageUtils</span>(page);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p><strong>合并采购需求</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 合并采购需求</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> mergeVo 前端传递的需要合并的采购需求</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Transactional</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">mergePurchase</span><span class="params">(MergeVo mergeVo)</span> &#123;</span><br><span class="line"> <span class="comment">//判断采购单是不是存在</span></span><br><span class="line"> <span class="type">Long</span> <span class="variable">purchaseId</span> <span class="operator">=</span> mergeVo.getPurchaseId();</span><br><span class="line"> <span class="keyword">if</span> (purchaseId == <span class="literal">null</span>) &#123;<span class="comment">//说明没有选择需要合并的采购单,需要先创建一个采购单</span></span><br><span class="line"> <span class="type">PurchaseEntity</span> <span class="variable">purchaseEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PurchaseEntity</span>();</span><br><span class="line"> purchaseEntity.setStatus(WareConstant.PurchaseStatesEnum.CREATED.getCode());</span><br><span class="line"> purchaseEntity.setCreateTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> purchaseEntity.setUpdateTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> <span class="built_in">this</span>.save(purchaseEntity);</span><br><span class="line"> purchaseId = purchaseEntity.getId();</span><br><span class="line"> &#125;</span><br><span class="line"> List&lt;Long&gt; items = mergeVo.getItems();</span><br><span class="line"> <span class="type">Long</span> <span class="variable">finalPurchaseId</span> <span class="operator">=</span> purchaseId;</span><br><span class="line"> List&lt;PurchaseDetailEntity&gt; detailEntityList = items.stream().map(item -&gt; &#123;</span><br><span class="line"> <span class="type">PurchaseDetailEntity</span> <span class="variable">detailEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PurchaseDetailEntity</span>();</span><br><span class="line"> detailEntity.setId(item);</span><br><span class="line"> detailEntity.setPurchaseId(finalPurchaseId);</span><br><span class="line"> detailEntity.setStatus(WareConstant.PurchaseDeatilStatesEnum.ASSIGNED.getCode());</span><br><span class="line"> <span class="keyword">return</span> detailEntity;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> detailService.updateBatchById(detailEntityList);</span><br><span class="line"> <span class="comment">//更新一下时间</span></span><br><span class="line"> <span class="type">PurchaseEntity</span> <span class="variable">purchaseEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PurchaseEntity</span>();</span><br><span class="line"> purchaseEntity.setId(purchaseId);</span><br><span class="line"> purchaseEntity.setUpdateTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> <span class="built_in">this</span>.updateById(purchaseEntity);</span><br><span class="line"> &#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h4 id="2-4-2-采购单"><a href="#2-4-2-采购单" class="headerlink" title="2.4.2 采购单"></a>2.4.2 采购单</h4><p><strong>领取采购单</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> ids 采购单id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">received</span><span class="params">(List&lt;Long&gt; ids)</span> &#123;</span><br><span class="line"> <span class="comment">//确认当前的采购单是新建或者分配状态</span></span><br><span class="line"> List&lt;PurchaseEntity&gt; purchaseEntities = ids.stream().map(id -&gt; &#123;</span><br><span class="line"> <span class="type">PurchaseEntity</span> <span class="variable">byId</span> <span class="operator">=</span> <span class="built_in">this</span>.getById(id);</span><br><span class="line"> <span class="keyword">return</span> byId;</span><br><span class="line"> &#125;).filter(item -&gt; &#123;</span><br><span class="line"> <span class="keyword">if</span> (item.getStatus() == WareConstant.PurchaseStatesEnum.CREATED.getCode() ||</span><br><span class="line"> item.getStatus() == WareConstant.PurchaseDeatilStatesEnum.ASSIGNED.getCode()) &#123;</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line"> &#125;).map(item-&gt;&#123;</span><br><span class="line"> <span class="comment">//改变采购单状态</span></span><br><span class="line"> item.setStatus(WareConstant.PurchaseStatesEnum.RECEIVE.getCode());</span><br><span class="line"> item.setUpdateTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> <span class="keyword">return</span> item;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> <span class="built_in">this</span>.updateBatchById(purchaseEntities);</span><br><span class="line"> <span class="comment">//改变采购项状态</span></span><br><span class="line"> purchaseEntities.forEach(item-&gt;&#123;</span><br><span class="line"> List&lt;PurchaseDetailEntity&gt; entities = detailService.listDetailByPurchaseId(item.getId());</span><br><span class="line"> List&lt;PurchaseDetailEntity&gt; detailEntityList = entities.stream().map(entity -&gt; &#123;</span><br><span class="line"> <span class="type">PurchaseDetailEntity</span> <span class="variable">purchaseDetailEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PurchaseDetailEntity</span>();</span><br><span class="line"> purchaseDetailEntity.setId(entity.getId());</span><br><span class="line"> purchaseDetailEntity.setStatus(WareConstant.PurchaseDeatilStatesEnum.BUYING.getCode());</span><br><span class="line"> <span class="keyword">return</span> purchaseDetailEntity;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> detailService.updateBatchById(detailEntityList);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p><strong>完成采购的功能</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Transactional</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">done</span><span class="params">(PurchaseDoneVo doneVo)</span> &#123;</span><br><span class="line"> <span class="type">Long</span> <span class="variable">id</span> <span class="operator">=</span> doneVo.getId();</span><br><span class="line"> <span class="comment">//改变采购项的状态</span></span><br><span class="line"> <span class="type">Boolean</span> <span class="variable">flag</span> <span class="operator">=</span> <span class="literal">true</span>;</span><br><span class="line"> List&lt;PurchaseItemDoneVo&gt; items = doneVo.getItems();</span><br><span class="line"> List&lt;PurchaseDetailEntity&gt; purchaseItemDoneVos = <span class="keyword">new</span> <span class="title class_">ArrayList</span>&lt;&gt;();</span><br><span class="line"> <span class="keyword">for</span> (PurchaseItemDoneVo item : items) &#123;</span><br><span class="line"> <span class="type">PurchaseDetailEntity</span> <span class="variable">detailEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PurchaseDetailEntity</span>();</span><br><span class="line"> <span class="keyword">if</span> (item.getStatus() == WareConstant.PurchaseDeatilStatesEnum.HASERROR.getCode()) &#123;</span><br><span class="line"> flag = <span class="literal">false</span>;</span><br><span class="line"> detailEntity.setStatus(item.getStatus());</span><br><span class="line"> &#125; <span class="keyword">else</span> &#123;</span><br><span class="line"> detailEntity.setStatus(WareConstant.PurchaseDeatilStatesEnum.FINISH.getCode());</span><br><span class="line"> <span class="comment">//将成功采购的进行入库</span></span><br><span class="line"> <span class="type">PurchaseDetailEntity</span> <span class="variable">purchaseDetailEntity</span> <span class="operator">=</span> detailService.getById(item.getItemId());</span><br><span class="line"> wareSkuService.addStock(purchaseDetailEntity.getSkuId(),purchaseDetailEntity.getWareId(),purchaseDetailEntity.getSkuNum());</span><br><span class="line"> &#125;</span><br><span class="line"> detailEntity.setId(item.getItemId());</span><br><span class="line"> purchaseItemDoneVos.add(detailEntity);</span><br><span class="line"> &#125;</span><br><span class="line"> detailService.updateBatchById(purchaseItemDoneVos);</span><br><span class="line"> <span class="comment">//改变采购单的状态</span></span><br><span class="line"> <span class="type">PurchaseEntity</span> <span class="variable">purchaseEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">PurchaseEntity</span>();</span><br><span class="line"> purchaseEntity.setId(id);</span><br><span class="line"> purchaseEntity.setStatus(flag ? WareConstant.PurchaseStatesEnum.FINISH.getCode() : WareConstant.PurchaseStatesEnum.HASERROR.getCode());</span><br><span class="line"> purchaseEntity.setUpdateTime(<span class="keyword">new</span> <span class="title class_">Date</span>());</span><br><span class="line"> <span class="built_in">this</span>.updateById(purchaseEntity);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p><strong>修改库存的功能</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Transactional</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">addStock</span><span class="params">(Long skuId, Long wareId, Integer skuNum)</span> &#123;</span><br><span class="line"> <span class="comment">//判断是添加的操作还是修改的操作</span></span><br><span class="line"> List&lt;WareSkuEntity&gt; wareSkuEntities = wareSkuDao.selectList(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;WareSkuEntity&gt;().eq(WareSkuEntity::getSkuId, skuId).eq(WareSkuEntity::getWareId, wareId));</span><br><span class="line"> <span class="keyword">if</span> (wareSkuEntities == <span class="literal">null</span> || wareSkuEntities.size() == <span class="number">0</span>) &#123;</span><br><span class="line"> <span class="type">WareSkuEntity</span> <span class="variable">wareSkuEntity</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">WareSkuEntity</span>();</span><br><span class="line"> wareSkuEntity.setSkuId(skuId);</span><br><span class="line"> wareSkuEntity.setWareId(wareId);</span><br><span class="line"> wareSkuEntity.setStock(skuNum);</span><br><span class="line"> wareSkuEntity.setStockLocked(<span class="number">0</span>);</span><br><span class="line"> <span class="comment">//远程查询sku的名字</span></span><br><span class="line"> <span class="keyword">try</span> &#123;</span><br><span class="line"> <span class="type">R</span> <span class="variable">r</span> <span class="operator">=</span> productFeignService.info(skuId);</span><br><span class="line"> <span class="keyword">if</span>(r.getCode() == <span class="number">0</span>)&#123;</span><br><span class="line"> Map&lt;String,Object&gt; skuInfo = (Map&lt;String, Object&gt;) r.get(<span class="string">&quot;skuInfo&quot;</span>);</span><br><span class="line"> wareSkuEntity.setSkuName((String) skuInfo.get(<span class="string">&quot;skuName&quot;</span>));</span><br><span class="line"> &#125;</span><br><span class="line"> &#125; <span class="keyword">catch</span> (Exception e) &#123;</span><br><span class="line"> log.warn(<span class="string">&quot;远程获取商品的Sku信息失败!&quot;</span>);</span><br><span class="line"> &#125;</span><br><span class="line"> wareSkuDao.insert(wareSkuEntity);</span><br><span class="line"> &#125; <span class="keyword">else</span> &#123;</span><br><span class="line"> wareSkuDao.addStock(skuId, wareId, skuNum);</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>sql语句</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"> <span class="comment">&lt;!--void addStock(@Param(&quot;skuId&quot;) Long skuId, @Param(&quot;wareId&quot;) Long wareId, @Param(&quot;skuNum&quot;) Integer skuNum);--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">insert</span> <span class="attr">id</span>=<span class="string">&quot;addStock&quot;</span>&gt;</span></span><br><span class="line"> update `wms_ware_sku`</span><br><span class="line"> set stock = stock + #&#123;skuNum&#125;</span><br><span class="line"> where sku_id = #&#123;skuId&#125;</span><br><span class="line"> and ware_id = #&#123;wareId&#125;</span><br><span class="line"><span class="tag">&lt;/<span class="name">insert</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h2 id="3-基础篇总结"><a href="#3-基础篇总结" class="headerlink" title="3.基础篇总结"></a><strong>3.基础篇总结</strong></h2><img src="/pictures/image-20230628170218776.png" alt="image-20230628170218776" style="zoom:150%;" />
<p>个人总结:</p>
<ul>
<li>细节很重要,编写代码的时候要注意细节问题(比如网关的配置,模糊路径和精确路径先后配置的问题)</li>
<li>要有良好的编码习惯,注意代码解耦和代码复用</li>
<li>业务逻辑很重要,编码之前要搞懂了业务逻辑之后再开始写代码</li>
<li>学习技术的时候要融会贯通,学习编程的思想</li>
<li>学技术一定要学会看开发文档技术说明书可以先从开发文档提供的demo开始</li>
</ul>
<h1 id="六-高级篇程序设计"><a href="#六-高级篇程序设计" class="headerlink" title="六.高级篇程序设计"></a>六.高级篇程序设计</h1><h2 id="1-ElasticSearch"><a href="#1-ElasticSearch" class="headerlink" title="1.ElasticSearch"></a>1.ElasticSearch</h2><p><strong>详细的教程</strong></p>
<p><strong><a href="https://jasonsgong.gitee.io/posts/22654.html">ElasticSearch | The Blog (gitee.io)</a></strong></p>
<h2 id="2-商城业务"><a href="#2-商城业务" class="headerlink" title="2.商城业务"></a>2.商城业务</h2><h3 id="2-1-商品上架"><a href="#2-1-商品上架" class="headerlink" title="2.1 商品上架"></a>2.1 商品上架</h3><p><strong>1.商品Mapping</strong></p>
<p>创建一个product索引和指定映射关系</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br></pre></td><td class="code"><pre><span class="line">PUT product</span><br><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;mappings&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;properties&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;skuId&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;long&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;spuId&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;keyword&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuTitle&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;text&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;analyzer&quot;</span><span class="punctuation">:</span> <span class="string">&quot;ik_smart&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuPrice&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;keyword&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;skuImg&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;keyword&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;index&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;doc_values&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;saleCount&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;long&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;hasStock&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;boolean&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;hotScore&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;long&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;brandId&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;long&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;catalogId&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;long&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;brandName&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;keyword&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;index&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;doc_values&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;brandImg&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;keyword&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;index&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;doc_values&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;catalogName&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;keyword&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;index&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;doc_values&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrs&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;nested&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;properties&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;attrId&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;long&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrName&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;keyword&quot;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;index&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;doc_values&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line"> <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">&quot;attrValue&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line"> <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span> <span class="string">&quot;keyword&quot;</span></span><br><span class="line"> <span class="punctuation">&#125;</span></span><br><span class="line"> <span class="punctuation">&#125;</span></span><br><span class="line"> <span class="punctuation">&#125;</span></span><br><span class="line"> <span class="punctuation">&#125;</span></span><br><span class="line"> <span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>
<p><strong>2.上架功能后端代码</strong></p>
<p>所需的实体类</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.common.to.es;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> lombok.Data;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.math.BigDecimal;</span><br><span class="line"><span class="keyword">import</span> java.util.List;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Jason Gong</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/7/5</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 对应ES中保存的文档的实体类</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Data</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">SkuEsModel</span> &#123;</span><br><span class="line"> <span class="keyword">private</span> Long skuId;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Long spuId;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String skuTitle;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> BigDecimal skuPrice;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String skuImg;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Long saleCount;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Boolean hasStock;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Long hotScore;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Long brandId;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Long catalogId;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String brandName;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String brandImg;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String catalogName;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> List&lt;Attrs&gt; attrs;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Data</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class</span> <span class="title class_">Attrs</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Long attrId;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String attrName;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String attrValue;</span><br><span class="line"></span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>商品上架的后端关键代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 商品上架的功能</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">up</span><span class="params">(Long spuId)</span> &#123;</span><br><span class="line"> <span class="comment">//查询当前spuId对应的所有sku信息</span></span><br><span class="line"> List&lt;SkuInfoEntity&gt; skus = skuInfoService.getSkusBySpuId(spuId);</span><br><span class="line"> List&lt;Long&gt; skuIds = skus.stream().map(SkuInfoEntity::getSkuId).collect(Collectors.toList());</span><br><span class="line"> <span class="comment">//规格属性信息的封装(可以被检索的规格属性信息)</span></span><br><span class="line"> List&lt;ProductAttrValueEntity&gt; baseAttrs = productAttrValueService.baseAttrListForSpu(spuId);</span><br><span class="line"> List&lt;Long&gt; attrIds = baseAttrs.stream().map(attr -&gt; &#123;</span><br><span class="line"> <span class="keyword">return</span> attr.getAttrId();</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> <span class="comment">//获取可以检索的属性id的集合</span></span><br><span class="line"> List&lt;Long&gt; searchAttrIds = attrService.selectSearchAttrs(attrIds);</span><br><span class="line"> <span class="comment">//将其转换成set集合</span></span><br><span class="line"> Set&lt;Long&gt; idSet = <span class="keyword">new</span> <span class="title class_">HashSet</span>&lt;&gt;(searchAttrIds);</span><br><span class="line"> <span class="comment">//最终需要封装的attrs</span></span><br><span class="line"> List&lt;SkuEsModel.Attrs&gt; attrs = baseAttrs.stream().filter(item -&gt; &#123;</span><br><span class="line"> <span class="keyword">return</span> idSet.contains(item.getAttrId());</span><br><span class="line"> &#125;).map(item -&gt; &#123;</span><br><span class="line"> SkuEsModel.<span class="type">Attrs</span> <span class="variable">skuAttr</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SkuEsModel</span>.Attrs();</span><br><span class="line"> BeanUtils.copyProperties(item, skuAttr);</span><br><span class="line"> <span class="keyword">return</span> skuAttr;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> <span class="comment">//库存</span></span><br><span class="line"> Map&lt;Long, Boolean&gt; stockMap = <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">try</span> &#123;</span><br><span class="line"> <span class="type">R</span> <span class="variable">r</span> <span class="operator">=</span> wareFeignService.getSkusHasStock(skuIds);</span><br><span class="line"> List&lt;SkuHasStockVo&gt; skuHasStockVos = r.getData(<span class="keyword">new</span> <span class="title class_">TypeReference</span>&lt;List&lt;SkuHasStockVo&gt;&gt;()&#123;&#125;);</span><br><span class="line"> stockMap = skuHasStockVos.stream().collect(Collectors.toMap(SkuHasStockVo::getSkuId, item -&gt; item.getHasStock()));</span><br><span class="line"> &#125; <span class="keyword">catch</span> (Exception e) &#123;</span><br><span class="line"> log.error(<span class="string">&quot;库存服务查询异常:原因&#123;&#125;&quot;</span>,e);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//封装sku的信息</span></span><br><span class="line"> Map&lt;Long, Boolean&gt; finalStockMap = stockMap;</span><br><span class="line"> List&lt;SkuEsModel&gt; upProducts = skus.stream().map(sku -&gt; &#123;</span><br><span class="line"> <span class="comment">//组装需要的数据</span></span><br><span class="line"> <span class="type">SkuEsModel</span> <span class="variable">skuEsModel</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SkuEsModel</span>();</span><br><span class="line"> BeanUtils.copyProperties(sku, skuEsModel);</span><br><span class="line"> <span class="comment">//价格 图片</span></span><br><span class="line"> skuEsModel.setSkuPrice(sku.getPrice());</span><br><span class="line"> skuEsModel.setSkuImg(sku.getSkuDefaultImg());</span><br><span class="line"> <span class="comment">//设置库存信息</span></span><br><span class="line"> <span class="keyword">if</span>(finalStockMap == <span class="literal">null</span>)&#123;</span><br><span class="line"> skuEsModel.setHasStock(<span class="literal">true</span>);</span><br><span class="line"> &#125;<span class="keyword">else</span> &#123;</span><br><span class="line"> skuEsModel.setHasStock(finalStockMap.get(sku.getSkuId()));</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="comment">//热度评分信息</span></span><br><span class="line"> skuEsModel.setHotScore(<span class="number">0L</span>);</span><br><span class="line"> <span class="comment">//品牌名 分类名 品牌价格</span></span><br><span class="line"> <span class="type">BrandEntity</span> <span class="variable">brand</span> <span class="operator">=</span> brandService.getById(sku.getBrandId());</span><br><span class="line"> skuEsModel.setBrandName(brand.getName());</span><br><span class="line"> skuEsModel.setBrandImg(brand.getLogo());</span><br><span class="line"> <span class="type">CategoryEntity</span> <span class="variable">category</span> <span class="operator">=</span> categoryService.getById(sku.getCatalogId());</span><br><span class="line"> skuEsModel.setCatalogName(category.getName());</span><br><span class="line"> <span class="comment">//设置attrs</span></span><br><span class="line"> skuEsModel.setAttrs(attrs);</span><br><span class="line"> <span class="keyword">return</span> skuEsModel;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> <span class="type">R</span> <span class="variable">r</span> <span class="operator">=</span> searchFeignService.productStatusUp(upProducts);</span><br><span class="line"> <span class="keyword">if</span>(r.getCode() == <span class="number">0</span>)&#123;</span><br><span class="line"> <span class="comment">//远程调用成功</span></span><br><span class="line"> spuInfoDao.updateSpuStatus(spuId, ProductConstant.StatusEnum.SPU_UP.getCode());</span><br><span class="line"> &#125;<span class="keyword">else</span> &#123;</span><br><span class="line"> <span class="comment">//远程调用失败</span></span><br><span class="line"> <span class="comment">//TODO 重复调用的问题</span></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * feign的调用流程</span></span><br><span class="line"><span class="comment"> * 1.构造请求的数据将对象转化成json</span></span><br><span class="line"><span class="comment"> * 2.发送请求进行执行(执行成功之后会解码响应数据)</span></span><br><span class="line"><span class="comment"> * 3.执行请求会有重试机制</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 过滤出属性id中可以被检索的属性的id</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> attrIds 原属性id的集合</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> 可以被检索的属性id的集合</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> List&lt;Long&gt; <span class="title function_">selectSearchAttrs</span><span class="params">(List&lt;Long&gt; attrIds)</span> &#123;</span><br><span class="line"> <span class="comment">//select attr_id from `pms_attr` where attr_id in (?) and search_type=1</span></span><br><span class="line"> <span class="keyword">return</span> attrDao.selectSearchAttrs(attrIds);</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">select</span> <span class="attr">id</span>=<span class="string">&quot;selectSearchAttrs&quot;</span> <span class="attr">resultType</span>=<span class="string">&quot;java.lang.Long&quot;</span>&gt;</span></span><br><span class="line"> select `attr_id`from `pms_attr` where `attr_id` in</span><br><span class="line"> <span class="tag">&lt;<span class="name">foreach</span> <span class="attr">collection</span>=<span class="string">&quot;attrIds&quot;</span> <span class="attr">item</span>=<span class="string">&quot;attr&quot;</span> <span class="attr">separator</span>=<span class="string">&quot;,&quot;</span> <span class="attr">open</span>=<span class="string">&quot;(&quot;</span> <span class="attr">close</span>=<span class="string">&quot;)&quot;</span>&gt;</span></span><br><span class="line"> #&#123;attr&#125;</span><br><span class="line"> <span class="tag">&lt;/<span class="name">foreach</span>&gt;</span></span><br><span class="line"> and `search_type`=1</span><br><span class="line"><span class="tag">&lt;/<span class="name">select</span>&gt;</span></span><br></pre></td></tr></table></figure>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 查询库存的方法</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> List&lt;SkuHasStockVo&gt; <span class="title function_">getSkusHasStock</span><span class="params">(List&lt;Long&gt; skuIds)</span> &#123;</span><br><span class="line"> List&lt;SkuHasStockVo&gt; skuHasStockVos = skuIds.stream().map(skuId -&gt; &#123;</span><br><span class="line"> <span class="type">SkuHasStockVo</span> <span class="variable">skuHasStockVo</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SkuHasStockVo</span>();</span><br><span class="line"> <span class="type">Long</span> <span class="variable">count</span> <span class="operator">=</span> wareSkuDao.getSkuStock(skuId);</span><br><span class="line"> skuHasStockVo.setSkuId(skuId);</span><br><span class="line"> <span class="keyword">if</span>(count != <span class="literal">null</span>)&#123;</span><br><span class="line"> skuHasStockVo.setHasStock(count &gt; <span class="number">0</span>);</span><br><span class="line"> &#125;<span class="keyword">else</span> &#123;</span><br><span class="line"> skuHasStockVo.setHasStock(<span class="literal">false</span>);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> skuHasStockVo;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> <span class="keyword">return</span> skuHasStockVos;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 存储商品数据</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> Boolean <span class="title function_">productStatusUp</span><span class="params">(List&lt;SkuEsModel&gt; skuEsModels)</span> <span class="keyword">throws</span> IOException &#123;</span><br><span class="line"> <span class="comment">//将数据保存到ES中</span></span><br><span class="line"> <span class="comment">//在ES中建立好索引</span></span><br><span class="line"> <span class="type">BulkRequest</span> <span class="variable">bulkRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">BulkRequest</span>();</span><br><span class="line"> <span class="keyword">for</span> (SkuEsModel skuEsModel : skuEsModels) &#123;</span><br><span class="line"> <span class="type">IndexRequest</span> <span class="variable">indexRequest</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">IndexRequest</span>(EsConstant.PRODUCT_INDEX);</span><br><span class="line"> indexRequest.id(skuEsModel.getSkuId().toString());</span><br><span class="line"> indexRequest.source(JSON.toJSONString(skuEsModel), XContentType.JSON);</span><br><span class="line"> bulkRequest.add(indexRequest);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="type">BulkResponse</span> <span class="variable">bulk</span> <span class="operator">=</span> restHighLevelClient.bulk(bulkRequest, GulimallElasticSearchConfig.COMMON_OPTIONS);</span><br><span class="line"> <span class="type">boolean</span> <span class="variable">hasFailure</span> <span class="operator">=</span> bulk.hasFailures();</span><br><span class="line"> List&lt;String&gt; ids = Arrays.stream(bulk.getItems()).map(item -&gt; &#123;</span><br><span class="line"> <span class="keyword">return</span> item.getId();</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> log.info(<span class="string">&quot;上架商品的id:&#123;&#125;&quot;</span>,ids);</span><br><span class="line"> <span class="keyword">return</span> !hasFailure;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<h3 id="2-2-首页"><a href="#2-2-首页" class="headerlink" title="2.2 首页"></a>2.2 首页</h3><p>项目的页面视图部署在对应的微服务项目的静态资源中</p>
<p><img src="/pictures/image-20230706112521327.png" alt="image-20230706112521327"></p>
<h4 id="2-2-1整合thymeleaf"><a href="#2-2-1整合thymeleaf" class="headerlink" title="2.2.1整合thymeleaf"></a>2.2.1整合thymeleaf</h4><p>添加thymeleaf的依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!-- thymeleaf--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-thymeleaf<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>将资料中的静态资源放在微服务工程的对应位置,并在配置文件中加入对应的配置</p>
<p><img src="/pictures/image-20230706114304695.png" alt="image-20230706114304695"></p>
<p>首页页面</p>
<p><img src="/pictures/image-20230706145050684.png" alt="image-20230706145050684"></p>
<p>在index.html上加上thymeleaf的名称空间</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">xmlns:th</span>=<span class="string">&quot;http://www.thymeleaf.org&quot;</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>修改页面的时候需要频繁的重启项目,使用热更新来解决该问题</p>
<p>导入devtools的依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--devtools--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-devtools<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">optional</span>&gt;</span>true<span class="tag">&lt;/<span class="name">optional</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>重启项目之后会显示如下的效果</p>
<p><img src="/pictures/image-20230706154112026.png" alt="image-20230706154112026"></p>
<p>这时我们在每次修改页面之后使用Ctrl+Shift+F9键可以热更新</p>
<p><img src="/pictures/image-20230706161401528.png" alt="image-20230706161401528"></p>
<h4 id="2-2-2-首页面三级分类显示"><a href="#2-2-2-首页面三级分类显示" class="headerlink" title="2.2.2 首页面三级分类显示"></a>2.2.2 首页面三级分类显示</h4><p>首页面的跳转以及一级分类的显示</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 首页面的跳转</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@GetMapping(&#123;&quot;/&quot;,&quot;index.html&quot;&#125;)</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">indexPage</span><span class="params">(Model model)</span>&#123;</span><br><span class="line"> <span class="comment">//查询所有的一级分类</span></span><br><span class="line"> List&lt;CategoryEntity&gt; categorys = categoryService.getLevelOneCategorys();</span><br><span class="line"> model.addAttribute(<span class="string">&quot;categorys&quot;</span>,categorys);</span><br><span class="line"> <span class="keyword">return</span> <span class="string">&quot;index&quot;</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>用于用户端首页面三级分类封装的数据</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.product.vo;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> lombok.AllArgsConstructor;</span><br><span class="line"><span class="keyword">import</span> lombok.Data;</span><br><span class="line"><span class="keyword">import</span> lombok.NoArgsConstructor;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.List;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Jason Gong</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@website</span> https://jasonsgong.gitee.io</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/7/7</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 用户端首页面三级分类封装的数据</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Data</span></span><br><span class="line"><span class="meta">@AllArgsConstructor</span></span><br><span class="line"><span class="meta">@NoArgsConstructor</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Catelog2Vo</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 一级父分类的id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> String catalog1Id;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 三级子分类</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> List&lt;Category3Vo&gt; catalog3List;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String id;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String name;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 三级分类vo</span></span><br><span class="line"><span class="comment"> * 静态内部类</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Data</span></span><br><span class="line"> <span class="meta">@AllArgsConstructor</span></span><br><span class="line"> <span class="meta">@NoArgsConstructor</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class</span> <span class="title class_">Category3Vo</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 父分类、二级分类id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> String catalog2Id;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String id;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String name;</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>前端相关的修改</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"> <span class="tag">&lt;<span class="name">li</span> <span class="attr">th:each</span>=<span class="string">&quot; category:$&#123;categorys&#125;&quot;</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;#&quot;</span> <span class="attr">class</span>=<span class="string">&quot;header_main_left_a&quot;</span> <span class="attr">ctg-data</span>=<span class="string">&quot;3&quot;</span> <span class="attr">th:attr</span>=<span class="string">&quot;ctg-data=$&#123;category.catId&#125;&quot;</span>&gt;</span><span class="tag">&lt;<span class="name">b</span> <span class="attr">th:text</span>=<span class="string">&quot;$&#123;category.name&#125;&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">b</span>&gt;</span><span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">li</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230707151505310.png" alt="image-20230707151505310"></p>
<p>controller层代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 首页面的商品分分类信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@ResponseBody</span></span><br><span class="line"> <span class="meta">@GetMapping(&quot;/index/catalog.json&quot;)</span></span><br><span class="line"> <span class="keyword">public</span> Map&lt;String, List&lt;Catelog2Vo&gt;&gt; <span class="title function_">getCatalogJson</span><span class="params">()</span>&#123;</span><br><span class="line"> <span class="keyword">return</span> categoryService.getCatalogJson();</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>service层代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Override</span></span><br><span class="line"> <span class="keyword">public</span> Map&lt;String, List&lt;Catelog2Vo&gt;&gt; <span class="title function_">getCatalogJson</span><span class="params">()</span> &#123;</span><br><span class="line"> <span class="comment">//查出所有的一级分类</span></span><br><span class="line"> List&lt;CategoryEntity&gt; levelOneCategorys = getLevelOneCategorys();</span><br><span class="line"> <span class="comment">//封装数据</span></span><br><span class="line"> Map&lt;String, List&lt;Catelog2Vo&gt;&gt; catelog2VoMap = levelOneCategorys.stream().collect(Collectors.toMap(k -&gt; k.getCatId().toString(), v -&gt; &#123;</span><br><span class="line"> <span class="comment">//查询以及分类下的二级分类</span></span><br><span class="line"> List&lt;CategoryEntity&gt; categoryEntities = categoryDao.selectList(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;CategoryEntity&gt;().eq(CategoryEntity::getParentCid, v.getCatId()));</span><br><span class="line"> List&lt;Catelog2Vo&gt; catelog2Vos = <span class="literal">null</span>;</span><br><span class="line"> <span class="keyword">if</span> (categoryEntities != <span class="literal">null</span>) &#123;</span><br><span class="line"> catelog2Vos = categoryEntities.stream().map(item -&gt; &#123;</span><br><span class="line"> <span class="type">Catelog2Vo</span> <span class="variable">catelog2Vo</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Catelog2Vo</span>(v.getCatId().toString(), <span class="literal">null</span>, item.getCatId().toString(), item.getName());</span><br><span class="line"> <span class="comment">//当前二级分类的三级分类</span></span><br><span class="line"> List&lt;CategoryEntity&gt; levelThreeCatelog = categoryDao.selectList(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;CategoryEntity&gt;().eq(CategoryEntity::getParentCid, item.getCatId()));</span><br><span class="line"> <span class="keyword">if</span>(levelThreeCatelog != <span class="literal">null</span>)&#123;</span><br><span class="line"> <span class="comment">//封装成指定的数据</span></span><br><span class="line"> List&lt;Catelog2Vo.Category3Vo&gt; category3VoList = levelThreeCatelog.stream().map(threeCatelog -&gt; &#123;</span><br><span class="line"> Catelog2Vo.<span class="type">Category3Vo</span> <span class="variable">category3Vo</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Catelog2Vo</span>.Category3Vo();</span><br><span class="line"> category3Vo.setCatalog2Id(item.getCatId().toString());</span><br><span class="line"> category3Vo.setName(threeCatelog.getName());</span><br><span class="line"> category3Vo.setId(threeCatelog.getCatId().toString());</span><br><span class="line"> <span class="keyword">return</span> category3Vo;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> catelog2Vo.setCatalog3List(category3VoList);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> catelog2Vo;</span><br><span class="line"> &#125;).collect(Collectors.toList());</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> catelog2Vos;</span><br><span class="line"> &#125;));</span><br><span class="line"> <span class="keyword">return</span> catelog2VoMap;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>页面实现的效果</p>
<p><img src="/pictures/image-20230707151543593.png" alt="image-20230707151543593"></p>
<h3 id="2-3-搭建域名访问环境"><a href="#2-3-搭建域名访问环境" class="headerlink" title="2.3 搭建域名访问环境"></a>2.3 搭建域名访问环境</h3><p><strong>1.安装SwitchHosts软件</strong></p>
<p>可以快捷的编辑操作hosts文件</p>
<p>打开的时候以管理员的身份打开</p>
<p><img src="/pictures/image-20230707153628394.png" alt="image-20230707153628394"></p>
<p><img src="/pictures/image-20230707154052952.png" alt="image-20230707154052952"></p>
<p>在添加的方案中添加如下的内容点击右下角的保存按钮保存保存失败的更改hosts文件的权限,将只读勾选掉)</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">192.168.195.100 gulimall.com</span><br></pre></td></tr></table></figure>
<p>保存成功之后可以直接访问域名,解析到虚拟机的ip</p>
<p><strong>Tips:有科学上网的测试的时候要先关闭科学上网的软件</strong></p>
<p> 安装了ES的访问gulimall.com:9200可以看到相应的内容</p>
<p><img src="/pictures/image-20230707160328001.png" alt="image-20230707160328001"></p>
<p><strong>2.正式搭建项目的域名访问环境</strong></p>
<p><img src="/pictures/image-20230708092745456.png" alt="image-20230708092745456"></p>
<p>nginx的配置文件</p>
<p><img src="/pictures/image-20230708093600923.png" alt="image-20230708093600923"></p>
<p>配置nginx</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">切换到nginx挂载在本机的配置文件所在的目录</span></span><br><span class="line">cd /mydata/nginx/conf</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">切换到nginx的分配置文件下复制一份 定义gulimall的配置,主配置文件中有include /etc/nginx/conf.d/*.conf;这么一段配置,主配置文件</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">会包含conf.d目录下的所有配置</span></span><br><span class="line">cd /mydata/nginx/conf/conf.d</span><br><span class="line">cp default.conf gulimall.conf 复制一份</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">在gulimall.conf配置文件中配置我们的配置</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">配置如下配置</span></span><br></pre></td></tr></table></figure>
<p>niginx的配置文件如下</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">server &#123;</span><br><span class="line"> listen 80;</span><br><span class="line"> server_name gulimall.com;</span><br><span class="line"></span><br><span class="line"> location / &#123;</span><br><span class="line"> #服务的IP 192.168.0.112</span><br><span class="line"> #服务的端口: 10000</span><br><span class="line"> proxy_pass http://192.168.0.112:10000;</span><br><span class="line"> &#125;</span><br><span class="line"> error_page 500 502 503 504 /50x.html;</span><br><span class="line"> location = /50x.html &#123;</span><br><span class="line"> root /usr/share/nginx/html;</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>这时我们在访问gulimall.com的时候就可以访问一下的页面了</p>
<p><img src="/pictures/image-20230708095940126.png" alt="image-20230708095940126"></p>
<p><strong>3.让nginx代理到网关</strong></p>
<p>在nginx.conf配置文件中加上如下的配置</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">#配置上游服务器</span><br><span class="line"> #gulimall是上游服务器的组名</span><br><span class="line"> upstream gulimall&#123;</span><br><span class="line"> #网关的地址</span><br><span class="line"> server 192.168.0.112:88;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<p>修改gulimall.conf中的配置</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">server &#123;</span><br><span class="line"> listen 80;</span><br><span class="line"> server_name gulimall.com;</span><br><span class="line"></span><br><span class="line"> location / &#123;</span><br><span class="line"> proxy_pass http://gulimall;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> error_page 500 502 503 504 /50x.html;</span><br><span class="line"> location = /50x.html &#123;</span><br><span class="line"> root /usr/share/nginx/html;</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>在网关的配置文件中加上一下的配置</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># nginx代理相关的断言</span></span><br><span class="line"><span class="bullet">-</span> <span class="attr">id:</span> <span class="string">gulimall_host_route</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">lb://gulimall-product</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Host=**.gulimall.com,gulimall.com</span></span><br></pre></td></tr></table></figure>
<p>这时我们重启网关的时候发现无法访问到相应的页面 是由于nginx访问网关的时候丢了host</p>
<p>这时我们需要加上如下的配置</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">proxy_set_header Host $host;</span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230708104321024.png" alt="image-20230708104321024"></p>
<img src="/pictures/image-20230708104848501.png" alt="image-20230708104848501" style="zoom:150%;" />
<h3 id="2-4-性能压测"><a href="#2-4-性能压测" class="headerlink" title="2.4 性能压测"></a>2.4 性能压测</h3><p><strong><a href="https://jasonsgong.gitee.io/posts/1416.html">压力测试与性能监控 | The Blog (gitee.io)</a></strong></p>
<p>JMeter压力测试</p>
<p><img src="/pictures/image-20230708152102009.png" alt="image-20230708152102009"></p>
<p>性能监控</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">jconsole</span><br><span class="line">jvisualvm</span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230709155555491.png" alt="image-20230709155555491"></p>
<h4 id="2-4-1优化中间件对性能的影响"><a href="#2-4-1优化中间件对性能的影响" class="headerlink" title="2.4.1优化中间件对性能的影响"></a>2.4.1优化中间件对性能的影响</h4><p>网关的优化、数据库索引的优化、thymeleaf的优化、静态资源的优化、nginx动静分离</p>
<p><img src="/pictures/image-20230710111805705.png" alt="image-20230710111805705"></p>
<h3 id="2-5-缓存使用"><a href="#2-5-缓存使用" class="headerlink" title="2.5 缓存使用"></a>2.5 缓存使用</h3><h4 id="2-5-1-本地缓存与分布式缓存"><a href="#2-5-1-本地缓存与分布式缓存" class="headerlink" title="2.5.1 本地缓存与分布式缓存"></a>2.5.1 本地缓存与分布式缓存</h4><p>为了系统性能的提升,我们一般都会将部分数据放入缓存中,加速访问。而 db 承担数据落盘工作。<br><strong>哪些数据适合放入缓存?</strong><br>1.即时性、数据一致性要求不高的<br>2.访问量大且更新频率不高的数据(读多,写少)</p>
<p><strong>本地缓存</strong></p>
<p><img src="/pictures/image-20230710143906286.png" alt="image-20230710143906286"></p>
<p><strong>分布式缓存</strong></p>
<p><img src="/pictures/image-20230710143341531.png" alt="image-20230710143341531"></p>
<h4 id="2-5-2-整合redis"><a href="#2-5-2-整合redis" class="headerlink" title="2.5.2 整合redis"></a>2.5.2 整合redis</h4><p><strong>1.安装Redis</strong></p>
<p><img src="/pictures/image-20230710144052877.png" alt="image-20230710144052877"></p>
<p><strong>2.项目中使用Redis</strong></p>
<p><strong><a href="https://jasonsgong.gitee.io/posts/13813.html">SpringBoot整合Redis | The Blog (gitee.io)</a></strong></p>
<p>2.1 引入依赖</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-data-redis<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>2.2 添加配置</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">spring:</span></span><br><span class="line"> <span class="attr">redis:</span></span><br><span class="line"> <span class="attr">host:</span> <span class="number">192.168</span><span class="number">.195</span><span class="number">.100</span></span><br><span class="line"> <span class="attr">port:</span> <span class="number">6379</span></span><br></pre></td></tr></table></figure>
<p>2.3 测试使用</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Autowired</span></span><br><span class="line"><span class="keyword">private</span> StringRedisTemplate stringRedisTemplate;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testRedis</span><span class="params">()</span>&#123;</span><br><span class="line"> ValueOperations&lt;String, String&gt; ops = stringRedisTemplate.opsForValue();</span><br><span class="line"> ops.set(<span class="string">&quot;hello&quot;</span>,<span class="string">&quot;word_&quot;</span>+ UUID.randomUUID().toString());</span><br><span class="line"> <span class="type">String</span> <span class="variable">hello</span> <span class="operator">=</span> ops.get(<span class="string">&quot;hello&quot;</span>);</span><br><span class="line"> System.out.println(hello);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230710145648233.png" alt="image-20230710145648233"></p>
<p><strong>lettuce堆外内存溢出bug</strong></p>
<p>产生原因:</p>
<p>1)、springboot2.0以后<strong>默认</strong>使用 <code>lettuce</code>作为操作redis的客户端它使用netty进行网络通信</p>
<p>2)、lettuce的bug导致netty堆外内存溢出。netty如果没有指定堆外内存默认使用Xms的值可以使用-Dio.netty.maxDirectMemory进行设置</p>
<p>解决方案由于是lettuce的bug造成不要直接使用-Dio.netty.maxDirectMemory去调大虚拟机堆外内存治标不治本。</p>
<ul>
<li>1)、升级lettuce客户端</li>
<li>2)、切换使用jedis</li>
</ul>
<p>修改依赖文件使用jedis作为客户端工具</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-data-redis<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">exclusions</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">exclusion</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>io.lettuce<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>lettuce-core<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">exclusion</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">exclusions</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>redis.clients<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>jedis<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="2-5-3-高并发下缓存失效问题"><a href="#2-5-3-高并发下缓存失效问题" class="headerlink" title="2.5.3 高并发下缓存失效问题"></a>2.5.3 高并发下缓存失效问题</h4><p><strong>缓存穿透</strong></p>
<img src="/pictures/image-20230710153635804.png" alt="image-20230710153635804" style="zoom:150%;" />
<p><strong>缓存雪崩</strong></p>
<img src="/pictures/image-20230710153651752.png" alt="image-20230710153651752" style="zoom:150%;" />
<p><strong>缓存击穿</strong></p>
<img src="/pictures/image-20230710153709464.png" alt="image-20230710153709464" style="zoom:150%;" />
<p><strong>分布式下如何加锁?</strong></p>
<img src="/pictures/image-20230710163735955.png" alt="image-20230710163735955" style="zoom:150%;" />
<p><strong>锁-时序问题</strong></p>
<img src="/pictures/image-20230710165738655.png" alt="image-20230710165738655" style="zoom:150%;" />
<p><strong>分布式锁演进-基本原理</strong></p>
<p><img src="/pictures/image-20230714163437984.png" alt="image-20230714163437984"></p>
<p><strong>分布式锁的最终形态</strong></p>
<p><img src="/pictures/image-20230714171221296.png" alt="image-20230714171221296"></p>
<h4 id="2-5-4-分布式锁-Redisson"><a href="#2-5-4-分布式锁-Redisson" class="headerlink" title="2.5.4 分布式锁-Redisson"></a>2.5.4 分布式锁-Redisson</h4><p>github地址: <a target="_blank" rel="noopener" href="https://github.com/redisson/redisson">https://github.com/redisson/redisson</a></p>
<p><strong>1.引入依赖</strong></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--redisson--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.redisson<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>redisson<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">version</span>&gt;</span>3.12.0<span class="tag">&lt;/<span class="name">version</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p><strong>2.配置redisson</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.product.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.redisson.Redisson;</span><br><span class="line"><span class="keyword">import</span> org.redisson.api.RedissonClient;</span><br><span class="line"><span class="keyword">import</span> org.redisson.config.Config;</span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.Bean;</span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.Configuration;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Jason Gong</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@website</span> https://jasonsgong.gitee.io</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/7/14</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> Redisson的配置</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Configuration</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyRedissonConfig</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 所有对redisson的操作通过RedissonClient</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@Bean(destroyMethod = &quot;shutdown&quot;)</span></span><br><span class="line"> <span class="keyword">public</span> RedissonClient <span class="title function_">redisson</span><span class="params">()</span> <span class="keyword">throws</span> IOException &#123;</span><br><span class="line"> <span class="comment">//创建配置</span></span><br><span class="line"> <span class="type">Config</span> <span class="variable">config</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Config</span>();</span><br><span class="line"> config.useSingleServer().setAddress(<span class="string">&quot;redis://192.168.195.100:6379&quot;</span>);</span><br><span class="line"> <span class="comment">//根据配置config创建RedissonClient实例</span></span><br><span class="line"> <span class="keyword">return</span> Redisson.create(config);</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>3.测试使用</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Autowired</span></span><br><span class="line"><span class="keyword">private</span> RedissonClient redissonClient;</span><br><span class="line"></span><br><span class="line"><span class="meta">@Test</span></span><br><span class="line"><span class="keyword">void</span> <span class="title function_">testRedisson</span><span class="params">()</span>&#123;</span><br><span class="line"> System.out.println(redissonClient);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230714175205635.png" alt="image-20230714175205635"></p>
<p><strong>4.简单的使用分布式锁</strong></p>
<p>上一个线程加锁之后没有解锁的话,后面的线程会一直等待前面的线程释放锁,自己再加锁。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@ResponseBody</span></span><br><span class="line"><span class="meta">@GetMapping(&quot;/hello&quot;)</span></span><br><span class="line"><span class="keyword">public</span> String <span class="title function_">hello</span><span class="params">()</span> &#123;</span><br><span class="line"> <span class="comment">//打印时间需要</span></span><br><span class="line"> <span class="type">SimpleDateFormat</span> <span class="variable">sdf</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">SimpleDateFormat</span>();<span class="comment">// 格式化时间</span></span><br><span class="line"> sdf.applyPattern(<span class="string">&quot;yyyy-MM-dd HH:mm:ss&quot;</span>);<span class="comment">// a为am/pm的标记</span></span><br><span class="line"> <span class="type">Date</span> <span class="variable">date</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Date</span>();<span class="comment">// 获取当前时间</span></span><br><span class="line"></span><br><span class="line"> <span class="comment">//获取同一把锁,只要锁的名字一样,就是同一把锁</span></span><br><span class="line"> <span class="type">RLock</span> <span class="variable">lock</span> <span class="operator">=</span> redissonClient.getLock(<span class="string">&quot;my-lock&quot;</span>);</span><br><span class="line"> <span class="comment">//加锁</span></span><br><span class="line"> lock.lock();<span class="comment">//阻塞式等待,锁没有释放的情况下会一直等待下去</span></span><br><span class="line"> <span class="comment">//1.锁的自动续期如果业务耗费的时间超长运行时会自动给锁续上新的30s默认时续期30s不必担心业务时间长锁自动过期被删掉</span></span><br><span class="line"> <span class="comment">//2.加锁的业务只要运行完成就不会给当前锁续期即使不手动解锁锁默认在30s以后自动s</span></span><br><span class="line"> System.out.println(<span class="string">&quot;现在时间:&quot;</span> + sdf.format(date));</span><br><span class="line"> <span class="keyword">try</span> &#123;</span><br><span class="line"> <span class="comment">//执行业务</span></span><br><span class="line"> System.out.println(<span class="string">&quot;加锁成功,执行业务,线程Id:&quot;</span>+Thread.currentThread().getId());</span><br><span class="line"> Thread.sleep(<span class="number">10000</span>);<span class="comment">//等待10秒</span></span><br><span class="line"> &#125; <span class="keyword">catch</span> (InterruptedException e) &#123;</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> <span class="title class_">RuntimeException</span>(e);</span><br><span class="line"> &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line"> <span class="comment">//解锁</span></span><br><span class="line"> System.out.println(<span class="string">&quot;释放锁,线程Id:&quot;</span>+Thread.currentThread().getId());</span><br><span class="line"> lock.unlock();</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> <span class="string">&quot;hello&quot;</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230714181620263.png" alt="image-20230714181620263"></p>
<p>my-lock对应的值会跟随线程的变化而变化</p>
<p><img src="/pictures/image-20230714182057982.png" alt="image-20230714182057982"></p>
<p><strong>读写锁</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 写锁没有释放的情况下,读锁必须等待写锁的释放,才能进行读的操作</span></span><br><span class="line"><span class="comment"> * 读写锁的测试</span></span><br><span class="line"><span class="comment"> * 写锁</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@ResponseBody</span></span><br><span class="line"> <span class="meta">@GetMapping(&quot;/write&quot;)</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">writeValue</span><span class="params">()</span>&#123;</span><br><span class="line"> <span class="type">RReadWriteLock</span> <span class="variable">lock</span> <span class="operator">=</span> redissonClient.getReadWriteLock(<span class="string">&quot;rw-lock&quot;</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">s</span> <span class="operator">=</span> <span class="string">&quot;&quot;</span>;</span><br><span class="line"> <span class="type">RLock</span> <span class="variable">rLock</span> <span class="operator">=</span> lock.writeLock();<span class="comment">//写锁</span></span><br><span class="line"> <span class="keyword">try</span> &#123;</span><br><span class="line"> rLock.lock();</span><br><span class="line"> s = UUID.randomUUID().toString();</span><br><span class="line"> Thread.sleep(<span class="number">30000</span>);</span><br><span class="line"> <span class="comment">//写的操作</span></span><br><span class="line"> redisTemplate.opsForValue().set(<span class="string">&quot;writeValue&quot;</span>,s);</span><br><span class="line"> &#125; <span class="keyword">catch</span> (InterruptedException e) &#123;</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> &#125;<span class="keyword">finally</span> &#123;</span><br><span class="line"> rLock.unlock();</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> s;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 读写锁的测试</span></span><br><span class="line"><span class="comment"> * 读锁</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="meta">@GetMapping(&quot;/read&quot;)</span></span><br><span class="line"> <span class="meta">@ResponseBody</span></span><br><span class="line"> <span class="keyword">public</span> String <span class="title function_">readValue</span><span class="params">()</span>&#123;</span><br><span class="line"> <span class="type">RReadWriteLock</span> <span class="variable">lock</span> <span class="operator">=</span> redissonClient.getReadWriteLock(<span class="string">&quot;rw-lock&quot;</span>);</span><br><span class="line"> <span class="type">String</span> <span class="variable">s</span> <span class="operator">=</span> <span class="string">&quot;&quot;</span>;</span><br><span class="line"> <span class="type">RLock</span> <span class="variable">rLock</span> <span class="operator">=</span> lock.readLock();<span class="comment">//读锁</span></span><br><span class="line"> <span class="keyword">try</span> &#123;</span><br><span class="line"> rLock.lock();</span><br><span class="line"> <span class="comment">//读的操作</span></span><br><span class="line"> s = redisTemplate.opsForValue().get(<span class="string">&quot;writeValue&quot;</span>);</span><br><span class="line"> &#125; <span class="keyword">catch</span> (Exception e) &#123;</span><br><span class="line"> e.printStackTrace();</span><br><span class="line"> &#125;<span class="keyword">finally</span> &#123;</span><br><span class="line"> rLock.unlock();</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> s;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<h4 id="2-5-5-分布式缓存一致性问题"><a href="#2-5-5-分布式缓存一致性问题" class="headerlink" title="2.5.5 分布式缓存一致性问题"></a>2.5.5 分布式缓存一致性问题</h4><p><strong>双写模式</strong></p>
<p><img src="/pictures/image-20230716100845389.png" alt="image-20230716100845389"></p>
<p><strong>失效模式</strong></p>
<p><img src="/pictures/image-20230716100909465.png" alt="image-20230716100909465"></p>
<p><strong>缓存数据一致性-解决方案</strong></p>
<p><img src="/pictures/image-20230716101939869.png" alt="image-20230716101939869"></p>
<p><strong>缓存数据一致性-解决-Canal</strong></p>
<p><img src="/pictures/image-20230716102510738.png" alt="image-20230716102510738"></p>
<h4 id="2-5-6-缓存-SpringCache"><a href="#2-5-6-缓存-SpringCache" class="headerlink" title="2.5.6 缓存-SpringCache"></a>2.5.6 缓存-SpringCache</h4><p><strong>1、简介</strong></p>
<ul>
<li><p>Spring 从 3.1 开始定义了 org.springframework.cache.Cache和 org.springframework.cache.CacheManager 接口来统一不同的缓存技术;并支持使用 JCacheJSR-107注解简化我们开发</p>
</li>
<li><p>Cache 接口为缓存的组件规范定义,包含缓存的各种操作集合;<br>Cache 接 口 下 Spring 提 供 了 各 种 xxxCache 的 实 现 如 RedisCache EhCacheCache ,ConcurrentMapCache 等;</p>
</li>
<li><p>每次调用需要缓存功能的方法时Spring 会检查检查指定参数的指定的目标方法是否已经被调用过;如果有就直接从缓存中获取方法调用后的结果,如果没有就调用方法并缓存结果后返回给用户。下次调用直接从缓存中获取。</p>
</li>
<li><p>使用 Spring 缓存抽象时我们需要关注以下两点;</p>
<p>1、确定方法需要被缓存以及他们的缓存策略</p>
<p>2、从缓存中读取之前缓存存储的数据</p>
</li>
</ul>
<p><strong>2.以前的笔记教程</strong></p>
<p><strong><a href="https://jasonsgong.gitee.io/posts/13813.html">SpringBoot整合Redis | The Blog (gitee.io)</a></strong></p>
<p><strong>3.项目中整合SpringCache简化开发</strong></p>
<p><strong>3.1.引入依赖</strong></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--我们使redis作为缓存的使用场景在前面我们还要引入redis的依赖--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-cache<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p><strong>3.2.编写配置文件</strong></p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#使用缓存的类型</span></span><br><span class="line"><span class="attr">spring.cache.type</span>=<span class="string">redis</span></span><br></pre></td></tr></table></figure>
<p><strong>3.3.测试使用缓存</strong></p>
<p>常用的缓存注解</p>
<p>@Cacheable 触发将数据保存到缓存的操作</p>
<p>@CachePut 不影响方法执行更新缓存</p>
<p>@CacheEvict 触发将数据从缓存中删除的操作</p>
<p>@Caching 组合多个缓存操作</p>
<p>@CacheConfig 在类级别上共享缓存的相关配置</p>
<p>1.在启动类上添加缓存的注解</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@EnableCaching</span> <span class="comment">//开启缓存功能</span></span><br></pre></td></tr></table></figure>
<p>2.测试使用</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//每一个需要缓存的数据需要我们指定放到那个名字的缓存[缓存的分区(按照业务类型分)]</span></span><br><span class="line"><span class="meta">@Cacheable(&#123;&quot;category&quot;&#125;)</span> <span class="comment">//代表当前方法的结果需要缓存,如果缓存中有,方法就不需要调用了,如果缓存中没有,就会调用方法,将方法的结果放入到缓存</span></span><br><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="keyword">public</span> List&lt;CategoryEntity&gt; <span class="title function_">getLevelOneCategorys</span><span class="params">()</span> &#123;</span><br><span class="line"> <span class="keyword">return</span> categoryDao.selectList(<span class="keyword">new</span> <span class="title class_">LambdaQueryWrapper</span>&lt;CategoryEntity&gt;().eq(CategoryEntity::getParentCid, <span class="number">0</span>));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230716112105848.png" alt="image-20230716112105848"></p>
<p><strong>自定义数据的存储</strong></p>
<p>设置自定义的key值</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Cacheable(value = &#123;&quot;category&quot;&#125;,key = &quot;&#x27;levelOneCategorys&#x27;&quot;)</span> <span class="comment">//自定义key值</span></span><br></pre></td></tr></table></figure>
<p>tips: #root.method.name是SpEL表达式</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Cacheable(value = &#123;&quot;category&quot;&#125;,key = &quot;#root.method.name&quot;)</span> <span class="comment">//使用方法名作为key值</span></span><br></pre></td></tr></table></figure>
<p>设置缓存数据的存活时间</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#设置一个小时的存活时间</span></span><br><span class="line"><span class="attr">spring.cache.redis.time-to-live</span>=<span class="string">3600000</span></span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230716152821097.png" alt="image-20230716152821097"></p>
<p><strong>将数据保存为json的格式</strong></p>
<p>添加配置类</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.product.config;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.autoconfigure.cache.CacheProperties;</span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.context.properties.EnableConfigurationProperties;</span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.Bean;</span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.Configuration;</span><br><span class="line"><span class="keyword">import</span> org.springframework.data.redis.cache.RedisCacheConfiguration;</span><br><span class="line"><span class="keyword">import</span> org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;</span><br><span class="line"><span class="keyword">import</span> org.springframework.data.redis.serializer.RedisSerializationContext;</span><br><span class="line"><span class="keyword">import</span> org.springframework.data.redis.serializer.StringRedisSerializer;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Jason Gong</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@website</span> https://jasonsgong.gitee.io</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/7/16</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 缓存的序列化的配置</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@EnableConfigurationProperties(CacheProperties.class)</span></span><br><span class="line"><span class="meta">@Configuration</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">MyCacheConfig</span> &#123;</span><br><span class="line"> <span class="meta">@Bean</span></span><br><span class="line"> RedisCacheConfiguration <span class="title function_">redisCacheConfiguration</span><span class="params">(CacheProperties cacheProperties)</span> &#123;</span><br><span class="line"> <span class="type">RedisCacheConfiguration</span> <span class="variable">config</span> <span class="operator">=</span> RedisCacheConfiguration.defaultCacheConfig();</span><br><span class="line"> config = config.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(<span class="keyword">new</span> <span class="title class_">StringRedisSerializer</span>()));</span><br><span class="line"> config = config.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(<span class="keyword">new</span> <span class="title class_">GenericJackson2JsonRedisSerializer</span>()));</span><br><span class="line"> <span class="comment">//让配置文件中所有的配置生效(下面的不配置的话,缓存的时间会失效)</span></span><br><span class="line"> CacheProperties.<span class="type">Redis</span> <span class="variable">redisProperties</span> <span class="operator">=</span> cacheProperties.getRedis();</span><br><span class="line"> <span class="keyword">if</span> (redisProperties.getTimeToLive() != <span class="literal">null</span>) &#123;</span><br><span class="line"> config = config.entryTtl(redisProperties.getTimeToLive());</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">if</span> (redisProperties.getKeyPrefix() != <span class="literal">null</span>) &#123;</span><br><span class="line"> config = config.prefixCacheNameWith(redisProperties.getKeyPrefix());</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">if</span> (!redisProperties.isCacheNullValues()) &#123;</span><br><span class="line"> config = config.disableCachingNullValues();</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">if</span> (!redisProperties.isUseKeyPrefix()) &#123;</span><br><span class="line"> config = config.disableKeyPrefix();</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">return</span> config;</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>效果</p>
<p><img src="/pictures/image-20230716160027391.png" alt="image-20230716160027391"></p>
<p><strong>其它的常用配置</strong></p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#缓存的前缀,如果指定了前缀就使用指定的前缀,没有指定前缀就使用缓存的名字作为前缀</span></span><br><span class="line"><span class="attr">spring.cache.redis.key-prefix</span>=<span class="string">CACHE_</span></span><br><span class="line"><span class="comment">#是否使用缓存的前缀</span></span><br><span class="line"><span class="attr">spring.cache.redis.use-key-prefix</span>=<span class="string">true</span></span><br><span class="line"><span class="comment">#是否缓存空值(缓存穿透的问题的解决)</span></span><br><span class="line"><span class="attr">spring.cache.redis.cache-null-values</span>=<span class="string">true</span></span><br></pre></td></tr></table></figure>
<h3 id="2-6-检索服务"><a href="#2-6-检索服务" class="headerlink" title="2.6 检索服务"></a>2.6 检索服务</h3><h4 id="2-6-1-整合页面"><a href="#2-6-1-整合页面" class="headerlink" title="2.6.1 整合页面"></a>2.6.1 整合页面</h4><p><img src="/pictures/image-20230716173751202.png" alt="image-20230716173751202"></p>
<h4 id="2-6-2-配置域名访问"><a href="#2-6-2-配置域名访问" class="headerlink" title="2.6.2 配置域名访问"></a>2.6.2 配置域名访问</h4><p><img src="/pictures/image-20230716173453604.png" alt="image-20230716173453604"></p>
<p>Nginx的配置</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">server &#123;</span><br><span class="line"> listen 80;</span><br><span class="line"> server_name *.gulimall.com;</span><br><span class="line"></span><br><span class="line"> location / &#123;</span><br><span class="line"> proxy_set_header Host $host;</span><br><span class="line"> proxy_pass http://gulimall;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> error_page 500 502 503 504 /50x.html;</span><br><span class="line"> location = /50x.html &#123;</span><br><span class="line"> root /usr/share/nginx/html;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>网关中配置断言</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#搜索</span></span><br><span class="line"><span class="bullet">-</span> <span class="attr">id:</span> <span class="string">gulimall_search_route</span></span><br><span class="line"> <span class="attr">uri:</span> <span class="string">lb://gulimall-search</span></span><br><span class="line"> <span class="attr">predicates:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">Host=search.gulimall.com</span></span><br></pre></td></tr></table></figure>
<p><img src="/pictures/image-20230716173628024.png" alt="image-20230716173628024"></p>
<h4 id="2-6-3-首页和搜索页相互跳转"><a href="#2-6-3-首页和搜索页相互跳转" class="headerlink" title="2.6.3 首页和搜索页相互跳转"></a>2.6.3 首页和搜索页相互跳转</h4><p><strong>首页无法跳转到搜索页的原因gumall改为gulimall即可</strong></p>
<p><img src="/pictures/image-20230716181052580.png" alt="image-20230716181052580"></p>
<p><strong>搜索框跳转到搜索页,修改页面中的代码</strong></p>
<p><img src="/pictures/image-20230717094656565.png" alt="image-20230717094656565"></p>
<h4 id="2-6-4-商品的检索"><a href="#2-6-4-商品的检索" class="headerlink" title="2.6.4 商品的检索"></a>2.6.4 商品的检索</h4><p><img src="/pictures/image-20230717095740594.png" alt="image-20230717095740594"></p>
<p>检索条件的VO</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.search.vo;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> lombok.Data;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.List;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Jason Gong</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@website</span> https://jasonsgong.gitee.io</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/7/17</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 检索条件的vo</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Data</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">SearchParam</span> &#123;</span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 页面传递过来的全文匹配关键字</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> String keyword;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 品牌id,可以多选</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> List&lt;Long&gt; brandId;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 三级分类id</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> Long catalog3Id;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 排序条件sort=price/salecount/hotscore_desc/asc</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> String sort;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 是否显示有货</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> Integer hasStock;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 价格区间查询</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> String skuPrice;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 按照属性进行筛选</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> List&lt;String&gt; attrs;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 页码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> <span class="type">Integer</span> <span class="variable">pageNum</span> <span class="operator">=</span> <span class="number">1</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 原生的所有查询条件</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> String _queryString;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>检索的结果</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.atguigu.gulimall.search.vo;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.atguigu.common.to.es.SkuEsModel;</span><br><span class="line"><span class="keyword">import</span> lombok.Data;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.ArrayList;</span><br><span class="line"><span class="keyword">import</span> java.util.List;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Jason Gong</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@website</span> https://jasonsgong.gitee.io</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Date</span> 2023/7/17</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> 根据检索条件返回给页面的商品信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Data</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">SearchResult</span> &#123;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 查询到的所有商品信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> List&lt;SkuEsModel&gt; product;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 当前页码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> Integer pageNum;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 总记录数</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> Long total;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 总页码</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> Integer totalPages;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> List&lt;Integer&gt; pageNavs;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 当前查询到的结果,所有涉及到的品牌</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> List&lt;BrandVo&gt; brands;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 当前查询到的结果,所有涉及到的所有属性</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> List&lt;AttrVo&gt; attrs;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 当前查询到的结果,所有涉及到的所有分类</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"> <span class="keyword">private</span> List&lt;CatalogVo&gt; catalogs;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> List&lt;NavVo&gt; navs;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Data</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class</span> <span class="title class_">NavVo</span> &#123;</span><br><span class="line"> <span class="keyword">private</span> String navName;</span><br><span class="line"> <span class="keyword">private</span> String navValue;</span><br><span class="line"> <span class="keyword">private</span> String link;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="meta">@Data</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class</span> <span class="title class_">BrandVo</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Long brandId;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String brandName;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String brandImg;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="meta">@Data</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class</span> <span class="title class_">AttrVo</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Long attrId;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String attrName;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> List&lt;String&gt; attrValue;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="meta">@Data</span></span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class</span> <span class="title class_">CatalogVo</span> &#123;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> Long catalogId;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> String catalogName;</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>未完待续(学习到177)……</strong></p>
</article><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/">项目实战</a></div><div class="post_share"><div class="social-share" data-image="/img/5.png" data-sites="wechat,weibo,qq"></div><link rel="stylesheet" href="/cdn/css/share.min.css" media="print" onload="this.media='all'"><script src="/cdn/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/img/wechat.jpg" target="_blank"><img class="post-qr-code-img" src="/img/wechat.jpg" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/img/alipay.jpg" target="_blank"><img class="post-qr-code-img" src="/img/alipay.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><br/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="far fa-comment-alt fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="gitalk-container"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/img/avatar.jpg" onerror="this.onerror=null;this.src='/img/loading.gif'" alt="avatar"/></div><div class="author-info__name">Jason</div><div class="author-info__description">Debug the World</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">77</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">47</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div><a id="card-info-btn"><i class="fab fa-microsoft"></i><span>Ctrl + D 收藏</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/JasonsGong" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="tencent://AddContact/?fromId=45&amp;fromSubId=1&amp;subcmd=all&amp;uin=2602183349&amp;website=www.oicqzone.com" target="_blank" title="QQ"><i class="fab fa-qq"></i></a><a class="social-icon" href="mailto:2602183349@qq.com" target="_blank" title="Email"><i class="fas fa-envelope-open-text"></i></a><a class="social-icon" href="https://github.com/JasonsGong?tab=repositories" target="_blank" title="代码仓库"><i class="fas fa-database"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">本网站是静态网站,更新页面资源请使用Ctrl+F5;若网站内文章对你有帮助,请使用Ctrl+D收藏该网站</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content is-expand"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%80-%E9%A1%B9%E7%9B%AE%E7%AE%80%E4%BB%8B"><span class="toc-text">一.项目简介</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E9%A1%B9%E7%9B%AE%E8%83%8C%E6%99%AF"><span class="toc-text">1.项目背景</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E9%A1%B9%E7%9B%AE%E6%9E%B6%E6%9E%84%E5%9B%BE"><span class="toc-text">2.项目架构图</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E9%A1%B9%E7%9B%AE%E6%8A%80%E6%9C%AF%E5%92%8C%E7%89%B9%E8%89%B2"><span class="toc-text">3.项目技术和特色</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-%E9%A1%B9%E7%9B%AE%E7%9A%84%E5%89%8D%E7%BD%AE%E8%A6%81%E6%B1%82"><span class="toc-text">4.项目的前置要求</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BA%8C-%E5%88%86%E5%B8%83%E5%BC%8F%E5%9F%BA%E7%A1%80%E6%A6%82%E5%BF%B5"><span class="toc-text">二.分布式基础概念</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E5%BE%AE%E6%9C%8D%E5%8A%A1"><span class="toc-text">1.微服务</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E9%9B%86%E7%BE%A4-%E5%88%86%E5%B8%83%E5%BC%8F-%E8%8A%82%E7%82%B9"><span class="toc-text">2.集群|分布式|节点</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E8%BF%9C%E7%A8%8B%E8%B0%83%E7%94%A8"><span class="toc-text">3.远程调用</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1"><span class="toc-text">4.负载均衡</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-%E6%9C%8D%E5%8A%A1%E6%B3%A8%E5%86%8C-%E5%8F%91%E7%8E%B0-%E6%B3%A8%E5%86%8C%E4%B8%AD%E5%BF%83"><span class="toc-text">5.服务注册|发现|注册中心</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#6-%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83"><span class="toc-text">6.配置中心</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-%E6%9C%8D%E5%8A%A1%E7%86%94%E6%96%AD%E5%92%8C%E6%9C%8D%E5%8A%A1%E9%99%8D%E7%BA%A7"><span class="toc-text">7.服务熔断和服务降级</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#8-API%E7%BD%91%E5%85%B3"><span class="toc-text">8.API网关</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%89-%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA"><span class="toc-text">三.环境搭建</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E5%AE%89%E8%A3%85%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="toc-text">1.安装虚拟机</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-Docker%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE"><span class="toc-text">2.Docker安装与配置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-Docker%E5%AE%89%E8%A3%85mysql"><span class="toc-text">3.Docker安装mysql</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-Docker%E5%AE%89%E8%A3%85redis"><span class="toc-text">4.Docker安装redis</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-%E7%BB%9F%E4%B8%80%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83"><span class="toc-text">5.统一开发环境</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#6-%E9%85%8D%E7%BD%AEGit"><span class="toc-text">6.配置Git</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-%E4%BB%8EGitee%E4%B8%8A%E5%88%9D%E5%A7%8B%E5%8C%96%E4%B8%80%E4%B8%AA%E9%A1%B9%E7%9B%AE"><span class="toc-text">7.从Gitee上初始化一个项目</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#8-%E5%88%9B%E5%BB%BA%E5%BE%AE%E6%9C%8D%E5%8A%A1%E6%A8%A1%E5%9D%97"><span class="toc-text">8.创建微服务模块</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#9-%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E8%AE%A1"><span class="toc-text">9.数据库设计</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#10-%E5%90%8E%E5%8F%B0%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F%E7%9A%84%E6%90%AD%E5%BB%BA"><span class="toc-text">10.后台管理系统的搭建</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#10-1-%E5%90%8E%E7%AB%AF%E7%9A%84%E6%90%AD%E5%BB%BA"><span class="toc-text">10.1.后端的搭建</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10-2-%E5%89%8D%E7%AB%AF%E7%9A%84%E6%90%AD%E5%BB%BA"><span class="toc-text">10.2 前端的搭建</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#11-%E5%BF%AB%E9%80%9F%E5%BC%80%E5%8F%91-%E9%80%86%E5%90%91%E5%B7%A5%E7%A8%8B%E7%9A%84%E6%90%AD%E5%BB%BA"><span class="toc-text">11.快速开发-逆向工程的搭建</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E5%99%A8%E5%BF%AB%E9%80%9F%E4%BD%BF%E7%94%A8%E6%A1%88%E4%BE%8B"><span class="toc-text">1.代码生成器快速使用案例</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E5%99%A8%E7%9A%84%E4%BD%BF%E7%94%A8%E6%AD%A5%E9%AA%A4"><span class="toc-text">2.代码生成器的使用步骤</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-%E5%90%8E%E5%8F%B0%E6%90%AD%E5%BB%BA%E5%AE%8C%E6%88%90%E4%B9%8B%E5%90%8E%E7%9A%84%E9%A1%B9%E7%9B%AE%E6%A0%91"><span class="toc-text">3.后台搭建完成之后的项目树</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%9B%9B-%E9%A1%B9%E7%9B%AE%E5%89%8D%E7%BD%AE%E7%9F%A5%E8%AF%86"><span class="toc-text">四.项目前置知识</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-SpringCloud-Alibaba"><span class="toc-text">1.SpringCloud Alibaba</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-1%E7%AE%80%E4%BB%8B"><span class="toc-text">1.1简介</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-2%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8SpringCloud-Alibaba%EF%BC%9F"><span class="toc-text">1.2为什么使用SpringCloud Alibaba</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-3-SpringCloud-Alibaba%E6%9C%80%E7%BB%88%E7%9A%84%E6%8A%80%E6%9C%AF%E6%90%AD%E9%85%8D%E6%96%B9%E6%A1%88"><span class="toc-text">1.3 SpringCloud Alibaba最终的技术搭配方案</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-4-%E9%A1%B9%E7%9B%AE%E4%B8%AD%E4%BD%BF%E7%94%A8SpringCloud-Alibaba"><span class="toc-text">1.4 项目中使用SpringCloud Alibaba</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-5-SpringCloud-Alibaba%E7%9A%84%E7%BB%84%E4%BB%B6"><span class="toc-text">1.5 SpringCloud Alibaba的组件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-Nacos%E6%B3%A8%E5%86%8C%E4%B8%AD%E5%BF%83"><span class="toc-text">1.Nacos注册中心</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-Feign%E5%A3%B0%E6%98%8E%E5%BC%8F%E8%BF%9C%E7%A8%8B%E8%B0%83%E7%94%A8"><span class="toc-text">2.Feign声明式远程调用</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-Nacos%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83"><span class="toc-text">3.Nacos配置中心</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4-Gateway%E7%BD%91%E5%85%B3"><span class="toc-text">4.Gateway网关</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E5%89%8D%E7%AB%AF%E5%BC%80%E5%8F%91%E7%9A%84%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86"><span class="toc-text">2.前端开发的基础知识</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BA%94-%E5%9F%BA%E7%A1%80%E7%AF%87%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1"><span class="toc-text">五.基础篇程序设计</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E5%95%86%E5%93%81%E6%9C%8D%E5%8A%A1"><span class="toc-text">1.商品服务</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-1-%E4%B8%89%E7%BA%A7%E5%88%86%E7%B1%BB"><span class="toc-text">1.1 三级分类</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-1-1-%E6%9F%A5%E8%AF%A2-%E9%80%92%E5%BD%92%E6%A0%91%E5%BD%A2%E7%BB%93%E6%9E%84%E6%95%B0%E6%8D%AE%E8%8E%B7%E5%8F%96"><span class="toc-text">1.1.1 查询-递归树形结构数据获取</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-1-2-%E9%85%8D%E7%BD%AE%E8%B7%AF%E7%94%B1%E5%92%8C%E7%BD%91%E5%85%B3%E5%92%8C%E8%B7%AF%E5%BE%84%E9%87%8D%E5%86%99"><span class="toc-text">1.1.2 配置路由和网关和路径重写</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-2-3-%E6%9F%A5%E8%AF%A2-%E9%A1%B5%E9%9D%A2%E4%B8%AD%E6%A0%91%E5%BD%A2%E6%98%BE%E7%A4%BA"><span class="toc-text">1.2.3 查询-页面中树形显示</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-2-4-%E5%88%A0%E9%99%A4-%E5%88%A0%E9%99%A4%E5%95%86%E5%93%81%E5%88%86%E7%B1%BB"><span class="toc-text">1.2.4 删除-删除商品分类</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-2-5-%E6%B7%BB%E5%8A%A0-%E6%B7%BB%E5%8A%A0%E5%95%86%E5%93%81%E5%88%86%E7%B1%BB"><span class="toc-text">1.2.5 添加-添加商品分类</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-2-6-%E4%BF%AE%E6%94%B9-%E4%BF%AE%E6%94%B9%E5%95%86%E5%93%81%E7%9A%84%E5%88%86%E7%B1%BB"><span class="toc-text">1.2.6 修改-修改商品的分类</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-2-%E5%93%81%E7%89%8C%E7%AE%A1%E7%90%86"><span class="toc-text">1.2 品牌管理</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-2-1-%E5%93%81%E7%89%8C%E7%9A%84%E5%A2%9E%E5%88%A0%E6%94%B9%E6%9F%A5%E5%8A%9F%E8%83%BD"><span class="toc-text">1.2.1 品牌的增删改查功能</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-2-2-JSR303-%E6%95%B0%E6%8D%AE%E6%A0%A1%E9%AA%8C"><span class="toc-text">1.2.2 JSR303-数据校验</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-2-3-%E7%BB%9F%E4%B8%80%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86"><span class="toc-text">1.2.3 统一异常处理</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-2-4-%E5%85%B3%E8%81%94%E5%88%86%E7%B1%BB%E5%8A%9F%E8%83%BD"><span class="toc-text">1.2.4 关联分类功能</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-3-%E5%B9%B3%E5%8F%B0%E5%B1%9E%E6%80%A7"><span class="toc-text">1.3 平台属性</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-3-1-%E5%B1%9E%E6%80%A7%E5%88%86%E7%BB%84%E5%8A%9F%E8%83%BD"><span class="toc-text">1.3.1 属性分组功能</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-3-2-%E8%A7%84%E6%A0%BC%E5%8F%82%E6%95%B0%E5%8A%9F%E8%83%BD"><span class="toc-text">1.3.2 规格参数功能</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-3-3-%E9%94%80%E5%94%AE%E5%B1%9E%E6%80%A7%E5%8A%9F%E8%83%BD"><span class="toc-text">1.3.3 销售属性功能</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-4-%E5%95%86%E5%93%81%E7%BB%B4%E6%8A%A4"><span class="toc-text">1.4 商品维护</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-4-1-SPU%E7%AE%A1%E7%90%86"><span class="toc-text">1.4.1 SPU管理</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-4-2-%E5%8F%91%E5%B8%83%E5%95%86%E5%93%81"><span class="toc-text">1.4.2 发布商品</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-4-3-%E5%95%86%E5%93%81%E7%AE%A1%E7%90%86"><span class="toc-text">1.4.3 商品管理</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E5%BA%93%E5%AD%98%E7%B3%BB%E7%BB%9F"><span class="toc-text">2.库存系统</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#2-1-%E4%BB%93%E5%BA%93%E7%BB%B4%E6%8A%A4"><span class="toc-text">2.1 仓库维护</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-2-%E5%BA%93%E5%AD%98%E5%B7%A5%E4%BD%9C%E5%8D%95"><span class="toc-text">2.2 库存工作单</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-3-%E5%95%86%E5%93%81%E5%BA%93%E5%AD%98"><span class="toc-text">2.3 商品库存</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-4-%E9%87%87%E8%B4%AD%E5%8D%95%E7%BB%B4%E6%8A%A4"><span class="toc-text">2.4 采购单维护</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#2-4-1-%E9%87%87%E8%B4%AD%E9%9C%80%E6%B1%82"><span class="toc-text">2.4.1 采购需求</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-4-2-%E9%87%87%E8%B4%AD%E5%8D%95"><span class="toc-text">2.4.2 采购单</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E5%9F%BA%E7%A1%80%E7%AF%87%E6%80%BB%E7%BB%93"><span class="toc-text">3.基础篇总结</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%85%AD-%E9%AB%98%E7%BA%A7%E7%AF%87%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1"><span class="toc-text">六.高级篇程序设计</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-ElasticSearch"><span class="toc-text">1.ElasticSearch</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E5%95%86%E5%9F%8E%E4%B8%9A%E5%8A%A1"><span class="toc-text">2.商城业务</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#2-1-%E5%95%86%E5%93%81%E4%B8%8A%E6%9E%B6"><span class="toc-text">2.1 商品上架</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-2-%E9%A6%96%E9%A1%B5"><span class="toc-text">2.2 首页</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#2-2-1%E6%95%B4%E5%90%88thymeleaf"><span class="toc-text">2.2.1整合thymeleaf</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-2-2-%E9%A6%96%E9%A1%B5%E9%9D%A2%E4%B8%89%E7%BA%A7%E5%88%86%E7%B1%BB%E6%98%BE%E7%A4%BA"><span class="toc-text">2.2.2 首页面三级分类显示</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-3-%E6%90%AD%E5%BB%BA%E5%9F%9F%E5%90%8D%E8%AE%BF%E9%97%AE%E7%8E%AF%E5%A2%83"><span class="toc-text">2.3 搭建域名访问环境</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-4-%E6%80%A7%E8%83%BD%E5%8E%8B%E6%B5%8B"><span class="toc-text">2.4 性能压测</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#2-4-1%E4%BC%98%E5%8C%96%E4%B8%AD%E9%97%B4%E4%BB%B6%E5%AF%B9%E6%80%A7%E8%83%BD%E7%9A%84%E5%BD%B1%E5%93%8D"><span class="toc-text">2.4.1优化中间件对性能的影响</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-5-%E7%BC%93%E5%AD%98%E4%BD%BF%E7%94%A8"><span class="toc-text">2.5 缓存使用</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#2-5-1-%E6%9C%AC%E5%9C%B0%E7%BC%93%E5%AD%98%E4%B8%8E%E5%88%86%E5%B8%83%E5%BC%8F%E7%BC%93%E5%AD%98"><span class="toc-text">2.5.1 本地缓存与分布式缓存</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-5-2-%E6%95%B4%E5%90%88redis"><span class="toc-text">2.5.2 整合redis</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-5-3-%E9%AB%98%E5%B9%B6%E5%8F%91%E4%B8%8B%E7%BC%93%E5%AD%98%E5%A4%B1%E6%95%88%E9%97%AE%E9%A2%98"><span class="toc-text">2.5.3 高并发下缓存失效问题</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-5-4-%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81-Redisson"><span class="toc-text">2.5.4 分布式锁-Redisson</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-5-5-%E5%88%86%E5%B8%83%E5%BC%8F%E7%BC%93%E5%AD%98%E4%B8%80%E8%87%B4%E6%80%A7%E9%97%AE%E9%A2%98"><span class="toc-text">2.5.5 分布式缓存一致性问题</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-5-6-%E7%BC%93%E5%AD%98-SpringCache"><span class="toc-text">2.5.6 缓存-SpringCache</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-6-%E6%A3%80%E7%B4%A2%E6%9C%8D%E5%8A%A1"><span class="toc-text">2.6 检索服务</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#2-6-1-%E6%95%B4%E5%90%88%E9%A1%B5%E9%9D%A2"><span class="toc-text">2.6.1 整合页面</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-6-2-%E9%85%8D%E7%BD%AE%E5%9F%9F%E5%90%8D%E8%AE%BF%E9%97%AE"><span class="toc-text">2.6.2 配置域名访问</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-6-3-%E9%A6%96%E9%A1%B5%E5%92%8C%E6%90%9C%E7%B4%A2%E9%A1%B5%E7%9B%B8%E4%BA%92%E8%B7%B3%E8%BD%AC"><span class="toc-text">2.6.3 首页和搜索页相互跳转</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-6-4-%E5%95%86%E5%93%81%E7%9A%84%E6%A3%80%E7%B4%A2"><span class="toc-text">2.6.4 商品的检索</span></a></li></ol></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最近更新</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/24183.html" title="任务进度"><img src="/img/4.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="任务进度"/></a><div class="content"><a class="title" href="/posts/24183.html" title="任务进度">任务进度</a><time datetime="2024-03-28T03:28:02.368Z" title="更新于 2024-03-28 11:28:02">2024-03-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/32696.html" title="Blog"><img src="/img/3.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Blog"/></a><div class="content"><a class="title" href="/posts/32696.html" title="Blog">Blog</a><time datetime="2024-03-25T03:14:05.606Z" title="更新于 2024-03-25 11:14:05">2024-03-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/5293.html" title="开源项目-若依框架"><img src="/img/2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="开源项目-若依框架"/></a><div class="content"><a class="title" href="/posts/5293.html" title="开源项目-若依框架">开源项目-若依框架</a><time datetime="2024-02-03T14:30:54.022Z" title="更新于 2024-02-03 22:30:54">2024-02-03</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/200.html" title="常用bat和shell脚本"><img src="/img/4.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="常用bat和shell脚本"/></a><div class="content"><a class="title" href="/posts/200.html" title="常用bat和shell脚本">常用bat和shell脚本</a><time datetime="2024-01-19T11:49:36.772Z" title="更新于 2024-01-19 19:49:36">2024-01-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/26357.html" title="WebSocket使用案例"><img src="/img/5.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="WebSocket使用案例"/></a><div class="content"><a class="title" href="/posts/26357.html" title="WebSocket使用案例">WebSocket使用案例</a><time datetime="2024-01-17T13:39:10.166Z" title="更新于 2024-01-17 21:39:10">2024-01-17</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comment-alt"></i></a><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/cdn/js/medium-zoom.min.js"></script><script src="/cdn/js/instantpage.min.js" type="module"></script><script src="/cdn/js/snackbar.min.js"></script><div class="js-pjax"><script>function loadGitalk () {
function initGitalk () {
var gitalk = new Gitalk(Object.assign({
clientID: '00fb27b1e484536359c2',
clientSecret: 'be41a12281c68b6e228d1a27e8d08aeb91541145',
repo: 'BlogComment',
owner: 'JasonsGong',
admin: ['JasonsGong'],
id: 'e92a578055ada87a3876e96bcfbb5763',
updateCountCallback: commentCount
},null))
gitalk.render('gitalk-container')
}
if (typeof Gitalk === 'function') initGitalk()
else {
getCSS('/cdn/css/gitalk.min.css')
getScript('/cdn/js/gitalk.min.js').then(initGitalk)
}
}
function commentCount(n){
let isCommentCount = document.querySelector('#post-meta .gitalk-comment-count')
if (isCommentCount) {
isCommentCount.textContent= n
}
}
if ('Gitalk' === 'Gitalk' || !true) {
if (true) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk)
else loadGitalk()
} else {
function loadOtherComment () {
loadGitalk()
}
}</script></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span> 数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><br/><div class="no-result" id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div><!-- hexo injector body_end start --><script data-pjax>
function butterfly_swiper_injector_config(){
var parent_div_git = document.getElementById('recent-posts');
var item_html = '<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" href="posts/19306.html" alt=""><img width="48" height="48" src="/img/1.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-04-21</span><a class="blog-slider__title" href="posts/19306.html" alt="">Docker容器化技术</a><div class="blog-slider__text">Docker</div><a class="blog-slider__button" href="posts/19306.html" alt="">详情 </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" href="posts/47003.html" alt=""><img width="48" height="48" src="/img/10.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-03-10</span><a class="blog-slider__title" href="posts/47003.html" alt="">常用正则表达式大全</a><div class="blog-slider__text">正则表达式</div><a class="blog-slider__button" href="posts/47003.html" alt="">详情 </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" href="posts/20683.html" alt=""><img width="48" height="48" src="/img/10.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-06-05</span><a class="blog-slider__title" href="posts/20683.html" alt="">Linux中开发环境的搭建</a><div class="blog-slider__text">环境搭建</div><a class="blog-slider__button" href="posts/20683.html" alt="">详情 </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" href="posts/63333.html" alt=""><img width="48" height="48" src="/img/7.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-06-03</span><a class="blog-slider__title" href="posts/63333.html" alt="">开发环境的搭建</a><div class="blog-slider__text">环境搭建</div><a class="blog-slider__button" href="posts/63333.html" alt="">详情 </a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>';
if (parent_div_git !== null && typeof parent_div_git !== 'undefined') {
parent_div_git.insertAdjacentHTML("afterbegin",item_html)
}
}
var elist = 'undefined'.split(',');
var cpage = location.pathname;
var epage = 'all';
var flag = 0;
for (var i=0;i<elist.length;i++){
if (cpage.includes(elist[i])){
flag++;
}
}
if ((epage ==='all')&&(flag == 0)){
butterfly_swiper_injector_config();
}
else if (epage === cpage){
butterfly_swiper_injector_config();
}
</script><script defer src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js"></script><script defer data-pjax src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper_init.js"></script><!-- hexo injector body_end end --></body></html>